Class: Thing
- Inherits:
-
Gamefic::Entity
- Object
- Gamefic::Entity
- Thing
show all
- Includes:
- Edibility, Grammar::Attributes
- Defined in:
- lib/gamefic-standard/edible.rb,
lib/gamefic-standard/entities/thing.rb
Instance Attribute Summary collapse
#gender, #plural
Attributes included from Edibility
#edible
Instance Method Summary
collapse
#person, #plural?
Methods included from Edibility
#edible?
Instance Attribute Details
#itemized=(value) ⇒ Boolean
5
6
7
|
# File 'lib/gamefic-standard/entities/thing.rb', line 5
def itemized=(value)
@itemized = value
end
|
#locale_description ⇒ String?
An optional description to use when itemizing entities in room descriptions. The locale_description will be used instead of adding the entity’s name to a list.
15
16
17
|
# File 'lib/gamefic-standard/entities/thing.rb', line 15
def locale_description
@locale_description
end
|
#portable=(value) ⇒ Boolean
8
9
10
|
# File 'lib/gamefic-standard/entities/thing.rb', line 8
def portable=(value)
@portable = value
end
|
Instance Method Details
#attached=(bool) ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/gamefic-standard/entities/thing.rb', line 40
def attached= bool
@attached = if parent.nil?
false
else
bool
end
end
|
#attached? ⇒ Boolean
35
36
37
|
# File 'lib/gamefic-standard/entities/thing.rb', line 35
def attached?
@attached ||= false
end
|
#itemized? ⇒ Boolean
Itemized entities are automatically listed in room descriptions.
23
24
25
|
# File 'lib/gamefic-standard/entities/thing.rb', line 23
def itemized?
@itemized
end
|
#parent=(new_parent) ⇒ Object
49
50
51
52
|
# File 'lib/gamefic-standard/entities/thing.rb', line 49
def parent= new_parent
self.attached = false unless new_parent == parent
super
end
|
#portable? ⇒ Boolean
Portable entities can be taken with TAKE actions.
30
31
32
|
# File 'lib/gamefic-standard/entities/thing.rb', line 30
def portable?
@portable
end
|
The entity’s parent room (i.e., the closest ascendant that is a Room).
57
58
59
60
61
62
63
|
# File 'lib/gamefic-standard/entities/thing.rb', line 57
def room
p = parent
until p.is_a?(Room) or p.nil?
p = p.parent
end
p
end
|