diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index 4ca617f7e7..df3daeeff9 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -89,16 +89,21 @@ return //returns a new list with only atoms that are in typecache L -//if reversed, return a new list with only atoms that aren't in typecache L -/proc/typecache_filter_list(list/atoms, list/typecache, reversed) +/proc/typecache_filter_list(list/atoms, list/typecache) . = list() for (var/thing in atoms) var/atom/A = thing - if(typecache[A.type] != reversed) //This assumes typecache[A.type] is either null or TRUE. God help you if it's FALSE + if (typecache[A.type]) + . += A + +/proc/typecache_filter_list_reverse(list/atoms, list/typecache) + . = list() + for (var/thing in atoms) + var/atom/A = thing + if (!typecache[A.type]) . += A //Like typesof() or subtypesof(), but returns a typecache instead of a list - /proc/typecacheof(path, ignore_root_path, only_root_path = FALSE) if(ispath(path)) var/list/types = list() diff --git a/code/__HELPERS/_lists.dm.rej b/code/__HELPERS/_lists.dm.rej index 94df951ce7..e69de29bb2 100644 --- a/code/__HELPERS/_lists.dm.rej +++ b/code/__HELPERS/_lists.dm.rej @@ -1,10 +0,0 @@ -diff a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm (rejected hunks) -@@ -90,7 +90,7 @@ - - //returns a new list with only atoms that are in typecache L - //if reversed, return a new list with only atoms that aren't in typecache L --/proc/typecache_filter_list(list/atoms, list/typecache, reversed) -+/proc/typecache_filter_list(list/atoms, list/typecache, reversed=FALSE) - . = list() - for (var/thing in atoms) - var/atom/A = thing diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 123ed856a7..924628a27d 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -407,10 +407,10 @@ if(!SSticker.HasRoundStarted()) add_blueprints(AM) -/turf/proc/empty(turf_type=/turf/open/space, baseturf_type) +/turf/proc/empty(turf_type=/turf/open/space, baseturf_type, delmobs = TRUE, forceop = FALSE) // Remove all atoms except observers, landmarks, docking ports 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(GetAllContents(),ignored_atoms,reversed=TRUE) + var/list/allowed_contents = typecache_filter_list_reverse(GetAllContents(),delmobs? ignored_atoms : ignored_atoms + typecacheof(list(/mob))) allowed_contents -= src for(var/i in 1 to allowed_contents.len) var/thing = allowed_contents[i] diff --git a/code/game/turfs/turf.dm.rej b/code/game/turfs/turf.dm.rej new file mode 100644 index 0000000000..f4c27f5c30 --- /dev/null +++ b/code/game/turfs/turf.dm.rej @@ -0,0 +1,10 @@ +diff a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm (rejected hunks) +@@ -410,7 +410,7 @@ + /turf/proc/empty(turf_type=/turf/open/space, baseturf_type) + // Remove all atoms except observers, landmarks, docking ports + 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(GetAllContents(),ignored_atoms,reversed=TRUE) ++ var/list/allowed_contents = typecache_filter_list_reverse(GetAllContents(),ignored_atoms) + allowed_contents -= src + for(var/i in 1 to allowed_contents.len) + var/thing = allowed_contents[i]