class Area
Attributes
objects[RW]
room[RW]
Public Class Methods
contents()
click to toggle source
# File lib/Olib/area.rb, line 2 def self.contents GameObj.loot.map { |obj| Olib::Item.new(obj) } end
deep()
click to toggle source
# File lib/Olib/area.rb, line 23 def Area.deep Area.new end
new()
click to toggle source
# File lib/Olib/area.rb, line 29 def initialize @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
Public Instance Methods
check_container(container)
click to toggle source
# File lib/Olib/area.rb, line 64 def check_container(container) unless container.contents container.look.at.on end end
contents()
click to toggle source
# File lib/Olib/area.rb, line 39 def contents items = [] @objects .reject { |container| container.name =~ /[A-Z][a-z]+ disk/ } .each { |container| check_container container item = Olib::Item.new container unless container.nested? container.contents.each { |item| item.container = container items << item } else container.containers.each do |nested| check_container nested nested.contents.each { |item| item.container = container items << item } end end } items.compact end
each() { |item| ... }
click to toggle source
# File lib/Olib/area.rb, line 6 def each self.contents.each { |item| yield item } end