Class: Room
- Inherits:
-
Thing
- Object
- Thing
- Room
- Defined in:
- lib/gamefic-standard/entities/room.rb
Instance Attribute Summary collapse
-
#explicit_exits ⇒ Object
writeonly
Sets the attribute explicit_exits.
Class Method Summary collapse
Instance Method Summary collapse
- #connect(destination, direction: nil, type: Portal, two_way: true) ⇒ Portal+
- #explicit_exits? ⇒ Boolean
- #portals ⇒ Array<Portal>
- #tell(message) ⇒ Object
Instance Attribute Details
#explicit_exits=(value) ⇒ Object (writeonly)
Sets the attribute explicit_exits
4 5 6 |
# File 'lib/gamefic-standard/entities/room.rb', line 4 def explicit_exits=(value) @explicit_exits = value end |
Class Method Details
.explicit_exits=(bool) ⇒ Object
42 43 44 |
# File 'lib/gamefic-standard/entities/room.rb', line 42 def explicit_exits=(bool) set_default explicit_exits: bool end |
.explicit_exits? ⇒ Boolean
38 39 40 |
# File 'lib/gamefic-standard/entities/room.rb', line 38 def explicit_exits? default_attributes[:explicit_exits] end |
Instance Method Details
#connect(destination, direction: nil, type: Portal, two_way: true) ⇒ Portal+
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gamefic-standard/entities/room.rb', line 26 def connect destination, direction: nil, type: Portal, two_way: true direction = Direction.find(direction) here = type.new(parent: self, destination: destination, direction: Direction.find(direction)) return here unless two_way there = type.new(parent: destination, destination: self, direction: direction&.reverse) [here, there] end |
#explicit_exits? ⇒ Boolean
8 9 10 |
# File 'lib/gamefic-standard/entities/room.rb', line 8 def explicit_exits? @explicit_exits end |
#portals ⇒ Array<Portal>
17 18 19 |
# File 'lib/gamefic-standard/entities/room.rb', line 17 def portals children.that_are(Portal) end |
#tell(message) ⇒ Object
12 13 14 |
# File 'lib/gamefic-standard/entities/room.rb', line 12 def tell() children.each { |c| c.tell } end |