Class: Area
- Inherits:
-
Olib::Container
- Object
- Olib::Gameobj_Extender
- Olib::Container
- Area
- Defined in:
- lib/Olib/area.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#objects ⇒ Object
Returns the value of attribute objects.
-
#room ⇒ Object
Returns the value of attribute room.
Attributes inherited from Olib::Container
#containers, #nested, #ontop, #ref
Attributes inherited from Olib::Gameobj_Extender
Class Method Summary collapse
Instance Method Summary collapse
- #check_container(container) ⇒ Object
-
#initialize ⇒ Area
constructor
A new instance of Area.
Methods inherited from Olib::Container
#[], #add, #at, #boxes, #def, #find_by_tags, #full?, #gems, #in, #jewelry, #look, #magic_items, #nested?, #on, #scrolls, #skins, #where
Methods inherited from Olib::Gameobj_Extender
Constructor Details
#initialize ⇒ Area
Returns a new instance of Area.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/Olib/area.rb', line 9 def initialize @contents = [] @room = Room.current @objects = [ GameObj.loot, GameObj.room_desc ] .flatten .compact .map { |thing| thing.id } .uniq # sometimes objects exist in both loot & room_desc .map { |id| Olib::Container.new id } end |
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
7 8 9 |
# File 'lib/Olib/area.rb', line 7 def contents @contents end |
#objects ⇒ Object
Returns the value of attribute objects.
7 8 9 |
# File 'lib/Olib/area.rb', line 7 def objects @objects end |
#room ⇒ Object
Returns the value of attribute room.
7 8 9 |
# File 'lib/Olib/area.rb', line 7 def room @room end |
Class Method Details
.current ⇒ Object
3 4 5 |
# File 'lib/Olib/area.rb', line 3 def Area.current Area.new end |
Instance Method Details
#check_container(container) ⇒ Object
44 45 46 47 48 |
# File 'lib/Olib/area.rb', line 44 def check_container(container) unless container.contents container.look.at.on end end |