diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index d63c10c508..393c5a465d 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -89,11 +89,13 @@ return //returns a new list with only atoms that are in typecache L -/proc/typecache_filter_list(list/atoms, list/typecache) +/proc/typecache_filter_list(list/atoms, list/typecache, reversed=FALSE) . = list() for (var/thing in atoms) var/atom/A = thing - if (typecache[A.type]) + if (typecache[A.type] && !reversed) + . += A + else if(reversed) . += A //Like typesof() or subtypesof(), but returns a typecache instead of a list diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index a2b548e2b5..01e846632c 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -411,7 +411,7 @@ // Remove all atoms except observers, landmarks, docking ports var/turf/T0 = src var/static/list/ignored_atoms = typecacheof(list(/mob/dead, /obj/effect/landmark, /obj/docking_port, /atom/movable/lighting_object)) - var/list/allowed_contents = typecache_filter_list(T0.GetAllContents(),ignored_atoms) + var/list/allowed_contents = typecache_filter_list(T0.GetAllContents(),ignored_atoms,reversed=TRUE) for(var/i in 1 to allowed_contents.len) var/thing = allowed_contents[i] qdel(thing, force=TRUE)