diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index 8e44b57396..f16b566b00 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -174,6 +174,15 @@ L[T] = TRUE return L +/proc/typecacheof_assoc_list(list/pathlist, ignore_root_path = FALSE) + . = list() + if(!istype(pathlist)) + return + for(var/P in pathlist) + var/value = pathlist[P] + for(var/T in (ignore_root_path ? subtypesof(P) : typesof(P))) + .[T] = value + //Empties the list by setting the length to 0. Hopefully the elements get garbage collected /proc/clearlist(list/list) if(istype(list)) @@ -579,4 +588,4 @@ var/list/ret = list() for(var/key in input) ret += key - return ret \ No newline at end of file + return ret diff --git a/code/modules/holodeck/area_copy.dm b/code/modules/holodeck/area_copy.dm index 8fa0825628..9fb97c08a7 100644 --- a/code/modules/holodeck/area_copy.dm +++ b/code/modules/holodeck/area_copy.dm @@ -4,6 +4,10 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list( "power_supply", "contents", "reagents", "stat", "x", "y", "z", "group", "atmos_adjacent_turfs", "comp_lookup" )) +GLOBAL_LIST_INIT(duplicate_forbidden_vars_by_type, typecacheof_assoc_list(list( + /obj/item/gun/energy = "ammo_type" + ))) + /proc/DuplicateObject(atom/original, perfectcopy = TRUE, sameloc = FALSE, atom/newloc = null, nerf = FALSE, holoitem=FALSE) RETURN_TYPE(original.type) if(!original) @@ -16,7 +20,7 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list( O = new original.type(newloc) if(perfectcopy && O && original) - for(var/V in original.vars - GLOB.duplicate_forbidden_vars) + for(var/V in original.vars - GLOB.duplicate_forbidden_vars - GLOB.duplicate_forbidden_vars_by_type[O.type]) if(islist(original.vars[V])) var/list/L = original.vars[V] O.vars[V] = L.Copy() diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 401678512b..be43bc48fd 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -67,8 +67,7 @@ /obj/item/gun/energy/Destroy() if(flags_1 & INITIALIZED_1) QDEL_NULL(cell) - if(!(flags_1 & HOLOGRAM_1)) //holodeck stuff. - QDEL_LIST(ammo_type) + QDEL_LIST(ammo_type) STOP_PROCESSING(SSobj, src) return ..()