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_delete.rb
# ZN Author:: ZombieJesus
# ZN version:: 0.1
# ZN date:: 11/07/2008
#

module Cmd

  # Loads an object based on it's oid
  def cmd_delete(args)
	case args
	when nil, ""
		sendto("Delete what?")
	when /^#(\d+)/
		obj = get_object($1.to_i)
		if (world.is_admin? id) or (world.is_builder? id and obj.owner == id)
			add_event(id,obj.id,:delete)
		else
			sendto("Builders can only edit objects they have created.")
		end
	else
		found = false
		get_object(location).objects.each do |obj|
			if(args == obj.name)
				found = true
				if (world.is_admin? id) or (world.is_builder? id and obj.owner == id)
					add_event(id,obj.id,:delete)
				else
					sendto("You do not have permission to delete that.")
				end
			end
		end
		sendto("There is no #{args} here.") if not found
	end
  end
  
end