Class: Worlds::Components::Travel
Instance Attribute Summary
Attributes inherited from Component
#commands, #owner
Instance Method Summary
collapse
Methods inherited from Component
#initialize, #select, #update
Instance Method Details
#invoke(target) ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/worlds/components/travel.rb', line 14
def invoke(target)
target = target.is_a?(Area) ? target : owner.area.linked_areas[target]
owner.area&.entities&.delete(owner)
target.entities << owner
owner.area = target
{ color: :green, content: "You are now in #{target.name}" }
end
|
#select_heading ⇒ Object
4
5
6
|
# File 'lib/worlds/components/travel.rb', line 4
def select_heading
"Choose a destination:"
end
|
#select_options ⇒ Object
8
9
10
|
# File 'lib/worlds/components/travel.rb', line 8
def select_options
owner.area.linked_areas
end
|