cmd_junk.rb
znmud-0.0.1/cmd/zombie/cmd_junk.rb · 1.1 KB
From the archive znmud-minimal-0.0.1.tar.gz
Download the archive « Back to the archive contents
#
# file:: cmd_junk.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")
# Loads an object based on it's oid
def cmd_junk(args)
case args
when nil, ""
sendto _("Junk what?")
when "all"
get_object(location).objects.each do |q|
add_event(id,q.id,:junk)
end
else
objs = find_inv(args)
if objs.size > 0
objs.each do |obj|
add_event(id,obj.id,:junk)
obj.contents.each do |c|
cobj = get_object(c)
cobj.unused = true
cobj.location = nil
obj.delete_contents(c)
end
if obj.is_a? BodyPart
obj.worn.each do |l, c|
cobj = get_object(c)
cobj.unused = true
cobj.location = nil
worn.delete(l)
end
if obj.wield
cobj = get_object(obj.wield)
cobj.unused = true
cobj.location = nil
obj.wield = nil
end
end
end
else
sendto _("You are not carrying %{args}" % {:args => args})
end
end
end
end