Tweak Duplicate object proc (#21069)

Better typepathing and doesnt try to update_icon on things
that don't have an update_icon proc defined

Also adds a holoitem flag so admin area copy doesn't make objects immune
to lava fire and acid
This commit is contained in:
oranges
2016-10-30 13:41:54 +01:00
committed by AnturK
parent 4dfd96b67b
commit ef38656c47
+11 -7
View File
@@ -1,7 +1,7 @@
/proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0, var/atom/newloc = null, var/nerf = 0)
/proc/DuplicateObject(var/atom/original, var/perfectcopy = TRUE, var/sameloc = FALSE, var/atom/newloc = null, var/nerf = FALSE, var/holoitem=FALSE)
if(!original)
return null
var/obj/O
var/atom/O
if(sameloc)
O = new original.type(original.loc)
@@ -20,15 +20,19 @@
else
O.vars[V] = original.vars[V]
if(istype(O))
O.resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF // holoitems do not burn
if(istype(O, /obj))
var/obj/N = O
if(holoitem)
N.resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF // holoitems do not burn
if(nerf && istype(O,/obj/item))
var/obj/item/I = O
I.damtype = STAMINA // thou shalt not
N.update_icon()
if(istype(O,/obj/machinery))
var/obj/machinery/M = O
M.power_change()
O.update_icon()
return O
@@ -89,13 +93,13 @@
X.icon_state = old_icon_state1
for(var/obj/O in T)
var/obj/O2 = DuplicateObject(O , 1, newloc = X, nerf=nerf_weapons)
var/obj/O2 = DuplicateObject(O , perfect_copy=TRUE, newloc = X, nerf=nerf_weapons, holoitem=TRUE)
if(!O2) continue
copiedobjs += O2.GetAllContents()
for(var/mob/M in T)
if(istype(M, /mob/camera)) continue // If we need to check for more mobs, I'll add a variable
var/mob/SM = DuplicateObject(M , 1, newloc = X)
var/mob/SM = DuplicateObject(M , perfect_copy=TRUE, newloc = X, holoitem=TRUE)
copiedobjs += SM.GetAllContents()
var/global/list/forbidden_vars = list("type","stat","loc","locs","vars", "parent", "parent_type","verbs","ckey","key","x","y","z","contents", "luminosity")