cmd_drop.rb
snippets · 385 B · 2010-03-30
cmd_drop.rb: a drop command for a Ruby MUD.
Download « Back to the snippets list
module Cmd
# drops an object in your inventory into the room
def cmd_drop(args)
found_object = false
objects.each do |obj|
if (obj.name.is_match?(args) || args.is_prefix?(obj.name))
found_object = true
add_event(id,obj.id,:drop)
break
end
end
if !found_object
sendto "You cannot find that object."
end
end
end