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_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