cmd_dig.rb
znmud-0.0.1/cmd/zombie/cmd_dig.rb · 955 B
From the archive znmud-minimal-0.0.1.tar.gz
Download the archive « Back to the archive contents
#
# file:: cmd_dig.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")
# The dig command
def cmd_dig(args)
can_dig = false
with_what = _("bare hands")
if get_object(location).has_attribute? :inside
sendto _("You can not dig inside.")
return
end
@body.wielding?.each do |oid|
if get_object(oid).has_attribute? :shovel
with_what = get_object(oid).shortname
can_dig = true
end
end
can_dig = true if world.can_build? id
if can_dig
sendto _("You begin digging with your %{obj}." % {:obj => with_what})
sendroom _("%{name} begins degging with %{pos} %{obj}." % {:name => name, :obj => with_what, :pos => pos_pronoun})
add_event(id,location,:dig)
else
sendto _("You have nothing to dig with.")
end
end
end