znmud-0.0.1/benchmark/
znmud-0.0.1/cmd/
znmud-0.0.1/cmd/emotes/
znmud-0.0.1/cmd/objects/
znmud-0.0.1/cmd/tiny/
znmud-0.0.1/doc/
znmud-0.0.1/farts/
znmud-0.0.1/lib/
znmud-0.0.1/lib/combat/
znmud-0.0.1/lib/core/bodytypes/
znmud-0.0.1/lib/engine/
znmud-0.0.1/lib/farts/
znmud-0.0.1/logs/
#
# file::    cmd_room.rb
# author::  Jon A. Lambert
# version:: 2.10.0
# date::    06/25/2006
#
# Additional Contributor: Craig Smith
#
# This source code copyright (C) 2005 by Jon A. Lambert
# All rights reserved.
#
# Released under the terms of the TeensyMUD Public License
# See LICENSE file for additional information.
#
module Cmd

  bindtextdomain("cmd")

  # creates a new room and autolinks the exits using the exit names provided.
  # (ex. @room My Room north south)
  def cmd_room(args)
    case args
    when /(.*) (.*) (.*)/
      curr = get_object(location)
      if not curr.owner == id and not world.is_admin? id
	sendto _("You can not attach a room to %{room_name}. Permission Denied." % {:room_name => curr.name})
	return
      end
      d=Room.new($1, id)
      if d.nil?
        log.error "Unable to create room."
        sendto _"System error: unable to create room."
        return
      end
      ex_name1 = $2.downcase
      ex_name2 = $3.downcase
      # These are just for simplicity and speed
      ex_name1 = "east" if ex_name1 == "e"
      ex_name1 = "west" if ex_name1 == "w"
      ex_name1 = "north" if ex_name1 == "n"
      ex_name1 = "south" if ex_name1 == "s"
      ex_name1 = "up" if ex_name1 == "u"
      ex_name1 = "down" if ex_name1 == "d"
      ex_name2 = "east" if ex_name2 == "e"
      ex_name2 = "west" if ex_name2 == "w"
      ex_name2 = "north" if ex_name2 == "n"
      ex_name2 = "south" if ex_name2 == "s"
      ex_name2 = "up" if ex_name2 == "u"
      ex_name2 = "down" if ex_name2 == "d"
      put_object(d)
      e1 = Exit.new(ex_name1, id, curr.id, d.id)
      curr.exits << e1.id
      e2 = Exit.new(ex_name2, id, d.id, curr.id)
      d.exits << e2.id
      e1.linked_exit = e2.id
      e2.linked_exit = e1.id
      put_object(e1)
      put_object(e2)
      sendto _("Ok.")
    else
      sendto _("Usage: @room <desc> <curr.exit> <remote.exit>")
    end
  end

end