b59 @verb #16:"@@renumber" any at/to any rdo #789 @program #16:"@@renumber" any at/to any if (player != this) return $msg:mtell("huh") endif dobj = toobj(dobjstr) iobj = toobj(iobjstr) if (!dobjstr || !iobjstr) player:tell("Usage: @@renumber <object #> to <garbage #>") elseif (dobj == #0 || iobj == #0) player:tell("For safety, you must specify the objects by their numbers.") elseif (parent(iobj) != $trash) player:tell(iobj, " isn't garbage. You must recycle it before you can clone to it.") else player:tell("Scanning for holes in the database...") holes = 0 for x in [#0..max_object()] if (!valid(x)) player:tell(x, " isn't a valid object. This object must be created before renumbering can occur.") holes = holes + 1 endif $command_utils:suspend_if_needed() endfor if (holes) player:tell(holes, " holes in the database found.") return endif player:tell("No holes are present in the database.") player:tell("Moving files...") for file in (iobj:filelist()) iobj:filedelete(file) endfor for file in (dobj:filelist()) dobj:filemove(file, iobj) $command_utils:suspend_if_needed() endfor suspend(0) player:tell("Creating a hole at ", iobj) $hard_creating_tasks = setadd($hard_creating_tasks, task_id()) recycle(iobj) suspend(0) player:tell("Renumbering ", dobj, "...") result = renumber(dobj) if (typeof(result) != $OBJ) player:tell("Renumbering returned -> ", result) return elseif (result == iobj) player:tell("Success! ", dobj, " renumbered to ", result) elseif (result == dobj) player:tell("Warning! ", dobj, " wasn't renumbered!") else player:tell("Warning! ", dobj, " renumbered to ", result, " instead of to ", iobj) endif player:tell("Scanning for $ and $web properties...") for core_obj in ({#0, @$ancestors(), $web.names}) for prop in (properties(core_obj)) if (core_obj.(prop) == dobj) player:tell(" Updating ", core_obj, ".", prop) core_obj.(prop) = result endif $command_utils:suspend_if_needed() endfor endfor if (`w = dobj in result.owner.owned_objects ! ANY') result.owner.owned_objects[w] = result endif player:tell("Filling new hole (", dobj, ") in the database...") $hard_creating_tasks = setadd($hard_creating_tasks, task_id()) new = create(#1) hole = renumber(new) reset_max_object() $recycler:recycle(hole) if (hole == dobj) player:tell(dobj, " successfully filled with a garbage object.") else player:tell("Warning! Attempt to fill ", dobj, " ended up filling ", hole, " instead!") endif player:tell("Renumbering finnished. Kicking ", result, " for no particular reason.") result:kick() "Just in case.." endif "Last modified by Dax (#789) on Wed May 4 06:44:30 2005 MDT." . 0