Class: Area

Inherits:
Olib::Container show all
Defined in:
lib/Olib/area.rb

Instance Attribute Summary collapse

Attributes inherited from Olib::Container

#containers, #nested, #ontop, #ref

Attributes inherited from Olib::Gameobj_Extender

#type

Class Method Summary collapse

Instance Method Summary collapse

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

#__extend__, #at, #echo

Constructor Details

#initializeArea

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

#contentsObject

Returns the value of attribute contents.



7
8
9
# File 'lib/Olib/area.rb', line 7

def contents
  @contents
end

#objectsObject

Returns the value of attribute objects.



7
8
9
# File 'lib/Olib/area.rb', line 7

def objects
  @objects
end

#roomObject

Returns the value of attribute room.



7
8
9
# File 'lib/Olib/area.rb', line 7

def room
  @room
end

Class Method Details

.currentObject



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