# # file:: cmd_close.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") # Close doors.. def cmd_close(args) case args when nil,"" sendto _("Close 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, :closedoor) else sendto _("There are too many to pick from.") end end end end