cmd_summon.rb
znmud-0.0.1/cmd/zombie/cmd_summon.rb · 1.3 KB
From the archive znmud-minimal-0.0.1.tar.gz
Download the archive « Back to the archive contents
#
# file:: cmd_summon.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")
# Priv. command that allows teleporting
# Can teleport to a room number or to a players name
def cmd_summon(args)
case args
when /(\w+)/ # Player name
whom = $1
world.all_characters.each do |cid|
plyr = get_object(cid)
if plyr.name=~/^#{whom}$/i
if plyr.location == location
sendto _("%{pronoun} is already here." % {:pronoun => plyr.pronoun})
elsif world.is_admin? plyr.id
sendto _("You can not summon a god.")
else
msg = Msg.new _("^p1 mumbles some words and waves %{pos} hands." % {:pos => pos_pronoun})
msg.p1 = name
sendroom(msg)
add_event(id, cid, :show, _("The room spins and dissolves in front of you!"))
loc = get_object(plyr.location)
if loc
loc.delete_contents(cid)
add_event(loc.id, location, :arrive, cid)
else
add_event(nil, location, :arrive, cid)
end
end
return
end
end
sendto(_("Player %{whom} not found." % {:whom => whom}))
else
sendto _("Usage: @summon playerName")
end
end
end