Duplicate Obj in Developer Help
I'm looking for an easy way to duplicate an obj and not sure if I'm missing something that could really help.
I basically just need a new obj type of the same type as the original plus all of the variables the same.
Deadron's methods a little safer, but if you have a ton of vars and don't feel like typing them all out, you can do it with some clever use of the vars list, like so:
var/obj/new_obj = new type()
var/list/dontcopy = list("verbs","vars","type")//Read-only
for(V in vars)
new_obj.vars["[V]"] = vars["[V]"]
You'll have to change the location of the new object, since it would be copied to the location of the old one, but thats why I returned the new_obj. You can force it not to copy some variables by adding their names to the dontcopy list.