Sha256: e21f9341e208db95da0cfef3fb140502de09c021c5db0692f9f3ed5b791606a5
Contents?: true
Size: 1020 Bytes
Versions: 1
Compression:
Stored size: 1020 Bytes
Contents
class Portal < Thing attr_accessor :destination # Find the portal in the destination that returns to this portal's parent # # @return [Room] def find_reverse return nil if destination.nil? rev = direction.reverse if rev != nil destination.children.that_are(Portal).each { |c| if c.direction == rev return c end } end nil end # Get the ordinal direction of this Portal # Portals have distinct direction and name properties so games can display a # bare compass direction for exits, e.g., "south" vs. "the southern door." # # @return [Direction] def direction @direction end def direction= d @direction = Direction.find(d) end def name @name || (direction.nil? ? destination.name : direction.name) end def instruction direction || (destination ? "to #{destination.definitely}" : name) end def synonyms "#{super} #{@destination} #{@direction} #{!direction.nil? ? direction.synonyms : ''}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gamefic-sdk-1.7.0 | scripts/standard/entities/portal.plot.rb |