cmd_unlock.rb
znmud-0.0.1/cmd/zombie/cmd_unlock.rb · 808 B
From the archive znmud-minimal-0.0.1.tar.gz
Download the archive « Back to the archive contents
#
# file:: cmd_unlock.rb
# This source code copyright (C) 2009 Craig Smith
# All rights reserved.
#
# Released under the terms of the TeensyMUD Public License
# See LICENSE file for additional information.
#
module Cmd
bindtextdomain("cmd")
# Opens doors..
def cmd_unlock(args)
case args
when nil,""
sendto _("Unlock what?")
else
loc = get_object(location)
possible_doors = []
loc.exits.each do |exid|
ex = get_object(exid)
if not ex.door_state == Exit::NO_DOOR
possible_doors << ex if ex.door_name=~/#{args}/i
end
end
case possible_doors.size
when 0
sendto _("You do not see that.")
when 1
add_event(id, possible_doors[0].id, :unlockdoor)
else
sendto _("There are too many to pick from.")
end
end
end
end