Class: Gamefic::Standard::Room
- Inherits:
-
Thing
- Object
- Thing
- Gamefic::Standard::Room
- Defined in:
- lib/gamefic/standard/entities/room.rb
Instance Attribute Summary collapse
-
#explicit_exits ⇒ Object
writeonly
Sets the attribute explicit_exits.
Instance Method Summary collapse
- #connect(destination, direction: nil, type: Portal, two_way: true, **opts) ⇒ Portal+
- #explicit_exits? ⇒ Boolean
- #portals ⇒ Array<Portal>
- #tell(message) ⇒ Object
Instance Attribute Details
#explicit_exits=(value) ⇒ Object (writeonly)
Sets the attribute explicit_exits
6 7 8 |
# File 'lib/gamefic/standard/entities/room.rb', line 6 def explicit_exits=(value) @explicit_exits = value end |
Instance Method Details
#connect(destination, direction: nil, type: Portal, two_way: true, **opts) ⇒ Portal+
28 29 30 31 32 33 34 35 |
# File 'lib/gamefic/standard/entities/room.rb', line 28 def connect(destination, direction: nil, type: Portal, two_way: true, **opts) direction = Direction.find(direction) here = type.new parent: self, destination: destination, direction: Direction.find(direction), **opts return here unless two_way there = type.new parent: destination, destination: self, direction: direction&.reverse, **opts [here, there] end |
#explicit_exits? ⇒ Boolean
10 11 12 |
# File 'lib/gamefic/standard/entities/room.rb', line 10 def explicit_exits? @explicit_exits end |
#portals ⇒ Array<Portal>
19 20 21 |
# File 'lib/gamefic/standard/entities/room.rb', line 19 def portals children.that_are(Portal) end |
#tell(message) ⇒ Object
14 15 16 |
# File 'lib/gamefic/standard/entities/room.rb', line 14 def tell() children.each { |c| c.tell } end |