Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: b84a109b74
Fetching contributors…

Cannot retrieve contributors at this time

90 lines (57 sloc) 1.724 kB
---
syntax:
- "get <prop>"
- "take <prop>"
- "get <character>"
- "take <character>"
logic: |
if character
prop = character
end
output = ''
if prop.location == @player.location
if prop.traits['portable']
can_get = true
if prop.traits['get_with']
prop.traits['get_with'].each do |needed_prop|
if @props[needed_prop].location != 'player'
can_get = false
end
end
end
if can_get == true
# make sure player isn't already carrying maximum
if !@player.can_carry_number_of_items \
|| @player.carrying.size <= (@player.can_carry_number_of_items - 1)
prop.location = 'player'
# if prop is supported by something, remove it from it
@props.each do |prop_to_check,data|
if @props[prop_to_check].traits['supporting']
if @props[prop_to_check].traits['supporting'].index(prop.id)
@props[prop_to_check].traits['supporting'].delete(prop.id)
output << "(Removing #{prop.noun} from #{@props[prop_to_check].noun}.)\n"
end
end
end
output << "You take #{prop.noun}.\n"
on_get_output = @game.event(prop, 'on_get')
if on_get_output
output << on_get_output
end
else
output << "You are carrying too much.\n"
end
else
output << "You can't do that yet.\n"
end
else
output << "It won't budge.\n"
end
else
if prop.location == 'player'
output << "You already have it!\n"
else
output << @game.not_found(prop.noun_base)
end
end
output
Jump to Line
Something went wrong with that request. Please try again.