From 97cdd39a7f6dd3753052323cfd7a8f504e7f09a3 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 15 Jul 2023 16:18:24 -0500 Subject: [PATCH 001/147] initial changes --- code/controllers/subsystem/garbage.dm | 11 ++++------- code/datums/components/spawner.dm | 3 ++- code/datums/mapgen/planetary/LavaGenerator.dm | 8 ++++---- code/modules/unit_tests/ship_placement.dm | 8 +++++++- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index 94cf90aad7d2..44a06396a326 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -230,12 +230,6 @@ SUBSYSTEM_DEF(garbage) #endif I.failures++ - if (I.qdel_flags & QDEL_ITEM_SUSPENDED_FOR_LAG) - #ifdef REFERENCE_TRACKING - if(ref_searching) - return //ref searching intentionally cancels all further fires while running so things that hold references don't end up getting deleted, so we want to return here instead of continue - #endif - continue if (GC_QUEUE_HARDDELETE) HardDelete(D) if (MC_TICK_CHECK) @@ -275,12 +269,15 @@ SUBSYSTEM_DEF(garbage) ++totaldels var/type = D.type var/refID = "\ref[D]" + var/datum/qdel_item/I = items[type] + + if (I.qdel_flags & QDEL_ITEM_SUSPENDED_FOR_LAG) + return var/tick_usage = TICK_USAGE del(D) tick_usage = TICK_USAGE_TO_MS(tick_usage) - var/datum/qdel_item/I = items[type] I.hard_deletes++ I.hard_delete_time += tick_usage if (tick_usage > I.hard_delete_max) diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm index e4f7fa4e8648..0b2794898e13 100644 --- a/code/datums/components/spawner.dm +++ b/code/datums/components/spawner.dm @@ -53,4 +53,5 @@ L.nest = src L.faction = src.faction P.visible_message("[L] [pick(spawn_text)] [P].") - playsound(P, pick(spawn_sound), 50, TRUE) + if(length(spawn_sound)) + playsound(P, pick(spawn_sound), 50, TRUE) diff --git a/code/datums/mapgen/planetary/LavaGenerator.dm b/code/datums/mapgen/planetary/LavaGenerator.dm index d154063bdc17..0bdcbfb2d9ab 100644 --- a/code/datums/mapgen/planetary/LavaGenerator.dm +++ b/code/datums/mapgen/planetary/LavaGenerator.dm @@ -96,10 +96,10 @@ ) feature_spawn_chance = 0.3 feature_spawn_list = list( - /obj/structure/flora/rock/hell = 5, - /obj/structure/elite_tumor = 1, - /obj/structure/geyser/random = 1, - /obj/effect/spawner/lootdrop/anomaly/lava = 0.5 + /obj/structure/flora/rock/hell = 10, + /obj/structure/elite_tumor = 2, + /obj/structure/geyser/random = 2, + /obj/effect/spawner/lootdrop/anomaly/lava = 1 ) mob_spawn_chance = 4 diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index 7261fa5efd47..a4ddcf04302e 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -2,10 +2,16 @@ SSair.is_test_loading = TRUE for(var/mapname as anything in SSmapping.ship_purchase_list) var/datum/map_template/shuttle/map = SSmapping.ship_purchase_list[mapname] + var/ship try - new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) + ship = new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) catch(var/exception/e) Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") + + try + qdel(ship) + catch(var/exception/e) + Fail("Runtime error deleting ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE var/list/errors = atmosscan(TRUE) From 70faf8273f8c11fe8f24015c39af31951b8061e6 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 15 Jul 2023 16:23:20 -0500 Subject: [PATCH 002/147] fuck --- code/modules/unit_tests/ship_placement.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index a4ddcf04302e..7d57fb9b050b 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -5,13 +5,13 @@ var/ship try ship = new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) - catch(var/exception/e) - Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") + catch(var/exception/placement_error) + Fail("Runtime error loading ship type ([map.name]): [placement_error] on [placement_error.file]:[placement_error.line]\n[placement_error.desc]") try qdel(ship) - catch(var/exception/e) - Fail("Runtime error deleting ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") + catch(var/exception/deletion_error) + Fail("Runtime error deleting ship type ([map.name]): [deletion_error] on [deletion_error.file]:[deletion_error.line]\n[deletion_error.desc]") SSair.is_test_loading = FALSE var/list/errors = atmosscan(TRUE) From aa0f898311aa4929c1c91006cbf3e68cc4276118 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 15 Jul 2023 16:24:03 -0500 Subject: [PATCH 003/147] I guess this doesn't actually make a difference --- code/modules/unit_tests/ship_placement.dm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index 7d57fb9b050b..5393dfc02166 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -8,10 +8,7 @@ catch(var/exception/placement_error) Fail("Runtime error loading ship type ([map.name]): [placement_error] on [placement_error.file]:[placement_error.line]\n[placement_error.desc]") - try - qdel(ship) - catch(var/exception/deletion_error) - Fail("Runtime error deleting ship type ([map.name]): [deletion_error] on [deletion_error.file]:[deletion_error.line]\n[deletion_error.desc]") + qdel(ship) SSair.is_test_loading = FALSE var/list/errors = atmosscan(TRUE) From fa770bbc3d6e2b735c50977ea0aaddd9edd89034 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 15 Jul 2023 16:28:19 -0500 Subject: [PATCH 004/147] please --- code/datums/mapgen/planetary/LavaGenerator.dm | 8 ++++---- code/modules/unit_tests/ship_placement.dm | 9 +++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/code/datums/mapgen/planetary/LavaGenerator.dm b/code/datums/mapgen/planetary/LavaGenerator.dm index 0bdcbfb2d9ab..d154063bdc17 100644 --- a/code/datums/mapgen/planetary/LavaGenerator.dm +++ b/code/datums/mapgen/planetary/LavaGenerator.dm @@ -96,10 +96,10 @@ ) feature_spawn_chance = 0.3 feature_spawn_list = list( - /obj/structure/flora/rock/hell = 10, - /obj/structure/elite_tumor = 2, - /obj/structure/geyser/random = 2, - /obj/effect/spawner/lootdrop/anomaly/lava = 1 + /obj/structure/flora/rock/hell = 5, + /obj/structure/elite_tumor = 1, + /obj/structure/geyser/random = 1, + /obj/effect/spawner/lootdrop/anomaly/lava = 0.5 ) mob_spawn_chance = 4 diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index 5393dfc02166..7261fa5efd47 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -2,13 +2,10 @@ SSair.is_test_loading = TRUE for(var/mapname as anything in SSmapping.ship_purchase_list) var/datum/map_template/shuttle/map = SSmapping.ship_purchase_list[mapname] - var/ship try - ship = new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) - catch(var/exception/placement_error) - Fail("Runtime error loading ship type ([map.name]): [placement_error] on [placement_error.file]:[placement_error.line]\n[placement_error.desc]") - - qdel(ship) + new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) + catch(var/exception/e) + Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE var/list/errors = atmosscan(TRUE) From 3e7f861a7b58fca496ddfc32a09dd489816ebe93 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 15 Jul 2023 16:31:06 -0500 Subject: [PATCH 005/147] this is probably important --- code/controllers/subsystem/garbage.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index 44a06396a326..db4b05b2c30a 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -253,7 +253,7 @@ SUBSYSTEM_DEF(garbage) if (isnull(D)) return if (level > GC_QUEUE_COUNT) - HardDelete(D) + HardDelete(D, TRUE) return var/gctime = world.time var/refid = "\ref[D]" @@ -264,14 +264,14 @@ SUBSYSTEM_DEF(garbage) queue[++queue.len] = list(gctime, refid) // not += for byond reasons //this is mainly to separate things profile wise. -/datum/controller/subsystem/garbage/proc/HardDelete(datum/D) +/datum/controller/subsystem/garbage/proc/HardDelete(datum/D, force) ++delslasttick ++totaldels var/type = D.type var/refID = "\ref[D]" var/datum/qdel_item/I = items[type] - if (I.qdel_flags & QDEL_ITEM_SUSPENDED_FOR_LAG) + if (!force && I.qdel_flags & QDEL_ITEM_SUSPENDED_FOR_LAG) return var/tick_usage = TICK_USAGE @@ -379,7 +379,7 @@ SUBSYSTEM_DEF(garbage) if (QDEL_HINT_HARDDEL) //qdel should assume this object won't gc, and queue a hard delete SSgarbage.Queue(D, GC_QUEUE_HARDDELETE) if (QDEL_HINT_HARDDEL_NOW) //qdel should assume this object won't gc, and hard del it post haste. - SSgarbage.HardDelete(D) + SSgarbage.HardDelete(D, TRUE) #ifdef REFERENCE_TRACKING if (QDEL_HINT_FINDREFERENCE) //qdel will, if REFERENCE_TRACKING is enabled, display all references to this object, then queue the object for deletion. SSgarbage.Queue(D) From f52d6758e98275bfeb6abf8e6f030b0e0b67a8a9 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Thu, 25 Mar 2021 22:01:23 -0700 Subject: [PATCH 006/147] Ref Tracking: Revengance (#57728) * Ref Tracking: Revengance Fixes reference tracking ignoring self references due to a poorly thought out tick checking system. Fixes reference tracking ignoring the contents of assoc lists Makes the reference tracking printouts actually describe what list the ref is in, rather then just saying "list" Adds REFERENCE_TRACKING_DEBUG, a define which toggles tracking info for the ref tracking procs, which allows for oversight on how the proc is working Allows for direct calls of qdel_and_find_ref_if_fail(), makes it use ref rather then REF(), fixing it breaking for mobs. (Ditto for the qdel hint which does the same thing) Moves REAGENTS_TESTING out of the reftracking define block Makes unit tests define REFERENCE_TRACKING, REFERENCE_TRACKING_DEBUG, and FIND_REF_NO_CHECK_TICK Adds a unit test that sanity checks the reference finder proc --- code/_compile_options.dm | 10 +++ code/controllers/subsystem/garbage.dm | 2 +- code/datums/datum.dm | 6 +- .../view_variables/reference_tracking.dm | 80 ++++++++++++------- code/modules/unit_tests/_unit_tests.dm | 4 + .../unit_tests/find_reference_sanity.dm | 69 ++++++++++++++++ 6 files changed, 138 insertions(+), 33 deletions(-) create mode 100644 code/modules/unit_tests/find_reference_sanity.dm diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 4b661c80e6e7..14c79b59b9d2 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -15,6 +15,9 @@ //#define REFERENCE_TRACKING #ifdef REFERENCE_TRACKING +///Used for doing dry runs of the reference finder, to test for feature completeness +//#define REFERENCE_TRACKING_DEBUG + ///Run a lookup on things hard deleting by default. //#define GC_FAILURE_HARD_LOOKUP #ifdef GC_FAILURE_HARD_LOOKUP @@ -72,6 +75,13 @@ #define TESTING #endif +#if defined(UNIT_TESTS) +//Hard del testing defines +#define REFERENCE_TRACKING +#define REFERENCE_TRACKING_DEBUG +#define FIND_REF_NO_CHECK_TICK +#endif + // A reasonable number of maximum overlays an object needs // If you think you need more, rethink it #define MAX_ATOM_OVERLAYS 100 diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index db4b05b2c30a..02434e72d72b 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -383,7 +383,7 @@ SUBSYSTEM_DEF(garbage) #ifdef REFERENCE_TRACKING if (QDEL_HINT_FINDREFERENCE) //qdel will, if REFERENCE_TRACKING is enabled, display all references to this object, then queue the object for deletion. SSgarbage.Queue(D) - D.find_references() //This breaks ci. Consider it insurance against somehow pring reftracking on accident + D.find_references() if (QDEL_HINT_IFFAIL_FINDREFERENCE) //qdel will, if REFERENCE_TRACKING is enabled and the object fails to collect, display all references to this object. SSgarbage.Queue(D) SSgarbage.reference_find_on_fail["\ref[D]"] = TRUE diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 01fc5d6643e0..50249df3c282 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -43,9 +43,13 @@ /// A weak reference to another datum var/datum/weakref/weak_reference -#ifdef TESTING +#ifdef REFERENCE_TRACKING var/running_find_references var/last_find_references = 0 + #ifdef REFERENCE_TRACKING_DEBUG + ///Stores info about where refs are found, used for sanity checks and testing + var/list/found_refs + #endif #endif #ifdef DATUMVAR_DEBUGGING_MODE diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 0e4cfef7cea8..a66a4075a84d 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -31,26 +31,18 @@ usr.client.running_find_references = type testing("Beginning search for references to a [type].") - last_find_references = world.time - DoSearchVar(GLOB, "(global) -> ") //globals - testing("Finished searching globals") + var/starting_time = world.time - for(var/atom/atom_thing) //atoms - DoSearchVar(atom_thing, "World -> [atom_thing]") - testing("Finished searching atoms") + DoSearchVar(GLOB, "GLOB") //globals + for(var/datum/thing in world) //atoms (don't beleive its lies) + DoSearchVar(thing, "World -> [thing.type]", search_time = starting_time) - for (var/datum/datum_thing) //datums - DoSearchVar(datum_thing, "World -> [datum_thing]") - testing("Finished searching datums") + for(var/datum/thing) //datums + DoSearchVar(thing, "Datums -> [thing.type]", search_time = starting_time) -#ifndef FIND_REF_SKIP_CLIENTS - // DO NOT RUN THIS ON A LIVE SERVER - // IT WILL CRASH!!! - for (var/client/client_thing) //clients - DoSearchVar(client_thing, "World -> [client_thing]") - testing("Finished searching clients") -#endif + for(var/client/thing) //clients + DoSearchVar(thing, "Clients -> [thing.type]", search_time = starting_time) testing("Completed search for references to a [type].") if(usr?.client) @@ -80,26 +72,33 @@ qdel_and_find_ref_if_fail(src, TRUE) -/datum/proc/DoSearchVar(potential_container, container_name, recursive_limit = 32) +/datum/proc/DoSearchVar(potential_container, container_name, recursive_limit = 64, search_time = world.time) #ifndef FIND_REF_NO_CHECK_TICK CHECK_TICK #endif + + #ifdef REFERENCE_TRACKING_DEBUG + if(!found_refs) + found_refs = list() + #endif + if(usr?.client && !usr.client.running_find_references) return if(!recursive_limit) + testing("Recursion limit reached. [container_name]") return if(istype(potential_container, /datum)) var/datum/datum_container = potential_container - if(datum_container.last_find_references == last_find_references) + if(datum_container.last_find_references == search_time) return - datum_container.last_find_references = last_find_references + datum_container.last_find_references = search_time var/list/vars_list = datum_container.vars for(var/varname in vars_list) - if (varname == "vars") + if (varname == "vars" || varname == "vis_locs") //Fun fact, vis_locs don't count for references continue #ifndef FIND_REF_NO_CHECK_TICK CHECK_TICK @@ -107,10 +106,13 @@ var/variable = vars_list[varname] if(variable == src) - testing("Found [type] \ref[src] in [datum_container.type]'s [varname] var. [container_name]") + #ifdef REFERENCE_TRACKING_DEBUG + found_refs[varname] = TRUE + #endif + testing("Found [type] \ref[src] in [datum_container.type]'s \ref[datum_container] [varname] var. [container_name]") else if(islist(variable)) - DoSearchVar(variable, "[container_name] -> [varname] (list)", recursive_limit-1) + DoSearchVar(variable, "[container_name] \ref[datum_container] -> [varname] (list)", recursive_limit - 1, search_time) else if(islist(potential_container)) var/normal = IS_NORMAL_LIST(potential_container) @@ -118,22 +120,38 @@ #ifndef FIND_REF_NO_CHECK_TICK CHECK_TICK #endif + //Check normal entrys if(element_in_list == src) + #ifdef REFERENCE_TRACKING_DEBUG + found_refs[potential_container] = TRUE + #endif testing("Found [type] \ref[src] in list [container_name].") - else if(element_in_list && !isnum(element_in_list) && normal) - if(potential_container[element_in_list] == src) - testing("Found [type] \ref[src] in list [container_name]\[[element_in_list]\]") - else if(islist(potential_container[element_in_list])) - DoSearchVar(potential_container[element_in_list], "[container_name]\[[element_in_list]\]", recursive_limit-1) + //Check assoc entrys + else if(element_in_list && !isnum(element_in_list) && normal && potential_container[element_in_list] == src) + #ifdef REFERENCE_TRACKING_DEBUG + found_refs[potential_container] = TRUE + #endif + testing("Found [type] \ref[src] in list [container_name]\[[element_in_list]\]") + //Check normal sublists else if(islist(element_in_list)) - var/list/list_element = element_in_list - DoSearchVar(element_in_list, "[container_name]\[[list_element.Find(element_in_list)]] -> list", recursive_limit - 1) + DoSearchVar(element_in_list, "[container_name] -> [element_in_list] (list)", recursive_limit - 1, search_time) + + //Check assoc sublists + else if(element_in_list && !isnum(element_in_list) && normal && islist(potential_container[element_in_list])) + DoSearchVar(potential_container[element_in_list], "[container_name]\[[element_in_list]\] -> [potential_container[element_in_list]] (list)", recursive_limit - 1, search_time) + + #ifndef FIND_REF_NO_CHECK_TICK + CHECK_TICK + #endif /proc/qdel_and_find_ref_if_fail(datum/thing_to_del, force = FALSE) - SSgarbage.reference_find_on_fail[REF(thing_to_del)] = TRUE - qdel(thing_to_del, force) + thing_to_del.qdel_and_find_ref_if_fail(force) + +/datum/proc/qdel_and_find_ref_if_fail(force = FALSE) + SSgarbage.reference_find_on_fail["\ref[src]"] = TRUE + qdel(src, force) #endif diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index f44687b85ad6..15163a72b69a 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -56,6 +56,10 @@ #include "timer_sanity.dm" #include "unit_test.dm" +#ifdef REFERENCE_TRACKING //Don't try and parse this file if ref tracking isn't turned on. IE: don't parse ref tracking please mr linter +#include "find_reference_sanity.dm" +#endif + #undef TEST_ASSERT #undef TEST_ASSERT_EQUAL #undef TEST_ASSERT_NOTEQUAL diff --git a/code/modules/unit_tests/find_reference_sanity.dm b/code/modules/unit_tests/find_reference_sanity.dm new file mode 100644 index 000000000000..e958c1e2ddfc --- /dev/null +++ b/code/modules/unit_tests/find_reference_sanity.dm @@ -0,0 +1,69 @@ +///Used to test the completeness of the reference finder proc. +/datum/unit_test/find_reference_sanity + +/atom/movable/ref_holder + var/atom/movable/ref_test/test + var/list/test_list = list() + var/list/test_assoc_list = list() + +/atom/movable/ref_test + var/atom/movable/ref_test/self_ref + +/datum/unit_test/find_reference_sanity/Run() + var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) + var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + + //Sanity check + victim.DoSearchVar(testbed, "Sanity Check", search_time = 1) //We increment search time to get around an optimization + TEST_ASSERT(!victim.found_refs.len, "The ref-tracking tool found a ref where none existed") + victim.found_refs.Cut() + + //Set up for the first round of tests + testbed.test = victim + testbed.test_list += victim + testbed.test_assoc_list["baseline"] = victim + + victim.DoSearchVar(testbed, "First Run", search_time = 2) + + TEST_ASSERT(victim.found_refs["test"], "The ref-tracking tool failed to find a regular value") + TEST_ASSERT(victim.found_refs[testbed.test_list], "The ref-tracking tool failed to find a list entry") + TEST_ASSERT(victim.found_refs[testbed.test_assoc_list], "The ref-tracking tool failed to find an assoc list value") + victim.found_refs.Cut() + testbed.test = null + testbed.test_list.Cut() + testbed.test_assoc_list.Cut() + + //Second round, bit harder this time + testbed.overlays += victim + testbed.vis_contents += victim + testbed.test_assoc_list[victim] = TRUE + + victim.DoSearchVar(testbed, "Second Run", search_time = 3) + + //This is another sanity check + TEST_ASSERT(!victim.found_refs[testbed.overlays], "The ref-tracking tool found an overlays entry? That shouldn't be possible") + TEST_ASSERT(victim.found_refs[testbed.vis_contents], "The ref-tracking tool failed to find a vis_contents entry") + TEST_ASSERT(victim.found_refs[testbed.test_assoc_list], "The ref-tracking tool failed to find an assoc list key") + victim.found_refs.Cut() + testbed.overlays.Cut() + testbed.vis_contents.Cut() + testbed.test_assoc_list.Cut() + + //Let's get a bit esoteric + victim.self_ref = victim + var/list/to_find = list(victim) + testbed.test_list += list(to_find) + var/list/to_find_assoc = list(victim) + testbed.test_assoc_list["Nesting"] = to_find_assoc + + victim.DoSearchVar(victim, "Third Run Self", search_time = 4) + victim.DoSearchVar(testbed, "Third Run Testbed", search_time = 4) + TEST_ASSERT(victim.found_refs["self_ref"], "The ref-tracking tool failed to find a self reference") + TEST_ASSERT(victim.found_refs[to_find], "The ref-tracking tool failed to find a nested list entry") + TEST_ASSERT(victim.found_refs[to_find_assoc], "The ref-tracking tool failed to find a nested assoc list entry") + victim.found_refs.Cut() + victim.self_ref = null + to_find.Cut() + testbed.test_list.Cut() + to_find_assoc.Cut() + testbed.test_assoc_list.Cut() From 2d5fbb49844e7ec097e003b9ee97eb450d202887 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Fri, 14 May 2021 16:32:13 -0700 Subject: [PATCH 007/147] Fixes some more holes in the ref tracker (#58972) * Fixes some more holes in the ref tracker The reference tracker was failing to check null keyed assoc list entries, along with being unable to check both lists in a list(list() = list()) pair This resolves that, and adds some new logic to the unit test to check for this sort of thing * Seperates the ref tracking unit test into 6 subtasks as requested --- .../view_variables/reference_tracking.dm | 17 ++++--- .../unit_tests/find_reference_sanity.dm | 49 +++++++++++++------ 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index a66a4075a84d..36d3f0aaff11 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -128,19 +128,20 @@ testing("Found [type] \ref[src] in list [container_name].") //Check assoc entrys - else if(element_in_list && !isnum(element_in_list) && normal && potential_container[element_in_list] == src) + else if(!isnum(element_in_list) && normal && potential_container[element_in_list] == src) #ifdef REFERENCE_TRACKING_DEBUG found_refs[potential_container] = TRUE #endif testing("Found [type] \ref[src] in list [container_name]\[[element_in_list]\]") - //Check normal sublists - else if(islist(element_in_list)) - DoSearchVar(element_in_list, "[container_name] -> [element_in_list] (list)", recursive_limit - 1, search_time) - - //Check assoc sublists - else if(element_in_list && !isnum(element_in_list) && normal && islist(potential_container[element_in_list])) - DoSearchVar(potential_container[element_in_list], "[container_name]\[[element_in_list]\] -> [potential_container[element_in_list]] (list)", recursive_limit - 1, search_time) + //We need to run both of these checks, since our object could be hiding in either of them + else + //Check normal sublists + if(islist(element_in_list)) + DoSearchVar(element_in_list, "[container_name] -> [element_in_list] (list)", recursive_limit - 1, search_time) + //Check assoc sublists + if(!isnum(element_in_list) && normal && islist(potential_container[element_in_list])) + DoSearchVar(potential_container[element_in_list], "[container_name]\[[element_in_list]\] -> [potential_container[element_in_list]] (list)", recursive_limit - 1, search_time) #ifndef FIND_REF_NO_CHECK_TICK CHECK_TICK diff --git a/code/modules/unit_tests/find_reference_sanity.dm b/code/modules/unit_tests/find_reference_sanity.dm index e958c1e2ddfc..53cccea9e7b3 100644 --- a/code/modules/unit_tests/find_reference_sanity.dm +++ b/code/modules/unit_tests/find_reference_sanity.dm @@ -16,8 +16,10 @@ //Sanity check victim.DoSearchVar(testbed, "Sanity Check", search_time = 1) //We increment search time to get around an optimization TEST_ASSERT(!victim.found_refs.len, "The ref-tracking tool found a ref where none existed") - victim.found_refs.Cut() +/datum/unit_test/find_reference_baseline/Run() + var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) + var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) //Set up for the first round of tests testbed.test = victim testbed.test_list += victim @@ -28,10 +30,10 @@ TEST_ASSERT(victim.found_refs["test"], "The ref-tracking tool failed to find a regular value") TEST_ASSERT(victim.found_refs[testbed.test_list], "The ref-tracking tool failed to find a list entry") TEST_ASSERT(victim.found_refs[testbed.test_assoc_list], "The ref-tracking tool failed to find an assoc list value") - victim.found_refs.Cut() - testbed.test = null - testbed.test_list.Cut() - testbed.test_assoc_list.Cut() + +/datum/unit_test/find_reference_exotic/Run() + var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) + var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) //Second round, bit harder this time testbed.overlays += victim @@ -44,10 +46,10 @@ TEST_ASSERT(!victim.found_refs[testbed.overlays], "The ref-tracking tool found an overlays entry? That shouldn't be possible") TEST_ASSERT(victim.found_refs[testbed.vis_contents], "The ref-tracking tool failed to find a vis_contents entry") TEST_ASSERT(victim.found_refs[testbed.test_assoc_list], "The ref-tracking tool failed to find an assoc list key") - victim.found_refs.Cut() - testbed.overlays.Cut() - testbed.vis_contents.Cut() - testbed.test_assoc_list.Cut() + +/datum/unit_test/find_reference_esoteric/Run() + var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) + var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) //Let's get a bit esoteric victim.self_ref = victim @@ -61,9 +63,26 @@ TEST_ASSERT(victim.found_refs["self_ref"], "The ref-tracking tool failed to find a self reference") TEST_ASSERT(victim.found_refs[to_find], "The ref-tracking tool failed to find a nested list entry") TEST_ASSERT(victim.found_refs[to_find_assoc], "The ref-tracking tool failed to find a nested assoc list entry") - victim.found_refs.Cut() - victim.self_ref = null - to_find.Cut() - testbed.test_list.Cut() - to_find_assoc.Cut() - testbed.test_assoc_list.Cut() + +/datum/unit_test/find_reference_null_key_entry/Run() + var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) + var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + + //Calm before the storm + testbed.test_assoc_list = list(null = victim) + + victim.DoSearchVar(testbed, "Fourth Run", search_time = 5) + TEST_ASSERT(testbed.test_assoc_list, "The ref-tracking tool failed to find a null key'd assoc list entry") + +/datum/unit_test/find_reference_assoc_investigation/Run() + var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) + var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + //Let's do some more complex assoc list investigation + var/list/to_find_in_key = list(victim) + testbed.test_assoc_list[to_find_in_key] = list("memes") + var/list/to_find_null_assoc_nested = list(victim) + testbed.test_assoc_list[null] = to_find_null_assoc_nested + + victim.DoSearchVar(testbed, "Fifth Run", search_time = 6) + TEST_ASSERT(victim.found_refs[to_find_in_key], "The ref-tracking tool failed to find a nested assoc list key") + TEST_ASSERT(victim.found_refs[to_find_null_assoc_nested], "The ref-tracking tool failed to find a null key'd nested assoc list entry") From 2315cf8a95949c72c49dd5d2a1e1ee308cf2bae8 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Thu, 10 Jun 2021 17:44:23 -0700 Subject: [PATCH 008/147] Fixes a bunch of harddels that are sourced from player action (#59371) Sourced from #59118 and a cursed project I'll pr later, This pr contains a lot of harddel fixes for stuff that pops up after a player interacts with something. I'm not gonna list them all here because there's something like 60 130, check the commit log if you're curious Oh and I moved ref tracking screaming to a separate define, and made some optimizations to the thing in general. I think that's it, this pr is a bit of a frankenstine --- code/__DEFINES/cooldowns.dm | 2 +- code/__DEFINES/mobs.dm | 3 + code/__DEFINES/subsystems.dm | 3 + code/__DEFINES/traits.dm | 4 + code/__HELPERS/_logging.dm | 5 + code/_compile_options.dm | 3 + code/controllers/subsystem/atoms.dm | 3 + code/datums/browser.dm | 19 ++- code/datums/components/fantasy/_fantasy.dm | 3 +- code/datums/components/storage/storage.dm | 16 +- code/datums/components/udder.dm | 1 + code/datums/dash_weapon.dm | 14 +- code/datums/hud.dm | 6 + code/datums/mind.dm | 55 +++---- .../game/gamemodes/clown_ops/clown_weapons.dm | 5 +- code/game/gamemodes/objective.dm | 5 + code/game/machinery/camera/tracking.dm | 8 +- code/game/machinery/computer/Operating.dm | 30 ++-- code/game/machinery/computer/dna_console.dm | 23 ++- code/game/machinery/dna_scanner.dm | 12 ++ code/game/machinery/launch_pad.dm | 56 ++++--- code/game/objects/items.dm | 7 +- code/game/objects/items/chrono_eraser.dm | 8 +- .../objects/items/devices/transfer_valve.dm | 4 + code/game/objects/items/dice.dm | 6 +- .../objects/items/implants/implant_track.dm | 14 +- code/game/objects/items/melee/energy.dm | 4 + code/game/objects/items/melee/misc.dm | 2 +- code/game/objects/items/stunbaton.dm | 5 +- code/game/objects/structures/displaycase.dm | 3 - .../objects/structures/ghost_role_spawners.dm | 9 +- code/game/objects/structures/tables_racks.dm | 15 +- code/game/objects/structures/traps.dm | 10 +- .../view_variables/reference_tracking.dm | 93 +++++------ .../abductor/equipment/glands/slime.dm | 4 +- .../blob/blobstrains/_blobstrain.dm | 4 + code/modules/antagonists/blob/overmind.dm | 1 + code/modules/antagonists/cult/cult_items.dm | 7 +- .../antagonists/disease/disease_disease.dm | 1 + .../antagonists/disease/disease_mob.dm | 2 + .../antagonists/slaughter/slaughter.dm | 2 +- code/modules/assembly/assembly.dm | 4 + code/modules/assembly/flash.dm | 15 +- .../portable/portable_atmospherics.dm | 4 +- code/modules/awaymissions/capture_the_flag.dm | 34 +++- code/modules/awaymissions/gateway.dm | 6 + code/modules/client/verbs/suicide.dm | 4 +- code/modules/clothing/head/misc.dm | 2 +- .../modules/clothing/spacesuits/chronosuit.dm | 5 + code/modules/clothing/spacesuits/hardsuit.dm | 10 +- code/modules/clothing/suits/toggles.dm | 5 +- code/modules/clothing/under/accessories.dm | 17 +- code/modules/events/wizard/greentext.dm | 3 +- code/modules/fields/timestop.dm | 2 +- code/modules/holodeck/holo_effect.dm | 60 ++++--- code/modules/language/language_holder.dm | 4 +- code/modules/lighting/lighting_source.dm | 3 +- code/modules/mining/laborcamp/laborstacker.dm | 16 +- .../mining/lavaland/necropolis_chests.dm | 6 + code/modules/mining/machine_stacking.dm | 18 ++- code/modules/mob/dead/new_player/login.dm | 4 +- .../modules/mob/dead/new_player/new_player.dm | 6 +- code/modules/mob/living/blood.dm | 1 - code/modules/mob/living/brain/brain.dm | 13 +- code/modules/mob/living/brain/brain_item.dm | 3 + code/modules/mob/living/carbon/human/human.dm | 1 + .../mob/living/carbon/human/human_defense.dm | 2 +- .../carbon/human/species_types/golems.dm | 4 +- .../carbon/human/species_types/jellypeople.dm | 105 +++++++------ code/modules/mob/living/living.dm | 2 +- code/modules/mob/living/living_defense.dm | 5 +- code/modules/mob/living/silicon/ai/ai.dm | 14 +- .../modules/mob/living/silicon/robot/robot.dm | 13 +- .../mob/living/simple_animal/bot/honkbot.dm | 5 +- .../mob/living/simple_animal/bot/secbot.dm | 5 +- .../mob/living/simple_animal/constructs.dm | 19 +-- .../mob/living/simple_animal/hostile/bees.dm | 3 +- .../simple_animal/hostile/giant_spider.dm | 2 + .../living/simple_animal/hostile/hostile.dm | 84 +++++----- .../simple_animal/hostile/jungle/mook.dm | 3 +- .../simple_animal/hostile/mecha_pilot.dm | 4 +- .../hostile/megafauna/colossus.dm | 15 +- .../hostile/megafauna/hierophant.dm | 2 +- .../hostile/mining_mobs/basilisk.dm | 3 +- .../hostile/retaliate/retaliate.dm | 30 +++- .../mob/living/simple_animal/slime/life.dm | 48 +++--- .../mob/living/simple_animal/slime/powers.dm | 2 +- .../mob/living/simple_animal/slime/slime.dm | 70 +++++++-- code/modules/mob/logout.dm | 4 +- code/modules/mob/mob.dm | 78 +++++++-- code/modules/mob/mob_defines.dm | 4 +- code/modules/mob/mob_lists.dm | 7 + .../NTNet/NTNRC/conversation.dm | 29 ++-- .../computers/machinery/console_presets.dm | 2 - .../file_system/programs/ntnrc_client.dm | 12 +- .../file_system/programs/sm_monitor.dm | 18 ++- .../modular_computers/hardware/hard_drive.dm | 2 +- code/modules/ninja/suit/suit.dm | 5 + code/modules/overmap/helm.dm | 28 ++-- .../overmap/ships/controlled_ship_datum.dm | 7 +- .../projectiles/ammunition/energy/portal.dm | 5 +- .../projectiles/guns/energy/laser_gatling.dm | 10 ++ .../projectiles/guns/energy/special.dm | 4 +- code/modules/projectiles/projectile.dm | 5 +- .../projectiles/projectile/special/curse.dm | 4 + .../projectile/special/wormhole.dm | 8 +- .../chemistry/reagents/other_reagents.dm | 2 +- code/modules/reagents/reagent_containers.dm | 16 +- .../reagents/reagent_containers/borghydro.dm | 2 +- code/modules/recycling/disposal/bin.dm | 5 +- .../research/nanites/nanite_chamber.dm | 1 - .../nanites/nanite_chamber_computer.dm | 15 +- .../research/nanites/nanite_programs.dm | 3 + .../nanites/nanite_programs/utility.dm | 2 +- .../crossbreeding/_status_effects.dm | 2 +- .../xenobiology/crossbreeding/burning.dm | 8 +- .../research/xenobiology/xenobio_camera.dm | 4 +- .../ruins/objects_and_mobs/ash_walker_den.dm | 9 ++ code/modules/shuttle/shuttle.dm | 16 +- code/modules/spells/spell.dm | 6 + .../spells/spell_types/personality_commune.dm | 4 + code/modules/surgery/organs/augments_arms.dm | 148 +++++++++++------- code/modules/tgui/tgui_alert.dm | 2 +- code/modules/vending/_vending.dm | 10 +- code/modules/zombie/organs.dm | 2 +- 125 files changed, 1087 insertions(+), 565 deletions(-) diff --git a/code/__DEFINES/cooldowns.dm b/code/__DEFINES/cooldowns.dm index ae027233c9e7..8f1f667a79f7 100644 --- a/code/__DEFINES/cooldowns.dm +++ b/code/__DEFINES/cooldowns.dm @@ -62,7 +62,7 @@ #define COOLDOWN_DECLARE(cd_index) var/##cd_index = 0 -#define COOLDOWN_START(cd_source, cd_index, cd_time) (cd_source.cd_index = world.time + cd_time) +#define COOLDOWN_START(cd_source, cd_index, cd_time) (cd_source.cd_index = world.time + (cd_time)) //Returns true if the cooldown has run its course, false otherwise #define COOLDOWN_FINISHED(cd_source, cd_index) (cd_source.cd_index < world.time) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index e4f600dcea6a..99cff793a761 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -430,3 +430,6 @@ #define THROW_MODE_DISABLED 0 #define THROW_MODE_TOGGLE 1 #define THROW_MODE_HOLD 2 + +//Saves a proc call, life is suffering. If who has no targets_from var, we assume it's just who +#define GET_TARGETS_FROM(who) (who.targets_from ? who.get_targets_from() : who) diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index d00300a3e8e4..51c454da1def 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -87,6 +87,9 @@ ///Call qdel on the atom after intialization #define INITIALIZE_HINT_QDEL 2 +///Call qdel with a force of TRUE after initialization +#define INITIALIZE_HINT_QDEL_FORCE 3 + ///type and all subtypes should always immediately call Initialize in New() #define INITIALIZE_IMMEDIATE(X) ##X/New(loc, ...){ \ ..(); \ diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 316a1834333f..6b0695fe7d4c 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -423,3 +423,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_FISH_SAFE_STORAGE "fish_case" /// Stuff that can go inside fish cases #define TRAIT_FISH_CASE_COMPATIBILE "fish_case_compatibile" + +/// Trait granted by [mob/living/silicon/ai] +/// Applied when the ai anchors itself +#define AI_ANCHOR_TRAIT "ai_anchor" diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index 4463d6adf287..e9feafa3ae79 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -35,6 +35,11 @@ SEND_TEXT(world.log, text) #endif +#ifdef REFERENCE_TRACKING_LOG +#define log_reftracker(msg) log_world("## REF SEARCH [msg]") +#else +#define log_reftracker(msg) +#endif /* Items with ADMINPRIVATE prefixed are stripped from public logs. */ /proc/log_admin(text) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 14c79b59b9d2..8f5accdf0c04 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -15,6 +15,9 @@ //#define REFERENCE_TRACKING #ifdef REFERENCE_TRACKING +///Should we be logging our findings or not +#define REFERENCE_TRACKING_LOG + ///Used for doing dry runs of the reference finder, to test for feature completeness //#define REFERENCE_TRACKING_DEBUG diff --git a/code/controllers/subsystem/atoms.dm b/code/controllers/subsystem/atoms.dm index fe73d2d60b1d..0c3ea203065c 100644 --- a/code/controllers/subsystem/atoms.dm +++ b/code/controllers/subsystem/atoms.dm @@ -96,6 +96,9 @@ SUBSYSTEM_DEF(atoms) if(INITIALIZE_HINT_QDEL) qdel(A) qdeleted = TRUE + if(INITIALIZE_HINT_QDEL_FORCE) + qdel(A, force = TRUE) + qdeleted = TRUE else BadInitializeCalls[the_type] |= BAD_INIT_NO_HINT diff --git a/code/datums/browser.dm b/code/datums/browser.dm index 2300e308a35f..c6d98adb0c0d 100644 --- a/code/datums/browser.dm +++ b/code/datums/browser.dm @@ -4,7 +4,7 @@ var/window_id // window_id is used as the window name for browse and onclose var/width = 0 var/height = 0 - var/atom/ref = null + var/datum/weakref/ref = null var/window_options = "can_close=1;can_minimize=1;can_maximize=0;can_resize=1;titlebar=1;" // window option is set using window_id var/stylesheets[0] var/scripts[0] @@ -16,8 +16,8 @@ /datum/browser/New(nuser, nwindow_id, ntitle = 0, nwidth = 0, nheight = 0, atom/nref = null) - user = nuser + RegisterSignal(user, COMSIG_PARENT_QDELETING, .proc/user_deleted) window_id = nwindow_id if (ntitle) title = format_text(ntitle) @@ -26,7 +26,11 @@ if (nheight) height = nheight if (nref) - ref = nref + ref = WEAKREF(nref) + +/datum/browser/proc/user_deleted(datum/source) + SIGNAL_HANDLER + user = null /datum/browser/proc/add_head_content(nhead_content) head_content = nhead_content @@ -113,8 +117,13 @@ /datum/browser/proc/setup_onclose() set waitfor = 0 //winexists sleeps, so we don't need to. for (var/i in 1 to 10) - if (user && winexists(user, window_id)) - onclose(user, window_id, ref) + if (user?.client && winexists(user, window_id)) + var/atom/send_ref + if(ref) + send_ref = ref.resolve() + if(!send_ref) + ref = null + onclose(user, window_id, send_ref) break /datum/browser/proc/close() diff --git a/code/datums/components/fantasy/_fantasy.dm b/code/datums/components/fantasy/_fantasy.dm index a203264fae0a..92bd0868a746 100644 --- a/code/datums/components/fantasy/_fantasy.dm +++ b/code/datums/components/fantasy/_fantasy.dm @@ -116,8 +116,7 @@ for(var/i in affixes) var/datum/fantasy_affix/affix = i affix.remove(src) - for(var/i in appliedComponents) - qdel(i) + QDEL_LIST(appliedComponents) master.force = max(0, master.force - quality) master.throwforce = max(0, master.throwforce - quality) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index da4fb04b3214..29d82b6dbb5a 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -405,20 +405,27 @@ M.client.screen |= boxes M.client.screen |= closer M.client.screen |= real_location.contents - M.active_storage = src + M.set_active_storage(src) LAZYOR(is_using, M) + RegisterSignal(M, COMSIG_PARENT_QDELETING, .proc/mob_deleted) return TRUE +/datum/component/storage/proc/mob_deleted(datum/source) + SIGNAL_HANDLER + hide_from(source) + /datum/component/storage/proc/hide_from(mob/M) + if(M.active_storage == src) + M.set_active_storage(null) + LAZYREMOVE(is_using, M) + + UnregisterSignal(M, COMSIG_PARENT_QDELETING) if(!M.client) return TRUE var/atom/real_location = real_location() M.client.screen -= boxes M.client.screen -= closer M.client.screen -= real_location.contents - if(M.active_storage == src) - M.active_storage = null - LAZYREMOVE(is_using, M) return TRUE /datum/component/storage/proc/close(mob/M) @@ -498,6 +505,7 @@ cansee |= M else LAZYREMOVE(is_using, M) + UnregisterSignal(M, COMSIG_PARENT_QDELETING) return cansee //Tries to dump content diff --git a/code/datums/components/udder.dm b/code/datums/components/udder.dm index 886b2c1b12f7..b9687dd8e05a 100644 --- a/code/datums/components/udder.dm +++ b/code/datums/components/udder.dm @@ -82,6 +82,7 @@ /obj/item/udder/Destroy() . = ..() STOP_PROCESSING(SSobj, src) + udder_mob = null /obj/item/udder/process(delta_time) if(udder_mob.stat != DEAD) diff --git a/code/datums/dash_weapon.dm b/code/datums/dash_weapon.dm index 0e22a4f350f0..3f519fc49155 100644 --- a/code/datums/dash_weapon.dm +++ b/code/datums/dash_weapon.dm @@ -6,7 +6,6 @@ var/current_charges = 1 var/max_charges = 1 var/charge_rate = 250 - var/mob/living/carbon/human/holder var/obj/item/dashing_item var/dash_sound = 'sound/magic/blink.ogg' var/recharge_sound = 'sound/magic/charge.ogg' @@ -17,7 +16,10 @@ /datum/action/innate/dash/Grant(mob/user, obj/dasher) . = ..() dashing_item = dasher - holder = user + +/datum/action/innate/dash/Destroy() + dashing_item = null + return ..() /datum/action/innate/dash/IsAvailable() if(current_charges > 0) @@ -26,7 +28,7 @@ return FALSE /datum/action/innate/dash/Activate() - dashing_item.attack_self(holder) //Used to toggle dash behavior in the dashing item + dashing_item.attack_self(owner) //Used to toggle dash behavior in the dashing item /datum/action/innate/dash/proc/Teleport(mob/user, atom/target) if(!IsAvailable()) @@ -39,12 +41,12 @@ var/obj/spot2 = new phasein(get_turf(user), user.dir) spot1.Beam(spot2,beam_effect,time=20) current_charges-- - holder.update_action_buttons_icon() + owner.update_action_buttons_icon() addtimer(CALLBACK(src, .proc/charge), charge_rate) /datum/action/innate/dash/proc/charge() current_charges = clamp(current_charges + 1, 0, max_charges) - holder.update_action_buttons_icon() + owner.update_action_buttons_icon() if(recharge_sound) playsound(dashing_item, recharge_sound, 50, TRUE) - to_chat(holder, "[src] now has [current_charges]/[max_charges] charges.") + to_chat(owner, "[src] now has [current_charges]/[max_charges] charges.") diff --git a/code/datums/hud.dm b/code/datums/hud.dm index 68e1800d5c34..eb01b49e0dc2 100644 --- a/code/datums/hud.dm +++ b/code/datums/hud.dm @@ -85,6 +85,7 @@ GLOBAL_LIST_INIT(huds, list( return if(!hudusers[M]) hudusers[M] = 1 + RegisterSignal(M, COMSIG_PARENT_QDELETING, PROC_REF(unregister_mob)) if(next_time_allowed[M] > world.time) if(!queued_to_see[M]) addtimer(CALLBACK(src, .proc/show_hud_images_after_cooldown, M), next_time_allowed[M] - world.time) @@ -96,6 +97,11 @@ GLOBAL_LIST_INIT(huds, list( else hudusers[M]++ +/datum/atom_hud/proc/unregister_mob(datum/source, force) + SIGNAL_HANDLER + remove_hud_from(source, TRUE) + remove_from_hud(source) + /datum/atom_hud/proc/hide_single_atomhud_from(hud_user,hidden_atom) if(hudusers[hud_user]) remove_from_single_hud(hud_user,hidden_atom) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 97def620c708..6d96f477099a 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -72,8 +72,8 @@ var/list/skills_rewarded ///Assoc list of skills. Use SKILL_LVL to access level, and SKILL_EXP to access skill's exp. var/list/known_skills = list() - ///What character we joined in as- either at roundstart or latejoin, so we know for persistent scars if we ended as the same person or not - var/mob/original_character + ///Weakref to thecharacter we joined in as- either at roundstart or latejoin, so we know for persistent scars if we ended as the same person or not + var/datum/weakref/original_character /// The index for what character slot, if any, we were loaded from, so we can track persistent scars on a per-character basis. Each character slot gets PERSISTENT_SCAR_SLOTS scar slots var/original_character_slot_index /// The index for our current scar slot, so we don't have to constantly check the savefile (unlike the slots themselves, this index is independent of selected char slot, and increments whenever a valid char is joined with) @@ -102,25 +102,21 @@ if(islist(antag_datums)) QDEL_LIST(antag_datums) QDEL_NULL(language_holder) - enslaved_to = null - soulOwner = null - martial_art = null - current = null - original_character = null - leave_all_antag_huds() + set_current(null) return ..() -/datum/mind/proc/handle_mob_deletion(mob/deleted_mob) - if (current == deleted_mob) - current = null - if (original_character == deleted_mob) - original_character = null - if (src == deleted_mob.mind) - deleted_mob.mind = null - if (istype(deleted_mob, /mob/living/carbon)) - var/mob/living/carbon/deleted_carbon = deleted_mob - if (src == deleted_carbon.last_mind) - deleted_carbon.last_mind = null +/datum/mind/proc/set_current(mob/new_current) + if(new_current && QDELETED(new_current)) + CRASH("Tried to set a mind's current var to a qdeleted mob, what the fuck") + if(current) + UnregisterSignal(src, COMSIG_PARENT_QDELETING) + current = new_current + if(current) + RegisterSignal(src, COMSIG_PARENT_QDELETING, .proc/clear_current) + +/datum/mind/proc/clear_current(datum/source) + SIGNAL_HANDLER + set_current(null) /datum/mind/proc/get_language_holder() if(!language_holder) @@ -128,7 +124,8 @@ return language_holder /datum/mind/proc/transfer_to(mob/new_character, force_key_move = 0) - if(current) // remove ourself from our old body's mind variable + set_original_character(null) + if(current) // remove ourself from our old body's mind variable current.mind = null UnregisterSignal(current, COMSIG_MOB_DEATH) SStgui.on_transfer(current, new_character) @@ -139,16 +136,16 @@ else key = new_character.key - if(new_character.mind) //disassociate any mind currently in our new body's mind variable - new_character.mind.current = null + if(new_character.mind) //disassociate any mind currently in our new body's mind variable + new_character.mind.set_current(null) var/datum/atom_hud/antag/hud_to_transfer = antag_hud//we need this because leave_hud() will clear this list var/mob/living/old_current = current if(current) - current.transfer_observers_to(new_character) //transfer anyone observing the old character to the new one - current = new_character //associate ourself with our new body - new_character.mind = src //and associate our new body with ourself - for(var/a in antag_datums) //Makes sure all antag datums effects are applied in the new body + current.transfer_observers_to(new_character) //transfer anyone observing the old character to the new one + set_current(new_character) //associate ourself with our new body + new_character.mind = src //and associate our new body with ourself + for(var/a in antag_datums) //Makes sure all antag datums effects are applied in the new body var/datum/antagonist/A = a A.on_body_transfer(old_current, current) if(iscarbon(new_character)) @@ -165,6 +162,10 @@ new_character.client.init_verbs() // re-initialize character specific verbs current.update_atom_languages() +//I cannot trust you fucks to do this properly +/datum/mind/proc/set_original_character(new_original_character) + original_character = WEAKREF(new_original_character) + /datum/mind/proc/init_known_skills() for (var/type in GLOB.skill_types) known_skills[type] = list(SKILL_LEVEL_NONE, 0) @@ -830,7 +831,7 @@ if(!mind.name) mind.name = real_name - mind.current = src + mind.set_current(src) /mob/living/carbon/mind_initialize() ..() diff --git a/code/game/gamemodes/clown_ops/clown_weapons.dm b/code/game/gamemodes/clown_ops/clown_weapons.dm index 589b27d59818..b03463b82a1b 100644 --- a/code/game/gamemodes/clown_ops/clown_weapons.dm +++ b/code/game/gamemodes/clown_ops/clown_weapons.dm @@ -163,8 +163,9 @@ if(iscarbon(hit_atom) && !caught)//if they are a carbon and they didn't catch it var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery) slipper.Slip(src, hit_atom) - if(thrownby && !caught) - addtimer(CALLBACK(src, /atom/movable.proc/throw_at, thrownby, throw_range+2, throw_speed, null, TRUE), 1) + var/mob/thrown_by = thrownby?.resolve() + if(thrown_by && !caught) + addtimer(CALLBACK(src, /atom/movable.proc/throw_at, thrown_by, throw_range+2, throw_speed, null, TRUE), 1) else return ..() diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index 9a114e9f3295..a2d933dba3d7 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -17,6 +17,11 @@ GLOBAL_LIST_EMPTY(objectives) if(text) explanation_text = text +//Apparently objectives can be qdel'd. Learn a new thing every day +/datum/objective/Destroy() + GLOB.objectives -= src + return ..() + /datum/objective/proc/get_owners() // Combine owner and team into a single list. . = (team && team.members) ? team.members.Copy() : list() if(owner) diff --git a/code/game/machinery/camera/tracking.dm b/code/game/machinery/camera/tracking.dm index 47b9a845b598..fd876b2987f2 100644 --- a/code/game/machinery/camera/tracking.dm +++ b/code/game/machinery/camera/tracking.dm @@ -49,9 +49,9 @@ track.namecounts[name] = 1 if(ishuman(L)) - track.humans[name] = L + track.humans[name] = WEAKREF(L) else - track.others[name] = L + track.others[name] = WEAKREF(L) var/list/targets = sortList(track.humans) + sortList(track.others) @@ -67,9 +67,9 @@ if(!track.initialized) trackable_mobs() - var/mob/target = (isnull(track.humans[target_name]) ? track.others[target_name] : track.humans[target_name]) + var/datum/weakref/target = (isnull(track.humans[target_name]) ? track.others[target_name] : track.humans[target_name]) - ai_actual_track(target) + ai_actual_track(target.resolve()) /mob/living/silicon/ai/proc/ai_actual_track(mob/living/target) if(!istype(target)) diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index 811e7d5c100a..d014b33010d7 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -8,7 +8,6 @@ icon_keyboard = "med_key" circuit = /obj/item/circuitboard/computer/operating - var/mob/living/carbon/human/patient var/obj/structure/table/optable/table var/obj/machinery/stasis/sbed var/list/advanced_surgeries = list() @@ -103,23 +102,18 @@ surgery["desc"] = initial(S.desc) surgeries += list(surgery) data["surgeries"] = surgeries - data["patient"] = null - if(table) - data["table"] = table - if(!table.check_eligible_patient()) - return data - data["patient"] = list() - patient = table.patient - else - if(sbed) - data["table"] = sbed - if(!ishuman(sbed.occupant) && !ismonkey(sbed.occupant)) - return data - data["patient"] = list() - patient = sbed.occupant - else - data["patient"] = null - return data + + //If there's no patient just hop to it yeah? + if(!table) + data["patient"] = null + return data + + data["table"] = table + if(!table.check_eligible_patient()) + return data + data["patient"] = list() + var/mob/living/carbon/human/patient = table.patient + switch(patient.stat) if(CONSCIOUS) data["patient"]["stat"] = "Conscious" diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm index 951901d2258d..437a19136453 100644 --- a/code/game/machinery/computer/dna_console.dm +++ b/code/game/machinery/computer/dna_console.dm @@ -225,7 +225,7 @@ can_use_scanner = TRUE else can_use_scanner = FALSE - connected_scanner = null + set_connected_scanner(null) is_viable_occupant = FALSE // Check for a viable occupant in the scanner. @@ -1540,8 +1540,7 @@ test_scanner = locate(/obj/machinery/dna_scannernew, get_step(src, direction)) if(!isnull(test_scanner)) if(test_scanner.is_operational) - connected_scanner = test_scanner - connected_scanner.linked_console = src + set_connected_scanner(test_scanner) return else broken_scanner = test_scanner @@ -1549,8 +1548,7 @@ // Ultimately, if we have a broken scanner, we'll attempt to connect to it as // a fallback case, but the code above will prefer a working scanner if(!isnull(broken_scanner)) - connected_scanner = broken_scanner - connected_scanner.linked_console = src + set_connected_scanner(broken_scanner) /** * Called by connected DNA Scanners when their doors close. @@ -1991,6 +1989,21 @@ tgui_view_state["storageDiskSubMode"] = "mutations" + +/obj/machinery/computer/scan_consolenew/proc/set_connected_scanner(new_scanner) + if(connected_scanner) + UnregisterSignal(connected_scanner, COMSIG_PARENT_QDELETING) + if(connected_scanner.linked_console == src) + connected_scanner.set_linked_console(null) + connected_scanner = new_scanner + if(connected_scanner) + RegisterSignal(connected_scanner, COMSIG_PARENT_QDELETING, .proc/react_to_scanner_del) + connected_scanner.set_linked_console(src) + +/obj/machinery/computer/scan_consolenew/proc/react_to_scanner_del(datum/source) + SIGNAL_HANDLER + set_connected_scanner(null) + #undef INJECTOR_TIMEOUT #undef NUMBER_OF_BUFFERS #undef SCRAMBLE_TIMEOUT diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index c0f49c36bdab..edeab10e73bf 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -144,6 +144,18 @@ return close_machine(target) +//This is only called by the scanner. if you ever want to use this outside of that context you'll need to refactor things a bit +/obj/machinery/dna_scannernew/proc/set_linked_console(new_console) + if(linked_console) + UnregisterSignal(linked_console, COMSIG_PARENT_QDELETING) + linked_console = new_console + if(linked_console) + RegisterSignal(linked_console, COMSIG_PARENT_QDELETING, .proc/react_to_console_del) + +/obj/machinery/dna_scannernew/proc/react_to_console_del(datum/source) + SIGNAL_HANDLER + set_linked_console(null) + //Just for transferring between genetics machines. /obj/item/disk/data diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index 60825b3e51f6..a07ec960ed63 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -43,7 +43,8 @@ update_indicator() /obj/machinery/launchpad/Destroy() - qdel(hud_list[DIAG_LAUNCHPAD_HUD]) + for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) + diag_hud.remove_from_hud(src) return ..() /obj/machinery/launchpad/examine(mob/user) @@ -257,9 +258,9 @@ /obj/machinery/launchpad/briefcase/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/launchpad_remote)) var/obj/item/launchpad_remote/L = I - if(L.pad == src) //do not attempt to link when already linked + if(L.pad == WEAKREF(src)) //do not attempt to link when already linked return ..() - L.pad = src + L.pad = WEAKREF(src) to_chat(user, "You link [src] to [L].") else return ..() @@ -296,9 +297,9 @@ /obj/item/storage/briefcase/launchpad/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/launchpad_remote)) var/obj/item/launchpad_remote/L = I - if(L.pad == src.pad) //do not attempt to link when already linked + if(L.pad == WEAKREF(src.pad)) //do not attempt to link when already linked return ..() - L.pad = src.pad + L.pad = WEAKREF(src.pad) to_chat(user, "You link [pad] to [L].") else return ..() @@ -310,11 +311,12 @@ icon_state = "folder" w_class = WEIGHT_CLASS_SMALL var/sending = TRUE - var/obj/machinery/launchpad/briefcase/pad + //A weakref to our linked pad + var/datum/weakref/pad /obj/item/launchpad_remote/Initialize(mapload, pad) //remote spawns linked to the briefcase pad . = ..() - src.pad = pad + src.pad = WEAKREF(pad) /obj/item/launchpad_remote/attack_self(mob/user) . = ..() @@ -334,16 +336,17 @@ /obj/item/launchpad_remote/ui_data(mob/user) var/list/data = list() - data["has_pad"] = pad ? TRUE : FALSE - if(pad) - data["pad_closed"] = pad.closed - if(!pad || pad.closed) + var/obj/machinery/launchpad/briefcase/our_pad = pad.resolve() + data["has_pad"] = our_pad ? TRUE : FALSE + if(our_pad) + data["pad_closed"] = our_pad.closed + if(!our_pad || our_pad.closed) return data - data["pad_name"] = pad.display_name - data["range"] = pad.range - data["x"] = pad.x_offset - data["y"] = pad.y_offset + data["pad_name"] = our_pad.display_name + data["range"] = our_pad.range + data["x"] = our_pad.x_offset + data["y"] = our_pad.y_offset return data /obj/item/launchpad_remote/proc/teleport(mob/user, obj/machinery/launchpad/pad) @@ -359,19 +362,22 @@ . = ..() if(.) return - + var/obj/machinery/launchpad/briefcase/our_pad = pad.resolve() + if(!our_pad) + pad = null + return TRUE switch(action) if("set_pos") var/new_x = text2num(params["x"]) var/new_y = text2num(params["y"]) - pad.set_offset(new_x, new_y) + our_pad.set_offset(new_x, new_y) . = TRUE if("move_pos") var/plus_x = text2num(params["x"]) var/plus_y = text2num(params["y"]) - pad.set_offset( - x = pad.x_offset + plus_x, - y = pad.y_offset + plus_y + our_pad.set_offset( + x = our_pad.x_offset + plus_x, + y = our_pad.y_offset + plus_y ) . = TRUE if("rename") @@ -379,16 +385,16 @@ var/new_name = params["name"] if(!new_name) return - pad.display_name = new_name + our_pad.display_name = new_name if("remove") . = TRUE - if(usr && alert(usr, "Are you sure?", "Unlink Launchpad", "I'm Sure", "Abort") != "Abort") - pad = null + if(usr && tgui_alert(usr, "Are you sure?", "Unlink Launchpad", list("I'm Sure", "Abort")) != "Abort") + our_pad = null if("launch") sending = TRUE - teleport(usr, pad) + teleport(usr, our_pad) . = TRUE if("pull") sending = FALSE - teleport(usr, pad) + teleport(usr, our_pad) . = TRUE diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 2db11c27731a..7974ddbfb36c 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -133,8 +133,8 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb ///A bitfield of bodytypes that the item cannot be worn by. var/restricted_bodytypes = null - ///Who threw the item - var/mob/thrownby = null + ///A weakref to the mob who threw the item + var/datum/weakref/thrownby = null //I cannot verbally describe how much I hate this var ///the icon to indicate this object is being dragged mouse_drag_pointer = MOUSE_ACTIVE_POINTER @@ -680,11 +680,10 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb /obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, gentle = FALSE, quickstart = TRUE) if(HAS_TRAIT(src, TRAIT_NODROP)) return - thrownby = thrower + thrownby = WEAKREF(thrower) callback = CALLBACK(src, .proc/after_throw, callback) //replace their callback with our own . = ..(target, range, speed, thrower, spin, diagonals_first, callback, force, gentle, quickstart = quickstart) - /obj/item/proc/after_throw(datum/callback/callback) if (callback) //call the original callback . = callback.Invoke() diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm index 28ff54d0f6d8..2eed89eb2e32 100644 --- a/code/game/objects/items/chrono_eraser.dm +++ b/code/game/objects/items/chrono_eraser.dm @@ -134,6 +134,10 @@ if(istype(C)) gun = C.gun +/obj/projectile/energy/chrono_beam/Destroy() + gun = null + return ..() + /obj/projectile/energy/chrono_beam/on_hit(atom/target) if(target && gun && isliving(target)) var/obj/structure/chrono_field/F = new(target.loc, target, gun) @@ -152,7 +156,9 @@ gun = loc . = ..() - +/obj/item/ammo_casing/energy/chrono_beam/Destroy() + gun = null + return ..() diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 8a3550962b39..5d8d9d290271 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -15,6 +15,10 @@ var/valve_open = FALSE var/toggle = TRUE +/obj/item/transfer_valve/Destroy() + attached_device = null + return ..() + /obj/item/transfer_valve/IsAssemblyHolder() return TRUE diff --git a/code/game/objects/items/dice.dm b/code/game/objects/items/dice.dm index 6e775d95c30c..2a6764242b59 100644 --- a/code/game/objects/items/dice.dm +++ b/code/game/objects/items/dice.dm @@ -183,8 +183,10 @@ diceroll(user) /obj/item/dice/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) - diceroll(thrownby) - . = ..() + var/mob/thrown_by = thrownby?.resolve() + if(thrown_by) + diceroll(thrown_by) + return ..() /obj/item/dice/proc/diceroll(mob/user) result = roll(sides) diff --git a/code/game/objects/items/implants/implant_track.dm b/code/game/objects/items/implants/implant_track.dm index d0455905eb9b..4370bf908b21 100644 --- a/code/game/objects/items/implants/implant_track.dm +++ b/code/game/objects/items/implants/implant_track.dm @@ -2,8 +2,12 @@ name = "tracking implant" desc = "Track with this." activated = FALSE - var/lifespan_postmortem = 6000 //for how many deciseconds after user death will the implant work? - var/allow_teleport = TRUE //will people implanted with this act as teleporter beacons? + ///for how many deciseconds after user death will the implant work? + var/lifespan_postmortem = 6000 + ///will people implanted with this act as teleporter beacons? + var/allow_teleport = TRUE + ///The id of the timer that's qdeleting us + var/timerid /obj/item/implant/tracking/c38 name = "TRAC implant" @@ -13,7 +17,11 @@ /obj/item/implant/tracking/c38/Initialize() . = ..() - QDEL_IN(src, lifespan) + timerid = QDEL_IN(src, lifespan) + +/obj/item/implant/tracking/c38/Destroy() + deltimer(timerid) + return ..() /obj/item/implant/tracking/New() ..() diff --git a/code/game/objects/items/melee/energy.dm b/code/game/objects/items/melee/energy.dm index b1ffb655f257..ab2519aeeef5 100644 --- a/code/game/objects/items/melee/energy.dm +++ b/code/game/objects/items/melee/energy.dm @@ -249,6 +249,10 @@ spark_system.set_up(5, 0, src) spark_system.attach(src) +/obj/item/melee/transforming/energy/blade/Destroy() + QDEL_NULL(spark_system) + return ..() + /obj/item/melee/transforming/energy/blade/transform_weapon(mob/living/user, supress_message_text) return diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index f247aabb0031..2b1ebe02e6bf 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -306,7 +306,7 @@ if(!iscarbon(user)) target.LAssailant = null else - target.LAssailant = user + target.LAssailant = WEAKREF(user) cooldown_check = world.time + cooldown else var/wait_desc = get_wait_description() diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 92d5103d48b9..7f7cb9d1c9da 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -329,8 +329,9 @@ var/caught = hit_atom.hitby(src, FALSE, FALSE, throwingdatum=throwingdatum) if(ishuman(hit_atom) && !caught && prob(throw_stun_chance))//if they are a carbon and they didn't catch it baton_effect(hit_atom) - if(thrownby && !caught) - addtimer(CALLBACK(src, /atom/movable.proc/throw_at, thrownby, throw_range+2, throw_speed, null, TRUE), 1) + var/mob/thrown_by = thrownby?.resolve() + if(thrown_by && !caught) + addtimer(CALLBACK(src, /atom/movable.proc/throw_at, thrown_by, throw_range+2, throw_speed, null, TRUE), 1) else return ..() diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 368026e4146f..1a2b80ee78fc 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -378,8 +378,6 @@ var/sale_price = 20 ///The Account which will receive payment for purchases. Set by the first ID to swipe the tray. var/datum/bank_account/payments_acc = null - ///We're using the same trick as paper does in order to cache the image, and only load the UI when messed with. - var/list/viewing_ui = list() /obj/structure/displaycase/forsale/update_icon() //remind me to fix my shitcode later var/icon/I @@ -403,7 +401,6 @@ if(!ui) ui = new(user, src, "Vendatray", name) ui.set_autoupdate(FALSE) - viewing_ui[user] = ui ui.open() /obj/structure/displaycase/forsale/ui_data(mob/user) diff --git a/code/game/objects/structures/ghost_role_spawners.dm b/code/game/objects/structures/ghost_role_spawners.dm index 2c24fbb3900a..4bdbc29290dd 100644 --- a/code/game/objects/structures/ghost_role_spawners.dm +++ b/code/game/objects/structures/ghost_role_spawners.dm @@ -68,7 +68,7 @@ yolk.equipOutfit(/datum/outfit/ashwalker)//this is an authentic mess we're making yolk.update_body() yolk.gib() - qdel(egg) + QDEL_NULL(egg) return ..() @@ -92,6 +92,11 @@ var/datum/team/ashwalkers/team var/obj/structure/ash_walker_eggshell/eggshell + +/obj/effect/mob_spawn/human/ash_walker/Destroy() + eggshell = null + return ..() + /obj/effect/mob_spawn/human/ash_walker/allow_spawn(mob/user) if(!(user.key in team.players_spawned))//one per person unless you get a bonus spawn return TRUE @@ -111,7 +116,7 @@ ADD_TRAIT(H, TRAIT_PRIMITIVE, ROUNDSTART_TRAIT) team.players_spawned += (new_spawn.key) eggshell.egg = null - qdel(eggshell) + QDEL_NULL(eggshell) /obj/effect/mob_spawn/human/ash_walker/Initialize(mapload, datum/team/ashwalkers/ashteam) . = ..() diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index e1b01e43df9b..2e7e89ddd09f 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -614,10 +614,21 @@ var/mob/living/carbon/M = locate(/mob/living/carbon) in loc if(M) if(M.resting) - patient = M + set_patient(M) else - patient = null + set_patient(null) +/obj/structure/table/optable/proc/set_patient(new_patient) + if(patient) + UnregisterSignal(patient, COMSIG_PARENT_QDELETING) + patient = new_patient + if(patient) + RegisterSignal(patient, COMSIG_PARENT_QDELETING, .proc/patient_deleted) + +/obj/structure/table/optable/proc/patient_deleted(datum/source) + SIGNAL_HANDLER + set_patient(null) + /obj/structure/table/optable/proc/check_eligible_patient() get_patient() if(!patient) diff --git a/code/game/objects/structures/traps.dm b/code/game/objects/structures/traps.dm index 6e0d99ddec33..0006bd8e331c 100644 --- a/code/game/objects/structures/traps.dm +++ b/code/game/objects/structures/traps.dm @@ -114,6 +114,12 @@ time_between_triggers = 10 flare_message = "[src] snaps shut!" +/obj/structure/trap/stun/hunter/Destroy() + if(!QDELETED(stored_item)) + qdel(stored_item) + stored_item = null + return ..() + /obj/structure/trap/stun/hunter/on_entered(datum/source, atom/movable/AM) if(isliving(AM)) var/mob/living/L = AM @@ -167,7 +173,9 @@ forceMove(stored_trap)//moves item into trap /obj/item/bountytrap/Destroy() - qdel(stored_trap) + if(!QDELETED(stored_trap)) + qdel(stored_trap) + stored_trap = null QDEL_NULL(radio) QDEL_NULL(spark_system) . = ..() diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 36d3f0aaff11..9dfe0b43f544 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -1,18 +1,10 @@ #ifdef REFERENCE_TRACKING -/datum/verb/find_refs() - set category = "Debug" - set name = "Find References" - set src in world - - find_references(FALSE) - - /datum/proc/find_references(skip_alert) running_find_references = type if(usr?.client) if(usr.client.running_find_references) - testing("CANCELLED search for references to a [usr.client.running_find_references].") + log_reftracker("CANCELLED search for references to a [usr.client.running_find_references].") usr.client.running_find_references = null running_find_references = null //restart the garbage collector @@ -30,21 +22,29 @@ if(usr?.client) usr.client.running_find_references = type - testing("Beginning search for references to a [type].") + log_reftracker("Beginning search for references to a [type].") var/starting_time = world.time + //Time to search the whole game for our ref DoSearchVar(GLOB, "GLOB") //globals + log_reftracker("Finished searching globals") + for(var/datum/thing in world) //atoms (don't beleive its lies) DoSearchVar(thing, "World -> [thing.type]", search_time = starting_time) + log_reftracker("Finished searching atoms") for(var/datum/thing) //datums DoSearchVar(thing, "Datums -> [thing.type]", search_time = starting_time) + log_reftracker("Finished searching datums") + //Warning, attempting to search clients like this will cause crashes if done on live. Watch yourself for(var/client/thing) //clients DoSearchVar(thing, "Clients -> [thing.type]", search_time = starting_time) + log_reftracker("Finished searching clients") + + log_reftracker("Completed search for references to a [type].") - testing("Completed search for references to a [type].") if(usr?.client) usr.client.running_find_references = null running_find_references = null @@ -53,25 +53,6 @@ SSgarbage.can_fire = TRUE SSgarbage.next_fire = world.time + world.tick_lag - -/datum/verb/qdel_then_find_references() - set category = "Debug" - set name = "qdel() then Find References" - set src in world - - qdel(src, TRUE) //force a qdel - if(!running_find_references) - find_references(TRUE) - - -/datum/verb/qdel_then_if_fail_find_references() - set category = "Debug" - set name = "qdel() then Find References if GC failure" - set src in world - - qdel_and_find_ref_if_fail(src, TRUE) - - /datum/proc/DoSearchVar(potential_container, container_name, recursive_limit = 64, search_time = world.time) #ifndef FIND_REF_NO_CHECK_TICK CHECK_TICK @@ -86,9 +67,14 @@ return if(!recursive_limit) - testing("Recursion limit reached. [container_name]") + log_reftracker("Recursion limit reached. [container_name]") return + //Check each time you go down a layer. This makes it a bit slow, but it won't effect the rest of the game at all + #ifndef FIND_REF_NO_CHECK_TICK + CHECK_TICK + #endif + if(istype(potential_container, /datum)) var/datum/datum_container = potential_container if(datum_container.last_find_references == search_time) @@ -98,6 +84,9 @@ var/list/vars_list = datum_container.vars for(var/varname in vars_list) + #ifndef FIND_REF_NO_CHECK_TICK + CHECK_TICK + #endif if (varname == "vars" || varname == "vis_locs") //Fun fact, vis_locs don't count for references continue #ifndef FIND_REF_NO_CHECK_TICK @@ -109,44 +98,44 @@ #ifdef REFERENCE_TRACKING_DEBUG found_refs[varname] = TRUE #endif - testing("Found [type] \ref[src] in [datum_container.type]'s \ref[datum_container] [varname] var. [container_name]") + log_reftracker("Found [type] \ref[src] in [datum_container.type]'s \ref[datum_container] [varname] var. [container_name]") + continue - else if(islist(variable)) + if(islist(variable)) DoSearchVar(variable, "[container_name] \ref[datum_container] -> [varname] (list)", recursive_limit - 1, search_time) else if(islist(potential_container)) var/normal = IS_NORMAL_LIST(potential_container) - for(var/element_in_list in potential_container) + var/list/potential_cache = potential_container + for(var/element_in_list in potential_cache) #ifndef FIND_REF_NO_CHECK_TICK CHECK_TICK #endif //Check normal entrys if(element_in_list == src) #ifdef REFERENCE_TRACKING_DEBUG - found_refs[potential_container] = TRUE + found_refs[potential_cache] = TRUE #endif - testing("Found [type] \ref[src] in list [container_name].") + log_reftracker("Found [type] \ref[src] in list [container_name].") + continue + var/assoc_val = null + if(!isnum(element_in_list) && normal) + assoc_val = potential_cache[element_in_list] //Check assoc entrys - else if(!isnum(element_in_list) && normal && potential_container[element_in_list] == src) + if(assoc_val == src) #ifdef REFERENCE_TRACKING_DEBUG - found_refs[potential_container] = TRUE + found_refs[potential_cache] = TRUE #endif - testing("Found [type] \ref[src] in list [container_name]\[[element_in_list]\]") - + log_reftracker("Found [type] \ref[src] in list [container_name]\[[element_in_list]\]") + continue //We need to run both of these checks, since our object could be hiding in either of them - else - //Check normal sublists - if(islist(element_in_list)) - DoSearchVar(element_in_list, "[container_name] -> [element_in_list] (list)", recursive_limit - 1, search_time) - //Check assoc sublists - if(!isnum(element_in_list) && normal && islist(potential_container[element_in_list])) - DoSearchVar(potential_container[element_in_list], "[container_name]\[[element_in_list]\] -> [potential_container[element_in_list]] (list)", recursive_limit - 1, search_time) - - #ifndef FIND_REF_NO_CHECK_TICK - CHECK_TICK - #endif - + //Check normal sublists + if(islist(element_in_list)) + DoSearchVar(element_in_list, "[container_name] -> [element_in_list] (list)", recursive_limit - 1, search_time) + //Check assoc sublists + if(islist(assoc_val)) + DoSearchVar(potential_container[element_in_list], "[container_name]\[[element_in_list]\] -> [assoc_val] (list)", recursive_limit - 1, search_time) /proc/qdel_and_find_ref_if_fail(datum/thing_to_del, force = FALSE) thing_to_del.qdel_and_find_ref_if_fail(force) diff --git a/code/modules/antagonists/abductor/equipment/glands/slime.dm b/code/modules/antagonists/abductor/equipment/glands/slime.dm index 30a13107595e..e7fee444f2d2 100644 --- a/code/modules/antagonists/abductor/equipment/glands/slime.dm +++ b/code/modules/antagonists/abductor/equipment/glands/slime.dm @@ -22,5 +22,5 @@ owner.vomit(20) var/mob/living/simple_animal/slime/Slime = new(get_turf(owner), "grey") - Slime.Friends = list(owner) - Slime.Leader = owner + Slime.set_friends(list(owner)) + Slime.set_leader(owner) diff --git a/code/modules/antagonists/blob/blobstrains/_blobstrain.dm b/code/modules/antagonists/blob/blobstrains/_blobstrain.dm index f6c61109512e..78a86cf79a3f 100644 --- a/code/modules/antagonists/blob/blobstrains/_blobstrain.dm +++ b/code/modules/antagonists/blob/blobstrains/_blobstrain.dm @@ -22,6 +22,10 @@ GLOBAL_LIST_INIT(valid_blobstrains, subtypesof(/datum/blobstrain) - list(/datum/ stack_trace("blobstrain created without overmind") overmind = new_overmind +/datum/blobstrain/Destroy() + overmind = null + return ..() + /datum/blobstrain/proc/on_gain() overmind.color = complementary_color for(var/BL in GLOB.blobs) diff --git a/code/modules/antagonists/blob/overmind.dm b/code/modules/antagonists/blob/overmind.dm index 25857459d556..e1e1127f2311 100644 --- a/code/modules/antagonists/blob/overmind.dm +++ b/code/modules/antagonists/blob/overmind.dm @@ -174,6 +174,7 @@ GLOBAL_LIST_EMPTY(blob_nodes) SSticker.force_ending = 1 /mob/camera/blob/Destroy() + QDEL_NULL(blobstrain) for(var/BL in GLOB.blobs) var/obj/structure/blob/B = BL if(B && B.overmind == src) diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index 8a8736d32c5a..ac506ff1eeb5 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -135,6 +135,11 @@ /obj/item/cult_bastard/proc/nemesis_effects(mob/living/user, mob/living/target) return +/obj/item/cult_bastard/Destroy() + QDEL_NULL(jaunt) + QDEL_NULL(linked_action) + return ..() + /obj/item/cult_bastard/examine(mob/user) . = ..() . += "This weapon will absorb the souls of unconscious human foes." @@ -216,7 +221,7 @@ phaseout = /obj/effect/temp_visual/dir_setting/cult/phase/out /datum/action/innate/dash/cult/IsAvailable() - if(current_charges) + if(iscultist(owner) && current_charges) return TRUE else return FALSE diff --git a/code/modules/antagonists/disease/disease_disease.dm b/code/modules/antagonists/disease/disease_disease.dm index 482beaba6be6..479e8345b533 100644 --- a/code/modules/antagonists/disease/disease_disease.dm +++ b/code/modules/antagonists/disease/disease_disease.dm @@ -12,6 +12,7 @@ /datum/disease/advance/sentient_disease/Destroy() . = ..() + overmind = null GLOB.sentient_disease_instances -= src /datum/disease/advance/sentient_disease/remove_disease() diff --git a/code/modules/antagonists/disease/disease_mob.dm b/code/modules/antagonists/disease/disease_mob.dm index 8f1ea1c2b04e..55f869b3a71a 100644 --- a/code/modules/antagonists/disease/disease_mob.dm +++ b/code/modules/antagonists/disease/disease_mob.dm @@ -72,10 +72,12 @@ the new instance inside the host to be updated to the template's stats. /mob/camera/disease/Destroy() . = ..() QDEL_NULL(adaptation_menu_action) + disease_template = null for(var/V in GLOB.sentient_disease_instances) var/datum/disease/advance/sentient_disease/S = V if(S.overmind == src) S.overmind = null + browser = null /mob/camera/disease/Login() . = ..() diff --git a/code/modules/antagonists/slaughter/slaughter.dm b/code/modules/antagonists/slaughter/slaughter.dm index 3751279f095e..b12050c263b7 100644 --- a/code/modules/antagonists/slaughter/slaughter.dm +++ b/code/modules/antagonists/slaughter/slaughter.dm @@ -49,7 +49,7 @@ del_on_death = 1 deathmessage = "screams in anger as it collapses into a puddle of viscera!" -/mob/living/simple_animal/slaughter/Initialize() +/mob/living/simple_animal/slaughter/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_BLOODCRAWL_EAT, "innate") var/obj/effect/proc_holder/spell/bloodcrawl/bloodspell = new diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index b040be6b05d9..49497bdfed7e 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -38,6 +38,10 @@ /obj/item/assembly/proc/on_entered(datum/source, atom/movable/AM) SIGNAL_HANDLER +/obj/item/assembly/Destroy() + holder = null + return ..() + /obj/item/assembly/get_part_rating() return 1 diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm index 3b61fbdd3317..3b094886cf49 100644 --- a/code/modules/assembly/flash.dm +++ b/code/modules/assembly/flash.dm @@ -236,19 +236,22 @@ desc = "A high-powered photon projector implant normally used for lighting purposes, but also doubles as a flashbulb weapon. Self-repair protocols fix the flashbulb if it ever burns out." var/flashcd = 20 var/overheat = 0 - var/obj/item/organ/cyberimp/arm/flash/I = null + //Wearef to our arm + var/datum/weakref/arm /obj/item/assembly/flash/armimplant/burn_out() - if(I && I.owner) - to_chat(I.owner, "Your photon projector implant overheats and deactivates!") - I.Retract() + var/obj/item/organ/cyberimp/arm/flash/real_arm = arm.resolve() + if(real_arm?.owner) + to_chat(real_arm.owner, "Your photon projector implant overheats and deactivates!") + real_arm.Retract() overheat = TRUE addtimer(CALLBACK(src, .proc/cooldown), flashcd * 2) /obj/item/assembly/flash/armimplant/try_use_flash(mob/user = null) if(overheat) - if(I && I.owner) - to_chat(I.owner, "Your photon projector is running too hot to be used again so quickly!") + var/obj/item/organ/cyberimp/arm/flash/real_arm = arm.resolve() + if(real_arm?.owner) + to_chat(real_arm.owner, "Your photon projector is running too hot to be used again so quickly!") return FALSE overheat = TRUE addtimer(CALLBACK(src, .proc/cooldown), flashcd) diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 4c6d0ecf498f..1e11cf479f9b 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -22,9 +22,9 @@ SSair.start_processing_machine(src) /obj/machinery/portable_atmospherics/Destroy() - SSair.stop_processing_machine(src) disconnect() - air_contents = null + QDEL_NULL(air_contents) + SSair.stop_processing_machine(src) return ..() diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 90502110c9c6..f8aa89357729 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -39,6 +39,8 @@ . = ..() if(!reset) reset = new reset_path(get_turf(src)) + reset.flag = src + RegisterSignal(src, COMSIG_PARENT_PREQDELETED, .proc/reset_flag) //just in case CTF has some map hazards (read: chasms). /obj/item/ctf/ComponentInitialize() . = ..() @@ -55,8 +57,24 @@ to_chat(M, "\The [src] has been returned to base!") STOP_PROCESSING(SSobj, src) -//ATTACK HAND IGNORING PARENT RETURN VALUE -/obj/item/ctf/attack_hand(mob/living/user) +/obj/item/ctf/proc/reset_flag(capture = FALSE) + SIGNAL_HANDLER + + var/turf/our_turf = get_turf(src.reset) + if(!our_turf) + return TRUE + forceMove(our_turf) + for(var/mob/M in GLOB.player_list) + var/area/mob_area = get_area(M) + if(istype(mob_area, /area/ctf)) + if(!capture) + to_chat(M, "[src] has been returned to the base!") + STOP_PROCESSING(SSobj, src) + return TRUE //so if called by a signal, it doesn't delete + +//working with attack hand feels like taking my brain and putting it through an industrial pill press so i'm gonna be a bit liberal with the comments +/obj/item/ctf/attack_hand(mob/living/user, list/modifiers) + //pre normal check item stuff, this is for our special flag checks if(!is_ctf_target(user) && !anyonecanpickup) to_chat(user, "Non-players shouldn't be moving the flag!") return @@ -116,6 +134,13 @@ icon_state = "banner" desc = "This is where a banner with Nanotrasen's logo on it would go." layer = LOW_ITEM_LAYER + var/obj/item/ctf/flag + +/obj/effect/ctf/flag_reset/Destroy() + if(flag) + flag.reset = null + flag = null + return ..() /obj/effect/ctf/flag_reset/red name = "red flag landmark" @@ -653,6 +678,11 @@ for(var/obj/machinery/capture_the_flag/CTF in GLOB.machines) CTF.dead_barricades += src +/obj/effect/ctf/dead_barricade/Destroy() + for(var/obj/machinery/capture_the_flag/CTF in GLOB.machines) + CTF.dead_barricades -= src + return ..() + /obj/effect/ctf/dead_barricade/proc/respawn() if(!QDELETED(src)) new /obj/structure/barricade/security/ctf(get_turf(src)) diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index 4de1b424f113..b1fec75a6df6 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -181,6 +181,12 @@ GLOBAL_LIST_EMPTY(gateway_destinations) vis_contents += portal_visuals return ..() +/obj/machinery/gateway/Destroy() + destination.target_gateway = null + GLOB.gateway_destinations -= destination + destination = null + return ..() + /obj/machinery/gateway/proc/generate_destination() destination = new destination_type destination.name = destination_name diff --git a/code/modules/client/verbs/suicide.dm b/code/modules/client/verbs/suicide.dm index a43a7ba16cb3..4e1a45d0a45f 100644 --- a/code/modules/client/verbs/suicide.dm +++ b/code/modules/client/verbs/suicide.dm @@ -3,9 +3,9 @@ /mob/proc/set_suicide(suicide_state) suiciding = suicide_state if(suicide_state) - GLOB.suicided_mob_list += src + add_to_mob_suicide_list() else - GLOB.suicided_mob_list -= src + remove_from_mob_suicide_list() /mob/living/carbon/set_suicide(suicide_state) //you thought that box trick was pretty clever, didn't you? well now hardmode is on, boyo. . = ..() diff --git a/code/modules/clothing/head/misc.dm b/code/modules/clothing/head/misc.dm index 2600ca1c5209..07b16d1553e1 100644 --- a/code/modules/clothing/head/misc.dm +++ b/code/modules/clothing/head/misc.dm @@ -147,7 +147,7 @@ if(!ishuman(user)) return var/mob/living/carbon/human/H = user - if(H.get_item_by_slot(ITEM_SLOT_HEAD) == src) + if(H.get_item_by_slot(ITEM_SLOT_HEAD) == src && !QDELETED(src)) //This can be called as a part of destroy user.remove_language(/datum/language/piratespeak/, TRUE, TRUE, LANGUAGE_HAT) to_chat(user, "You can no longer speak like a pirate.") diff --git a/code/modules/clothing/spacesuits/chronosuit.dm b/code/modules/clothing/spacesuits/chronosuit.dm index c59f5b3aeeed..9c1bf3acdc0c 100644 --- a/code/modules/clothing/spacesuits/chronosuit.dm +++ b/code/modules/clothing/spacesuits/chronosuit.dm @@ -65,6 +65,7 @@ /obj/item/clothing/suit/space/chronos/Destroy() dropped() + QDEL_NULL(teleport_now) return ..() /obj/item/clothing/suit/space/chronos/emp_act(severity) @@ -332,6 +333,10 @@ check_flags = AB_CHECK_CONSCIOUS //|AB_CHECK_INSIDE var/obj/item/clothing/suit/space/chronos/chronosuit = null +/datum/action/innate/chrono_teleport/Destroy() + chronosuit = null + return ..() + /datum/action/innate/chrono_teleport/IsAvailable() return (chronosuit && chronosuit.activated && chronosuit.camera && !chronosuit.teleporting) diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index e6ff7a1a15b5..bde5ba13e3eb 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -31,6 +31,10 @@ /obj/item/clothing/head/helmet/space/hardsuit/Destroy() . = ..() + if(!QDELETED(suit)) + qdel(suit) + suit = null + QDEL_NULL(soundloop) STOP_PROCESSING(SSobj, src) /obj/item/clothing/head/helmet/space/hardsuit/attack_self(mob/user) @@ -111,7 +115,6 @@ greyscale_colors = list(list(11, 19), list(22, 12), list(16, 9)) greyscale_icon_state = "hardsuit" - /obj/item/clothing/suit/space/hardsuit/Initialize() if(jetpack && ispath(jetpack)) jetpack = new jetpack(src) @@ -906,6 +909,7 @@ slowdown = 0 shield_state = "shield-red" shield_on = "shield-red" + jetpack = /obj/item/tank/jetpack/suit /obj/item/clothing/suit/space/hardsuit/shielded/syndi/multitool_act(mob/living/user, obj/item/I) . = ..() @@ -924,10 +928,6 @@ to_chat(user, "You update the hardsuit's hardware, changing back the shield's color to red.") user.update_inv_wear_suit() -/obj/item/clothing/suit/space/hardsuit/shielded/syndi/Initialize() - jetpack = new /obj/item/tank/jetpack/suit(src) - . = ..() - /obj/item/clothing/head/helmet/space/hardsuit/shielded/syndi name = "blood-red hardsuit helmet" desc = "An advanced hardsuit helmet with built in energy shielding." diff --git a/code/modules/clothing/suits/toggles.dm b/code/modules/clothing/suits/toggles.dm index 9379f52314df..4255335cda74 100644 --- a/code/modules/clothing/suits/toggles.dm +++ b/code/modules/clothing/suits/toggles.dm @@ -137,10 +137,11 @@ . = ..() /obj/item/clothing/suit/space/hardsuit/Destroy() - if(helmet) + if(!QDELETED(helmet)) helmet.suit = null qdel(helmet) - qdel(jetpack) + helmet = null + QDEL_NULL(jetpack) return ..() /obj/item/clothing/head/helmet/space/hardsuit/Destroy() diff --git a/code/modules/clothing/under/accessories.dm b/code/modules/clothing/under/accessories.dm index ea58a2ae65ff..e3e8be62bab7 100644 --- a/code/modules/clothing/under/accessories.dm +++ b/code/modules/clothing/under/accessories.dm @@ -11,6 +11,10 @@ var/datum/component/storage/detached_pockets var/attachment_slot = CHEST +/obj/item/clothing/accessory/Destroy() + set_detached_pockets(null) + return ..() + /obj/item/clothing/accessory/proc/can_attach_accessory(obj/item/clothing/U, mob/user) if(!attachment_slot || (U && U.body_parts_covered & attachment_slot)) return TRUE @@ -23,7 +27,7 @@ if(SEND_SIGNAL(U, COMSIG_CONTAINS_STORAGE)) return FALSE U.TakeComponent(storage) - detached_pockets = storage + set_detached_pockets(storage) U.attached_accessory = src forceMove(U) layer = FLOAT_LAYER @@ -66,6 +70,17 @@ U.attached_accessory = null U.accessory_overlay = null +/obj/item/clothing/accessory/proc/set_detached_pockets(new_pocket) + if(detached_pockets) + UnregisterSignal(detached_pockets, COMSIG_PARENT_QDELETING) + detached_pockets = new_pocket + if(detached_pockets) + RegisterSignal(detached_pockets, COMSIG_PARENT_QDELETING, .proc/handle_pockets_del) + +/obj/item/clothing/accessory/proc/handle_pockets_del(datum/source) + SIGNAL_HANDLER + set_detached_pockets(null) + /obj/item/clothing/accessory/proc/on_uniform_equip(obj/item/clothing/under/U, user) return diff --git a/code/modules/events/wizard/greentext.dm b/code/modules/events/wizard/greentext.dm index e54096b6617c..5232f81bb696 100644 --- a/code/modules/events/wizard/greentext.dm +++ b/code/modules/events/wizard/greentext.dm @@ -83,8 +83,9 @@ if(!(resistance_flags & ON_FIRE) && !force) return QDEL_HINT_LETMELIVE - SSticker.round_end_events -= roundend_callback GLOB.poi_list.Remove(src) + LAZYREMOVE(SSticker.round_end_events, roundend_callback) + roundend_callback = null //This ought to free the callback datum, and prevent us from harddeling for(var/i in GLOB.player_list) var/mob/M = i var/message = "A dark temptation has passed from this world" diff --git a/code/modules/fields/timestop.dm b/code/modules/fields/timestop.dm index 9bb39ff267ea..d720868b07ec 100644 --- a/code/modules/fields/timestop.dm +++ b/code/modules/fields/timestop.dm @@ -36,7 +36,7 @@ INVOKE_ASYNC(src, .proc/timestop) /obj/effect/timestop/Destroy() - qdel(chronofield) + QDEL_NULL(chronofield) playsound(src, 'sound/magic/timeparadox2.ogg', 75, TRUE, frequency = -1) //reverse! return ..() diff --git a/code/modules/holodeck/holo_effect.dm b/code/modules/holodeck/holo_effect.dm index 3f164952fbb4..9c69b8e89812 100644 --- a/code/modules/holodeck/holo_effect.dm +++ b/code/modules/holodeck/holo_effect.dm @@ -28,31 +28,36 @@ /obj/effect/holodeck_effect/cards icon = 'icons/obj/toy.dmi' icon_state = "deck_nanotrasen_full" - var/obj/item/toy/cards/deck/D + var/obj/item/toy/cards/deck/deck /obj/effect/holodeck_effect/cards/activate(obj/machinery/computer/holodeck/HC) - D = new(loc) + deck = new(loc) safety(!(HC.obj_flags & EMAGGED)) - D.holo = HC - return D + deck.holo = HC + RegisterSignal(deck, COMSIG_PARENT_QDELETING, .proc/handle_card_delete) + return deck + +/obj/effect/holodeck_effect/cards/proc/handle_card_delete(datum/source) + SIGNAL_HANDLER + deck = null /obj/effect/holodeck_effect/cards/safety(active) - if(!D) + if(!deck) return if(active) - D.card_hitsound = null - D.card_force = 0 - D.card_throwforce = 0 - D.card_throw_speed = 3 - D.card_throw_range = 7 - D.card_attack_verb = list("attacked") + deck.card_hitsound = null + deck.card_force = 0 + deck.card_throwforce = 0 + deck.card_throw_speed = 3 + deck.card_throw_range = 7 + deck.card_attack_verb = list("attacked") else - D.card_hitsound = 'sound/weapons/bladeslice.ogg' - D.card_force = 5 - D.card_throwforce = 10 - D.card_throw_speed = 3 - D.card_throw_range = 7 - D.card_attack_verb = list("attacked", "sliced", "diced", "slashed", "cut") + deck.card_hitsound = 'sound/weapons/bladeslice.ogg' + deck.card_force = 5 + deck.card_throwforce = 10 + deck.card_throw_speed = 3 + deck.card_throw_range = 7 + deck.card_attack_verb = list("attacked", "sliced", "diced", "slashed", "cut") /obj/effect/holodeck_effect/sparks/activate(obj/machinery/computer/holodeck/HC) @@ -68,24 +73,29 @@ /obj/effect/holodeck_effect/mobspawner var/mobtype = /mob/living/simple_animal/hostile/carp/holocarp - var/mob/mob = null + var/mob/our_mob = null /obj/effect/holodeck_effect/mobspawner/activate(obj/machinery/computer/holodeck/HC) if(islist(mobtype)) mobtype = pick(mobtype) - mob = new mobtype(loc) - mob.flags_1 |= HOLOGRAM_1 + our_mob = new mobtype(loc) + our_mob.flags_1 |= HOLOGRAM_1 // these vars are not really standardized but all would theoretically create stuff on death - for(var/v in list("butcher_results","corpse","weapon1","weapon2","blood_volume") & mob.vars) - mob.vars[v] = null - return mob + for(var/v in list("butcher_results","corpse","weapon1","weapon2","blood_volume") & our_mob.vars) + our_mob.vars[v] = null + RegisterSignal(our_mob, COMSIG_PARENT_QDELETING, .proc/handle_mob_delete) + return our_mob /obj/effect/holodeck_effect/mobspawner/deactivate(obj/machinery/computer/holodeck/HC) - if(mob) - HC.derez(mob) + if(our_mob) + HC.derez(our_mob) qdel(src) +/obj/effect/holodeck_effect/mobspawner/proc/handle_mob_delete(datum/source) + SIGNAL_HANDLER + our_mob = null + /obj/effect/holodeck_effect/mobspawner/pet mobtype = list( /mob/living/simple_animal/butterfly, /mob/living/simple_animal/chick/holo, diff --git a/code/modules/language/language_holder.dm b/code/modules/language/language_holder.dm index 9a32cacb53e5..1f42ec424706 100644 --- a/code/modules/language/language_holder.dm +++ b/code/modules/language/language_holder.dm @@ -53,7 +53,9 @@ Key procs var/atom/owner /// Initializes, and copies in the languages from the current atom if available. -/datum/language_holder/New(_owner) +/datum/language_holder/New(atom/_owner) + if(_owner && QDELETED(_owner)) + CRASH("Langauge holder added to a qdeleting thing, what the fuck \ref[_owner]") owner = _owner if(istype(owner, /datum/mind)) var/datum/mind/M = owner diff --git a/code/modules/lighting/lighting_source.dm b/code/modules/lighting/lighting_source.dm index a83591fe97ab..9aeed0602f24 100644 --- a/code/modules/lighting/lighting_source.dm +++ b/code/modules/lighting/lighting_source.dm @@ -61,7 +61,8 @@ source_atom = null source_turf = null pixel_turf = null - . = ..() + + return ..() // Yes this doesn't align correctly on anything other than 4 width tabs. // If you want it to go switch everybody to elastic tab stops. diff --git a/code/modules/mining/laborcamp/laborstacker.dm b/code/modules/mining/laborcamp/laborstacker.dm index bad8c876d39d..dc42690d1b68 100644 --- a/code/modules/mining/laborcamp/laborstacker.dm +++ b/code/modules/mining/laborcamp/laborstacker.dm @@ -17,9 +17,12 @@ GLOBAL_LIST(labor_sheet_values) /obj/machinery/mineral/labor_claim_console/Initialize() . = ..() - Radio = new/obj/item/radio(src) + Radio = new /obj/item/radio(src) Radio.listening = FALSE locate_stacking_machine() + //If we can't find a stacking machine end it all ok? + if(!stacking_machine) + return INITIALIZE_HINT_QDEL if(!GLOB.labor_sheet_values) var/sheet_list = list() @@ -30,6 +33,13 @@ GLOBAL_LIST(labor_sheet_values) sheet_list += list(list("ore" = initial(sheet.name), "value" = initial(sheet.point_value))) GLOB.labor_sheet_values = sortList(sheet_list, /proc/cmp_sheet_list) +/obj/machinery/mineral/labor_claim_console/Destroy() + QDEL_NULL(Radio) + if(stacking_machine) + stacking_machine.console = null + stacking_machine = null + return ..() + /proc/cmp_sheet_list(list/a, list/b) return a["value"] - b["value"] @@ -88,9 +98,7 @@ GLOBAL_LIST(labor_sheet_values) /obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine() stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir)) if(stacking_machine) - stacking_machine.CONSOLE = src - else - qdel(src) + stacking_machine.console = src /obj/machinery/mineral/labor_claim_console/emag_act(mob/user) if(!(obj_flags & EMAGGED)) diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index e52ad2516220..198d02ab4628 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -419,6 +419,12 @@ var/obj/item/warp_cube/linked var/teleporting = FALSE +/obj/item/warp_cube/Destroy() + if(!QDELETED(linked)) + qdel(linked) + linked = null + return ..() + /obj/item/warp_cube/attack_self(mob/user) var/turf/current_location = get_turf(user) var/area/current_area = current_location.loc diff --git a/code/modules/mining/machine_stacking.dm b/code/modules/mining/machine_stacking.dm index 68c9666aa9eb..f7d9e19cf9c2 100644 --- a/code/modules/mining/machine_stacking.dm +++ b/code/modules/mining/machine_stacking.dm @@ -16,7 +16,13 @@ . = ..() machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir)) if (machine) - machine.CONSOLE = src + machine.console = src + +/obj/machinery/mineral/stacking_unit_console/Destroy() + if(machine) + machine.console = null + machine = null + return ..() /obj/machinery/mineral/stacking_unit_console/multitool_act(mob/living/user, obj/item/I) if(!multitool_check_buffer(user, I)) @@ -78,7 +84,7 @@ circuit = /obj/item/circuitboard/machine/stacking_machine input_dir = EAST output_dir = WEST - var/obj/machinery/mineral/stacking_unit_console/CONSOLE + var/obj/machinery/mineral/stacking_unit_console/console var/stk_types = list() var/stk_amt = list() var/stack_list[0] //Key: Type. Value: Instance of type. @@ -92,7 +98,9 @@ materials = AddComponent(/datum/component/remote_materials, "stacking", mapload, FALSE, mapload && force_connect) /obj/machinery/mineral/stacking_machine/Destroy() - CONSOLE = null + if(console) + console.machine = null + console = null materials = null return ..() @@ -103,8 +111,8 @@ /obj/machinery/mineral/stacking_machine/multitool_act(mob/living/user, obj/item/multitool/M) if(istype(M)) if(istype(M.buffer, /obj/machinery/mineral/stacking_unit_console)) - CONSOLE = M.buffer - CONSOLE.machine = src + console = M.buffer + console.machine = src to_chat(user, "You link [src] to the console in [M]'s buffer.") return TRUE diff --git a/code/modules/mob/dead/new_player/login.dm b/code/modules/mob/dead/new_player/login.dm index 373950e296dc..5c47ccd6d526 100644 --- a/code/modules/mob/dead/new_player/login.dm +++ b/code/modules/mob/dead/new_player/login.dm @@ -6,8 +6,8 @@ client.set_db_player_flags() if(!mind) mind = new /datum/mind(key) - mind.active = 1 - mind.current = src + mind.active = TRUE + mind.set_current(src) . = ..() if(!. || !client) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index fc23e4b79200..90a613c37ee7 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -417,8 +417,10 @@ if(mind) if(transfer_after) mind.late_joiner = TRUE - mind.active = 0 //we wish to transfer the key manually - mind.transfer_to(H) //won't transfer key since the mind is not active + mind.active = FALSE //we wish to transfer the key manually + mind.original_character_slot_index = client.prefs.default_slot + mind.transfer_to(H) //won't transfer key since the mind is not active + mind.set_original_character(H) H.name = real_name client.init_verbs() diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index d9f05cfc1c42..981ec9c96360 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -179,7 +179,6 @@ if(blood_id == /datum/reagent/blood) //actual blood reagent var/blood_data = list() //set the blood data - blood_data["donor"] = src blood_data["viruses"] = list() for(var/thing in diseases) diff --git a/code/modules/mob/living/brain/brain.dm b/code/modules/mob/living/brain/brain.dm index b87ebfc0a97d..80daa8de3e3c 100644 --- a/code/modules/mob/living/brain/brain.dm +++ b/code/modules/mob/living/brain/brain.dm @@ -28,13 +28,14 @@ stored_dna.species = new rando_race() /mob/living/brain/Destroy() - if(key) //If there is a mob connected to this thing. Have to check key twice to avoid false death reporting. - if(stat!=DEAD) //If not dead. - death(1) //Brains can die again. AND THEY SHOULD AHA HA HA HA HA HA - if(mind) //You aren't allowed to return to brains that don't exist - mind.current = null - ghostize() //Ghostize checks for key so nothing else is necessary. + if(key) //If there is a mob connected to this thing. Have to check key twice to avoid false death reporting. + if(stat!=DEAD) //If not dead. + death(1) //Brains can die again. AND THEY SHOULD AHA HA HA HA HA HA + if(mind) //You aren't allowed to return to brains that don't exist + mind.set_current(null) + ghostize() //Ghostize checks for key so nothing else is necessary. container = null + QDEL_NULL(stored_dna) return ..() /mob/living/brain/ex_act() //you cant blow up brainmobs because it makes transfer_to() freak out when borgs blow up. diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm index a7f990006bb9..12da55acff2c 100644 --- a/code/modules/mob/living/brain/brain_item.dm +++ b/code/modules/mob/living/brain/brain_item.dm @@ -189,6 +189,9 @@ if(brainmob) QDEL_NULL(brainmob) QDEL_LIST(traumas) + + if(owner?.mind) //You aren't allowed to return to brains that don't exist + owner.mind.set_current(null) return ..() /obj/item/organ/brain/on_life() diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 067476afbbaf..bb0f42be4dc5 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -40,6 +40,7 @@ /mob/living/carbon/human/Destroy() QDEL_NULL(physiology) + QDEL_LIST(bioware) GLOB.human_list -= src return ..() diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 999161bd72dd..57e7df756544 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -141,7 +141,7 @@ if(istype(AM, /obj/item)) I = AM throwpower = I.throwforce - if(I.thrownby == src) //No throwing stuff at yourself to trigger hit reactions + if(I.thrownby == WEAKREF(src)) //No throwing stuff at yourself to trigger hit reactions return ..() if(check_shields(AM, throwpower, "\the [AM.name]", THROWN_PROJECTILE_ATTACK)) hitpush = FALSE diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index 191567454742..76be509875d2 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -445,7 +445,7 @@ var/obj/item/I if(istype(AM, /obj/item)) I = AM - if(I.thrownby == H) //No throwing stuff at yourself to trigger the teleport + if(I.thrownby == WEAKREF(H)) //No throwing stuff at yourself to trigger the teleport return 0 else reactive_teleport(H) @@ -577,7 +577,7 @@ var/obj/item/I if(istype(AM, /obj/item)) I = AM - if(I.thrownby == H) //No throwing stuff at yourself to make bananas + if(I.thrownby == WEAKREF(H)) //No throwing stuff at yourself to make bananas return 0 else new/obj/item/grown/bananapeel/specialpeel(get_turf(H)) diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index 084113dd1b7f..d07c808a0663 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -525,18 +525,25 @@ examine_limb_id = SPECIES_JELLYPERSON +//Species datums don't normally implement destroy, but JELLIES SUCK ASS OUT OF A STEEL STRAW +/datum/species/jelly/luminescent/Destroy(force, ...) + current_extract = null + QDEL_NULL(glow) + QDEL_NULL(integrate_extract) + QDEL_NULL(extract_major) + QDEL_NULL(extract_minor) + return ..() + + /datum/species/jelly/luminescent/on_species_loss(mob/living/carbon/C) ..() if(current_extract) current_extract.forceMove(C.drop_location()) current_extract = null - qdel(glow) - if(integrate_extract) - integrate_extract.Remove(C) - if(extract_minor) - extract_minor.Remove(C) - if(extract_major) - extract_major.Remove(C) + QDEL_NULL(glow) + QDEL_NULL(integrate_extract) + QDEL_NULL(extract_major) + QDEL_NULL(extract_minor) /datum/species/jelly/luminescent/on_species_gain(mob/living/carbon/C, datum/species/old_species) ..() @@ -582,13 +589,9 @@ button_icon_state = "slimeconsume" icon_icon = 'icons/mob/actions/actions_slime.dmi' background_icon_state = "bg_alien" - var/datum/species/jelly/luminescent/species - -/datum/action/innate/integrate_extract/New(_species) - ..() - species = _species /datum/action/innate/integrate_extract/proc/update_name() + var/datum/species/jelly/luminescent/species = target if(!species || !species.current_extract) name = "Integrate Extract" desc = "Eat a slime extract to use its properties." @@ -597,6 +600,7 @@ desc = "Eject your current slime extract." /datum/action/innate/integrate_extract/UpdateButtonIcon(status_only, force) + var/datum/species/jelly/luminescent/species = target if(!species || !species.current_extract) button_icon_state = "slimeconsume" else @@ -605,11 +609,13 @@ /datum/action/innate/integrate_extract/ApplyIcon(atom/movable/screen/movable/action_button/current_button, force) ..(current_button, TRUE) - if(species && species.current_extract) + var/datum/species/jelly/luminescent/species = target + if(species?.current_extract) current_button.add_overlay(mutable_appearance(species.current_extract.icon, species.current_extract.icon_state)) /datum/action/innate/integrate_extract/Activate() var/mob/living/carbon/human/H = owner + var/datum/species/jelly/luminescent/species = target if(!is_species(H, /datum/species/jelly/luminescent) || !species) return CHECK_DNA_AND_SPECIES(H) @@ -645,25 +651,23 @@ icon_icon = 'icons/mob/actions/actions_slime.dmi' background_icon_state = "bg_alien" var/activation_type = SLIME_ACTIVATE_MINOR - var/datum/species/jelly/luminescent/species - -/datum/action/innate/use_extract/New(_species) - ..() - species = _species /datum/action/innate/use_extract/IsAvailable() if(..()) + var/datum/species/jelly/luminescent/species = target if(species && species.current_extract && (world.time > species.extract_cooldown)) return TRUE return FALSE /datum/action/innate/use_extract/ApplyIcon(atom/movable/screen/movable/action_button/current_button, force) ..(current_button, TRUE) - if(species && species.current_extract) + var/datum/species/jelly/luminescent/species = owner + if(species?.current_extract) current_button.add_overlay(mutable_appearance(species.current_extract.icon, species.current_extract.icon_state)) /datum/action/innate/use_extract/Activate() var/mob/living/carbon/human/H = owner + var/datum/species/jelly/luminescent/species = owner if(!is_species(H, /datum/species/jelly/luminescent) || !species) return CHECK_DNA_AND_SPECIES(H) @@ -690,24 +694,35 @@ var/datum/action/innate/link_minds/link_minds var/list/mob/living/linked_mobs = list() var/list/datum/action/innate/linked_speech/linked_actions = list() - var/mob/living/carbon/human/slimelink_owner + var/datum/weakref/slimelink_owner var/current_link_id = 0 examine_limb_id = SPECIES_JELLYPERSON +//Species datums don't normally implement destroy, but JELLIES SUCK ASS OUT OF A STEEL STRAW +/datum/species/jelly/stargazer/Destroy() + for(var/mob/living/link_to_clear as anything in linked_mobs) + unlink_mob(link_to_clear) + linked_mobs.Cut() + QDEL_NULL(project_thought) + QDEL_NULL(link_minds) + slimelink_owner = null + return ..() + /datum/species/jelly/stargazer/on_species_loss(mob/living/carbon/C) ..() - for(var/M in linked_mobs) - unlink_mob(M) + for(var/mob/living/link_to_clear as anything in linked_mobs) + unlink_mob(link_to_clear) if(project_thought) - project_thought.Remove(C) + QDEL_NULL(project_thought) if(link_minds) - link_minds.Remove(C) + QDEL_NULL(link_minds) + slimelink_owner = null /datum/species/jelly/stargazer/spec_death(gibbed, mob/living/carbon/human/H) ..() - for(var/M in linked_mobs) - unlink_mob(M) + for(var/mob/living/link_to_clear as anything in linked_mobs) + unlink_mob(link_to_clear) /datum/species/jelly/stargazer/on_species_gain(mob/living/carbon/C, datum/species/old_species) ..() @@ -715,7 +730,7 @@ project_thought.Grant(C) link_minds = new(src) link_minds.Grant(C) - slimelink_owner = C + slimelink_owner = WEAKREF(C) link_mob(C) /datum/species/jelly/stargazer/proc/link_mob(mob/living/M) @@ -727,8 +742,11 @@ return FALSE if(M in linked_mobs) return FALSE + var/mob/living/carbon/human/owner = slimelink_owner.resolve() + if(!owner) + return FALSE linked_mobs.Add(M) - to_chat(M, "You are now connected to [slimelink_owner.real_name]'s Slime Link.") + to_chat(M, "You are now connected to [owner.real_name]'s Slime Link.") var/datum/action/innate/linked_speech/action = new(src) linked_actions.Add(action) action.Grant(M) @@ -743,9 +761,12 @@ UnregisterSignal(M, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING)) var/datum/action/innate/linked_speech/action = linked_actions[link_id] action.Remove(M) - to_chat(M, "You are no longer connected to [slimelink_owner.real_name]'s Slime Link.") - linked_mobs[link_id] = null - linked_actions[link_id] = null + var/mob/living/carbon/human/owner = slimelink_owner.resolve() + if(owner) + to_chat(M, "You are no longer connected to [owner.real_name]'s Slime Link.") + linked_mobs -= M + linked_actions -= action + qdel(action) /datum/action/innate/linked_speech name = "Slimelink" @@ -753,14 +774,12 @@ button_icon_state = "link_speech" icon_icon = 'icons/mob/actions/actions_slime.dmi' background_icon_state = "bg_alien" - var/datum/species/jelly/stargazer/species - -/datum/action/innate/linked_speech/New(_species) - ..() - species = _species /datum/action/innate/linked_speech/Activate() var/mob/living/carbon/human/H = owner + if(H.stat == DEAD) + return + var/datum/species/jelly/stargazer/species = target if(!species || !(H in species.linked_mobs)) to_chat(H, "The link seems to have been severed...") Remove(H) @@ -773,9 +792,11 @@ Remove(H) return - if(message) - var/msg = "\[[species.slimelink_owner.real_name]'s Slime Link\] [H]: [message]" - log_directed_talk(H, species.slimelink_owner, msg, LOG_SAY, "slime link") + var/mob/living/carbon/human/star_owner = species.slimelink_owner.resolve() + + if(message && star_owner) + var/msg = "\[[star_owner.real_name]'s Slime Link\] [H]: [message]" + log_directed_talk(H, star_owner, msg, LOG_SAY, "slime link") for(var/X in species.linked_mobs) var/mob/living/M = X to_chat(M, msg) @@ -830,11 +851,6 @@ button_icon_state = "mindlink" icon_icon = 'icons/mob/actions/actions_slime.dmi' background_icon_state = "bg_alien" - var/datum/species/jelly/stargazer/species - -/datum/action/innate/link_minds/New(_species) - ..() - species = _species /datum/action/innate/link_minds/Activate() var/mob/living/carbon/human/H = owner @@ -847,6 +863,7 @@ return var/mob/living/target = H.pulling + var/datum/species/jelly/stargazer/species = target to_chat(H, "You begin linking [target]'s mind to yours...") to_chat(target, "You feel a foreign presence within your mind...") diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 191e089274d6..a17064f0f877 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -314,7 +314,7 @@ if(!iscarbon(src)) M.LAssailant = null else - M.LAssailant = usr + M.LAssailant = WEAKREF(usr) if(isliving(M)) var/mob/living/L = M SEND_SIGNAL(M, COMSIG_LIVING_GET_PULLED, src) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 6bb9e9aad856..31676cd64007 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -93,8 +93,9 @@ "Your armor has softened a hit to your [parse_zone(zone)]." ) apply_damage(I.throwforce, dtype, zone, armor) - if(I.thrownby) - log_combat(I.thrownby, src, "threw and hit", I) + var/mob/thrown_by = I.thrownby?.resolve() + if(thrown_by) + log_combat(thrown_by, src, "threw and hit", I) else return 1 else diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index a8d73750e815..a2ed70254f77 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -106,7 +106,7 @@ new/obj/structure/AIcore/deactivated(loc) //New empty terminal. return INITIALIZE_HINT_QDEL //Delete AI. - ADD_TRAIT(src, TRAIT_NO_TELEPORT, src) + ADD_TRAIT(src, TRAIT_NO_TELEPORT, AI_ANCHOR_TRAIT) if(L && istype(L, /datum/ai_laws)) laws = L laws.associate(src) @@ -335,11 +335,11 @@ var/is_anchored = FALSE if(move_resist == MOVE_FORCE_OVERPOWERING) move_resist = MOVE_FORCE_NORMAL - REMOVE_TRAIT(src, TRAIT_NO_TELEPORT, src) + REMOVE_TRAIT(src, TRAIT_NO_TELEPORT, AI_ANCHOR_TRAIT) else is_anchored = TRUE move_resist = MOVE_FORCE_OVERPOWERING - ADD_TRAIT(src, TRAIT_NO_TELEPORT, src) + ADD_TRAIT(src, TRAIT_NO_TELEPORT, AI_ANCHOR_TRAIT) to_chat(src, "You are now [is_anchored ? "" : "un"]anchored.") // the message in the [] will change depending whether or not the AI is anchored @@ -381,9 +381,11 @@ trackeable += track.humans + track.others var/list/target = list() for(var/I in trackeable) - var/mob/M = trackeable[I] - if(M.name == string) - target += M + var/datum/weakref/to_resolve = trackeable[I] + var/mob/to_track = to_resolve.resolve() + if(!to_track || to_track.name != string) + continue + target += to_track if(name == string) target += src if(target.len) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 8dfca209ce39..90e09bd8585d 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -200,12 +200,13 @@ if(T && istype(radio) && istype(radio.keyslot)) radio.keyslot.forceMove(T) radio.keyslot = null - qdel(wires) - qdel(module) - qdel(eye_lights) - wires = null - module = null - eye_lights = null + QDEL_NULL(wires) + QDEL_NULL(module) + QDEL_NULL(eye_lights) + QDEL_NULL(inv1) + QDEL_NULL(inv2) + QDEL_NULL(inv3) + QDEL_NULL(spark_system) cell = null return ..() diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index d4fa1ccdc43d..d3dc66683c1d 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -158,8 +158,9 @@ Maintenance panel panel is [open ? "opened" : "closed"]"}, if(istype(AM, /obj/item)) playsound(src, honksound, 50, TRUE, -1) var/obj/item/I = AM - if(I.throwforce < health && I.thrownby && (istype(I.thrownby, /mob/living/carbon/human))) - var/mob/living/carbon/human/H = I.thrownby + var/mob/thrown_by = I.thrownby?.resolve() + if(I.throwforce < health && thrown_by && (istype(thrown_by, /mob/living/carbon/human))) + var/mob/living/carbon/human/H = thrown_by retaliate(H) ..() diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 8e954265fcf2..f19bc24832c5 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -249,8 +249,9 @@ Auto Patrol: []"}, /mob/living/simple_animal/bot/secbot/hitby(atom/movable/AM, skipcatch = FALSE, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum) if(istype(AM, /obj/item)) var/obj/item/I = AM - if(I.throwforce < src.health && I.thrownby && ishuman(I.thrownby)) - var/mob/living/carbon/human/H = I.thrownby + var/mob/thrown_by = I.thrownby?.resolve() + if(I.throwforce < src.health && thrown_by && ishuman(thrown_by)) + var/mob/living/carbon/human/H = thrown_by retaliate(H) ..() diff --git a/code/modules/mob/living/simple_animal/constructs.dm b/code/modules/mob/living/simple_animal/constructs.dm index 778cd3ff4910..df3cfe349808 100644 --- a/code/modules/mob/living/simple_animal/constructs.dm +++ b/code/modules/mob/living/simple_animal/constructs.dm @@ -42,6 +42,7 @@ var/can_repair_constructs = FALSE var/can_repair_self = FALSE var/runetype + var/datum/action/innate/cult/create_rune/our_rune var/holy = FALSE /mob/living/simple_animal/hostile/construct/Initialize() @@ -60,13 +61,17 @@ S.action.button.moved = "6:[pos],4:-2" spellnum++ if(runetype) - var/datum/action/innate/cult/create_rune/CR = new runetype(src) - CR.Grant(src) + our_rune = new runetype(src) + our_rune.Grant(src) var/pos = 2+spellnum*31 - CR.button.screen_loc = "6:[pos],4:-2" - CR.button.moved = "6:[pos],4:-2" + our_rune.button.screen_loc = "6:[pos],4:-2" + our_rune.button.moved = "6:[pos],4:-2" add_overlay("glow_[icon_state][holy]") +/mob/living/simple_animal/hostile/construct/Destroy() + QDEL_NULL(our_rune) + return ..() + /mob/living/simple_animal/hostile/construct/Login() . = ..() if(!. || !client) @@ -450,15 +455,11 @@ background_icon_state = "bg_demon" buttontooltipstyle = "cult" button_icon_state = "cult_mark" - var/mob/living/simple_animal/hostile/construct/harvester/the_construct - -/datum/action/innate/seek_prey/Grant(mob/living/C) - the_construct = C - ..() /datum/action/innate/seek_prey/Activate() if(GLOB.cult_narsie == null) return + var/mob/living/simple_animal/hostile/construct/harvester/the_construct = owner if(the_construct.seeking) desc = "None can hide from Nar'Sie, activate to track a survivor attempting to flee the red harvest!" button_icon_state = "cult_mark" diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index 302449ba87cf..08d2be2faa23 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -92,7 +92,8 @@ return ..() else . = list() // The following code is only very slightly slower than just returning oview(vision_range, targets_from), but it saves us much more work down the line - var/list/searched_for = oview(vision_range, targets_from) + var/atom/target_from = GET_TARGETS_FROM(src) + var/list/searched_for = oview(vision_range, target_from) for(var/obj/A in searched_for) . += A for(var/mob/A in searched_for) diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index 8dbd15b64640..0c1604becf6d 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -395,6 +395,8 @@ action_icon = 'icons/mob/actions/actions_animal.dmi' action_icon_state = "wrap_0" action_background_icon_state = "bg_alien" + //Set this to false since we're our own action, for some reason + has_action = FALSE /obj/effect/proc_holder/wrap/Initialize() . = ..() diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 4a4e2fbb3ec7..25e9284b61ca 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -47,8 +47,9 @@ var/stat_attack = CONSCIOUS var/stat_exclusive = FALSE //Mobs with this set to TRUE will exclusively attack things defined by stat_attack, stat_attack DEAD means they will only attack corpses var/attack_same = 0 //Set us to 1 to allow us to attack our own faction - //Use set_targets_from to modify this var - var/atom/targets_from = null //all range/attack/etc. calculations should be done from this atom, defaults to the mob itself, useful for Vehicles and such + //Use GET_TARGETS_FROM(mob) to access this + //Attempting to call GET_TARGETS_FROM(mob) when this var is null will just return mob as a base + var/datum/weakref/targets_from //all range/attack/etc. calculations should be done from the atom this weakrefs, useful for Vehicles and such. var/attack_all_objects = FALSE //if true, equivalent to having a wanted_objects list containing ALL objects. var/lose_patience_timer_id //id for a timer to call LoseTarget(), used to stop mobs fixating on a target they can't reach @@ -69,14 +70,9 @@ /mob/living/simple_animal/hostile/Initialize() . = ..() - - if(!targets_from) - set_targets_from(src) wanted_objects = typecacheof(wanted_objects) - /mob/living/simple_animal/hostile/Destroy() - set_targets_from(null) //We can't use losetarget here because fucking cursed blobs override it to do nothing the motherfuckers GiveTarget(null) return ..() @@ -96,7 +92,8 @@ EscapeConfinement() if(AICanContinue(possible_targets)) - if(!QDELETED(target) && !targets_from.Adjacent(target)) + var/atom/target_from = GET_TARGETS_FROM(src) + if(!QDELETED(target) && !target_from.Adjacent(target)) DestroyPathToTarget() if(!MoveToTarget(possible_targets)) //if we lose our target if(AIShouldSleep(possible_targets)) // we try to acquire a new one @@ -146,15 +143,19 @@ //////////////HOSTILE MOB TARGETTING AND AGGRESSION//////////// /mob/living/simple_animal/hostile/proc/ListTargets() //Step 1, find out what we can see + var/atom/target_from = GET_TARGETS_FROM(src) if(!search_objects) - . = hearers(vision_range, targets_from) - src //Remove self, so we don't suicide + . = hearers(vision_range, target_from) - src //Remove self, so we don't suicide var/static/hostile_machines = typecacheof(list(/obj/machinery/porta_turret, /obj/mecha)) . += typecache_filter_list(view(vision_range, targets_from), hostile_machines) + for(var/HM in typecache_filter_list(range(vision_range, target_from), hostile_machines)) + if(can_see(target_from, HM, vision_range)) + . += HM else - . = oview(vision_range, targets_from) + . = oview(vision_range, target_from) /mob/living/simple_animal/hostile/proc/FindTarget(list/possible_targets, HasTargetsList = 0)//Step 2, filter down possible targets to things we actually care about . = list() @@ -190,10 +191,11 @@ /mob/living/simple_animal/hostile/proc/PickTarget(list/Targets)//Step 3, pick amongst the possible, attackable targets if(target != null)//If we already have a target, but are told to pick again, calculate the lowest distance between all possible, and pick from the lowest distance targets + var/atom/target_from = GET_TARGETS_FROM(src) for(var/pos_targ in Targets) var/atom/A = pos_targ - var/target_dist = get_dist(targets_from, target) - var/possible_target_distance = get_dist(targets_from, A) + var/target_dist = get_dist(target_from, target) + var/possible_target_distance = get_dist(target_from, A) if(target_dist < possible_target_distance) Targets -= A if(!Targets.len)//We didnt find nothin! @@ -272,7 +274,8 @@ GainPatience() /mob/living/simple_animal/hostile/proc/CheckAndAttack() - if(target && targets_from && isturf(targets_from.loc) && target.Adjacent(targets_from) && !incapacitated()) + var/atom/target_from = GET_TARGETS_FROM(src) + if(target && isturf(target_from.loc) && target.Adjacent(target_from) && !incapacitated()) AttackingTarget() /mob/living/simple_animal/hostile/proc/MoveToTarget(list/possible_targets)//Step 5, handle movement between us and our target @@ -280,14 +283,15 @@ if(!target || !CanAttack(target)) LoseTarget() return 0 + var/atom/target_from = GET_TARGETS_FROM(src) if(target in possible_targets) var/turf/T = get_turf(src) if(target.virtual_z() != T.virtual_z()) LoseTarget() return 0 - var/target_distance = get_dist(targets_from,target) + var/target_distance = get_dist(target_from,target) if(ranged) //We ranged? Shoot at em - if(!target.Adjacent(targets_from) && ranged_cooldown <= world.time) //But make sure they're not in range for a melee attack and our range attack is off cooldown + if(!target.Adjacent(target_from) && ranged_cooldown <= world.time) //But make sure they're not in range for a melee attack and our range attack is off cooldown OpenFire(target) if(charger && (target_distance > minimum_distance) && (target_distance <= charge_distance))//Attempt to close the distance with a charge. enter_charge(target) @@ -303,7 +307,7 @@ else Goto(target,move_to_delay,minimum_distance) if(target) - if(targets_from && isturf(targets_from.loc) && target.Adjacent(targets_from)) //If they're next to us, attack + if(isturf(target_from.loc) && target.Adjacent(target_from)) //If they're next to us, attack MeleeAction() else if(rapid_melee > 1 && target_distance <= melee_queue_distance) @@ -312,7 +316,7 @@ return 1 return 0 if(environment_smash) - if(target.loc != null && get_dist(targets_from, target.loc) <= vision_range) //We can't see our target, but he's in our vision range still + if(target.loc != null && get_dist(target_from, target.loc) <= vision_range) //We can't see our target, but he's in our vision range still if(ranged_ignores_vision && ranged_cooldown <= world.time) //we can't see our target... but we can fire at them! OpenFire(target) if((environment_smash & ENVIRONMENT_SMASH_WALLS) || (environment_smash & ENVIRONMENT_SMASH_RWALLS)) //If we're capable of smashing through walls, forget about vision completely after finding our target @@ -378,7 +382,8 @@ /mob/living/simple_animal/hostile/proc/summon_backup(distance, exact_faction_match) do_alert_animation(src) playsound(loc, 'sound/machines/chime.ogg', 50, TRUE, -1) - for(var/mob/living/simple_animal/hostile/M in oview(distance, targets_from)) + var/atom/target_from = GET_TARGETS_FROM(src) + for(var/mob/living/simple_animal/hostile/M in oview(distance, target_from)) if(faction_check_mob(M, TRUE)) if(M.AIStatus == AI_OFF) return @@ -410,9 +415,10 @@ /mob/living/simple_animal/hostile/proc/Shoot(atom/targeted_atom) - if(QDELETED(targeted_atom) || targeted_atom == targets_from.loc || targeted_atom == targets_from) + var/atom/target_from = GET_TARGETS_FROM(src) + if(QDELETED(targeted_atom) || targeted_atom == target_from.loc || targeted_atom == target_from) return - var/turf/startloc = get_turf(targets_from) + var/turf/startloc = get_turf(target_from) if(casingtype) var/obj/item/ammo_casing/casing = new casingtype(startloc) playsound(src, projectilesound, 100, TRUE) @@ -426,7 +432,7 @@ P.yo = targeted_atom.y - startloc.y P.xo = targeted_atom.x - startloc.x if(AIStatus != AI_ON)//Don't want mindless mobs to have their movement screwed up firing in space - newtonian_move(get_dir(targeted_atom, targets_from)) + newtonian_move(get_dir(targeted_atom, target_from)) P.original = targeted_atom P.preparePixelProjectile(targeted_atom, src) P.fire() @@ -454,15 +460,16 @@ dodging = TRUE /mob/living/simple_animal/hostile/proc/DestroyObjectsInDirection(direction) - var/turf/T = get_step(targets_from, direction) + var/atom/target_from = GET_TARGETS_FROM(src) + var/turf/T = get_step(target_from, direction) if(QDELETED(T)) return - if(T.Adjacent(targets_from)) + if(T.Adjacent(target_from)) if(CanSmashTurfs(T)) T.attack_animal(src) return for(var/obj/O in T.contents) - if(!O.Adjacent(targets_from)) + if(!O.Adjacent(target_from)) continue if((ismachinery(O) || isstructure(O)) && O.density && environment_smash >= ENVIRONMENT_SMASH_STRUCTURES && !O.IsObscured()) O.attack_animal(src) @@ -471,7 +478,8 @@ /mob/living/simple_animal/hostile/proc/DestroyPathToTarget() if(environment_smash) EscapeConfinement() - var/dir_to_target = get_dir(targets_from, target) + var/atom/target_from = GET_TARGETS_FROM(src) + var/dir_to_target = get_dir(target_from, target) var/dir_list = list() if(ISDIAGONALDIR(dir_to_target)) //it's diagonal, so we need two directions to hit for(var/direction in GLOB.cardinals) @@ -491,18 +499,19 @@ /mob/living/simple_animal/hostile/proc/EscapeConfinement() + var/atom/target_from = GET_TARGETS_FROM(src) if(buckled) buckled.attack_animal(src) - if(!isturf(targets_from.loc) && targets_from.loc != null)//Did someone put us in something? - var/atom/A = targets_from.loc + if(!isturf(target_from.loc) && target_from.loc != null)//Did someone put us in something? + var/atom/A = target_from.loc A.attack_animal(src)//Bang on it till we get out - /mob/living/simple_animal/hostile/proc/FindHidden() if(istype(target.loc, /obj/structure/closet) || istype(target.loc, /obj/machinery/disposal) || istype(target.loc, /obj/machinery/sleeper)) var/atom/A = target.loc + var/atom/target_from = GET_TARGETS_FROM(src) Goto(A,move_to_delay,minimum_distance) - if(A.Adjacent(targets_from)) + if(A.Adjacent(target_from)) A.attack_animal(src) return 1 @@ -657,17 +666,12 @@ charge_state = FALSE update_icons() -/mob/living/simple_animal/hostile/proc/set_targets_from(atom/target_from) - if(targets_from) - UnregisterSignal(targets_from, COMSIG_PARENT_QDELETING) - targets_from = target_from - if(targets_from) - RegisterSignal(targets_from, COMSIG_PARENT_QDELETING, .proc/handle_targets_from_del) - -/mob/living/simple_animal/hostile/proc/handle_targets_from_del(datum/source) - SIGNAL_HANDLER - if(targets_from != src) - set_targets_from(src) +/mob/living/simple_animal/hostile/proc/get_targets_from() + var/atom/target_from = targets_from.resolve() + if(!target_from) + targets_from = null + return src + return target_from /mob/living/simple_animal/hostile/proc/handle_target_del(datum/source) SIGNAL_HANDLER diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm b/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm index 0df00f99c1c7..a3c384af5472 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm @@ -93,9 +93,10 @@ melee_damage_lower = 15 melee_damage_upper = 15 var/mob_direction = get_dir(src,target) + var/atom/target_from = GET_TARGETS_FROM(src) if(get_dist(src,target) > 1) step(src,mob_direction) - if(targets_from && isturf(targets_from.loc) && target.Adjacent(targets_from) && isliving(target)) + if(isturf(target_from.loc) && target.Adjacent(target_from) && isliving(target)) var/mob/living/L = target L.attack_animal(src) return diff --git a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm index aa86ccfd4d06..a4678a69799a 100644 --- a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm +++ b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm @@ -73,7 +73,7 @@ Featuring: return 0 LoseTarget() //Target was our mecha, so null it out M.aimob_enter_mech(src) - set_targets_from(M) + targets_from = WEAKREF(M) allow_movement_on_non_turfs = TRUE //duh var/do_ranged = 0 for(var/equip in mecha.equipment) @@ -99,7 +99,7 @@ Featuring: mecha.aimob_exit_mech(src) allow_movement_on_non_turfs = FALSE - set_targets_from(src) + targets_from = null //Find a new mecha wanted_objects = typecacheof(/obj/mecha/combat, TRUE) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index e25165cbbdfe..4ded55413f8e 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -270,10 +270,9 @@ Difficulty: Very Hard else SSexplosions.medturf += target - - +//There can only ever be one blackbox, and we want to know if there already is one when we spawn +GLOBAL_DATUM(blackbox, /obj/machinery/smartfridge/black_box) //Black Box - /obj/machinery/smartfridge/black_box name = "black box" desc = "A completely indestructible chunk of crystal, rumoured to predate the start of this universe. It looks like you could store things inside it." @@ -302,11 +301,9 @@ Difficulty: Very Hard /obj/machinery/smartfridge/black_box/Initialize() . = ..() - var/static/obj/machinery/smartfridge/black_box/current - if(current && current != src) - qdel(src, force=TRUE) - return - current = src + if(GLOB.blackbox != src) + return INITIALIZE_HINT_QDEL_FORCE + GLOB.blackbox = src ReadMemory() /obj/machinery/smartfridge/black_box/process() @@ -351,6 +348,8 @@ Difficulty: Very Hard /obj/machinery/smartfridge/black_box/Destroy(force = FALSE) if(force) + if(GLOB.blackbox == src) + GLOB.blackbox = null for(var/thing in src) qdel(thing) return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index c22d5dcd9dc9..e26e2a324329 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -85,7 +85,6 @@ Difficulty: Hard var/did_reset = TRUE //if we timed out, returned to our beacon, and healed some var/list/kill_phrases = list("Wsyvgi sj irivkc xettih. Vitemvmrk...", "Irivkc wsyvgi jsyrh. Vitemvmrk...", "Jyip jsyrh. Egxmzexmrk vitemv gcgpiw...", "Kix fiex. Liepmrk...") var/list/target_phrases = list("Xevkix psgexih.", "Iriqc jsyrh.", "Eguymvih xevkix.") - var/list/stored_nearby = list() // stores people nearby the hierophant when it enters the death animation /mob/living/simple_animal/hostile/megafauna/hierophant/Initialize() . = ..() @@ -411,6 +410,7 @@ Difficulty: Hard blinking = TRUE //we do a fancy animation, release a huge burst(), and leave our staff. visible_message("\"Mrmxmexmrk wipj-hiwxvygx wiuyirgi...\"") visible_message("[src] shrinks, releasing a massive burst of energy!") + var/list/stored_nearby = list() for(var/mob/living/L in view(7,src)) stored_nearby += L // store the people to grant the achievements to once we die hierophant_burst(null, get_turf(src), 10) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm index 1611ef0d5c3d..c957c704eb13 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm @@ -69,7 +69,8 @@ /mob/living/simple_animal/hostile/asteroid/basilisk/GiveTarget(new_target) if(..()) //we have a target - if(isliving(target) && !target.Adjacent(targets_from) && ranged_cooldown <= world.time)//No more being shot at point blank or spammed with RNG beams + var/atom/target_from = GET_TARGETS_FROM(src) + if(isliving(target) && !target.Adjacent(target_from) && ranged_cooldown <= world.time)//No more being shot at point blank or spammed with RNG beams OpenFire(target) /mob/living/simple_animal/hostile/asteroid/basilisk/ex_act(severity, target) diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm index 63a796a80954..0eb4232e65fd 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm @@ -7,7 +7,7 @@ if(!L.stat) return L else - enemies -= L + remove_enemy(L) else if(ismecha(A)) var/obj/mecha/M = A if(M.occupant) @@ -29,19 +29,37 @@ if(isliving(A)) var/mob/living/M = A if(faction_check_mob(M) && attack_same || !faction_check_mob(M)) - enemies |= M + add_enemy(M) else if(ismecha(A)) var/obj/mecha/M = A if(M.occupant) - enemies |= M - enemies |= M.occupant + add_enemy(M) + add_enemy(M.occupant) for(var/mob/living/simple_animal/hostile/retaliate/H in around) if(faction_check_mob(H) && !attack_same && !H.attack_same) - H.enemies |= enemies - return 0 + H.add_enemies(enemies) /mob/living/simple_animal/hostile/retaliate/adjustHealth(amount, updating_health = TRUE, forced = FALSE) . = ..() if(. > 0 && stat == CONSCIOUS) Retaliate() + +/mob/living/simple_animal/hostile/retaliate/proc/add_enemy(new_enemy) + RegisterSignal(new_enemy, COMSIG_PARENT_QDELETING, .proc/remove_enemy, override = TRUE) + enemies |= new_enemy + +/mob/living/simple_animal/hostile/retaliate/proc/add_enemies(new_enemies) + for(var/new_enemy in new_enemies) + RegisterSignal(new_enemy, COMSIG_PARENT_QDELETING, .proc/remove_enemy, override = TRUE) + enemies |= new_enemy + +/mob/living/simple_animal/hostile/retaliate/proc/clear_enemies() + for(var/enemy in enemies) + UnregisterSignal(enemy, COMSIG_PARENT_QDELETING) + enemies.Cut() + +/mob/living/simple_animal/hostile/retaliate/proc/remove_enemy(datum/enemy_to_remove) + SIGNAL_HANDLER + UnregisterSignal(enemy_to_remove, COMSIG_PARENT_QDELETING) + enemies -= enemy_to_remove diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index 777144a068cf..5260c76e8a01 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -54,13 +54,13 @@ break if(Target.health <= -70 || Target.stat == DEAD) - Target = null + set_target(null) AIproc = 0 break if(Target) if(locate(/mob/living/simple_animal/slime) in Target.buckled_mobs) - Target = null + set_target(null) AIproc = 0 break if(!AIproc) @@ -98,7 +98,7 @@ // Bug of the month candidate: slimes were attempting to move to target only if it was directly next to them, which caused them to target things, but not approach them step_to(src, Target) else - Target = null + set_target(null) AIproc = 0 break @@ -174,12 +174,10 @@ if(M.stat == DEAD) // our victim died if(!client) if(!rabid && !attacked) - if(M.LAssailant && M.LAssailant != M) + var/mob/last_to_hurt = M.LAssailant?.resolve() + if(last_to_hurt && last_to_hurt != M) if(prob(50)) - if(!(M.LAssailant in Friends)) - Friends[M.LAssailant] = 1 - else - ++Friends[M.LAssailant] + add_friendship(last_to_hurt, 1) else to_chat(src, "This subject does not have a strong enough life energy anymore...") @@ -290,7 +288,7 @@ --target_patience if (target_patience <= 0 || SStun > world.time || Discipline || attacked || docile) // Tired of chasing or something draws out attention target_patience = 0 - Target = null + set_target(null) if(AIproc && SStun > world.time) return @@ -305,7 +303,7 @@ if(hungry == 2 && !client) // if a slime is starving, it starts losing its friends if(Friends.len > 0 && prob(1)) var/mob/nofriend = pick(Friends) - --Friends[nofriend] + add_friendship(nofriend, -1) if(!Target) if(will_hunt() && hungry || attacked || rabid) // Only add to the list if we need to @@ -339,16 +337,16 @@ if(targets.len > 0) if(attacked || rabid || hungry == 2) - Target = targets[1] // I am attacked and am fighting back or so hungry I don't even care + set_target(targets[1]) // I am attacked and am fighting back or so hungry I don't even care else for(var/mob/living/carbon/C in targets) if(!Discipline && prob(5)) if(ishuman(C) || isalienadult(C)) - Target = C + set_target(C) break if(islarva(C) || ismonkey(C)) - Target = C + set_target(C) break if (Target) @@ -422,13 +420,13 @@ if (Leader == who) // Already following him to_say = pick("Yes...", "Lead...", "Follow...") else if (Friends[who] > Friends[Leader]) // VIVA - Leader = who + set_leader(who) to_say = "Yes... I follow [who]..." else to_say = "No... I follow [Leader]..." else if (Friends[who] >= SLIME_FRIENDSHIP_FOLLOW) - Leader = who + set_leader(who) to_say = "I follow..." else // Not friendly enough to_say = pick("No...", "I no follow...") @@ -436,27 +434,27 @@ if (buckled) // We are asked to stop feeding if (Friends[who] >= SLIME_FRIENDSHIP_STOPEAT) Feedstop() - Target = null + set_target(null) if (Friends[who] < SLIME_FRIENDSHIP_STOPEAT_NOANGRY) - --Friends[who] + add_friendship(who, -1) to_say = "Grrr..." // I'm angry but I do it else to_say = "Fine..." else if (Target) // We are asked to stop chasing if (Friends[who] >= SLIME_FRIENDSHIP_STOPCHASE) - Target = null + set_target(null) if (Friends[who] < SLIME_FRIENDSHIP_STOPCHASE_NOANGRY) - --Friends[who] + add_friendship(who, -1) to_say = "Grrr..." // I'm angry but I do it else to_say = "Fine..." else if (Leader) // We are asked to stop following if (Leader == who) to_say = "Yes... I stay..." - Leader = null + set_leader(null) else if (Friends[who] > Friends[Leader]) - Leader = null + set_leader(null) to_say = "Yes... I stop..." else to_say = "No... keep follow..." @@ -478,7 +476,7 @@ to_say = "No... won't stay..." else if (findtext(phrase, "attack")) if (rabid && prob(20)) - Target = who + set_target(who) AIprocess() //Wake up the slime's Target AI, needed otherwise this doesn't work to_say = "ATTACK!?!?" else if (Friends[who] >= SLIME_FRIENDSHIP_ATTACK) @@ -486,14 +484,14 @@ if (findtext(phrase, lowertext(L.name))) if (isslime(L)) to_say = "NO... [L] slime friend" - --Friends[who] //Don't ask a slime to attack its friend + add_friendship(who, -1) //Don't ask a slime to attack its friend else if(!Friends[L] || Friends[L] < 1) - Target = L + set_target(L) AIprocess()//Wake up the slime's Target AI, needed otherwise this doesn't work to_say = "Ok... I attack [Target]" else to_say = "No... like [L] ..." - --Friends[who] //Don't ask a slime to attack its friend + add_friendship(who, -1) //Don't ask a slime to attack its friend break else to_say = "No... no listen" diff --git a/code/modules/mob/living/simple_animal/slime/powers.dm b/code/modules/mob/living/simple_animal/slime/powers.dm index 1503455c4a23..c7174470dc5c 100644 --- a/code/modules/mob/living/simple_animal/slime/powers.dm +++ b/code/modules/mob/living/simple_animal/slime/powers.dm @@ -197,7 +197,7 @@ M.powerlevel = new_powerlevel if(i != 1) step_away(M,src) - M.Friends = Friends.Copy() + M.set_friends(Friends) babies += M M.mutation_chance = clamp(mutation_chance+(rand(5,-5)),0,100) SSblackbox.record_feedback("tally", "slime_babies_born", 1, M.colour) diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 4128eedfefb4..ed0ab3335117 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -1,3 +1,4 @@ +#define SLIME_CARES_ABOUT(to_check) (to_check && (to_check == Target || to_check == Leader || (to_check in Friends))) /mob/living/simple_animal/slime name = "grey baby slime (123)" icon = 'icons/mob/slimes.dmi' @@ -109,10 +110,9 @@ for (var/A in actions) var/datum/action/AC = A AC.Remove(src) - Target = null - Leader = null - Friends.Cut() - speech_buffer.Cut() + set_target(null) + set_leader(null) + clear_friends() return ..() /mob/living/simple_animal/slime/proc/set_colour(new_colour) @@ -333,10 +333,7 @@ /mob/living/simple_animal/slime/attackby(obj/item/W, mob/living/user, params) if(istype(W, /obj/item/stack/sheet/mineral/plasma) && !stat) //Let's you feed slimes plasma. - if (user in Friends) - ++Friends[user] - else - Friends[user] = 1 + add_friendship(user, 1) to_chat(user, "You feed the slime the plasma. It chirps happily.") var/obj/item/stack/sheet/mineral/plasma/S = W S.use(1) @@ -404,7 +401,7 @@ adjustBruteLoss(rand(15,20)) if(!client) if(Target) // Like cats - Target = null + set_target(null) ++Discipline return @@ -449,8 +446,7 @@ if(Discipline == 1) attacked = 0 - if(Target) - Target = null + set_target(null) if(buckled) Feedstop(silent = TRUE) //we unbuckle the slime from the mob it latched onto. @@ -486,3 +482,55 @@ /mob/living/simple_animal/slime/random/Initialize(mapload, new_colour, new_is_adult) . = ..(mapload, pick(slime_colours), prob(50)) + +/mob/living/simple_animal/slime/proc/set_target(new_target) + var/old_target = Target + Target = new_target + if(old_target && !SLIME_CARES_ABOUT(old_target)) + UnregisterSignal(old_target, COMSIG_PARENT_QDELETING) + if(Target) + RegisterSignal(Target, COMSIG_PARENT_QDELETING, .proc/clear_memories_of, override = TRUE) + +/mob/living/simple_animal/slime/proc/set_leader(new_leader) + var/old_leader = Leader + Leader = new_leader + if(old_leader && !SLIME_CARES_ABOUT(old_leader)) + UnregisterSignal(old_leader, COMSIG_PARENT_QDELETING) + if(Leader) + RegisterSignal(Leader, COMSIG_PARENT_QDELETING, .proc/clear_memories_of, override = TRUE) + +/mob/living/simple_animal/slime/proc/add_friendship(new_friend, amount = 1) + if(!Friends[new_friend]) + Friends[new_friend] = 0 + Friends[new_friend] += amount + if(new_friend) + RegisterSignal(new_friend, COMSIG_PARENT_QDELETING, .proc/clear_memories_of, override = TRUE) + +/mob/living/simple_animal/slime/proc/set_friendship(new_friend, amount = 1) + Friends[new_friend] = amount + if(new_friend) + RegisterSignal(new_friend, COMSIG_PARENT_QDELETING, .proc/clear_memories_of, override = TRUE) + +/mob/living/simple_animal/slime/proc/remove_friend(friend) + Friends -= friend + if(friend && !SLIME_CARES_ABOUT(friend)) + UnregisterSignal(friend, COMSIG_PARENT_QDELETING) + +/mob/living/simple_animal/slime/proc/set_friends(new_buds) + clear_friends() + for(var/mob/friend as anything in new_buds) + set_friendship(friend, new_buds[friend]) + +/mob/living/simple_animal/slime/proc/clear_friends() + for(var/mob/friend as anything in Friends) + remove_friend(friend) + +/mob/living/simple_animal/slime/proc/clear_memories_of(datum/source) + SIGNAL_HANDLER + if(source == Target) + set_target(null) + if(source == Leader) + set_leader(null) + remove_friend(source) + +#undef SLIME_CARES_ABOUT diff --git a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm index 00cac3ed2b84..ae0871880818 100644 --- a/code/modules/mob/logout.dm +++ b/code/modules/mob/logout.dm @@ -4,9 +4,7 @@ SStgui.on_logout(src) unset_machine() remove_from_player_list() - if(client?.movingmob) //In the case the client was transferred to another mob and not deleted. - LAZYREMOVE(client.movingmob.client_mobs_in_contents, src) - client.movingmob = null + clear_client_in_contents() ..() if(loc) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 0755045d5974..04fbd4e3de3b 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -16,13 +16,11 @@ * * qdels any client colours in place on this mob * - * Unsets the currently active machine - * - * Clears roundstart quirks list + * Clears any refs to the mob inside its current location * * Ghostizes the client attached to this mob * - * Removes references to the mob from its former mind, and vice versa + * If our mind still exists, clear its current var to prevent harddels * * Parent call */ @@ -30,6 +28,7 @@ remove_from_mob_list() remove_from_dead_mob_list() remove_from_alive_mob_list() + remove_from_mob_suicide_list() focus = null if(length(progressbars)) stack_trace("[src] destroyed with elements in its progressbars list") @@ -47,12 +46,10 @@ QDEL_LIST(client_colours) active_storage = null unset_machine() - ghostize() - if(mind) - mind.handle_mob_deletion(src) - if(istype(loc, /atom/movable)) - var/atom/movable/movable_loc = loc - LAZYREMOVE(movable_loc.client_mobs_in_contents, src) + clear_client_in_contents() //Gotta do this here as well as Logout, since client will be null by the time it gets there, cause of that ghostize + ghostize() //False, since we're deleting it currently + if(mind?.current == src) //Let's just be safe yeah? This will occasionally be cleared, but not always. Can't do it with ghostize without changing behavior + mind.set_current(null) return ..() @@ -1363,3 +1360,64 @@ /// Used for typing indicator, relevant on /living level /mob/proc/set_typing_indicator(state) return + +/mob/vv_edit_var(var_name, var_value) + switch(var_name) + if(NAMEOF(src, control_object)) + var/obj/O = var_value + if(!istype(O) || (O.obj_flags & DANGEROUS_POSSESSION)) + return FALSE + if(NAMEOF(src, machine)) + set_machine(var_value) + . = TRUE + if(NAMEOF(src, focus)) + set_focus(var_value) + . = TRUE + if(NAMEOF(src, nutrition)) + set_nutrition(var_value) + . = TRUE + if(NAMEOF(src, stat)) + set_stat(var_value) + . = TRUE + if(NAMEOF(src, dizziness)) + set_dizziness(var_value) + . = TRUE + if(NAMEOF(src, eye_blind)) + set_blindness(var_value) + . = TRUE + if(NAMEOF(src, eye_blurry)) + set_blurriness(var_value) + . = TRUE + + if(!isnull(.)) + datum_flags |= DF_VAR_EDITED + return + + var/slowdown_edit = (var_name == NAMEOF(src, cached_multiplicative_slowdown)) + var/diff + if(slowdown_edit && isnum(cached_multiplicative_slowdown) && isnum(var_value)) + remove_movespeed_modifier(/datum/movespeed_modifier/admin_varedit) + diff = var_value - cached_multiplicative_slowdown + + . = ..() + + if(. && slowdown_edit && isnum(diff)) + add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/admin_varedit, multiplicative_slowdown = diff) + +/mob/proc/set_active_storage(new_active_storage) + if(active_storage) + UnregisterSignal(active_storage, COMSIG_PARENT_QDELETING) + active_storage = new_active_storage + if(active_storage) + RegisterSignal(active_storage, COMSIG_PARENT_QDELETING, .proc/active_storage_deleted) + +/mob/proc/active_storage_deleted(datum/source) + SIGNAL_HANDLER + set_active_storage(null) + +///Clears the client in contents list of our current "eye". Prevents hard deletes +/mob/proc/clear_client_in_contents() + if(client?.movingmob) //In the case the client was transferred to another mob and not deleted. + client.movingmob.client_mobs_in_contents -= src + UNSETEMPTY(client.movingmob.client_mobs_in_contents) + client.movingmob = null diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 03916f94be9d..ccf3ff52b915 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -151,8 +151,8 @@ /// Can this mob enter shuttles var/move_on_shuttle = 1 - ///The last mob/living/carbon to push/drag/grab this mob (exclusively used by slimes friend recognition) - var/mob/living/carbon/LAssailant = null + ///A weakref to the last mob/living/carbon to push/drag/grab this mob (exclusively used by slimes friend recognition) + var/datum/weakref/LAssailant = null /** * construct spells and mime spells. diff --git a/code/modules/mob/mob_lists.dm b/code/modules/mob/mob_lists.dm index bd47d511e1d4..e09f2a5e523b 100644 --- a/code/modules/mob/mob_lists.dm +++ b/code/modules/mob/mob_lists.dm @@ -22,6 +22,13 @@ if(client) remove_from_current_living_players() +///Adds a mob reference to the list of all suicided mobs +/mob/proc/add_to_mob_suicide_list() + GLOB.suicided_mob_list += src + +///Removes a mob references from the list of all suicided mobs +/mob/proc/remove_from_mob_suicide_list() + GLOB.suicided_mob_list -= src ///Adds the mob reference to the list of all the dead mobs. If mob is cliented, it adds it to the list of all dead player-mobs. /mob/proc/add_to_dead_mob_list() diff --git a/code/modules/modular_computers/NTNet/NTNRC/conversation.dm b/code/modules/modular_computers/NTNet/NTNRC/conversation.dm index 27eb3a6ae970..92369d9917ff 100644 --- a/code/modules/modular_computers/NTNet/NTNRC/conversation.dm +++ b/code/modules/modular_computers/NTNet/NTNRC/conversation.dm @@ -22,6 +22,8 @@ /datum/ntnet_conversation/Destroy() if(SSnetworks.station_network) SSnetworks.station_network.chat_channels.Remove(src) + for(var/datum/computer_file/program/chatclient/chatterbox in clients) + purge_client(chatterbox) return ..() /datum/ntnet_conversation/proc/add_message(message, username) @@ -38,23 +40,30 @@ return messages = messages.Copy(messages.len-50 ,0) -/datum/ntnet_conversation/proc/add_client(datum/computer_file/program/chatclient/C) - if(!istype(C)) +/datum/ntnet_conversation/proc/add_client(datum/computer_file/program/chatclient/new_user) + if(!istype(new_user)) return - clients.Add(C) - add_status_message("[C.username] has joined the channel.") + new_user.conversations |= src + clients.Add(new_user) + add_status_message("[new_user.username] has joined the channel.") // No operator, so we assume the channel was empty. Assign this user as operator. if(!operator) - changeop(C) + changeop(new_user) -/datum/ntnet_conversation/proc/remove_client(datum/computer_file/program/chatclient/C) - if(!istype(C) || !(C in clients)) +//Clear all of our references to a client, used for client deletion +/datum/ntnet_conversation/proc/purge_client(datum/computer_file/program/chatclient/forget) + remove_client(forget) + forget.conversations -= src + +/datum/ntnet_conversation/proc/remove_client(datum/computer_file/program/chatclient/leaving) + if(!istype(leaving)) return - clients.Remove(C) - add_status_message("[C.username] has left the channel.") + if(leaving in clients) + clients.Remove(leaving) + add_status_message("[leaving.username] has left the channel.") // Channel operator left, pick new operator - if(C == operator) + if(leaving == operator) operator = null if(clients.len) var/datum/computer_file/program/chatclient/newop = pick(clients) diff --git a/code/modules/modular_computers/computers/machinery/console_presets.dm b/code/modules/modular_computers/computers/machinery/console_presets.dm index 3c741e987ea5..129be055c1eb 100644 --- a/code/modules/modular_computers/computers/machinery/console_presets.dm +++ b/code/modules/modular_computers/computers/machinery/console_presets.dm @@ -25,8 +25,6 @@ /obj/machinery/modular_computer/console/preset/proc/install_programs() return - - // ===== ENGINEERING CONSOLE ===== /obj/machinery/modular_computer/console/preset/engineering console_department = "Engineering" diff --git a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm index b34c7e7dfb30..ff776b417a17 100644 --- a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm +++ b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm @@ -14,12 +14,20 @@ var/username var/active_channel var/list/channel_history = list() - var/operator_mode = FALSE // Channel operator mode - var/netadmin_mode = FALSE // Administrator mode (invisible to other users + bypasses passwords) + var/operator_mode = FALSE // Channel operator mode + var/netadmin_mode = FALSE // Administrator mode (invisible to other users + bypasses passwords) + //A list of all the converstations we're a part of + var/list/datum/ntnet_conversation/conversations = list() /datum/computer_file/program/chatclient/New() username = "DefaultUser[rand(100, 999)]" +/datum/computer_file/program/chatclient/Destroy() + for(var/datum/ntnet_conversation/discussion as anything in conversations) + discussion.purge_client(src) + conversations.Cut() + return ..() + /datum/computer_file/program/chatclient/ui_act(action, params) . = ..() if(.) diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index 2aeba2beba33..664b1a19cca1 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -36,11 +36,15 @@ refresh() /datum/computer_file/program/supermatter_monitor/kill_program(forced = FALSE) + for(var/supermatter in supermatters) + clear_supermatter(supermatter) supermatters = null ..() // Refreshes list of active supermatter crystals /datum/computer_file/program/supermatter_monitor/proc/refresh() + for(var/supermatter in supermatters) + clear_supermatter(supermatter) supermatters = list() var/turf/T = get_turf(ui_host()) if(!T) @@ -50,9 +54,7 @@ if (!isturf(S.loc) || !S.virtual_z() == T.virtual_z()) continue supermatters.Add(S) - - if(!(active in supermatters)) - active = null + RegisterSignal(S, COMSIG_PARENT_QDELETING, .proc/react_to_del) /datum/computer_file/program/supermatter_monitor/proc/get_status() . = SUPERMATTER_INACTIVE @@ -185,3 +187,13 @@ active = S set_signals() return TRUE + +/datum/computer_file/program/supermatter_monitor/proc/react_to_del(datum/source) + SIGNAL_HANDLER + clear_supermatter(source) + +/datum/computer_file/program/supermatter_monitor/proc/clear_supermatter(matter) + supermatters -= matter + if(matter == active) + active = null + UnregisterSignal(matter, COMSIG_PARENT_QDELETING) diff --git a/code/modules/modular_computers/hardware/hard_drive.dm b/code/modules/modular_computers/hardware/hard_drive.dm index 2e735158b6fe..bad68010557c 100644 --- a/code/modules/modular_computers/hardware/hard_drive.dm +++ b/code/modules/modular_computers/hardware/hard_drive.dm @@ -117,7 +117,7 @@ return null /obj/item/computer_hardware/hard_drive/Destroy() - stored_files = null + QDEL_LIST(stored_files) return ..() /obj/item/computer_hardware/hard_drive/Initialize() diff --git a/code/modules/ninja/suit/suit.dm b/code/modules/ninja/suit/suit.dm index c4ba5eede53a..cb355014d4e7 100644 --- a/code/modules/ninja/suit/suit.dm +++ b/code/modules/ninja/suit/suit.dm @@ -72,6 +72,11 @@ Contents: cell.name = "black power cell" cell.icon_state = "bscell" +/obj/item/clothing/suit/space/space_ninja/Destroy() + QDEL_NULL(spark_system) + QDEL_NULL(cell) + return ..() + // Space Suit temperature regulation and power usage /obj/item/clothing/suit/space/space_ninja/process() var/mob/living/carbon/human/user = src.loc diff --git a/code/modules/overmap/helm.dm b/code/modules/overmap/helm.dm index ab07c4789f85..070f4d9f9cd1 100644 --- a/code/modules/overmap/helm.dm +++ b/code/modules/overmap/helm.dm @@ -211,23 +211,24 @@ .["aiControls"] = allow_ai_control .["burnDirection"] = current_ship.burn_direction .["burnPercentage"] = current_ship.burn_percentage - for(var/obj/machinery/power/shuttle/engine/E as anything in current_ship.shuttle_port.engine_list) + for(var/datum/weakref/engine in current_ship.shuttle_port.engine_list) + var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() var/list/engine_data - if(!E.thruster_active) + if(!real_engine.thruster_active) engine_data = list( - name = E.name, + name = real_engine.name, fuel = 0, maxFuel = 100, - enabled = E.enabled, - ref = REF(E) + enabled = real_engine.enabled, + ref = REF(engine) ) else engine_data = list( - name = E.name, - fuel = E.return_fuel(), - maxFuel = E.return_fuel_cap(), - enabled = E.enabled, - ref = REF(E) + name = real_engine.name, + fuel = real_engine.return_fuel(), + maxFuel = real_engine.return_fuel_cap(), + enabled = real_engine.enabled, + ref = REF(engine) ) .["engineInfo"] += list(engine_data) @@ -300,9 +301,10 @@ say(current_ship.Dock(to_act)) return if("toggle_engine") - var/obj/machinery/power/shuttle/engine/E = locate(params["engine"]) in current_ship.shuttle_port.engine_list - E.enabled = !E.enabled - E.update_icon_state() + var/datum/weakref/engine = locate(params["engine"]) in current_ship.shuttle_port.engine_list + var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() + real_engine.enabled = !real_engine.enabled + real_engine.update_icon_state() current_ship.refresh_engines() return if("change_burn_percentage") diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index d4ebcb8d4735..100c33af38ed 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -183,10 +183,11 @@ var/thrust_used = 0 //The amount of thrust that the engines will provide with one burn refresh_engines() calculate_avg_fuel() - for(var/obj/machinery/power/shuttle/engine/E as anything in shuttle_port.engine_list) - if(!E.enabled) + for(var/datum/weakref/engine in shuttle_port.engine_list) + var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() + if(!real_engine.enabled) continue - thrust_used += E.burn_engine(percentage, deltatime) + thrust_used += real_engine.burn_engine(percentage, deltatime) thrust_used = thrust_used / (shuttle_port.turf_count * 100) est_thrust = thrust_used / percentage * 100 //cheeky way of rechecking the thrust, check it every time it's used diff --git a/code/modules/projectiles/ammunition/energy/portal.dm b/code/modules/projectiles/ammunition/energy/portal.dm index 6f2b02644640..492878613658 100644 --- a/code/modules/projectiles/ammunition/energy/portal.dm +++ b/code/modules/projectiles/ammunition/energy/portal.dm @@ -4,7 +4,8 @@ harmful = FALSE fire_sound = 'sound/weapons/pulse3.ogg' select_name = "blue" - var/obj/item/gun/energy/wormhole_projector/gun + //Weakref to the gun that shot us + var/datum/weakref/gun /obj/item/ammo_casing/energy/wormhole/orange projectile_type = /obj/projectile/beam/wormhole/orange @@ -12,7 +13,7 @@ /obj/item/ammo_casing/energy/wormhole/Initialize(mapload, obj/item/gun/energy/wormhole_projector/wh) . = ..() - gun = wh + gun = WEAKREF(wh) /obj/item/ammo_casing/energy/wormhole/throw_proj() . = ..() diff --git a/code/modules/projectiles/guns/energy/laser_gatling.dm b/code/modules/projectiles/guns/energy/laser_gatling.dm index b34355331ac5..4a1cf5ebafab 100644 --- a/code/modules/projectiles/guns/energy/laser_gatling.dm +++ b/code/modules/projectiles/guns/energy/laser_gatling.dm @@ -25,6 +25,10 @@ START_PROCESSING(SSobj, src) /obj/item/minigunpack/Destroy() + if(!QDELETED(gun)) + qdel(gun) + gun = null + QDEL_NULL(battery) STOP_PROCESSING(SSobj, src) return ..() @@ -121,6 +125,12 @@ AddComponent(/datum/component/automatic_fire, 0.2 SECONDS) return ..() +/obj/item/gun/energy/minigun/Destroy() + if(!QDELETED(ammo_pack)) + qdel(ammo_pack) + ammo_pack = null + return ..() + /obj/item/gun/energy/minigun/attack_self(mob/living/user) return diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 9bdb7f33e03b..0b945bbd4da0 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -219,10 +219,10 @@ for(var/i in 1 to ammo_type.len) var/obj/item/ammo_casing/energy/wormhole/W = ammo_type[i] if(istype(W)) - W.gun = src + W.gun = WEAKREF(src) var/obj/projectile/beam/wormhole/WH = W.BB if(istype(WH)) - WH.gun = src + WH.gun = WEAKREF(src) /obj/item/gun/energy/wormhole_projector/process_chamber() ..() diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 8f2488be7f69..6586d8195ebd 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -871,13 +871,14 @@ finalize_hitscan_and_generate_tracers() STOP_PROCESSING(SSprojectiles, src) cleanup_beam_segments() - qdel(trajectory) + if(trajectory) + QDEL_NULL(trajectory) return ..() /obj/projectile/proc/cleanup_beam_segments() QDEL_LIST_ASSOC(beam_segments) beam_segments = list() - QDEL_NULL(beam_index) //WS edit - Hitscan emitters + QDEL_NULL(beam_index) /obj/projectile/proc/finalize_hitscan_and_generate_tracers(impacting = TRUE) if(trajectory && beam_index) diff --git a/code/modules/projectiles/projectile/special/curse.dm b/code/modules/projectiles/projectile/special/curse.dm index 1993176de157..55827c56e725 100644 --- a/code/modules/projectiles/projectile/special/curse.dm +++ b/code/modules/projectiles/projectile/special/curse.dm @@ -20,6 +20,10 @@ handedness = prob(50) icon_state = "cursehand[handedness]" +/obj/projectile/curse_hand/Destroy() + QDEL_NULL(arm) + return ..() + /obj/projectile/curse_hand/update_icon_state() icon_state = "[initial(icon_state)][handedness]" diff --git a/code/modules/projectiles/projectile/special/wormhole.dm b/code/modules/projectiles/projectile/special/wormhole.dm index 2bc9713f1a03..f35436683377 100644 --- a/code/modules/projectiles/projectile/special/wormhole.dm +++ b/code/modules/projectiles/projectile/special/wormhole.dm @@ -5,7 +5,8 @@ damage = 0 nodamage = TRUE pass_flags = PASSGLASS | PASSTABLE | PASSGRILLE | PASSMOB - var/obj/item/gun/energy/wormhole_projector/gun + //Weakref to the thing that shot us + var/datum/weakref/gun color = "#33CCFF" tracer_type = /obj/effect/projectile/tracer/wormhole impact_type = /obj/effect/projectile/impact/wormhole @@ -23,7 +24,8 @@ /obj/projectile/beam/wormhole/on_hit(atom/target) - if(!gun) + var/obj/item/gun/energy/wormhole_projector/projector = gun.resolve() + if(!projector) qdel(src) return - gun.create_portal(src, get_turf(src)) + projector.create_portal(src, get_turf(src)) diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index a81add0b3d52..a63fa14e868e 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -1,5 +1,5 @@ /datum/reagent/blood - data = list("donor"=null,"viruses"=null,"blood_DNA"=null,"blood_type"=null,"resistances"=null,"trace_chem"=null,"mind"=null,"ckey"=null,"gender"=null,"real_name"=null,"cloneable"=null,"factions"=null,"quirks"=null) + data = list("viruses"=null,"blood_DNA"=null,"blood_type"=null,"resistances"=null,"trace_chem"=null,"mind"=null,"ckey"=null,"gender"=null,"real_name"=null,"cloneable"=null,"factions"=null,"quirks"=null) name = "Blood" color = COLOR_BLOOD metabolization_rate = 5 //fast rate so it disappears fast. diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 527f559dedd9..56808470a623 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -195,12 +195,14 @@ /obj/item/reagent_containers/proc/bartender_check(atom/target) . = FALSE - if(target.CanPass(src, get_turf(src)) && thrownby && HAS_TRAIT(thrownby, TRAIT_BOOZE_SLIDER)) + var/mob/thrown_by = thrownby?.resolve() + if(target.CanPass(src, get_turf(src)) && thrown_by && HAS_TRAIT(thrown_by, TRAIT_BOOZE_SLIDER)) . = TRUE /obj/item/reagent_containers/proc/SplashReagents(atom/target, thrown = FALSE) if(!reagents || !reagents.total_volume || !spillable) return + var/mob/thrown_by = thrownby?.resolve() if(ismob(target) && target.reagents) if(thrown) @@ -213,8 +215,8 @@ for(var/datum/reagent/A in reagents.reagent_list) R += "[A.type] ([num2text(A.volume)])," - if(thrownby) - log_combat(thrownby, M, "splashed", R) + if(thrown_by) + log_combat(thrown_by, M, "splashed", R) reagents.expose(target, TOUCH) else if(bartender_check(target) && thrown) @@ -222,10 +224,10 @@ return else - if(isturf(target) && reagents.reagent_list.len && thrownby) - log_combat(thrownby, target, "splashed (thrown) [english_list(reagents.reagent_list)]", "in [AREACOORD(target)]") - log_game("[key_name(thrownby)] splashed (thrown) [english_list(reagents.reagent_list)] on [target] in [AREACOORD(target)].") - message_admins("[ADMIN_LOOKUPFLW(thrownby)] splashed (thrown) [english_list(reagents.reagent_list)] on [target] in [ADMIN_VERBOSEJMP(target)].") + if(isturf(target) && reagents.reagent_list.len && thrown_by) + log_combat(thrown_by, target, "splashed (thrown) [english_list(reagents.reagent_list)]", "in [AREACOORD(target)]") + log_game("[key_name(thrown_by)] splashed (thrown) [english_list(reagents.reagent_list)] on [target] in [AREACOORD(target)].") + message_admins("[ADMIN_LOOKUPFLW(thrown_by)] splashed (thrown) [english_list(reagents.reagent_list)] on [target] in [ADMIN_VERBOSEJMP(target)].") playsound(src, 'sound/items/glass_splash.ogg', 50, 1) visible_message("[src] spills its contents all over [target].") reagents.expose(target, TOUCH) diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index 50506a0d5984..70b2660f8404 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -44,9 +44,9 @@ Borg Hypospray /obj/item/reagent_containers/borghypo/Destroy() STOP_PROCESSING(SSobj, src) + QDEL_LIST(reagent_list) return ..() - /obj/item/reagent_containers/borghypo/process() //Every [recharge_time] seconds, recharge some reagents for the cyborg charge_tick++ if(charge_tick >= recharge_time) diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index e2bedeef660f..222adad76345 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -140,8 +140,9 @@ else target.visible_message("[user] places [target] in [src].", "[user] places you in [src].") log_combat(user, target, "stuffed", addition="into [src]") - target.LAssailant = user - update_icon() + target.LAssailant = WEAKREF(user) + . = TRUE + update_appearance() /obj/machinery/disposal/relaymove(mob/living/user, direction) attempt_escape(user) diff --git a/code/modules/research/nanites/nanite_chamber.dm b/code/modules/research/nanites/nanite_chamber.dm index cc6eed4ed282..a38733d31447 100644 --- a/code/modules/research/nanites/nanite_chamber.dm +++ b/code/modules/research/nanites/nanite_chamber.dm @@ -11,7 +11,6 @@ idle_power_usage = 50 active_power_usage = 300 - var/obj/machinery/computer/nanite_chamber_control/console var/locked = FALSE var/breakout_time = 1200 var/scan_level diff --git a/code/modules/research/nanites/nanite_chamber_computer.dm b/code/modules/research/nanites/nanite_chamber_computer.dm index da65235772aa..bcacabad3c25 100644 --- a/code/modules/research/nanites/nanite_chamber_computer.dm +++ b/code/modules/research/nanites/nanite_chamber_computer.dm @@ -2,7 +2,6 @@ name = "nanite chamber control console" desc = "Controls a connected nanite chamber. Can inoculate nanites, load programs, and analyze existing nanite swarms." var/obj/machinery/nanite_chamber/chamber - var/obj/item/disk/nanite_program/disk icon_screen = "nanite_chamber_control" circuit = /obj/item/circuitboard/computer/nanite_chamber_control @@ -15,8 +14,7 @@ var/C = locate(/obj/machinery/nanite_chamber, get_step(src, direction)) if(C) var/obj/machinery/nanite_chamber/NC = C - chamber = NC - NC.console = src + set_connected_chamber(NC) /obj/machinery/computer/nanite_chamber_control/interact() if(!chamber) @@ -97,3 +95,14 @@ log_combat(usr, chamber.occupant, "injected", null, "with nanites via [src]") chamber.occupant.investigate_log("was injected with nanites by [key_name(usr)] via [src] at [AREACOORD(src)].", INVESTIGATE_NANITES) . = TRUE + +/obj/machinery/computer/nanite_chamber_control/proc/set_connected_chamber(new_chamber) + if(chamber) + UnregisterSignal(chamber, COMSIG_PARENT_QDELETING) + chamber = new_chamber + if(chamber) + RegisterSignal(chamber, COMSIG_PARENT_QDELETING, .proc/react_to_chamber_del) + +/obj/machinery/computer/nanite_chamber_control/proc/react_to_chamber_del(datum/source) + SIGNAL_HANDLER + set_connected_chamber(null) diff --git a/code/modules/research/nanites/nanite_programs.dm b/code/modules/research/nanites/nanite_programs.dm index 06c7bf13d45f..9f9752fa5cb2 100644 --- a/code/modules/research/nanites/nanite_programs.dm +++ b/code/modules/research/nanites/nanite_programs.dm @@ -69,6 +69,9 @@ on_mob_remove() if(nanites) nanites.programs -= src + for(var/datum/nanite_rule/rule as anything in rules) + rule.remove() + rules.Cut() return ..() /datum/nanite_program/proc/copy() diff --git a/code/modules/research/nanites/nanite_programs/utility.dm b/code/modules/research/nanites/nanite_programs/utility.dm index 7e6237dc5744..73c0b2ea8006 100644 --- a/code/modules/research/nanites/nanite_programs/utility.dm +++ b/code/modules/research/nanites/nanite_programs/utility.dm @@ -324,7 +324,7 @@ /datum/nanite_program/dermal_button/on_mob_remove() . = ..() - qdel(button) + QDEL_NULL(button) /datum/nanite_program/dermal_button/proc/press() if(activated) diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm index be4a4d6714c7..4626e4154cc8 100644 --- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm +++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm @@ -462,7 +462,7 @@ for(var/mob/living/simple_animal/slime/S in range(1, get_turf(owner))) if(!(owner in S.Friends)) to_chat(owner, "[linked_extract] pulses gently as it communicates with [S].") - S.Friends[owner] = 1 + S.set_friendship(owner, 1) return ..() /datum/status_effect/stabilized/orange diff --git a/code/modules/research/xenobiology/crossbreeding/burning.dm b/code/modules/research/xenobiology/crossbreeding/burning.dm index ee581e7ab39c..60a54c461bf1 100644 --- a/code/modules/research/xenobiology/crossbreeding/burning.dm +++ b/code/modules/research/xenobiology/crossbreeding/burning.dm @@ -34,7 +34,7 @@ Burning extracts: /obj/item/slimecross/burning/grey/do_effect(mob/user) var/mob/living/simple_animal/slime/S = new(get_turf(user),"grey") S.visible_message("A baby slime emerges from [src], and it nuzzles [user] before burbling hungrily!") - S.Friends[user] = 20 //Gas, gas, gas + S.set_friendship(user, 20) //Gas, gas, gas S.bodytemperature = T0C + 400 //We gonna step on the gas. S.set_nutrition(S.get_hunger_nutrition()) //Tonight, we fight! ..() @@ -201,10 +201,10 @@ Burning extracts: for(var/mob/living/simple_animal/slime/S in view(7, get_turf(user))) if(user in S.Friends) var/friendliness = S.Friends[user] - S.Friends = list() - S.Friends[user] = friendliness + S.clear_friends() + S.set_friendship(user, friendliness) else - S.Friends = list() + S.clear_friends() S.rabid = 1 S.visible_message("The [S] is driven into a dangerous frenzy!") ..() diff --git a/code/modules/research/xenobiology/xenobio_camera.dm b/code/modules/research/xenobiology/xenobio_camera.dm index ea28f5196e59..d2b1d49f78fe 100644 --- a/code/modules/research/xenobiology/xenobio_camera.dm +++ b/code/modules/research/xenobiology/xenobio_camera.dm @@ -241,7 +241,7 @@ if(X.monkeys >= 1) var/mob/living/carbon/monkey/food = new /mob/living/carbon/monkey(remote_eye.loc, TRUE, owner) if (!QDELETED(food)) - food.LAssailant = C + food.LAssailant = WEAKREF(C) X.monkeys-- X.monkeys = round(X.monkeys, 0.1) //Prevents rounding errors to_chat(owner, "[X] now has [X.monkeys] monkeys stored.") @@ -443,7 +443,7 @@ if(X.monkeys >= 1) var/mob/living/carbon/monkey/food = new /mob/living/carbon/monkey(T, TRUE, C) if (!QDELETED(food)) - food.LAssailant = C + food.LAssailant = WEAKREF(C) X.monkeys-- X.monkeys = round(X.monkeys, 0.1) //Prevents rounding errors to_chat(C, "[X] now has [X.monkeys] monkeys stored.") diff --git a/code/modules/ruins/objects_and_mobs/ash_walker_den.dm b/code/modules/ruins/objects_and_mobs/ash_walker_den.dm index 1538f4d1145a..31a6ee6f0c0f 100644 --- a/code/modules/ruins/objects_and_mobs/ash_walker_den.dm +++ b/code/modules/ruins/objects_and_mobs/ash_walker_den.dm @@ -19,6 +19,7 @@ var/datum/team/ashwalkers/ashies var/last_act = 0 var/init_zlevel = 0 //This is my home, I refuse to settle anywhere else. + var/datum/linked_objective /obj/structure/lavaland/ash_walker/Initialize() .=..() @@ -26,9 +27,17 @@ ashies = new /datum/team/ashwalkers() var/datum/objective/protect_object/objective = new objective.set_target(src) + linked_objective = objective ashies.objectives += objective START_PROCESSING(SSprocessing, src) +/obj/structure/lavaland/ash_walker/Destroy() + ashies.objectives -= linked_objective + ashies = null + QDEL_NULL(linked_objective) + STOP_PROCESSING(SSprocessing, src) + return ..() + /obj/structure/lavaland/ash_walker/deconstruct(disassembled) new /obj/item/assembly/signaler/anomaly (get_step(loc, pick(GLOB.alldirs))) new /obj/effect/collapse(loc) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 6c02ab344cc4..772ecaab7e23 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -879,8 +879,16 @@ var/range = max(width, height) var/long_range = range * 2.5 var/atom/distant_source - if(engine_list[1]) - distant_source = engine_list[1] + var/list/engines = list() + for(var/datum/weakref/engine in engine_list) + var/obj/structure/shuttle/engine/real_engine = engine.resolve() + if(!real_engine) + engine_list -= engine + continue + engines += real_engine + + if(engines[1]) + distant_source = engines[1] else for(var/A in areas) distant_source = locate(/obj/machinery/door) in A @@ -894,11 +902,11 @@ M.playsound_local(distant_source, "sound/runtime/hyperspace/[selected_sound]_distance.ogg", 100) else if(dist_far <= range) var/source - if(engine_list.len == 0) + if(engines.len == 0) source = distant_source else var/closest_dist = 10000 - for(var/obj/O in engine_list) + for(var/obj/O in engines) var/dist_near = get_dist(M, O) if(dist_near < closest_dist) source = O diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index aef9faea7bd6..532c2de3d7be 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -20,6 +20,12 @@ if(has_action) action = new base_action(src) +/obj/effect/proc_holder/Destroy() + if(!QDELETED(action)) + qdel(action) + action = null + return ..() + /obj/effect/proc_holder/proc/on_gain(mob/living/user) return diff --git a/code/modules/spells/spell_types/personality_commune.dm b/code/modules/spells/spell_types/personality_commune.dm index f358f2eb9e7f..1b6389bf3816 100644 --- a/code/modules/spells/spell_types/personality_commune.dm +++ b/code/modules/spells/spell_types/personality_commune.dm @@ -14,6 +14,10 @@ . = ..() trauma = T +/obj/effect/proc_holder/spell/targeted/personality_commune/Destroy() + trauma = null + return ..() + // Pillaged and adapted from telepathy code /obj/effect/proc_holder/spell/targeted/personality_commune/cast(list/targets, mob/user) if(!istype(trauma)) diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index a51f89d3063e..b584d6b6ac2b 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -5,22 +5,38 @@ icon_state = "implant-toolkit" w_class = WEIGHT_CLASS_SMALL actions_types = list(/datum/action/item_action/organ_action/toggle) - - var/list/items_list = list() - // Used to store a list of all items inside, for multi-item implants. - // I would use contents, but they shuffle on every activation/deactivation leading to interface inconsistencies. - - var/obj/item/holder = null - // You can use this var for item path, it would be converted into an item on New() + ///A ref for the arm we're taking up. Mostly for the unregister signal upon removal + var/obj/hand + //A list of typepaths to create and insert into ourself on init + var/list/items_to_create = list() + /// Used to store a list of all items inside, for multi-item implants. + var/list/items_list = list()// I would use contents, but they shuffle on every activation/deactivation leading to interface inconsistencies. + /// You can use this var for item path, it would be converted into an item on New(). + var/obj/item/active_item /obj/item/organ/cyberimp/arm/Initialize() . = ..() - if(ispath(holder)) - holder = new holder(src) + if(ispath(active_item)) + active_item = new active_item(src) + items_list += WEAKREF(active_item) + + for(var/typepath in items_to_create) + var/atom/new_item = new typepath(src) + items_list += WEAKREF(new_item) update_icon() SetSlotFromZone() - items_list = contents.Copy() + +/obj/item/organ/cyberimp/arm/Destroy() + hand = null + active_item = null + for(var/datum/weakref/ref in items_list) + var/obj/item/to_del = ref.resolve() + if(!to_del) + continue + qdel(to_del) + items_list.Cut() + return ..() /obj/item/organ/cyberimp/arm/proc/SetSlotFromZone() switch(zone) @@ -68,40 +84,40 @@ Retract() /obj/item/organ/cyberimp/arm/proc/Retract() - if(!holder || (holder in src)) + if(!active_item || (active_item in src)) return - owner.visible_message("[owner] retracts [holder] back into [owner.p_their()] [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.", - "[holder] snaps back into your [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.", + owner.visible_message("[owner] retracts [active_item] back into [owner.p_their()] [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.", + "[active_item] snaps back into your [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.", "You hear a short mechanical noise.") - if(istype(holder, /obj/item/assembly/flash/armimplant)) - var/obj/item/assembly/flash/F = holder + if(istype(active_item, /obj/item/assembly/flash/armimplant)) + var/obj/item/assembly/flash/F = active_item F.set_light(0) - owner.transferItemToLoc(holder, src, TRUE) - holder = null + owner.transferItemToLoc(active_item, src, TRUE) + active_item = null playsound(get_turf(owner), 'sound/mecha/mechmove03.ogg', 50, TRUE) /obj/item/organ/cyberimp/arm/proc/Extend(obj/item/item) if(!(item in src)) return - holder = item + active_item = item - ADD_TRAIT(holder, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT) - holder.resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF - holder.slot_flags = null - holder.set_custom_materials(null) + ADD_TRAIT(active_item, TRAIT_NODROP, HAND_REPLACEMENT_TRAIT) + active_item.resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF + active_item.slot_flags = null + active_item.set_custom_materials(null) - if(istype(holder, /obj/item/assembly/flash/armimplant)) - var/obj/item/assembly/flash/F = holder + if(istype(active_item, /obj/item/assembly/flash/armimplant)) + var/obj/item/assembly/flash/F = active_item F.set_light(7) var/side = zone == BODY_ZONE_R_ARM? RIGHT_HANDS : LEFT_HANDS var/hand = owner.get_empty_held_index_for_side(side) if(hand) - owner.put_in_hand(holder, hand) + owner.put_in_hand(active_item, hand) else var/list/hand_items = owner.get_held_items_for_side(side, all = TRUE) var/success = FALSE @@ -112,32 +128,36 @@ failure_message += "Your [I] interferes with [src]!" continue to_chat(owner, "You drop [I] to activate [src]!") - success = owner.put_in_hand(holder, owner.get_empty_held_index_for_side(side)) + success = owner.put_in_hand(active_item, owner.get_empty_held_index_for_side(side)) break if(!success) for(var/i in failure_message) to_chat(owner, i) return - owner.visible_message("[owner] extends [holder] from [owner.p_their()] [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.", - "You extend [holder] from your [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.", + owner.visible_message("[owner] extends [active_item] from [owner.p_their()] [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.", + "You extend [active_item] from your [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.", "You hear a short mechanical noise.") playsound(get_turf(owner), 'sound/mecha/mechmove03.ogg', 50, TRUE) /obj/item/organ/cyberimp/arm/ui_action_click() - if((organ_flags & ORGAN_FAILING) || (!holder && !contents.len)) + if((organ_flags & ORGAN_FAILING) || (!active_item && !contents.len)) to_chat(owner, "The implant doesn't respond. It seems to be broken...") return - if(!holder || (holder in src)) - holder = null + if(!active_item || (active_item in src)) + active_item = null if(contents.len == 1) Extend(contents[1]) else var/list/choice_list = list() - for(var/obj/item/I in items_list) - choice_list[I] = image(I) + for(var/datum/weakref/augment_ref in items_list) + var/obj/item/augment_item = augment_ref.resolve() + if(!augment_item) + items_list -= augment_ref + continue + choice_list[augment_item] = image(augment_item) var/obj/item/choice = show_radial_menu(owner, owner, choice_list) - if(owner && owner == usr && owner.stat != DEAD && (src in owner.internal_organs) && !holder && (choice in contents)) + if(owner && owner == usr && owner.stat != DEAD && (src in owner.internal_organs) && !active_item && (choice in contents)) // This monster sanity check is a nice example of how bad input is. Extend(choice) else @@ -163,7 +183,7 @@ name = "arm-mounted laser implant" desc = "A variant of the arm cannon implant that fires lethal laser beams. The cannon emerges from the subject's arm and remains inside when not in use." icon_state = "arm_laser" - contents = newlist(/obj/item/gun/energy/laser/mounted) + items_to_create = list(/obj/item/gun/energy/laser/mounted) /obj/item/organ/cyberimp/arm/gun/laser/l zone = BODY_ZONE_L_ARM @@ -173,7 +193,7 @@ name = "arm-mounted taser implant" desc = "A variant of the arm cannon implant that fires electrodes and disabler shots. The cannon emerges from the subject's arm and remains inside when not in use." icon_state = "arm_taser" - contents = newlist(/obj/item/gun/energy/e_gun/advtaser/mounted) + items_to_create = list(/obj/item/gun/energy/e_gun/advtaser/mounted) /obj/item/organ/cyberimp/arm/gun/taser/l zone = BODY_ZONE_L_ARM @@ -181,64 +201,82 @@ /obj/item/organ/cyberimp/arm/toolset name = "integrated toolset implant" desc = "A stripped-down version of the engineering cyborg toolset, designed to be installed on subject's arm. Contain advanced versions of every tool." - contents = newlist(/obj/item/screwdriver/cyborg, /obj/item/wrench/cyborg, /obj/item/weldingtool/largetank/cyborg, + items_to_create = list(/obj/item/screwdriver/cyborg, /obj/item/wrench/cyborg, /obj/item/weldingtool/largetank/cyborg, /obj/item/crowbar/cyborg, /obj/item/wirecutters/cyborg, /obj/item/multitool/cyborg) /obj/item/organ/cyberimp/arm/toolset/l zone = BODY_ZONE_L_ARM /obj/item/organ/cyberimp/arm/toolset/emag_act(mob/user) - if(!(locate(/obj/item/kitchen/knife/combat/cyborg) in items_list)) - to_chat(user, "You unlock [src]'s integrated knife!") - items_list += new /obj/item/kitchen/knife/combat/cyborg(src) - return 1 - return 0 + for(var/datum/weakref/created_item in items_list) + var/obj/potential_knife = created_item.resolve() + if(istype(/obj/item/kitchen/knife/combat/cyborg, potential_knife)) + return FALSE + + to_chat(user, "You unlock [src]'s integrated knife!") + items_list += WEAKREF(new /obj/item/kitchen/knife/combat/cyborg(src)) + return TRUE /obj/item/organ/cyberimp/arm/esword name = "arm-mounted energy blade" desc = "An illegal and highly dangerous cybernetic implant that can project a deadly blade of concentrated energy." - contents = newlist(/obj/item/melee/transforming/energy/blade/hardlight) + items_to_create = list(/obj/item/melee/transforming/energy/blade/hardlight) /obj/item/organ/cyberimp/arm/medibeam name = "integrated medical beamgun" desc = "A cybernetic implant that allows the user to project a healing beam from their hand." - contents = newlist(/obj/item/gun/medbeam) + items_to_create = list(/obj/item/gun/medbeam) /obj/item/organ/cyberimp/arm/flash name = "integrated high-intensity photon projector" //Why not desc = "An integrated projector mounted onto a user's arm that is able to be used as a powerful flash." - contents = newlist(/obj/item/assembly/flash/armimplant) + items_to_create = list(/obj/item/assembly/flash/armimplant) /obj/item/organ/cyberimp/arm/flash/Initialize() . = ..() - if(locate(/obj/item/assembly/flash/armimplant) in items_list) - var/obj/item/assembly/flash/armimplant/F = locate(/obj/item/assembly/flash/armimplant) in items_list - F.I = src + for(var/datum/weakref/created_item in items_list) + var/obj/potential_flash = created_item.resolve() + if(!istype(/obj/item/assembly/flash/armimplant, potential_flash)) + continue + var/obj/item/assembly/flash/armimplant/flash = potential_flash + flash.arm = WEAKREF(src) // Todo: wipe single letter vars out of assembly code + +/obj/item/organ/cyberimp/arm/flash/Extend() + . = ..() + active_item.set_light_range(7) + active_item.set_light_on(TRUE) + +/obj/item/organ/cyberimp/arm/flash/Retract() + active_item.set_light_on(FALSE) + return ..() /obj/item/organ/cyberimp/arm/baton name = "arm electrification implant" desc = "An illegal combat implant that allows the user to administer disabling shocks from their arm." - contents = newlist(/obj/item/borg/stun) + items_to_create = list(/obj/item/borg/stun) /obj/item/organ/cyberimp/arm/combat name = "combat cybernetics implant" desc = "A powerful cybernetic implant that contains combat modules built into the user's arm." - contents = newlist(/obj/item/melee/transforming/energy/blade/hardlight, /obj/item/gun/medbeam, /obj/item/borg/stun, /obj/item/assembly/flash/armimplant) + items_to_create = list(/obj/item/melee/transforming/energy/blade/hardlight, /obj/item/gun/medbeam, /obj/item/borg/stun, /obj/item/assembly/flash/armimplant) /obj/item/organ/cyberimp/arm/combat/Initialize() . = ..() - if(locate(/obj/item/assembly/flash/armimplant) in items_list) - var/obj/item/assembly/flash/armimplant/F = locate(/obj/item/assembly/flash/armimplant) in items_list - F.I = src + for(var/datum/weakref/created_item in items_list) + var/obj/potential_flash = created_item.resolve() + if(!istype(/obj/item/assembly/flash/armimplant, potential_flash)) + continue + var/obj/item/assembly/flash/armimplant/flash = potential_flash + flash.arm = WEAKREF(src) // Todo: wipe single letter vars out of assembly code /obj/item/organ/cyberimp/arm/surgery name = "surgical toolset implant" desc = "A set of surgical tools hidden behind a concealed panel on the user's arm." - contents = newlist(/obj/item/retractor/augment, /obj/item/hemostat/augment, /obj/item/cautery/augment, /obj/item/surgicaldrill/augment, /obj/item/scalpel/augment, /obj/item/circular_saw/augment) + items_to_create = list(/obj/item/retractor/augment, /obj/item/hemostat/augment, /obj/item/cautery/augment, /obj/item/surgicaldrill/augment, /obj/item/scalpel/augment, /obj/item/circular_saw/augment) /obj/item/organ/cyberimp/arm/power_cord name = "power cord implant" desc = "An internal power cord hooked up to a battery. Useful if you run on volts." - contents = newlist(/obj/item/apc_powercord) + contents = list(/obj/item/apc_powercord) zone = "l_arm" diff --git a/code/modules/tgui/tgui_alert.dm b/code/modules/tgui/tgui_alert.dm index 1a86cca705bd..9d2dd3b5a059 100644 --- a/code/modules/tgui/tgui_alert.dm +++ b/code/modules/tgui/tgui_alert.dm @@ -90,7 +90,7 @@ * the window was closed by the user. */ /datum/tgui_modal/proc/wait() - while (!choice && !closed) + while (!choice && !closed && !QDELETED(src)) stoplag(1) /datum/tgui_modal/ui_interact(mob/user, datum/tgui/ui) diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index 26aafc42aee9..2f0ca46f6ce5 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -65,7 +65,7 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C var/vend_ready = TRUE ///Next world time to send a purchase message var/purchase_message_cooldown - ///Last mob to shop with us + ///The ref of the last mob to shop with us var/last_shopper var/tilted = FALSE var/tiltable = TRUE @@ -802,10 +802,10 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C D.adjust_money(price_to_use) SSblackbox.record_feedback("amount", "vending_spent", price_to_use) log_econ("[price_to_use] credits were inserted into [src] by [D.account_holder] to buy [R].") - if(last_shopper != usr || purchase_message_cooldown < world.time) + if(last_shopper != REF(usr) || purchase_message_cooldown < world.time) say("Thank you for shopping with [src]!") purchase_message_cooldown = world.time + 5 SECONDS - last_shopper = usr + last_shopper = REF(usr) use_power(5) if(icon_vend) //Show the vending animation if needed flick(icon_vend,src) @@ -1041,10 +1041,10 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C S.forceMove(drop_location()) loaded_items-- use_power(5) - if(last_shopper != usr || purchase_message_cooldown < world.time) + if(last_shopper != REF(usr) || purchase_message_cooldown < world.time) say("Thank you for buying local and purchasing [S]!") purchase_message_cooldown = world.time + 5 SECONDS - last_shopper = usr + last_shopper = REF(usr) vend_ready = TRUE updateUsrDialog() return diff --git a/code/modules/zombie/organs.dm b/code/modules/zombie/organs.dm index 34397a98c888..02919f32a758 100644 --- a/code/modules/zombie/organs.dm +++ b/code/modules/zombie/organs.dm @@ -30,7 +30,7 @@ /obj/item/organ/zombie_infection/Remove(mob/living/carbon/M, special = 0) . = ..() STOP_PROCESSING(SSobj, src) - if(iszombie(M) && old_species && !special) + if(iszombie(M) && old_species && !QDELETED(M) && !special) M.set_species(old_species) if(timer_id) deltimer(timer_id) From c0d69c43a4b30f5058cf563c0a437b2ac92c01e1 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Sun, 15 Aug 2021 21:09:26 -0700 Subject: [PATCH 009/147] Del The World: Unit testing for hard deletes (#59612) Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> --- .github/CONTRIBUTING.md | 4 + .github/HARDDEL_GUIDE.md | 265 ++++++++++++++++++ code/__DEFINES/atoms.dm | 4 + code/_compile_options.dm | 4 +- code/_onclick/hud/credits.dm | 8 +- code/_onclick/hud/families.dm | 2 + code/_onclick/hud/robot.dm | 12 + code/_onclick/hud/screen_objects.dm | 2 + code/controllers/subsystem/atoms.dm | 10 - code/datums/brain_damage/imaginary_friend.dm | 5 +- code/datums/components/udder.dm | 2 + code/datums/datum.dm | 7 +- code/datums/hud.dm | 11 +- code/game/machinery/launch_pad.dm | 7 +- code/game/machinery/navbeacon.dm | 2 + code/game/objects/effects/decals/crayon.dm | 2 +- .../effects/effect_system/effect_shield.dm | 2 +- code/game/objects/items/RSF.dm | 3 +- .../objects/items/devices/chameleonproj.dm | 4 +- .../items/devices/forcefieldprojector.dm | 8 +- .../objects/items/grenades/clusterbuster.dm | 3 +- code/game/objects/items/storage/fancy.dm | 2 + .../crates_lockers/closets/secure/freezer.dm | 2 +- code/game/objects/structures/manned_turret.dm | 2 +- code/game/objects/structures/traps.dm | 3 + code/game/turfs/open/openspace.dm | 3 + .../view_variables/reference_tracking.dm | 11 +- code/modules/antagonists/cult/blood_magic.dm | 9 +- code/modules/antagonists/revenant/revenant.dm | 2 +- .../traitor/equipment/Malf_Modules.dm | 19 +- code/modules/buildmode/effects/line.dm | 3 + code/modules/cargo/gondolapod.dm | 5 +- code/modules/cargo/supplypod.dm | 3 + code/modules/flufftext/Hallucination.dm | 3 + code/modules/holodeck/computer.dm | 2 +- code/modules/hydroponics/grown.dm | 3 + code/modules/hydroponics/seeds.dm | 2 +- code/modules/mapping/mapping_helpers.dm | 11 +- code/modules/mining/fulton.dm | 2 +- .../mining/lavaland/necropolis_chests.dm | 6 + code/modules/mining/minebot.dm | 1 + code/modules/mob/living/blood.dm | 2 + .../carbon/human/species_types/jellypeople.dm | 2 +- .../carbon/human/species_types/snail.dm | 6 + code/modules/mob/living/inhand_holder.dm | 6 + code/modules/mob/living/silicon/ai/ai.dm | 2 +- .../modules/mob/living/silicon/robot/robot.dm | 2 +- .../simple_animal/guardian/types/support.dm | 2 +- .../hostile/megafauna/wendigo.dm | 2 + .../hostile/mining_mobs/curse_blob.dm | 3 +- code/modules/power/apc.dm | 17 +- .../power/singularity/containment_field.dm | 22 +- code/modules/projectiles/gun.dm | 2 + .../projectiles/guns/energy/dueling.dm | 11 +- code/modules/projectiles/guns/magic.dm | 3 +- code/modules/projectiles/projectile.dm | 10 +- code/modules/projectiles/projectile/magic.dm | 1 + .../projectiles/projectile/special/gravity.dm | 6 +- .../projectile/special/hallucination.dm | 2 +- code/modules/research/designs.dm | 1 + .../modules/ruins/lavalandruin_code/puzzle.dm | 3 +- code/modules/shuttle/shuttle.dm | 4 + code/modules/spells/spell_types/lichdom.dm | 3 + code/modules/spells/spell_types/shapeshift.dm | 3 +- .../spells/spell_types/touch_attacks.dm | 6 +- code/modules/surgery/organs/augments_arms.dm | 2 +- code/modules/unit_tests/_unit_tests.dm | 9 + code/modules/unit_tests/create_and_destroy.dm | 168 +++++++++++ .../unit_tests/find_reference_sanity.dm | 23 ++ code/modules/unit_tests/unit_test.dm | 58 ++-- code/modules/vehicles/atv.dm | 42 +-- shiptest.dme | 1 + 72 files changed, 749 insertions(+), 136 deletions(-) create mode 100644 .github/HARDDEL_GUIDE.md create mode 100644 code/__DEFINES/atoms.dm create mode 100644 code/modules/unit_tests/create_and_destroy.dm diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 64a36fb4c17b..70f333da19f9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -350,6 +350,10 @@ This prevents nesting levels from getting deeper then they need to be. - [tgui/README.md](../tgui/README.md) - [tgui/tutorial-and-examples.md](../tgui/docs/tutorial-and-examples.md) +### Don't create code that hangs references + +This is part of the larger issue of hard deletes, read this file for more info: [Guide to Harddels](HARDDEL_GUIDE.md)) + ### Other Notes - Code should be modular where possible; if you are working on a new addition, then strongly consider putting it in its own file unless it makes sense to put it with similar ones (i.e. a new tool would go in the "tools.dm" file) diff --git a/.github/HARDDEL_GUIDE.md b/.github/HARDDEL_GUIDE.md new file mode 100644 index 000000000000..4790150ea0d2 --- /dev/null +++ b/.github/HARDDEL_GUIDE.md @@ -0,0 +1,265 @@ +# Hard Deletes +1. [What is hard deletion](#What-is-hard-deletion) +2. [Causes of hard deletes](#causes-of-hard-deletes) +3. [Detecting hard deletes](#detecting-hard-deletes) +4. [Techniques for fixing hard deletes](#techniques-for-fixing-hard-deletes) +5. [Help my code is erroring how fix](#help-my-code-is-erroring-how-fix) + +## What is Hard Deletion +Hard deletion is a very expensive operation that basically clears all references to some "thing" from memory. Objects that undergo this process are referred to as hard deletes, or simply harddels + +What follows is a discussion of the theory behind this, why we would ever do it, and the what we do to avoid doing it as often as possible + +I'm gonna be using words like references and garbage collection, but don't worry, it's not complex, just a bit hard to pierce + +### Why do we need to Hard Delete? + +Ok so let's say you're some guy called Jerry, and you're writing a programming language + +You want your coders to be able to pass around objects without doing a full copy. So you'll store the pack of data somewhere in memory + +```dm +/someobject + var/id = 42 + var/name = "some shit" +``` + +Then you want them to be able to pass that object into say a proc, without doing a full copy. So you let them pass in the object's location in memory instead +This is called passing something by reference + +```dm +someshit(someobject) //This isn't making a copy of someobject, it's passing in a reference to it +``` + +This of course means they can store that location in memory in another object's vars, or in a list, or whatever + +```dm +/datum + var/reference + +/proc/someshit(mem_location) + var/datum/some_obj = new() + some_obj.reference = mem_location +``` + +But what happens when you get rid of the object we're passing around references to? If we just cleared it out from memory, everything that holds a reference to it would suddenly be pointing to nowhere, or worse, something totally different! + +So then, you've gotta do something to clean up these references when you want to delete an object + +We could hold a list of references to everything that references us, but god, that'd get really expensive wouldn't it + +Why not keep count of how many times we're referenced then? If an object's ref count is ever 0, nothing whatsoever cares about it, so we can freely get rid of it + +But if something's holding onto a reference to us, we're not gonna have any idea where or what it is + +So I guess you should scan all of memory for that reference? + +```dm +del(someobject) //We now need to scan memory until we find the thing holding a ref to us, and clear it +``` + +This pattern is about how BYOND handles this problem of hanging references, or Garbage Collection + +It's not a broken system, but as you can imagine scanning all of memory gets expensive fast + +What can we do to help that? + +### How we can avoid hard deletes + +If hard deletion is so slow, we're gonna need to clean up all our references ourselves + +In our codebase we do this with `/datum/proc/Destroy()`, a proc called by `qdel()`, whose purpose I will explain later + +This procs only job is cleaning up references to the object it's called on. Nothing more, nothing else. Don't let me catch you giving it side effects + +There's a long long list of things this does, since we use it a TON. So I can't really give you a short description. It will always move the object to nullspace though + +## Causes Of Hard Deletes + +Now that you know the theory, let's go over what can actually cause hard deletes. Some of this is obvious, some of it's much less so. + +The BYOND reference has a list [Here](https://secure.byond.com/docs/ref/#/DM/garbage), but it's not a complete one + +* Stored in a var +* An item in a list, or associated with a list item +* Has a tag +* Is on the map (always true for turfs) +* Inside another atom's contents +* Inside an atom's vis_contents +* A temporary value in a still-running proc +* Is a mob with a key +* Is an image object attached to an atom + +Let's briefly go over the more painful ones yeah? + +### Sleeping procs + +Any proc that calls `sleep()`, `spawn()`, or anything that creates a seperate "thread" (not technically a thread, but it's the same in these terms. Not gonna cause any race conditions tho) will hang references to any var inside it. This includes the usr it started from, the src it was called on, and any vars created as a part of processing + +### Static vars + +`/static` and `/global` vars count for this too, they'll hang references just as well as anything. Be wary of this, these suckers can be a pain to solve + +### Range() and View() like procs + +Some internal BYOND procs will hold references to objects passed into them for a time after the proc is finished doing work, because they cache the returned info to make some code faster. You should never run into this issue, since we wait for what should be long enough to avoid this issue as a part of garbage collection + +This is what `qdel()` does by the by, it literally just means queue deletion. A reference to the object gets put into a queue, and if it still exists after 5 minutes or so, we hard delete it + +### Walk() procs + +Calling `walk()` on something will put it in an internal queue, which it'll remain in until `walk(thing, 0)` is called on it, which removes it from the queue + +This sort is very cheap to harddel, since BYOND prioritizes checking this queue first when it's clearing refs, but it should be avoided since it causes false positives + +You can read more about how BYOND prioritizes these things [Here](https://www.patreon.com/posts/diving-for-35855766) + +## Detecting Hard Deletes + +For very simple hard deletes, simple inspection should be enough to find them. Look at what the object does during `Initialize()`, and see if it's doing anything it doesn't undo later. +If that fails, search the object's typepath, and look and see if anything is holding a reference to it without regard for the object deleting + +BYOND currently doesn't have the capability to give us information about where a hard delete is. Fortunately we can search for most all of then ourselves. +The procs to perform this search are hidden behind compile time defines, since they'd be way too risky to expose to admin button pressing + +If you're having issues solving a harddel and want to perform this check yourself, go to `_compile_options.dm` and uncomment `TESTING`, `REFERENCE_TRACKING`, and `GC_FAILURE_HARD_LOOKUP` + +You can read more about what each of these do in that file, but the long and short of it is if something would hard delete our code will search for the reference (This will look like your game crashing, just hold out) and print information about anything it finds to the runtime log, which you can find inside the round folder inside `/data/logs/year/month/day` + +It'll tell you what object is holding the ref if it's in an object, or what pattern of list transversal was required to find the ref if it's hiding in a list of some sort + +## Techniques For Fixing Hard Deletes + +Once you've found the issue, it becomes a matter of making sure the ref is cleared as a part of Destroy(). I'm gonna walk you through a few patterns and discuss how you might go about fixing them + +### Our Tools + +First and simplest we have `Destroy()`. Use this to clean up after yourself for simple cases + +```dm +/someobject/Initialize() + . = ..() + GLOB.somethings += src //We add ourselves to some global list + +/someobject/Destroy() + GLOB.somethings -= src //So when we Destroy() clean yourself from the list + return ..() +``` + +Next, and slightly more complex, pairs of objects that reference each other + +This is helpful when for cases where both objects "own" each other + +```dm +/someobject + var/someotherobject/buddy + +/someotherobject + var/someobject/friend + +/someobject/Initialize() + if(!buddy) + buddy = new() + buddy.friend = src + +/someotherobject/Initialize() + if(!friend) + friend = new() + friend.buddy = src + +/someobject/Destroy() + if(buddy) + buddy.friend = null //Make sure to clear their ref to you + buddy = null //We clear our ref to them to make sure nothing goes wrong + +/someotherobject/Destroy() + if(friend) + friend.buddy = null //Make sure to clear their ref to you + friend = null //We clear our ref to them to make sure nothing goes wrong +``` + +Something similar can be accomplished with `QDELETED()`, a define that checks to see if something has started being `Destroy()`'d yet, and `QDEL_NULL()`, a define that `qdel()`'s a var and then sets it to null + +Now let's discuss something a bit more complex, weakrefs + +You'll need a bit of context, so let's do that now + +BYOND has an internal bit of behavior that looks like this + +`var/string = "\ref[someobject]"` + +This essentially gets that object's position in memory directly. Unlike normal references, this doesn't count for hard deletes. You can retrieve the object in question by using `locate()` + +`var/someobject/someobj = locate(string)` + +This has some flaws however, since the bit of memory we're pointing to might change, which would cause issues. Fortunately we've developed a datum to handle worrying about this for you, `/datum/weakref` + +You can create one using the `WEAKREF()` proc, and use weakref.resolve() to retrieve the actual object + +This should be used for things that your object doesn't "own", but still cares about + +For instance, a paper bin would own the paper inside it, but the paper inside it would just hold a weakref to the bin + +There's no need to clean these up, just make sure you account for it being null, since it'll return that if the object doesn't exist or has been queued for deletion + +```dm +/someobject + var/datum/weakref/our_coin + +/someobject/proc/set_coin(/obj/item/coin/new_coin) + our_coin = WEAKREF(new_coin) + +/someobject/proc/get_value() + if(!our_coin) + return 0 + + var/obj/item/coin/potential_coin = our_coin.resolve() + if(!potential_coin) + our_coin = null //Remember to clear the weakref if we get nothing + return 0 + return potential_coin.value +``` + +Now, for the worst case scenario + +Let's say you've got a var that's used too often to be weakref'd without making the code too expensive + +You can't hold a paired reference to it because it's not like it would ever care about you outside of just clearing the ref + +So then, we want to temporarily remember to clear a reference when it's deleted + +This is where I might lose you, but we're gonna use signals + +`qdel()`, the proc that sets off this whole deletion business, sends a signal called `COMSIG_PARENT_QDELETING` + +We can listen for that signal, and if we hear it clear whatever reference we may have + +Here's an example + +```dm +/somemob + var/mob/target + +/somemob/proc/set_target(new_target) + if(target) + UnregisterSignal(target, COMSIG_PARENT_QDELETING) //We need to make sure any old signals are cleared + target = new_target + if(target) + RegisterSignal(target, COMSIG_PARENT_QDELETING, .proc/clear_target) //Call clear_target if target is ever qdel()'d + +/somemob/proc/clear_target(datum/source) + SIGNAL_HANDLER + set_target(null) +``` + +This really should be your last resort, since signals have some limitations. If some subtype of somemob also registered for parent_qdeleting on the same target you'd get a runtime, since signals don't support it + +But if you can't do anything else for reasons of conversion ease, or hot code, this will work + +## Help My Code Is Erroring How Fix + +First, do a quick check. + +Are you doing anything to the object in `Initialize()` that you don't undo in `Destroy()`? I don't mean like, setting its name, but are you adding it to any lists, stuff like that + +If this fails, you're just gonna have to read over this doc. You can skip the theory if you'd like, but it's all pretty important for having an understanding of this problem diff --git a/code/__DEFINES/atoms.dm b/code/__DEFINES/atoms.dm new file mode 100644 index 000000000000..3c7b67070f88 --- /dev/null +++ b/code/__DEFINES/atoms.dm @@ -0,0 +1,4 @@ +#define BAD_INIT_QDEL_BEFORE 1 +#define BAD_INIT_DIDNT_INIT 2 +#define BAD_INIT_SLEPT 4 +#define BAD_INIT_NO_HINT 8 diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 8f5accdf0c04..fde08e7e235a 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -1,4 +1,4 @@ -//#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this +#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this //uncommented, but not visible in the release version) //#define DATUMVAR_DEBUGGING_MODE //Enables the ability to cache datum vars and retrieve later for debugging which vars changed. @@ -32,7 +32,7 @@ //#define VISUALIZE_ACTIVE_TURFS //Highlights atmos active turfs in green #endif //ifdef TESTING -//#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER +#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER #ifndef PRELOAD_RSC //set to: #define PRELOAD_RSC 2 // 0 to allow using external resources or on-demand behaviour; diff --git a/code/_onclick/hud/credits.dm b/code/_onclick/hud/credits.dm index 603754d2c093..01e4cd1de1f4 100644 --- a/code/_onclick/hud/credits.dm +++ b/code/_onclick/hud/credits.dm @@ -63,11 +63,15 @@ GLOBAL_LIST_INIT(patrons, world.file2list("[global.config.directory]/patrons.txt QDEL_IN(src, CREDIT_ROLL_SPEED) /atom/movable/screen/credit/proc/add_to_clients() - for(var/client/C in GLOB.clients) - if(C.prefs.show_credits) + for(var/client/C as anything in GLOB.clients) + if(C?.prefs.show_credits) C.screen += src /atom/movable/screen/credit/Destroy() + for(var/client/C as anything in GLOB.clients) + if(!C) + continue + C.screen -= src screen_loc = null return ..() diff --git a/code/_onclick/hud/families.dm b/code/_onclick/hud/families.dm index eb4bc2239c6a..ae523450cb82 100644 --- a/code/_onclick/hud/families.dm +++ b/code/_onclick/hud/families.dm @@ -12,6 +12,8 @@ /atom/movable/screen/wanted/Initialize() . = ..() var/datum/game_mode/gang/F = SSticker.mode + if(!istype(F)) + return level = F.wanted_level cops_arrived = F.cops_arrived update_icon() diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm index 5cd8edc36871..baa6e5a63270 100644 --- a/code/_onclick/hud/robot.dm +++ b/code/_onclick/hud/robot.dm @@ -284,6 +284,12 @@ else icon_state = "lamp_off" +/atom/movable/screen/robot/lamp/Destroy() + if(robot) + robot.lampButton = null + robot = null + return ..() + /atom/movable/screen/robot/modPC name = "Modular Interface" icon_state = "template" @@ -295,6 +301,12 @@ return robot.modularInterface?.interact(robot) +/atom/movable/screen/robot/modPC/Destroy() + if(robot) + robot.interfaceButton = null + robot = null + return ..() + /atom/movable/screen/robot/alerts name = "Alert Panel" icon = 'icons/hud/screen_ai.dmi' diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 26c09f79db29..c3e6b18e5404 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -686,6 +686,8 @@ /atom/movable/screen/splash/New(client/C, visible, use_previous_title) //TODO: Make this use INITIALIZE_IMMEDIATE, except its not easy . = ..() + if(!istype(C)) + return holder = C diff --git a/code/controllers/subsystem/atoms.dm b/code/controllers/subsystem/atoms.dm index 0c3ea203065c..ee629f41fac1 100644 --- a/code/controllers/subsystem/atoms.dm +++ b/code/controllers/subsystem/atoms.dm @@ -1,8 +1,3 @@ -#define BAD_INIT_QDEL_BEFORE 1 -#define BAD_INIT_DIDNT_INIT 2 -#define BAD_INIT_SLEPT 4 -#define BAD_INIT_NO_HINT 8 - SUBSYSTEM_DEF(atoms) name = "Atoms" init_order = INIT_ORDER_ATOMS @@ -169,8 +164,3 @@ SUBSYSTEM_DEF(atoms) var/initlog = InitLog() if(initlog) text2file(initlog, "[GLOB.log_directory]/initialize.log") - -#undef BAD_INIT_QDEL_BEFORE -#undef BAD_INIT_DIDNT_INIT -#undef BAD_INIT_SLEPT -#undef BAD_INIT_NO_HINT diff --git a/code/datums/brain_damage/imaginary_friend.dm b/code/datums/brain_damage/imaginary_friend.dm index 2526c4bc9766..7a9e61500de6 100644 --- a/code/datums/brain_damage/imaginary_friend.dm +++ b/code/datums/brain_damage/imaginary_friend.dm @@ -89,6 +89,9 @@ to_chat(src, "You cannot directly influence the world around you, but you can see what [owner] cannot.") /mob/camera/imaginary_friend/Initialize(mapload, _trauma) + if(!_trauma) + stack_trace("Imaginary friend created without trauma, wtf") + return INITIALIZE_HINT_QDEL . = ..() trauma = _trauma @@ -131,7 +134,7 @@ client.images |= current_image /mob/camera/imaginary_friend/Destroy() - if(owner.client) + if(owner?.client) owner.client.images.Remove(human_image) if(client) client.images.Remove(human_image) diff --git a/code/datums/components/udder.dm b/code/datums/components/udder.dm index b9687dd8e05a..062b291e027c 100644 --- a/code/datums/components/udder.dm +++ b/code/datums/components/udder.dm @@ -134,6 +134,8 @@ name = "\proper nutrient sac" /obj/item/udder/gutlunch/initial_conditions() + if(!udder_mob) + return if(udder_mob.gender == FEMALE) START_PROCESSING(SSobj, src) RegisterSignal(udder_mob, COMSIG_HOSTILE_ATTACKINGTARGET, .proc/on_mob_attacking) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 50249df3c282..ff29802f10d1 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -95,8 +95,13 @@ continue qdel(timer) - //BEGIN: ECS SHIT + #ifdef REFERENCE_TRACKING + #ifdef REFERENCE_TRACKING_DEBUG + found_refs = null + #endif + #endif + //BEGIN: ECS SHIT var/list/dc = datum_components if(dc) var/all_components = dc[/datum/component] diff --git a/code/datums/hud.dm b/code/datums/hud.dm index eb01b49e0dc2..32e93a2d1c45 100644 --- a/code/datums/hud.dm +++ b/code/datums/hud.dm @@ -47,16 +47,17 @@ GLOBAL_LIST_INIT(huds, list( /datum/atom_hud/Destroy() for(var/v in hudusers) - remove_hud_from(v, TRUE) + remove_hud_from(v) for(var/v in hudatoms) remove_from_hud(v) GLOB.all_huds -= src return ..() -/datum/atom_hud/proc/remove_hud_from(mob/M, force = FALSE) +/datum/atom_hud/proc/remove_hud_from(mob/M, absolute = FALSE) if(!M || !hudusers[M]) return - if (force || !--hudusers[M]) + if (absolute || !--hudusers[M]) + UnregisterSignal(M, COMSIG_PARENT_QDELETING) hudusers -= M if(next_time_allowed[M]) next_time_allowed -= M @@ -67,7 +68,7 @@ GLOBAL_LIST_INIT(huds, list( remove_from_single_hud(M, A) /datum/atom_hud/proc/remove_from_hud(atom/A) - if(!A || !(A in hudatoms)) + if(!A) return FALSE for(var/mob/M in hudusers) remove_from_single_hud(M, A) @@ -141,7 +142,7 @@ GLOBAL_LIST_INIT(huds, list( //MOB PROCS /mob/proc/reload_huds() for(var/datum/atom_hud/hud in GLOB.all_huds) - if(hud && hud.hudusers[src]) + if(hud?.hudusers[src]) for(var/atom/A in hud.hudatoms) hud.add_to_single_hud(src, A) diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index a07ec960ed63..c7752a8cbfaa 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -233,7 +233,9 @@ src.briefcase = briefcase /obj/machinery/launchpad/briefcase/Destroy() - QDEL_NULL(briefcase) + if(!QDELETED(briefcase)) + qdel(briefcase) + briefcase = null return ..() /obj/machinery/launchpad/briefcase/isAvailable() @@ -275,7 +277,8 @@ /obj/item/storage/briefcase/launchpad/Destroy() if(!QDELETED(pad)) - QDEL_NULL(pad) + qdel(pad) + pad = null return ..() /obj/item/storage/briefcase/launchpad/PopulateContents() diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index 39bf5d2efe98..be5d2d31e1a7 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -79,6 +79,8 @@ /obj/machinery/navbeacon/proc/glob_lists_register(init=FALSE) if(!init) glob_lists_deregister() + if(!codes) + return if(codes["patrol"]) if(!GLOB.navbeacons["[z]"]) GLOB.navbeacons["[z]"] = list() diff --git a/code/game/objects/effects/decals/crayon.dm b/code/game/objects/effects/decals/crayon.dm index 4bb99fe98b22..173764fdf198 100644 --- a/code/game/objects/effects/decals/crayon.dm +++ b/code/game/objects/effects/decals/crayon.dm @@ -46,4 +46,4 @@ GLOBAL_LIST(gang_tags) /obj/effect/decal/cleanable/crayon/gang/Destroy() LAZYREMOVE(GLOB.gang_tags, src) - ..() + return ..() diff --git a/code/game/objects/effects/effect_system/effect_shield.dm b/code/game/objects/effects/effect_system/effect_shield.dm index 4344fbb26076..00f943aa138e 100644 --- a/code/game/objects/effects/effect_system/effect_shield.dm +++ b/code/game/objects/effects/effect_system/effect_shield.dm @@ -16,7 +16,7 @@ /obj/effect/shield/Destroy() var/turf/location = get_turf(src) location.heat_capacity=old_heat_capacity - ..() + return ..() /obj/effect/shield/singularity_act() return diff --git a/code/game/objects/items/RSF.dm b/code/game/objects/items/RSF.dm index 9a0f8d069ab8..a6bdb4534b9b 100644 --- a/code/game/objects/items/RSF.dm +++ b/code/game/objects/items/RSF.dm @@ -46,7 +46,7 @@ RSF /obj/item/rsf/Initialize() . = ..() - to_dispense = cost_by_item[1] + to_dispense ||= cost_by_item[1] /obj/item/rsf/examine(mob/user) . = ..() @@ -152,6 +152,7 @@ RSF dispense_cost = 100 discriptor = "cookie-units" action_type = "Fabricates" + to_dispense = /obj/item/reagent_containers/food/snacks/cookie ///Tracks whether or not the cookiesynth is about to print a poisoned cookie var/toxin = FALSE //This might be better suited to some initialize fuckery, but I don't have a good "poisoned" sprite ///Holds a copy of world.time taken the last time the synth gained a charge. Used with cooldowndelay to track when the next charge should be gained diff --git a/code/game/objects/items/devices/chameleonproj.dm b/code/game/objects/items/devices/chameleonproj.dm index 40a52a23c6c1..18038aadfe05 100644 --- a/code/game/objects/items/devices/chameleonproj.dm +++ b/code/game/objects/items/devices/chameleonproj.dm @@ -176,5 +176,7 @@ return /obj/effect/dummy/chameleon/Destroy() - master.disrupt(0) + if(master) + master.disrupt(0) + master = null return ..() diff --git a/code/game/objects/items/devices/forcefieldprojector.dm b/code/game/objects/items/devices/forcefieldprojector.dm index 39d06ab5a8b6..6f489b706af6 100644 --- a/code/game/objects/items/devices/forcefieldprojector.dm +++ b/code/game/objects/items/devices/forcefieldprojector.dm @@ -95,8 +95,9 @@ /obj/structure/projected_forcefield/Destroy() visible_message("[src] flickers and disappears!") playsound(src,'sound/weapons/resonator_blast.ogg',25,TRUE) - generator.current_fields -= src - generator = null + if(generator) + generator.current_fields -= src + generator = null return ..() /obj/structure/projected_forcefield/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) @@ -105,4 +106,5 @@ /obj/structure/projected_forcefield/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) if(sound_effect) play_attack_sound(damage_amount, damage_type, damage_flag) - generator.shield_integrity = max(generator.shield_integrity - damage_amount, 0) + if(generator) + generator.shield_integrity = max(generator.shield_integrity - damage_amount, 0) diff --git a/code/game/objects/items/grenades/clusterbuster.dm b/code/game/objects/items/grenades/clusterbuster.dm index 6e4687d72c32..0c7203f0a5c0 100644 --- a/code/game/objects/items/grenades/clusterbuster.dm +++ b/code/game/objects/items/grenades/clusterbuster.dm @@ -70,7 +70,8 @@ ///////////////////////////////// /obj/effect/payload_spawner/Initialize(mapload, type, numspawned) ..() - spawn_payload(type, numspawned) + if(type && isnum(numspawned)) + spawn_payload(type, numspawned) return INITIALIZE_HINT_QDEL /obj/effect/payload_spawner/proc/spawn_payload(type, numspawned) diff --git a/code/game/objects/items/storage/fancy.dm b/code/game/objects/items/storage/fancy.dm index b3e32f2be8a6..c5ac53600652 100644 --- a/code/game/objects/items/storage/fancy.dm +++ b/code/game/objects/items/storage/fancy.dm @@ -23,6 +23,8 @@ /obj/item/storage/fancy/PopulateContents() var/datum/component/storage/STR = GetComponent(/datum/component/storage) + if(!spawn_type) + return for(var/i = 1 to STR.max_items) new spawn_type(src) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/freezer.dm b/code/game/objects/structures/crates_lockers/closets/secure/freezer.dm index c2af6ad410c3..0e7ab6e0a526 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/freezer.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/freezer.dm @@ -4,7 +4,7 @@ /obj/structure/closet/secure_closet/freezer/Destroy() recursive_organ_check(src) - ..() + return ..() /obj/structure/closet/secure_closet/freezer/Initialize() . = ..() diff --git a/code/game/objects/structures/manned_turret.dm b/code/game/objects/structures/manned_turret.dm index 9b13275088c6..9dda5181c071 100644 --- a/code/game/objects/structures/manned_turret.dm +++ b/code/game/objects/structures/manned_turret.dm @@ -230,7 +230,7 @@ /obj/item/gun_control/Destroy() turret = null - ..() + return ..() /obj/item/gun_control/CanItemAutoclick() return TRUE diff --git a/code/game/objects/structures/traps.dm b/code/game/objects/structures/traps.dm index 0006bd8e331c..aa7e94dffe8a 100644 --- a/code/game/objects/structures/traps.dm +++ b/code/game/objects/structures/traps.dm @@ -130,6 +130,9 @@ /obj/structure/trap/stun/hunter/flare() ..() + var/turf/our_turf = get_turf(src) + if(!our_turf) + return stored_item.forceMove(get_turf(src)) forceMove(stored_item) if(caught) diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm index 5fbc7cc40622..306988f0d42f 100644 --- a/code/game/turfs/open/openspace.dm +++ b/code/game/turfs/open/openspace.dm @@ -153,6 +153,9 @@ GLOBAL_DATUM_INIT(openspace_backdrop_one_for_all, /atom/movable/openspace_backdr /turf/open/openspace/icemoon/Initialize(mapload, inherited_virtual_z) . = ..() var/turf/T = below() + //I wonder if I should error here + if(!T) + return if(T.flags_1 & NO_RUINS_1) ChangeTurf(replacement_turf, null, CHANGETURF_IGNORE_AIR) return diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 9dfe0b43f544..7f76bc98ee9b 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -59,7 +59,7 @@ #endif #ifdef REFERENCE_TRACKING_DEBUG - if(!found_refs) + if(!found_refs && SSgarbage.should_save_refs) found_refs = list() #endif @@ -96,7 +96,8 @@ if(variable == src) #ifdef REFERENCE_TRACKING_DEBUG - found_refs[varname] = TRUE + if(SSgarbage.should_save_refs) + found_refs[varname] = TRUE #endif log_reftracker("Found [type] \ref[src] in [datum_container.type]'s \ref[datum_container] [varname] var. [container_name]") continue @@ -114,7 +115,8 @@ //Check normal entrys if(element_in_list == src) #ifdef REFERENCE_TRACKING_DEBUG - found_refs[potential_cache] = TRUE + if(SSgarbage.should_save_refs) + found_refs[potential_cache] = TRUE #endif log_reftracker("Found [type] \ref[src] in list [container_name].") continue @@ -125,7 +127,8 @@ //Check assoc entrys if(assoc_val == src) #ifdef REFERENCE_TRACKING_DEBUG - found_refs[potential_cache] = TRUE + if(SSgarbage.should_save_refs) + found_refs[potential_cache] = TRUE #endif log_reftracker("Found [type] \ref[src] in list [container_name]\[[element_in_list]\]") continue diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm index 45fff96dc5d4..ea902bc032a3 100644 --- a/code/modules/antagonists/cult/blood_magic.dm +++ b/code/modules/antagonists/cult/blood_magic.dm @@ -356,9 +356,10 @@ var/datum/action/innate/cult/blood_spell/source /obj/item/melee/blood_magic/New(loc, spell) - source = spell - uses = source.charges - health_cost = source.health_cost + if(spell) + source = spell + uses = source.charges + health_cost = source.health_cost ..() /obj/item/melee/blood_magic/Destroy() @@ -373,7 +374,7 @@ source.desc = source.base_desc source.desc += "
Has [uses] use\s remaining." source.UpdateButtonIcon() - ..() + return ..() /obj/item/melee/blood_magic/attack_self(mob/living/user) afterattack(user, user, TRUE) diff --git a/code/modules/antagonists/revenant/revenant.dm b/code/modules/antagonists/revenant/revenant.dm index be3c68d359b9..99e0605ed092 100644 --- a/code/modules/antagonists/revenant/revenant.dm +++ b/code/modules/antagonists/revenant/revenant.dm @@ -447,7 +447,7 @@ /obj/item/ectoplasm/revenant/Destroy() if(!QDELETED(revenant)) qdel(revenant) - ..() + return ..() //objectives /datum/objective/revenant diff --git a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm index db65e0cbd688..27a10e7db427 100644 --- a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm +++ b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm @@ -245,6 +245,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/AI_Module)) owner_AI.doomsday_device.start() for(var/obj/item/pinpointer/nuke/P in GLOB.pinpointer_list) P.switch_mode_to(TRACK_MALF_AI) //Pinpointers start tracking the AI wherever it goes + P.alert = TRUE //WEEWOO qdel(src) /obj/machinery/doomsday_device @@ -256,21 +257,31 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/AI_Module)) verb_exclaim = "blares" var/timing = FALSE var/obj/effect/countdown/doomsday/countdown + var/mob/living/silicon/ai/owner var/detonation_timer var/next_announce /obj/machinery/doomsday_device/Initialize() . = ..() + if(!isAI(loc)) + stack_trace("Doomsday created outside an AI somehow, shit's fucking broke. Anyway, we're just gonna qdel now. Go make a github issue report.") + return INITIALIZE_HINT_QDEL + owner = loc countdown = new(src) /obj/machinery/doomsday_device/Destroy() QDEL_NULL(countdown) STOP_PROCESSING(SSfastprocess, src) SSmapping.remove_nuke_threat(src) - for(var/A in GLOB.ai_list) - var/mob/living/silicon/ai/AI = A - if(AI.doomsday_device == src) - AI.doomsday_device = null + set_security_level("red") + for(var/mob/living/silicon/robot/borg in owner?.connected_robots) + borg.toggle_headlamp(FALSE, TRUE) //forces borg lamp to update + owner?.doomsday_device = null + owner?.nuking = null + owner = null + for(var/obj/item/pinpointer/nuke/P in GLOB.pinpointer_list) + P.switch_mode_to(TRACK_NUKE_DISK) //Party's over, back to work, everyone + P.alert = FALSE return ..() /obj/machinery/doomsday_device/proc/start() diff --git a/code/modules/buildmode/effects/line.dm b/code/modules/buildmode/effects/line.dm index f38e0c53871b..394c0d205a51 100644 --- a/code/modules/buildmode/effects/line.dm +++ b/code/modules/buildmode/effects/line.dm @@ -3,6 +3,9 @@ var/client/cl /obj/effect/buildmode_line/New(client/C, atom/atom_a, atom/atom_b, linename) + if(!C || !atom_a || !atom_b) + stack_trace("Buildmode effect created with odd inputs") + return name = linename abstract_move(get_turf(atom_a)) I = image('icons/misc/mark.dmi', src, "line", 19.0) diff --git a/code/modules/cargo/gondolapod.dm b/code/modules/cargo/gondolapod.dm index 31998df93f41..fd429ed98223 100644 --- a/code/modules/cargo/gondolapod.dm +++ b/code/modules/cargo/gondolapod.dm @@ -30,6 +30,9 @@ var/obj/structure/closet/supplypod/centcompod/linked_pod /mob/living/simple_animal/pet/gondola/gondolapod/Initialize(mapload, pod) + if(!pod) + stack_trace("Gondola pod created with no pod") + return INITIALIZE_HINT_QDEL linked_pod = pod name = linked_pod.name . = ..() @@ -73,6 +76,6 @@ update_icon() /mob/living/simple_animal/pet/gondola/gondolapod/death() - qdel(linked_pod) //Will cause the open() proc for the linked supplypod to be called with the "broken" parameter set to true, meaning that it will dump its contents on death + QDEL_NULL(linked_pod) //Will cause the open() proc for the linked supplypod to be called with the "broken" parameter set to true, meaning that it will dump its contents on death qdel(src) ..() diff --git a/code/modules/cargo/supplypod.dm b/code/modules/cargo/supplypod.dm index 39410aa07a35..d02b04961cf0 100644 --- a/code/modules/cargo/supplypod.dm +++ b/code/modules/cargo/supplypod.dm @@ -302,6 +302,9 @@ /obj/effect/DPtarget/Initialize(mapload, podParam, single_order = null) . = ..() + if(!podParam) + stack_trace("Pod landingzone created with no pod") + return INITIALIZE_HINT_QDEL if (ispath(podParam)) //We can pass either a path for a pod (as expressconsoles do), or a reference to an instantiated pod (as the centcom_podlauncher does) podParam = new podParam() //If its just a path, instantiate it pod = podParam diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index fc128a052f03..514f0587da6f 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -101,6 +101,9 @@ GLOBAL_LIST_INIT(hallucination_list, list( /obj/effect/hallucination/simple/Initialize(mapload, mob/living/carbon/T) . = ..() + if(!T) + stack_trace("A hallucination was created with no target") + return INITIALIZE_HINT_QDEL target = T current_image = GetImage() if(target.client) diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index e8c31b9c4c7b..e92ba7b42406 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -89,7 +89,7 @@ and clear when youre done! if you dont i will use :newspaper2: on you /obj/machinery/computer/holodeck/LateInitialize()//from here linked is populated and the program list is generated. its also set to load the offline program linked = GLOB.areas_by_type[mapped_start_area] - bottom_left = locate(linked.x, linked.y, src.z) + bottom_left = locate(linked.x, linked.y, z) var/area/computer_area = get_area(src) if(istype(computer_area, /area/holodeck)) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index c7f0ebe190bf..7fa710323207 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -33,6 +33,9 @@ // This is for adminspawn or map-placed growns. They get the default stats of their seed type. seed = new seed() seed.adjust_potency(50-seed.potency) + else if(!seed) + stack_trace("Grown object created without a seed. WTF") + return INITIALIZE_HINT_QDEL pixel_x = base_pixel_x + rand(-5, 5) pixel_y = base_pixel_y + rand(-5, 5) diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index c04bd8ee3195..e108ea53b4aa 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -259,7 +259,7 @@ var/list/data = null if(rid == "blood") // Hack to make blood in plants always O- data = list("blood_type" = "O-") - if(rid == /datum/reagent/consumable/nutriment || rid == /datum/reagent/consumable/nutriment/vitamin) + if(istype(T) && (rid == /datum/reagent/consumable/nutriment || rid == /datum/reagent/consumable/nutriment/vitamin)) // apple tastes of apple. data = T.tastes diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index 38f72ce43a04..706c88637b34 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -279,11 +279,14 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) new /obj/item/toy/balloon/corgi(thing) else openturfs += thing + //cake + knife to cut it! - var/turf/food_turf = get_turf(pick(table)) - new /obj/item/kitchen/knife(food_turf) - var/obj/item/reagent_containers/food/snacks/store/cake/birthday/iancake = new(food_turf) - iancake.desc = "Happy birthday, Ian!" + if(length(table)) + var/turf/food_turf = get_turf(pick(table)) + new /obj/item/kitchen/knife(food_turf) + var/obj/item/reagent_containers/food/snacks/store/cake/birthday/iancake = new(food_turf) + iancake.desc = "Happy birthday, Ian!" + //some balloons! this picks an open turf and pops a few balloons in and around that turf, yay. for(var/i in 1 to balloon_clusters) var/turf/clusterspot = pick_n_take(openturfs) diff --git a/code/modules/mining/fulton.dm b/code/modules/mining/fulton.dm index 5d412ad6fb8f..5d4db89f59d1 100644 --- a/code/modules/mining/fulton.dm +++ b/code/modules/mining/fulton.dm @@ -172,7 +172,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons) /obj/structure/extraction_point/Destroy() GLOB.total_extraction_beacons -= src - ..() + return ..() /obj/effect/extraction_holder name = "extraction holder" diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index 198d02ab4628..3a8e4ec26d8d 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -950,6 +950,12 @@ . += "This weapon contains a gradual heat accelerator that increases shot power as the weapon's energy stores are depleted. Shots at low power are significantly stronger, but also have incredibly short range." /obj/item/gun/energy/spur/update_icon() + if(!cell) + chargesound = null + recoil = 1 + fire_sound = 'sound/weapons/spur_high.ogg' + return + var/maxcharge = cell.maxcharge var/charge = cell.charge diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 6df19e1a11de..2230639b5344 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -48,6 +48,7 @@ /mob/living/simple_animal/hostile/mining_drone/Initialize() . = ..() + stored_gun = new(src) var/datum/action/innate/minedrone/toggle_light/toggle_light_action = new() toggle_light_action.Grant(src) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 981ec9c96360..eb5963b96623 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -281,6 +281,8 @@ break if(!B) B = new /obj/effect/decal/cleanable/blood/splatter(T, get_static_viruses()) + if(QDELETED(B)) //Give it up + return B.bloodiness = min((B.bloodiness + BLOOD_AMOUNT_PER_DECAL), BLOOD_POOL_MAX) B.transfer_mob_blood_dna(src) //give blood info to the blood decal. if(temp_blood_DNA) diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index d07c808a0663..94cd1523344a 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -565,7 +565,7 @@ /datum/species/jelly/luminescent/proc/update_glow(mob/living/carbon/C, intensity) if(intensity) glow_intensity = intensity - glow.set_light(glow_intensity, glow_intensity, C.dna.features["mcolor"]) + glow.set_light_range_power_color(glow_intensity, glow_intensity, C.dna.features["mcolor"]) /obj/effect/dummy/luminescent_glow name = "luminescent glow" diff --git a/code/modules/mob/living/carbon/human/species_types/snail.dm b/code/modules/mob/living/carbon/human/species_types/snail.dm index 36766f34ca53..4d9d41bd411d 100644 --- a/code/modules/mob/living/carbon/human/species_types/snail.dm +++ b/code/modules/mob/living/carbon/human/species_types/snail.dm @@ -67,6 +67,12 @@ max_integrity = 200 resistance_flags = FIRE_PROOF | ACID_PROOF +/obj/item/storage/backpack/snail/dropped(mob/user, silent) + . = ..() + emptyStorage() + if(!QDELETED(src)) + qdel(src) + /obj/item/storage/backpack/snail/Initialize() . = ..() ADD_TRAIT(src, TRAIT_NODROP, "snailshell") diff --git a/code/modules/mob/living/inhand_holder.dm b/code/modules/mob/living/inhand_holder.dm index f4b5f85b91a6..e16dcf9e3326 100644 --- a/code/modules/mob/living/inhand_holder.dm +++ b/code/modules/mob/living/inhand_holder.dm @@ -85,6 +85,12 @@ /obj/item/clothing/head/mob_holder/container_resist_act() release() +/obj/item/clothing/head/mob_holder/drone/Initialize(mapload, mob/living/M, worn_state, head_icon, lh_icon, rh_icon, worn_slot_flags = NONE) + //If we're not being put onto a drone, end it all + if(!isdrone(M)) + return INITIALIZE_HINT_QDEL + return ..() + /obj/item/clothing/head/mob_holder/drone/deposit(mob/living/L) . = ..() if(!isdrone(L)) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index a2ed70254f77..733596a19cb9 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -985,9 +985,9 @@ return /mob/living/silicon/ai/spawned/Initialize(mapload, datum/ai_laws/L, mob/target_ai) - . = ..() if(!target_ai) target_ai = src //cheat! just give... ourselves as the spawned AI, because that's technically correct + . = ..() /mob/living/silicon/ai/proc/camera_visibility(mob/camera/aiEye/moved_eye) GLOB.cameranet.visibility(moved_eye, client, all_eyes, USE_STATIC_OPAQUE) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 90e09bd8585d..333b8e7a9c52 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -506,7 +506,7 @@ /mob/living/silicon/robot/proc/SetLockdown(state = TRUE) // They stay locked down if their wire is cut. - if(wires.is_cut(WIRE_LOCKDOWN)) + if(wires?.is_cut(WIRE_LOCKDOWN)) state = TRUE if(state) throw_alert("locked", /atom/movable/screen/alert/locked) diff --git a/code/modules/mob/living/simple_animal/guardian/types/support.dm b/code/modules/mob/living/simple_animal/guardian/types/support.dm index 9d39d055b7c4..00344f48da59 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/support.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/support.dm @@ -101,7 +101,7 @@ /obj/structure/receiving_pad/New(loc, mob/living/simple_animal/hostile/guardian/healer/G) . = ..() - if(G.guardiancolor) + if(G?.guardiancolor) add_atom_colour(G.guardiancolor, FIXED_COLOUR_PRIORITY) /obj/structure/receiving_pad/proc/disappear() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/wendigo.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/wendigo.dm index b487f38d002d..42836c58cf6b 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/wendigo.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/wendigo.dm @@ -138,6 +138,8 @@ Difficulty: Hard /// Slams the ground around the wendigo throwing back enemies caught nearby /mob/living/simple_animal/hostile/megafauna/wendigo/proc/ground_slam(range, delay) var/turf/orgin = get_turf(src) + if(!orgin) + return var/list/all_turfs = RANGE_TURFS(range, orgin) for(var/i = 0 to range) for(var/turf/T in all_turfs) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm index b24f055d3bb9..2b9c781b3bd6 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm @@ -56,7 +56,8 @@ /mob/living/simple_animal/hostile/asteroid/curseblob/proc/check_for_target() if(QDELETED(set_target) || set_target.stat != CONSCIOUS || z != set_target.z) - qdel(src) + if(!QDELETED(src)) + qdel(src) return TRUE /mob/living/simple_animal/hostile/asteroid/curseblob/GiveTarget(new_target) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 1ab74e4d6a3b..161de6bb3e9d 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -197,17 +197,18 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(malfai && operating) malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000) - area.power_light = FALSE - area.power_equip = FALSE - area.power_environ = FALSE - area.power_change() - area.poweralert(FALSE, src) + if(area) + area.power_light = FALSE + area.power_equip = FALSE + area.power_environ = FALSE + area.power_change() + area.poweralert(FALSE, src) if(occupier) malfvacate(1) - qdel(wires) - wires = null + if(wires) + QDEL_NULL(wires) if(cell) - qdel(cell) + QDEL_NULL(cell) if(terminal) disconnect_terminal() . = ..() diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index d03c7d5c3af4..b829093edf3e 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -14,8 +14,8 @@ CanAtmosPass = ATMOS_PASS_NO light_range = 4 layer = ABOVE_OBJ_LAYER - var/obj/machinery/field/generator/FG1 = null - var/obj/machinery/field/generator/FG2 = null + var/obj/machinery/field/generator/field_gen_1 = null + var/obj/machinery/field/generator/field_gen_2 = null /obj/machinery/field/containment/Initialize() . = ..() @@ -27,8 +27,12 @@ AddElement(/datum/element/connect_loc, loc_connections) /obj/machinery/field/containment/Destroy() - FG1.fields -= src - FG2.fields -= src + if(field_gen_1) + field_gen_1.fields -= src + field_gen_1 = null + if(field_gen_2) + field_gen_2.fields -= src + field_gen_2 = null CanAtmosPass = ATMOS_PASS_YES air_update_turf(TRUE) return ..() @@ -59,12 +63,12 @@ return FALSE /obj/machinery/field/containment/attack_animal(mob/living/simple_animal/M) - if(!FG1 || !FG2) + if(!field_gen_1 || !field_gen_2) qdel(src) return if(ismegafauna(M)) M.visible_message("[M] glows fiercely as the containment field flickers out!") - FG1.calc_power(INFINITY) //rip that 'containment' field + field_gen_1.calc_power(INFINITY) //rip that 'containment' field M.adjustHealth(-M.obj_damage) else return ..() @@ -80,12 +84,12 @@ /obj/machinery/field/containment/proc/set_master(master1,master2) if(!master1 || !master2) return FALSE - FG1 = master1 - FG2 = master2 + field_gen_1 = master1 + field_gen_2 = master2 return TRUE /obj/machinery/field/containment/shock(mob/living/user) - if(!FG1 || !FG2) + if(!field_gen_1 || !field_gen_2) qdel(src) return FALSE ..() diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 7a513c7090fb..abbe950c22d1 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -96,6 +96,8 @@ QDEL_NULL(chambered) if(azoom) QDEL_NULL(azoom) + if(isatom(suppressed)) //SUPPRESSED IS USED AS BOTH A TRUE/FALSE AND AS A REF, WHAT THE FUCKKKKKKKKKKKKKKKKK + QDEL_NULL(suppressed) return ..() /obj/item/gun/handle_atom_del(atom/A) diff --git a/code/modules/projectiles/guns/energy/dueling.dm b/code/modules/projectiles/guns/energy/dueling.dm index a10fa260e70e..3ba599eb9975 100644 --- a/code/modules/projectiles/guns/energy/dueling.dm +++ b/code/modules/projectiles/guns/energy/dueling.dm @@ -183,11 +183,12 @@ /obj/item/gun/energy/dueling/Destroy() . = ..() - if(duel.gun_A == src) - duel.gun_A = null - if(duel.gun_B == src) - duel.gun_B = null - duel = null + if(duel) + if(duel.gun_A == src) + duel.gun_A = null + if(duel.gun_B == src) + duel.gun_B = null + duel = null /obj/item/gun/energy/dueling/can_trigger_gun(mob/living/user) . = ..() diff --git a/code/modules/projectiles/guns/magic.dm b/code/modules/projectiles/guns/magic.dm index 0cc94b88c177..e095d614b964 100644 --- a/code/modules/projectiles/guns/magic.dm +++ b/code/modules/projectiles/guns/magic.dm @@ -51,7 +51,8 @@ /obj/item/gun/magic/Initialize() . = ..() charges = max_charges - chambered = new ammo_type(src) + if(ammo_type) + chambered = new ammo_type(src) if(can_charge) START_PROCESSING(SSobj, src) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 6586d8195ebd..27d656da3c76 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -157,14 +157,14 @@ /// If true directly targeted turfs can be hit var/can_hit_turfs = FALSE + var/static/list/projectile_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + /obj/projectile/Initialize() . = ..() decayedRange = range - - var/static/list/loc_connections = list( - COMSIG_ATOM_ENTERED = .proc/on_entered - ) - AddElement(/datum/element/connect_loc, loc_connections) + AddElement(/datum/element/connect_loc, projectile_connections) /obj/projectile/proc/Range() range-- diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index d359fd893893..8e5d48926c72 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -423,6 +423,7 @@ /obj/projectile/magic/locker/Destroy() locker_suck = FALSE + RemoveElement(/datum/element/connect_loc, projectile_connections) //We do this manually so the forcemoves don't "hit" us. This behavior is kinda dumb, someone refactor this for(var/atom/movable/AM in contents) AM.forceMove(get_turf(src)) . = ..() diff --git a/code/modules/projectiles/projectile/special/gravity.dm b/code/modules/projectiles/projectile/special/gravity.dm index d3abf739d34d..2b56599f9812 100644 --- a/code/modules/projectiles/projectile/special/gravity.dm +++ b/code/modules/projectiles/projectile/special/gravity.dm @@ -15,7 +15,7 @@ . = ..() var/obj/item/ammo_casing/energy/gravity/repulse/C = loc if(istype(C)) //Hard-coded maximum power so servers can't be crashed by trying to throw the entire Z level's items - power = min(C.gun.power, 15) + power = min(C.gun?.power, 15) /obj/projectile/gravityrepulse/on_hit() . = ..() @@ -50,7 +50,7 @@ . = ..() var/obj/item/ammo_casing/energy/gravity/attract/C = loc if(istype(C)) //Hard-coded maximum power so servers can't be crashed by trying to throw the entire Z level's items - power = min(C.gun.power, 15) + power = min(C.gun?.power, 15) /obj/projectile/gravityattract/on_hit() . = ..() @@ -84,7 +84,7 @@ . = ..() var/obj/item/ammo_casing/energy/gravity/chaos/C = loc if(istype(C)) //Hard-coded maximum power so servers can't be crashed by trying to throw the entire Z level's items - power = min(C.gun.power, 15) + power = min(C.gun?.power, 15) /obj/projectile/gravitychaos/on_hit() . = ..() diff --git a/code/modules/projectiles/projectile/special/hallucination.dm b/code/modules/projectiles/projectile/special/hallucination.dm index 918ce629ebcf..74fa2b2ad17a 100644 --- a/code/modules/projectiles/projectile/special/hallucination.dm +++ b/code/modules/projectiles/projectile/special/hallucination.dm @@ -28,7 +28,7 @@ hal_target.client.images += fake_icon /obj/projectile/hallucination/Destroy() - if(hal_target.client) + if(hal_target?.client) hal_target.client.images -= fake_icon QDEL_NULL(fake_icon) return ..() diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index 3b7994eef201..c788c3066514 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -159,6 +159,7 @@ other types of metals and chemistry for reagents). name = "design disk - disposable gun" desc = "A design disk containing designs for a cheap and disposable gun." illustration = "gun" + max_blueprints = 2 /obj/item/disk/design_disk/disposable_gun/Initialize() . = ..() diff --git a/code/modules/ruins/lavalandruin_code/puzzle.dm b/code/modules/ruins/lavalandruin_code/puzzle.dm index 6dffbb81272b..1325e40310f9 100644 --- a/code/modules/ruins/lavalandruin_code/puzzle.dm +++ b/code/modules/ruins/lavalandruin_code/puzzle.dm @@ -242,7 +242,8 @@ /obj/structure/puzzle_element/Moved() . = ..() - source.validate() + if(source) + source.validate() //Admin abuse version so you can pick the icon before it sets up /obj/effect/sliding_puzzle/admin diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 772ecaab7e23..ce63691a1a73 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -182,8 +182,12 @@ T.maptext = null if(_color) var/turf/T = locate(L[1], L[2], z) + if(!T) + return T.color = "#0f0" T = locate(L[3], L[4], z) + if(!T) + return T.color = "#00f" #endif diff --git a/code/modules/spells/spell_types/lichdom.dm b/code/modules/spells/spell_types/lichdom.dm index aa5eed12dcbd..db92e6530000 100644 --- a/code/modules/spells/spell_types/lichdom.dm +++ b/code/modules/spells/spell_types/lichdom.dm @@ -92,6 +92,9 @@ /obj/item/phylactery/Initialize(mapload, datum/mind/newmind) . = ..() + if(!mind) + stack_trace("A phylactery was created with no target mind") + return INITIALIZE_HINT_QDEL mind = newmind name = "phylactery of [mind.name]" diff --git a/code/modules/spells/spell_types/shapeshift.dm b/code/modules/spells/spell_types/shapeshift.dm index c9101c396334..65eb0cebb2b3 100644 --- a/code/modules/spells/spell_types/shapeshift.dm +++ b/code/modules/spells/spell_types/shapeshift.dm @@ -120,7 +120,8 @@ src.source = source shape = loc if(!istype(shape)) - CRASH("shapeshift holder created outside mob/living") + stack_trace("shapeshift holder created outside mob/living") + return INITIALIZE_HINT_QDEL stored = caster if(stored.mind) stored.mind.transfer_to(shape) diff --git a/code/modules/spells/spell_types/touch_attacks.dm b/code/modules/spells/spell_types/touch_attacks.dm index c130dbb57f5b..69649d11aebb 100644 --- a/code/modules/spells/spell_types/touch_attacks.dm +++ b/code/modules/spells/spell_types/touch_attacks.dm @@ -9,8 +9,10 @@ /obj/effect/proc_holder/spell/targeted/touch/Destroy() remove_hand() - to_chat(usr, "The power of the spell dissipates from your hand.") - ..() + if(action?.owner) + var/mob/guy_who_needs_to_know = action.owner + to_chat(guy_who_needs_to_know, span_notice("The power of the spell dissipates from your hand.")) + return ..() /obj/effect/proc_holder/spell/targeted/touch/proc/remove_hand(recharge = FALSE) QDEL_NULL(attached_hand) diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index b584d6b6ac2b..7519ac3181a0 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -278,5 +278,5 @@ /obj/item/organ/cyberimp/arm/power_cord name = "power cord implant" desc = "An internal power cord hooked up to a battery. Useful if you run on volts." - contents = list(/obj/item/apc_powercord) + items_to_create = list(/obj/item/apc_powercord) zone = "l_arm" diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 15163a72b69a..54dd0695520e 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -20,6 +20,14 @@ /// Intended to be used in the manner of `TEST_FOCUS(/datum/unit_test/math)` #define TEST_FOCUS(test_path) ##test_path { focus = TRUE; } +/// Constants indicating unit test completion status +#define UNIT_TEST_PASSED 0 +#define UNIT_TEST_FAILED 1 +#define UNIT_TEST_SKIPPED 2 + +#define TEST_DEFAULT 1 +#define TEST_DEL_WORLD INFINITY + #include "anchored_mobs.dm" #include "autowiki.dm" #include "bespoke_id.dm" @@ -28,6 +36,7 @@ #include "component_tests.dm" #include "connect_loc.dm" #include "emoting.dm" +#include "create_and_destroy.dm" #include "keybinding_init.dm" #include "machine_disassembly.dm" #include "outfit_sanity.dm" diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm new file mode 100644 index 000000000000..6699d7e26096 --- /dev/null +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -0,0 +1,168 @@ +///Delete one of every type, sleep a while, then check to see if anything has gone fucky +/datum/unit_test/create_and_destroy + //You absolutely must run last + priority = TEST_DEL_WORLD + +/datum/unit_test/create_and_destroy/Run() + //We'll spawn everything here + var/turf/spawn_at = run_loc_bottom_left + var/list/ignore = list( + //Never meant to be created, errors out the ass for mobcode reasons + /mob/living/carbon, + //And another + /obj/item/slimecross/recurring, + //This should be obvious + /obj/machinery/doomsday_device, + //Template type + /obj/effect/mob_spawn, + //Say it with me now, type template + /obj/effect/mapping_helpers/component_injector, + //template type + /obj/effect/mapping_helpers/trait_injector, + //Singleton + /mob/dview, + //Template + /obj/effect/mapping_helpers/custom_icon, + //Needs an implant inside + /obj/item/implantcase, + //Needs a ship + /obj/item/key/ship, + //Template + /obj/machinery/power/shuttle/engine/liquid, + ) + //This turf existing is an error in and of itself + ignore += typesof(/turf/baseturf_skipover) + ignore += typesof(/turf/baseturf_bottom) + //Needs a contractee + ignore += typesof(/obj/item/paper/contract) + //This demands a borg, so we'll let if off easy + ignore += typesof(/obj/item/modular_computer/tablet/integrated) + //This one demands a computer, ditto + ignore += typesof(/obj/item/modular_computer/processor) + //Needs special input, let's be nice + ignore += typesof(/obj/effect/abstract/proximity_checker) + //Very finiky, blacklisting to make things easier + ignore += typesof(/obj/item/poster/wanted) + //We can't pass a mind into this + ignore += typesof(/obj/item/phylactery) + //This expects a seed, we can't pass it + ignore += typesof(/obj/item/reagent_containers/food/snacks/grown) + //Nothing to hallucinate if there's nothing to hallicinate + ignore += typesof(/obj/effect/hallucination) + //These want fried food to take on the shape of, we can't pass that in + ignore += typesof(/obj/item/reagent_containers/food/snacks/deepfryholder) + //Can't pass in a thing to glow + ignore += typesof(/obj/effect/abstract/eye_lighting) + //It wants a lot more context then we have + ignore += typesof(/obj/effect/buildmode_line) + //We don't have a disease to pass in + ignore += typesof(/obj/effect/mapping_helpers/component_injector/infective) + //There's no shapeshift to hold + ignore += typesof(/obj/shapeshift_holder) + //No tauma to pass in + ignore += typesof(/mob/camera/imaginary_friend) + //No pod to gondola + ignore += typesof(/mob/living/simple_animal/pet/gondola/gondolapod) + //Hangs a ref post invoke async, which we don't support. Could put a qdeleted check but it feels hacky + ignore += typesof(/obj/effect/anomaly/grav/high) + //See above + ignore += typesof(/obj/effect/timestop) + //this boi spawns turf changing stuff, and it stacks and causes pain. Let's just not + ignore += typesof(/obj/effect/sliding_puzzle) + //Stacks baseturfs, can't be tested here + ignore += typesof(/obj/effect/temp_visual/lava_warning) + //Stacks baseturfs, can't be tested here + ignore += typesof(/obj/effect/ctf) + //Our system doesn't support it without warning spam from unregister calls on things that never registered + ignore += typesof(/obj/docking_port) + //Expects a mob to holderize, we have nothing to give + ignore += typesof(/obj/item/clothing/head/mob_holder) + + var/list/cached_contents = spawn_at.contents.Copy() + var/baseturf_count = length(spawn_at.baseturfs) + + for(var/type_path in typesof(/atom/movable, /turf) - ignore) //No areas please + if(ispath(type_path, /turf)) + spawn_at.ChangeTurf(type_path, /turf/baseturf_skipover) + //We change it back to prevent pain, please don't ask + spawn_at.ChangeTurf(/turf/open/floor/wood, /turf/baseturf_skipover) + if(baseturf_count != length(spawn_at.baseturfs)) + Fail("[type_path] changed the amount of baseturfs we have [baseturf_count] -> [length(spawn_at.baseturfs)]") + baseturf_count = length(spawn_at.baseturfs) + else + var/atom/creation = new type_path(spawn_at) + if(QDELETED(creation)) + continue + //Go all in + qdel(creation, force = TRUE) + //This will hold a ref to the last thing we process unless we set it to null + //Yes byond is fucking sinful + creation = null + + //There's a lot of stuff that either spawns stuff in on create, or removes stuff on destroy. Let's cut it all out so things are easier to deal with + var/list/to_del = spawn_at.contents - cached_contents + if(length(to_del)) + for(var/atom/to_kill in to_del) + qdel(to_kill) + + //Hell code, we're bound to have ended the round somehow so let's stop if from ending while we work + SSticker.delay_end = TRUE + //Prevent the garbage subsystem from harddeling anything, if only to save time + SSgarbage.collection_timeout[GC_QUEUE_HARDDELETE] = 10000 HOURS + //Clear it, just in case + cached_contents.Cut() + + //Now that we've qdel'd everything, let's sleep until the gc has processed all the shit we care about + var/time_needed = SSgarbage.collection_timeout[GC_QUEUE_CHECK] + var/start_time = world.time + var/garbage_queue_processed = FALSE + + sleep(time_needed) + while(!garbage_queue_processed) + var/list/queue_to_check = SSgarbage.queues[GC_QUEUE_CHECK] + //How the hell did you manage to empty this? Good job! + if(!length(queue_to_check)) + garbage_queue_processed = TRUE + break + + var/list/oldest_packet = queue_to_check[1] + //Pull out the time we deld at + var/qdeld_at = oldest_packet[1] + //If we've found a packet that got del'd later then we finished, then all our shit has been processed + if(qdeld_at > start_time) + garbage_queue_processed = TRUE + break + + if(world.time > start_time + time_needed + 8 MINUTES) + Fail("Something has gone horribly wrong, the garbage queue has been processing for well over 10 minutes. What the hell did you do") + break + + //Immediately fire the gc right after + SSgarbage.next_fire = 1 + //Unless you've seriously fucked up, queue processing shouldn't take "that" long. Let her run for a bit, see if anything's changed + sleep(20 SECONDS) + + //Alright, time to see if anything messed up + var/list/cache_for_sonic_speed = SSgarbage.items + for(var/path in cache_for_sonic_speed) + var/datum/qdel_item/item = cache_for_sonic_speed[path] + if(item.failures) + Fail("[item.name] hard deleted [item.failures] times out of a total del count of [item.qdels]") + if(item.no_respect_force) + Fail("[item.name] failed to respect force deletion [item.no_respect_force] times out of a total del count of [item.qdels]") + if(item.no_hint) + Fail("[item.name] failed to return a qdel hint [item.no_hint] times out of a total del count of [item.qdels]") + + cache_for_sonic_speed = SSatoms.BadInitializeCalls + for(var/path in cache_for_sonic_speed) + var/fails = cache_for_sonic_speed[path] + if(fails & BAD_INIT_NO_HINT) + Fail("[path] didn't return an Initialize hint") + if(fails & BAD_INIT_QDEL_BEFORE) + Fail("[path] qdel'd in New()") + if(fails & BAD_INIT_SLEPT) + Fail("[path] slept during Initialize()") + + SSticker.delay_end = FALSE + //This shouldn't be needed, but let's be polite + SSgarbage.collection_timeout[GC_QUEUE_HARDDELETE] = 10 SECONDS diff --git a/code/modules/unit_tests/find_reference_sanity.dm b/code/modules/unit_tests/find_reference_sanity.dm index 53cccea9e7b3..f41714f0659d 100644 --- a/code/modules/unit_tests/find_reference_sanity.dm +++ b/code/modules/unit_tests/find_reference_sanity.dm @@ -6,20 +6,34 @@ var/list/test_list = list() var/list/test_assoc_list = list() +/atom/movable/ref_holder/Destroy() + test = null + test_list.Cut() + test_assoc_list.Cut() + return ..() + /atom/movable/ref_test var/atom/movable/ref_test/self_ref +/atom/movable/ref_test/Destroy(force) + self_ref = null + return ..() + /datum/unit_test/find_reference_sanity/Run() var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + SSgarbage.should_save_refs = TRUE //Sanity check victim.DoSearchVar(testbed, "Sanity Check", search_time = 1) //We increment search time to get around an optimization TEST_ASSERT(!victim.found_refs.len, "The ref-tracking tool found a ref where none existed") + SSgarbage.should_save_refs = FALSE /datum/unit_test/find_reference_baseline/Run() var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + SSgarbage.should_save_refs = TRUE + //Set up for the first round of tests testbed.test = victim testbed.test_list += victim @@ -30,10 +44,12 @@ TEST_ASSERT(victim.found_refs["test"], "The ref-tracking tool failed to find a regular value") TEST_ASSERT(victim.found_refs[testbed.test_list], "The ref-tracking tool failed to find a list entry") TEST_ASSERT(victim.found_refs[testbed.test_assoc_list], "The ref-tracking tool failed to find an assoc list value") + SSgarbage.should_save_refs = FALSE /datum/unit_test/find_reference_exotic/Run() var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + SSgarbage.should_save_refs = TRUE //Second round, bit harder this time testbed.overlays += victim @@ -46,10 +62,12 @@ TEST_ASSERT(!victim.found_refs[testbed.overlays], "The ref-tracking tool found an overlays entry? That shouldn't be possible") TEST_ASSERT(victim.found_refs[testbed.vis_contents], "The ref-tracking tool failed to find a vis_contents entry") TEST_ASSERT(victim.found_refs[testbed.test_assoc_list], "The ref-tracking tool failed to find an assoc list key") + SSgarbage.should_save_refs = FALSE /datum/unit_test/find_reference_esoteric/Run() var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + SSgarbage.should_save_refs = TRUE //Let's get a bit esoteric victim.self_ref = victim @@ -63,10 +81,12 @@ TEST_ASSERT(victim.found_refs["self_ref"], "The ref-tracking tool failed to find a self reference") TEST_ASSERT(victim.found_refs[to_find], "The ref-tracking tool failed to find a nested list entry") TEST_ASSERT(victim.found_refs[to_find_assoc], "The ref-tracking tool failed to find a nested assoc list entry") + SSgarbage.should_save_refs = FALSE /datum/unit_test/find_reference_null_key_entry/Run() var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + SSgarbage.should_save_refs = TRUE //Calm before the storm testbed.test_assoc_list = list(null = victim) @@ -77,6 +97,8 @@ /datum/unit_test/find_reference_assoc_investigation/Run() var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + SSgarbage.should_save_refs = TRUE + //Let's do some more complex assoc list investigation var/list/to_find_in_key = list(victim) testbed.test_assoc_list[to_find_in_key] = list("memes") @@ -86,3 +108,4 @@ victim.DoSearchVar(testbed, "Fifth Run", search_time = 6) TEST_ASSERT(victim.found_refs[to_find_in_key], "The ref-tracking tool failed to find a nested assoc list key") TEST_ASSERT(victim.found_refs[to_find_null_assoc_nested], "The ref-tracking tool failed to find a null key'd nested assoc list entry") + SSgarbage.should_save_refs = FALSE diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm index 4a1e5f37906e..b8ca1ea6f146 100644 --- a/code/modules/unit_tests/unit_test.dm +++ b/code/modules/unit_tests/unit_test.dm @@ -28,6 +28,8 @@ GLOBAL_VAR(test_log) /// The type of turf to allocate for the testing zone var/test_turf_type = /turf/open/floor/plasteel + ///The priority of the test, the larger it is the later it fires + var/priority = TEST_DEFAULT //internal shit var/focus = FALSE var/succeeded = TRUE @@ -36,6 +38,9 @@ GLOBAL_VAR(test_log) var/static/datum/map_zone/mapzone +/proc/cmp_unit_test_priority(datum/unit_test/a, datum/unit_test/b) + return initial(a.priority) - initial(b.priority) + /datum/unit_test/New() if (isnull(mapzone)) var/height = 7 @@ -80,37 +85,48 @@ GLOBAL_VAR(test_log) allocated += instance return instance +/proc/RunUnitTest(test_path, list/test_results) + var/datum/unit_test/test = new test_path + + GLOB.current_test = test + var/duration = REALTIMEOFDAY + + test.Run() + + duration = REALTIMEOFDAY - duration + GLOB.current_test = null + GLOB.failed_any_test |= !test.succeeded + + var/list/log_entry = list("[test.succeeded ? "PASS" : "FAIL"]: [test_path] [duration / 10]s") + var/list/fail_reasons = test.fail_reasons + + for(var/J in 1 to LAZYLEN(fail_reasons)) + log_entry += "\tREASON #[J]: [fail_reasons[J]]" + var/message = log_entry.Join("\n") + log_test(message) + + test_results[test_path] = list("status" = test.succeeded ? UNIT_TEST_PASSED : UNIT_TEST_FAILED, "message" = message, "name" = test_path) + + qdel(test) + /proc/RunUnitTests() CHECK_TICK - var/tests_to_run = subtypesof(/datum/unit_test) + var/list/tests_to_run = subtypesof(/datum/unit_test) for (var/_test_to_run in tests_to_run) var/datum/unit_test/test_to_run = _test_to_run if (initial(test_to_run.focus)) tests_to_run = list(test_to_run) break - for(var/I in tests_to_run) - var/datum/unit_test/test = new I - - GLOB.current_test = test - var/duration = REALTIMEOFDAY - - test.Run() - - duration = REALTIMEOFDAY - duration - GLOB.current_test = null - GLOB.failed_any_test |= !test.succeeded - - var/list/log_entry = list("[test.succeeded ? "PASS" : "FAIL"]: [I] [duration / 10]s") - var/list/fail_reasons = test.fail_reasons - - qdel(test) + tests_to_run = sortTim(tests_to_run, /proc/cmp_unit_test_priority) - for(var/J in 1 to LAZYLEN(fail_reasons)) - log_entry += "\tREASON #[J]: [fail_reasons[J]]" - log_test(log_entry.Join("\n")) + var/list/test_results = list() - CHECK_TICK + for(var/unit_path in tests_to_run) + CHECK_TICK //We check tick first because the unit test we run last may be so expensive that checking tick will lock up this loop forever + RunUnitTest(unit_path, test_results) SSticker.force_ending = TRUE + //We have to call this manually because del_text can preceed us, and SSticker doesn't fire in the post game + SSticker.standard_reboot() diff --git a/code/modules/vehicles/atv.dm b/code/modules/vehicles/atv.dm index a0d3c6d13c7d..a785ba5985d7 100644 --- a/code/modules/vehicles/atv.dm +++ b/code/modules/vehicles/atv.dm @@ -44,25 +44,29 @@ /obj/vehicle/ridden/atv/turret/Moved() . = ..() - if(turret) - turret.forceMove(get_turf(src)) - switch(dir) - if(NORTH) - turret.pixel_x = base_pixel_x - turret.pixel_y = base_pixel_y + 4 - turret.layer = ABOVE_MOB_LAYER - if(EAST) - turret.pixel_x = base_pixel_x - 12 - turret.pixel_y = base_pixel_y + 4 - turret.layer = OBJ_LAYER - if(SOUTH) - turret.pixel_x = base_pixel_x - turret.pixel_y = base_pixel_y + 4 - turret.layer = OBJ_LAYER - if(WEST) - turret.pixel_x = base_pixel_x + 12 - turret.pixel_y = base_pixel_y + 4 - turret.layer = OBJ_LAYER + if(!turret) + return + var/turf/our_turf = get_turf(src) + if(!our_turf) + return + turret.forceMove(our_turf) + switch(dir) + if(NORTH) + turret.pixel_x = base_pixel_x + turret.pixel_y = base_pixel_y + 4 + turret.layer = ABOVE_MOB_LAYER + if(EAST) + turret.pixel_x = base_pixel_x - 12 + turret.pixel_y = base_pixel_y + 4 + turret.layer = OBJ_LAYER + if(SOUTH) + turret.pixel_x = base_pixel_x + turret.pixel_y = base_pixel_y + 4 + turret.layer = OBJ_LAYER + if(WEST) + turret.pixel_x = base_pixel_x + 12 + turret.pixel_y = base_pixel_y + 4 + turret.layer = OBJ_LAYER /obj/vehicle/ridden/atv/attackby(obj/item/W as obj, mob/user as mob, params) if(W.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) diff --git a/shiptest.dme b/shiptest.dme index 0e559adb16d0..77914966120d 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -30,6 +30,7 @@ #include "code\__DEFINES\aquarium.dm" #include "code\__DEFINES\atmospherics.dm" #include "code\__DEFINES\atom_hud.dm" +#include "code\__DEFINES\atoms.dm" #include "code\__DEFINES\bitfields.dm" #include "code\__DEFINES\blackmarket.dm" #include "code\__DEFINES\bodyparts.dm" From 2fa00a491b453f37a9973d3198f53d970b83504a Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 15 Jul 2023 22:46:13 -0500 Subject: [PATCH 010/147] OOPS --- code/_compile_options.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index fde08e7e235a..8f5accdf0c04 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -1,4 +1,4 @@ -#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this +//#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this //uncommented, but not visible in the release version) //#define DATUMVAR_DEBUGGING_MODE //Enables the ability to cache datum vars and retrieve later for debugging which vars changed. @@ -32,7 +32,7 @@ //#define VISUALIZE_ACTIVE_TURFS //Highlights atmos active turfs in green #endif //ifdef TESTING -#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER +//#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER #ifndef PRELOAD_RSC //set to: #define PRELOAD_RSC 2 // 0 to allow using external resources or on-demand behaviour; From 80def1de4b05e83bc625cf65afc37ab84b0eb019 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 15 Jul 2023 22:57:52 -0500 Subject: [PATCH 011/147] fixes indentation --- code/game/objects/items/implants/implant_track.dm | 4 ++-- code/game/objects/structures/tables_racks.dm | 5 ++++- code/modules/mob/mob_lists.dm | 2 +- code/modules/unit_tests/create_and_destroy.dm | 11 +++++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/implants/implant_track.dm b/code/game/objects/items/implants/implant_track.dm index 4370bf908b21..a83d69c53145 100644 --- a/code/game/objects/items/implants/implant_track.dm +++ b/code/game/objects/items/implants/implant_track.dm @@ -3,9 +3,9 @@ desc = "Track with this." activated = FALSE ///for how many deciseconds after user death will the implant work? - var/lifespan_postmortem = 6000 + var/lifespan_postmortem = 6000 ///will people implanted with this act as teleporter beacons? - var/allow_teleport = TRUE + var/allow_teleport = TRUE ///The id of the timer that's qdeleting us var/timerid diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 2e7e89ddd09f..5cc0b264538b 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -311,6 +311,9 @@ /obj/structure/table/rolling/Moved(atom/OldLoc, Dir) . = ..() + //Nullspaced + if(!loc) + return for(var/mob/M in OldLoc.contents)//Kidnap everyone on top M.forceMove(loc) for(var/x in attached_items) @@ -628,7 +631,7 @@ /obj/structure/table/optable/proc/patient_deleted(datum/source) SIGNAL_HANDLER set_patient(null) - + /obj/structure/table/optable/proc/check_eligible_patient() get_patient() if(!patient) diff --git a/code/modules/mob/mob_lists.dm b/code/modules/mob/mob_lists.dm index e09f2a5e523b..cda3ce9cc48d 100644 --- a/code/modules/mob/mob_lists.dm +++ b/code/modules/mob/mob_lists.dm @@ -25,7 +25,7 @@ ///Adds a mob reference to the list of all suicided mobs /mob/proc/add_to_mob_suicide_list() GLOB.suicided_mob_list += src - + ///Removes a mob references from the list of all suicided mobs /mob/proc/remove_from_mob_suicide_list() GLOB.suicided_mob_list -= src diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 6699d7e26096..01470914f423 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -29,6 +29,15 @@ /obj/item/key/ship, //Template /obj/machinery/power/shuttle/engine/liquid, + //needs a template + /obj/effect/landmark/subship, + //needs a friend :( + /obj/effect/mob_spawn/human/demonic_friend, + //Needs a pod + /obj/effect/DPfall, + /obj/effect/DPtarget, + //needs a derg + /obj/structure/carp_rift, ) //This turf existing is an error in and of itself ignore += typesof(/turf/baseturf_skipover) @@ -77,6 +86,8 @@ ignore += typesof(/obj/docking_port) //Expects a mob to holderize, we have nothing to give ignore += typesof(/obj/item/clothing/head/mob_holder) + //Needs ships + ignore += typesof(/obj/overmap) var/list/cached_contents = spawn_at.contents.Copy() var/baseturf_count = length(spawn_at.baseturfs) From 17b78d32c2ef0c47e5fa9382e9a5e47082078eff Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 15 Jul 2023 23:14:58 -0500 Subject: [PATCH 012/147] small tweaks --- code/modules/detectivework/detective_work.dm | 2 +- code/modules/unit_tests/create_and_destroy.dm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/detectivework/detective_work.dm b/code/modules/detectivework/detective_work.dm index 2a0bc21722a5..b236f4fa5aa1 100644 --- a/code/modules/detectivework/detective_work.dm +++ b/code/modules/detectivework/detective_work.dm @@ -66,7 +66,7 @@ /obj/add_blood_DNA(list/dna) . = ..() - if(length(dna)) + if(length(dna) && !QDELETED(src)) . = AddComponent(/datum/component/forensics, null, null, dna) /obj/item/clothing/gloves/add_blood_DNA(list/blood_dna, list/datum/disease/diseases) diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 01470914f423..0d747e384abe 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -88,6 +88,8 @@ ignore += typesof(/obj/item/clothing/head/mob_holder) //Needs ships ignore += typesof(/obj/overmap) + //Needs a holopad + ignore += typesof(/mob/living/simple_animal/hologram) var/list/cached_contents = spawn_at.contents.Copy() var/baseturf_count = length(spawn_at.baseturfs) From c8ea2aa65eff5045b0a60d5bcb802750ca60b85c Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:49:21 -0800 Subject: [PATCH 013/147] Ref tracker TLC, makes unit test harddel errors more descriptive (#62725) --- code/__HELPERS/_logging.dm | 2 +- code/_compile_options.dm | 6 +++--- .../view_variables/reference_tracking.dm | 16 ++++++++++++-- code/modules/unit_tests/create_and_destroy.dm | 4 ++-- .../unit_tests/find_reference_sanity.dm | 21 +++++++++++++++++++ 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index e9feafa3ae79..427f38d86784 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -35,7 +35,7 @@ SEND_TEXT(world.log, text) #endif -#ifdef REFERENCE_TRACKING_LOG +#ifdef REFERENCE_TRACKING #define log_reftracker(msg) log_world("## REF SEARCH [msg]") #else #define log_reftracker(msg) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 8f5accdf0c04..1724fb5e6462 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -15,15 +15,14 @@ //#define REFERENCE_TRACKING #ifdef REFERENCE_TRACKING -///Should we be logging our findings or not -#define REFERENCE_TRACKING_LOG - ///Used for doing dry runs of the reference finder, to test for feature completeness +///Slightly slower, higher in memory. Just not optimal //#define REFERENCE_TRACKING_DEBUG ///Run a lookup on things hard deleting by default. //#define GC_FAILURE_HARD_LOOKUP #ifdef GC_FAILURE_HARD_LOOKUP +///Don't stop when searching, go till you're totally done #define FIND_REF_NO_CHECK_TICK #endif //ifdef GC_FAILURE_HARD_LOOKUP @@ -83,6 +82,7 @@ #define REFERENCE_TRACKING #define REFERENCE_TRACKING_DEBUG #define FIND_REF_NO_CHECK_TICK +#define GC_FAILURE_HARD_LOOKUP #endif // A reasonable number of maximum overlays an object needs diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 7f76bc98ee9b..4e0c668c6e3e 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -27,9 +27,18 @@ var/starting_time = world.time //Time to search the whole game for our ref - DoSearchVar(GLOB, "GLOB") //globals + DoSearchVar(GLOB, "GLOB", search_time = starting_time) //globals log_reftracker("Finished searching globals") + //Yes we do actually need to do this. The searcher refuses to read weird lists + //And global.vars is a really weird list + var/global_vars = list() + for(var/key in global.vars) + global_vars[key] = global.vars[key] + + DoSearchVar(global_vars, "Native Global", search_time = starting_time) + log_reftracker("Finished searching native globals") + for(var/datum/thing in world) //atoms (don't beleive its lies) DoSearchVar(thing, "World -> [thing.type]", search_time = starting_time) log_reftracker("Finished searching atoms") @@ -59,7 +68,7 @@ #endif #ifdef REFERENCE_TRACKING_DEBUG - if(!found_refs && SSgarbage.should_save_refs) + if(SSgarbage.should_save_refs && !found_refs) found_refs = list() #endif @@ -98,6 +107,7 @@ #ifdef REFERENCE_TRACKING_DEBUG if(SSgarbage.should_save_refs) found_refs[varname] = TRUE + continue //End early, don't want these logging #endif log_reftracker("Found [type] \ref[src] in [datum_container.type]'s \ref[datum_container] [varname] var. [container_name]") continue @@ -117,6 +127,7 @@ #ifdef REFERENCE_TRACKING_DEBUG if(SSgarbage.should_save_refs) found_refs[potential_cache] = TRUE + continue //End early, don't want these logging #endif log_reftracker("Found [type] \ref[src] in list [container_name].") continue @@ -129,6 +140,7 @@ #ifdef REFERENCE_TRACKING_DEBUG if(SSgarbage.should_save_refs) found_refs[potential_cache] = TRUE + continue //End early, don't want these logging #endif log_reftracker("Found [type] \ref[src] in list [container_name]\[[element_in_list]\]") continue diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 0d747e384abe..54a0d393a9f5 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -146,8 +146,8 @@ garbage_queue_processed = TRUE break - if(world.time > start_time + time_needed + 8 MINUTES) - Fail("Something has gone horribly wrong, the garbage queue has been processing for well over 10 minutes. What the hell did you do") + if(world.time > start_time + time_needed + 30 MINUTES) //If this gets us gitbanned I'm going to laugh so hard + Fail("Something has gone horribly wrong, the garbage queue has been processing for well over 30 minutes. What the hell did you do") break //Immediately fire the gc right after diff --git a/code/modules/unit_tests/find_reference_sanity.dm b/code/modules/unit_tests/find_reference_sanity.dm index f41714f0659d..67b6072d3b96 100644 --- a/code/modules/unit_tests/find_reference_sanity.dm +++ b/code/modules/unit_tests/find_reference_sanity.dm @@ -2,12 +2,14 @@ /datum/unit_test/find_reference_sanity /atom/movable/ref_holder + var/static/atom/movable/ref_test/static_test var/atom/movable/ref_test/test var/list/test_list = list() var/list/test_assoc_list = list() /atom/movable/ref_holder/Destroy() test = null + static_test = null test_list.Cut() test_assoc_list.Cut() return ..() @@ -109,3 +111,22 @@ TEST_ASSERT(victim.found_refs[to_find_in_key], "The ref-tracking tool failed to find a nested assoc list key") TEST_ASSERT(victim.found_refs[to_find_null_assoc_nested], "The ref-tracking tool failed to find a null key'd nested assoc list entry") SSgarbage.should_save_refs = FALSE + +/datum/unit_test/find_reference_static_investigation/Run() + var/atom/movable/ref_test/victim = allocate(/atom/movable/ref_test) + var/atom/movable/ref_holder/testbed = allocate(/atom/movable/ref_holder) + SSgarbage.should_save_refs = TRUE + + //Lets check static vars now, since those can be a real headache + testbed.static_test = victim + + //Yes we do actually need to do this. The searcher refuses to read weird lists + //And global.vars is a really weird list + var/global_vars = list() + for(var/key in global.vars) + global_vars[key] = global.vars[key] + + victim.DoSearchVar(global_vars, "Sixth Run", search_time = 7) + + TEST_ASSERT(victim.found_refs[global_vars], "The ref-tracking tool failed to find a natively global variable") + SSgarbage.should_save_refs = FALSE From 1cc9fdd547f3fb68561af5212e34c2ef2e947a1d Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 15 Jul 2023 23:18:12 -0500 Subject: [PATCH 014/147] tgstation/tgstation#63877 Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> --- code/__HELPERS/_logging.dm | 11 +++++++++-- code/_compile_options.dm | 10 ++++++++++ code/_globalvars/logging.dm | 5 +++++ code/game/world.dm | 3 +++ .../admin/view_variables/reference_tracking.dm | 2 ++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index 427f38d86784..333506d95ac7 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -35,9 +35,16 @@ SEND_TEXT(world.log, text) #endif -#ifdef REFERENCE_TRACKING +#if defined(REFERENCE_DOING_IT_LIVE) +#define log_reftracker(msg) log_harddel("## REF SEARCH [msg]") + +/proc/log_harddel(text) + WRITE_LOG(GLOB.harddel_log, text) + +#elif defined(REFERENCE_TRACKING) // Doing it locally #define log_reftracker(msg) log_world("## REF SEARCH [msg]") -#else + +#else //Not tracking at all #define log_reftracker(msg) #endif diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 1724fb5e6462..a1db7ae6f98f 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -31,6 +31,16 @@ //#define VISUALIZE_ACTIVE_TURFS //Highlights atmos active turfs in green #endif //ifdef TESTING +/// If this is uncommented, we set up the ref tracker to be used in a live environment +/// And to log events to [log_dir]/harddels.log +#define REFERENCE_DOING_IT_LIVE +#ifdef REFERENCE_DOING_IT_LIVE +// compile the backend +#define REFERENCE_TRACKING +// actually look for refs +#define GC_FAILURE_HARD_LOOKUP +#endif // REFERENCE_DOING_IT_LIVE + //#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER #ifndef PRELOAD_RSC //set to: diff --git a/code/_globalvars/logging.dm b/code/_globalvars/logging.dm index e83b4bfca48e..181752707d4d 100644 --- a/code/_globalvars/logging.dm +++ b/code/_globalvars/logging.dm @@ -49,6 +49,11 @@ GLOBAL_PROTECT(perf_log) GLOBAL_VAR(demo_log) GLOBAL_PROTECT(demo_log) +#ifdef REFERENCE_DOING_IT_LIVE +GLOBAL_VAR(harddel_log) +GLOBAL_PROTECT(harddel_log) +#endif + GLOBAL_LIST_EMPTY(bombers) GLOBAL_PROTECT(bombers) GLOBAL_LIST_EMPTY(admin_log) diff --git a/code/game/world.dm b/code/game/world.dm index effed0cb63a3..b8ee40566c59 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -153,6 +153,9 @@ GLOBAL_VAR(restart_counter) #ifdef UNIT_TESTS GLOB.test_log = "[GLOB.log_directory]/tests.log" start_log(GLOB.test_log) +#endif +#ifdef REFERENCE_DOING_IT_LIVE + GLOB.harddel_log = "[GLOB.log_directory]/harddels.log" #endif start_log(GLOB.world_game_log) start_log(GLOB.world_attack_log) diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 4e0c668c6e3e..613150cee8eb 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -47,12 +47,14 @@ DoSearchVar(thing, "Datums -> [thing.type]", search_time = starting_time) log_reftracker("Finished searching datums") +#ifndef REFERENCE_DOING_IT_LIVE //Warning, attempting to search clients like this will cause crashes if done on live. Watch yourself for(var/client/thing) //clients DoSearchVar(thing, "Clients -> [thing.type]", search_time = starting_time) log_reftracker("Finished searching clients") log_reftracker("Completed search for references to a [type].") +#endif if(usr?.client) usr.client.running_find_references = null From 808d1dd8f689fa6722f44859aa2702777ccf58d3 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 16 Jul 2023 00:15:14 -0500 Subject: [PATCH 015/147] buncha fixes --- code/_compile_options.dm | 4 +-- code/datums/components/udder.dm | 2 +- code/game/machinery/shuttle/shuttle_engine.dm | 4 +-- code/modules/holodeck/computer.dm | 2 +- code/modules/overmap/helm.dm | 6 +++++ .../overmap/ships/controlled_ship_datum.dm | 25 +++++++++++++------ code/modules/research/designs.dm | 5 ++-- .../surgery/bodyparts/robot_bodyparts.dm | 7 +----- code/modules/unit_tests/create_and_destroy.dm | 7 ++++++ 9 files changed, 40 insertions(+), 22 deletions(-) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index a1db7ae6f98f..df0b9437f760 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -1,4 +1,4 @@ -//#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this +#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this //uncommented, but not visible in the release version) //#define DATUMVAR_DEBUGGING_MODE //Enables the ability to cache datum vars and retrieve later for debugging which vars changed. @@ -41,7 +41,7 @@ #define GC_FAILURE_HARD_LOOKUP #endif // REFERENCE_DOING_IT_LIVE -//#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER +#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER #ifndef PRELOAD_RSC //set to: #define PRELOAD_RSC 2 // 0 to allow using external resources or on-demand behaviour; diff --git a/code/datums/components/udder.dm b/code/datums/components/udder.dm index 062b291e027c..ae2ceb6ec7e9 100644 --- a/code/datums/components/udder.dm +++ b/code/datums/components/udder.dm @@ -141,8 +141,8 @@ RegisterSignal(udder_mob, COMSIG_HOSTILE_ATTACKINGTARGET, .proc/on_mob_attacking) /obj/item/udder/gutlunch/Destroy() - . = ..() UnregisterSignal(udder_mob, COMSIG_HOSTILE_ATTACKINGTARGET) + . = ..() /obj/item/udder/gutlunch/process(delta_time) var/mob/living/simple_animal/hostile/asteroid/gutlunch/gutlunch = udder_mob diff --git a/code/game/machinery/shuttle/shuttle_engine.dm b/code/game/machinery/shuttle/shuttle_engine.dm index 26bfc846c5d0..0f8802f65a73 100644 --- a/code/game/machinery/shuttle/shuttle_engine.dm +++ b/code/game/machinery/shuttle/shuttle_engine.dm @@ -66,12 +66,12 @@ /obj/machinery/power/shuttle/engine/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) . = ..() - port.engine_list |= src + port.engine_list |= WEAKREF(src) parent_shuttle = port /obj/machinery/power/shuttle/engine/Destroy() if(parent_shuttle) - parent_shuttle.engine_list -= src + parent_shuttle.engine_list -= WEAKREF(src) return ..() /obj/machinery/power/shuttle/engine/on_construction() diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index e92ba7b42406..b36fcf443bc3 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -89,7 +89,6 @@ and clear when youre done! if you dont i will use :newspaper2: on you /obj/machinery/computer/holodeck/LateInitialize()//from here linked is populated and the program list is generated. its also set to load the offline program linked = GLOB.areas_by_type[mapped_start_area] - bottom_left = locate(linked.x, linked.y, z) var/area/computer_area = get_area(src) if(istype(computer_area, /area/holodeck)) @@ -115,6 +114,7 @@ and clear when youre done! if you dont i will use :newspaper2: on you else linked.power_usage = list(AREA_USAGE_LEN) + bottom_left = locate(linked.x, linked.y, z) COOLDOWN_START(src, holodeck_cooldown, HOLODECK_CD) generate_program_list() load_program(offline_program,TRUE) diff --git a/code/modules/overmap/helm.dm b/code/modules/overmap/helm.dm index 070f4d9f9cd1..b219b506328d 100644 --- a/code/modules/overmap/helm.dm +++ b/code/modules/overmap/helm.dm @@ -213,6 +213,9 @@ .["burnPercentage"] = current_ship.burn_percentage for(var/datum/weakref/engine in current_ship.shuttle_port.engine_list) var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() + if(!real_engine) + engine_list -= engine + continue var/list/engine_data if(!real_engine.thruster_active) engine_data = list( @@ -303,6 +306,9 @@ if("toggle_engine") var/datum/weakref/engine = locate(params["engine"]) in current_ship.shuttle_port.engine_list var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() + if(!real_engine) + engine_list -= engine + return real_engine.enabled = !real_engine.enabled real_engine.update_icon_state() current_ship.refresh_engines() diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index 100c33af38ed..b3232fb3f3c5 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -185,6 +185,9 @@ calculate_avg_fuel() for(var/datum/weakref/engine in shuttle_port.engine_list) var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() + if(!real_engine) + engine_list -= engine + continue if(!real_engine.enabled) continue thrust_used += real_engine.burn_engine(percentage, deltatime) @@ -199,10 +202,14 @@ */ /datum/overmap/ship/controlled/proc/refresh_engines() var/calculated_thrust - for(var/obj/machinery/power/shuttle/engine/E as anything in shuttle_port.engine_list) - E.update_engine() - if(E.enabled) - calculated_thrust += E.thrust + for(var/datum/weakref/engine in shuttle_port.engine_list) + var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() + if(!real_engine) + engine_list -= engine + continue + real_engine.update_engine() + if(real_engine.enabled) + calculated_thrust += real_engine.thrust est_thrust = calculated_thrust / (shuttle_port.turf_count * 100) /** @@ -211,10 +218,14 @@ /datum/overmap/ship/controlled/proc/calculate_avg_fuel() var/fuel_avg = 0 var/engine_amnt = 0 - for(var/obj/machinery/power/shuttle/engine/E as anything in shuttle_port.engine_list) - if(!E.enabled) + for(var/datum/weakref/engine in shuttle_port.engine_list) + var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() + if(!real_engine) + engine_list -= engine + continue + if(!real_engine.enabled) continue - fuel_avg += E.return_fuel() / E.return_fuel_cap() + fuel_avg += real_engine.return_fuel() / real_engine.return_fuel_cap() engine_amnt++ if(!engine_amnt || !fuel_avg) avg_fuel_amnt = 0 diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index c788c3066514..a2f5979fa7da 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -104,8 +104,7 @@ other types of metals and chemistry for reagents). . = ..() pixel_x = base_pixel_x + rand(-5, 5) pixel_y = base_pixel_y + rand(-5, 5) - for(var/i in 1 to max_blueprints) - blueprints += null + blueprints = new/list(max_blueprints) /obj/item/disk/design_disk/adv name = "Advanced Component Design Disk" @@ -172,7 +171,7 @@ other types of metals and chemistry for reagents). name = "design disk - CMM mecha modifications" desc = "A design disk containing specifications for CMM-custom mecha conversions." color = "#57b8f0" - max_blueprints = 3 + max_blueprints = 2 /obj/item/disk/design_disk/cmm_mechs/Initialize() . = ..() diff --git a/code/modules/surgery/bodyparts/robot_bodyparts.dm b/code/modules/surgery/bodyparts/robot_bodyparts.dm index 79b674438098..990a9a693d13 100644 --- a/code/modules/surgery/bodyparts/robot_bodyparts.dm +++ b/code/modules/surgery/bodyparts/robot_bodyparts.dm @@ -509,16 +509,11 @@ static_icon = 'icons/mob/augmentation/augments_vox.dmi' bodytype = BODYTYPE_VOX | BODYTYPE_ROBOTIC -/obj/item/bodypart/l_leg/robot/vox +/obj/item/bodypart/leg/robot/vox name = "prosthetic vox left leg" static_icon = 'icons/mob/augmentation/augments_vox.dmi' bodytype = BODYTYPE_VOX | BODYTYPE_ROBOTIC -/obj/item/bodypart/r_leg/robot/vox - name = "prosthetic vox right leg" - static_icon = 'icons/mob/augmentation/augments_vox.dmi' - bodytype = BODYTYPE_VOX | BODYTYPE_ROBOTIC - // Surplus Vox Robotic /obj/item/bodypart/l_arm/robot/surplus/vox name = "surplus prosthetic vox left arm" diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 54a0d393a9f5..4913c1b6b89d 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -38,6 +38,13 @@ /obj/effect/DPtarget, //needs a derg /obj/structure/carp_rift, + //doesn't have icons + /obj/item/bodypart, + /obj/item/bodypart/chest, + /obj/item/bodypart/head, + /obj/item/bodypart/l_arm, + /obj/item/bodypart/r_arm, + /obj/item/bodypart/leg ) //This turf existing is an error in and of itself ignore += typesof(/turf/baseturf_skipover) From 079b0fd551e000b17ede98f35a53d288f892a73b Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 16 Jul 2023 00:17:05 -0500 Subject: [PATCH 016/147] augh --- code/_compile_options.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index df0b9437f760..a1db7ae6f98f 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -1,4 +1,4 @@ -#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this +//#define TESTING //By using the testing("message") proc you can create debug-feedback for people with this //uncommented, but not visible in the release version) //#define DATUMVAR_DEBUGGING_MODE //Enables the ability to cache datum vars and retrieve later for debugging which vars changed. @@ -41,7 +41,7 @@ #define GC_FAILURE_HARD_LOOKUP #endif // REFERENCE_DOING_IT_LIVE -#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER +//#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER #ifndef PRELOAD_RSC //set to: #define PRELOAD_RSC 2 // 0 to allow using external resources or on-demand behaviour; From c418f8bec137025f97286f9e2d6016a0ed2445a2 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 16 Jul 2023 00:27:01 -0500 Subject: [PATCH 017/147] final cleanup --- code/modules/overmap/helm.dm | 4 ++-- .../overmap/ships/controlled_ship_datum.dm | 18 +++--------------- code/modules/shuttle/shuttle.dm | 17 ++++++++++------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/code/modules/overmap/helm.dm b/code/modules/overmap/helm.dm index b219b506328d..974de8e40d63 100644 --- a/code/modules/overmap/helm.dm +++ b/code/modules/overmap/helm.dm @@ -214,7 +214,7 @@ for(var/datum/weakref/engine in current_ship.shuttle_port.engine_list) var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() if(!real_engine) - engine_list -= engine + current_ship.shuttle_port.engine_list -= engine continue var/list/engine_data if(!real_engine.thruster_active) @@ -307,7 +307,7 @@ var/datum/weakref/engine = locate(params["engine"]) in current_ship.shuttle_port.engine_list var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() if(!real_engine) - engine_list -= engine + current_ship.shuttle_port.engine_list -= engine return real_engine.enabled = !real_engine.enabled real_engine.update_icon_state() diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index b3232fb3f3c5..1894642fedb4 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -183,11 +183,7 @@ var/thrust_used = 0 //The amount of thrust that the engines will provide with one burn refresh_engines() calculate_avg_fuel() - for(var/datum/weakref/engine in shuttle_port.engine_list) - var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() - if(!real_engine) - engine_list -= engine - continue + for(var/obj/machinery/power/shuttle/engine/real_engine as anything in shuttle_port.get_engines()) if(!real_engine.enabled) continue thrust_used += real_engine.burn_engine(percentage, deltatime) @@ -202,11 +198,7 @@ */ /datum/overmap/ship/controlled/proc/refresh_engines() var/calculated_thrust - for(var/datum/weakref/engine in shuttle_port.engine_list) - var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() - if(!real_engine) - engine_list -= engine - continue + for(var/obj/machinery/power/shuttle/engine/real_engine as anything in shuttle_port.get_engines()) real_engine.update_engine() if(real_engine.enabled) calculated_thrust += real_engine.thrust @@ -218,11 +210,7 @@ /datum/overmap/ship/controlled/proc/calculate_avg_fuel() var/fuel_avg = 0 var/engine_amnt = 0 - for(var/datum/weakref/engine in shuttle_port.engine_list) - var/obj/machinery/power/shuttle/engine/real_engine = engine.resolve() - if(!real_engine) - engine_list -= engine - continue + for(var/obj/machinery/power/shuttle/engine/real_engine as anything in shuttle_port.get_engines()) if(!real_engine.enabled) continue fuel_avg += real_engine.return_fuel() / real_engine.return_fuel_cap() diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index ce63691a1a73..073583d45c10 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -866,6 +866,15 @@ else . = "unknown" +/obj/docking_port/mobile/proc/get_engines() + . = list() + for(var/datum/weakref/engine in engine_list) + var/obj/structure/shuttle/engine/real_engine = engine.resolve() + if(!real_engine) + engine_list -= engine + continue + . += real_engine + /obj/docking_port/mobile/proc/hyperspace_sound(phase, list/areas) var/selected_sound switch(phase) @@ -883,13 +892,7 @@ var/range = max(width, height) var/long_range = range * 2.5 var/atom/distant_source - var/list/engines = list() - for(var/datum/weakref/engine in engine_list) - var/obj/structure/shuttle/engine/real_engine = engine.resolve() - if(!real_engine) - engine_list -= engine - continue - engines += real_engine + var/list/engines = get_engines() if(engines[1]) distant_source = engines[1] From b091ca3864957b74db432000a8db3837dde1b24d Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 16 Jul 2023 00:58:17 -0500 Subject: [PATCH 018/147] quirk reference fixes --- .../subsystem/processing/quirks.dm | 14 ++++--- code/datums/dna.dm | 4 +- code/datums/traits/_quirk.dm | 3 -- code/datums/traits/negative.dm | 1 - code/modules/client/preferences.dm | 42 +++++++++---------- 5 files changed, 30 insertions(+), 34 deletions(-) diff --git a/code/controllers/subsystem/processing/quirks.dm b/code/controllers/subsystem/processing/quirks.dm index e62e5bd30e3f..b5b8113384df 100644 --- a/code/controllers/subsystem/processing/quirks.dm +++ b/code/controllers/subsystem/processing/quirks.dm @@ -8,11 +8,11 @@ PROCESSING_SUBSYSTEM_DEF(quirks) wait = 10 runlevels = RUNLEVEL_GAME - var/list/quirks = list() //Assoc. list of all roundstart quirk datum types; "name" = /path/ - var/list/quirk_points = list() //Assoc. list of quirk names and their "point cost"; positive numbers are good traits, and negative ones are bad - var/list/quirk_objects = list() //A list of all quirk objects in the game, since some may process - var/list/quirk_blacklist = list() //A list a list of quirks that can not be used with each other. Format: list(quirk1,quirk2),list(quirk3,quirk4) - var/list/quirk_instances = list() //Assoc. list with instances of all roundstart quirk datum types; "name" = /path/ + var/list/quirks = list() //Assoc. list of all roundstart quirk datum types; "name" = /path/ + var/list/quirk_points = list() //Assoc. list of quirk names and their "point cost"; positive numbers are good traits, and negative ones are bad + var/list/quirk_objects = list() //A list of all quirk objects in the game, since some may process + var/list/quirk_blacklist = list() //A list a list of quirks that can not be used with each other. Format: list(quirk1,quirk2),list(quirk3,quirk4) + var/list/species_blacklist = list() //A list of quirks and the species they can't be used by /datum/controller/subsystem/processing/quirks/Initialize(timeofday) if(!quirks.len) @@ -25,6 +25,9 @@ PROCESSING_SUBSYSTEM_DEF(quirks) list("Alcohol Tolerance","Light Drinker"), \ list("Clown Fan","Mime Fan"), \ list("Bad Touch", "Friendly")) + + species_blacklist = list("Blood Deficiency" = list(SPECIES_IPC, SPECIES_JELLYPERSON, SPECIES_PLASMAMAN, SPECIES_VAMPIRE)) + for(var/client/client in GLOB.clients) client?.prefs.check_quirk_compatibility() return ..() @@ -37,7 +40,6 @@ PROCESSING_SUBSYSTEM_DEF(quirks) var/datum/quirk/T = V quirks[initial(T.name)] = T quirk_points[initial(T.name)] = initial(T.value) - quirk_instances[initial(T.name)] = new T /datum/controller/subsystem/processing/quirks/proc/AssignQuirks(mob/living/user, client/cli, spawn_effects) var/badquirk = FALSE diff --git a/code/datums/dna.dm b/code/datums/dna.dm index 60e74d97fb7d..5a1c2b3783d4 100644 --- a/code/datums/dna.dm +++ b/code/datums/dna.dm @@ -339,8 +339,8 @@ for(var/datum/quirk/quirk_instance as anything in roundstart_quirks) quirks_to_remove += quirk_instance.type for(var/quirk_name in quirks_resolved) - var/datum/quirk/quirk_instance = SSquirks.quirk_instances[quirk_name] - quirks_resolved += quirk_instance.type + var/datum/quirk/quirk_type = SSquirks.quirks[quirk_name] + quirks_resolved += quirk_type quirks_resolved -= quirk_name quirks_to_remove -= quirks_resolved for(var/quirk_type in quirks_to_remove) diff --git a/code/datums/traits/_quirk.dm b/code/datums/traits/_quirk.dm index 75d9dde5cff5..bd4f5982901d 100644 --- a/code/datums/traits/_quirk.dm +++ b/code/datums/traits/_quirk.dm @@ -1,5 +1,3 @@ -#define TRAIT_SPECIES_WHITELIST(ids...) list("type" = "allowed", ids) -#define TRAIT_SPECIES_BLACKLIST(ids...) list("type" = "blocked", ids) //every quirk in this folder should be coded around being applied on spawn //these are NOT "mob quirks" like GOTTAGOFAST, but exist as a medium to apply them and other different effects /datum/quirk @@ -12,7 +10,6 @@ var/medical_record_text //This text will appear on medical records for the trait. Not yet implemented var/mood_quirk = FALSE //if true, this quirk affects mood and is unavailable if moodlets are disabled var/list/mob_traits //if applicable, apply and remove these mob traits - var/list/species_lock = list() //List of id-based locks for species, use either TRAIT_SPECIES_WHITELIST or TRAIT_SPECIES_BLACKLIST inputting the species ids to said macros. Example: species_lock = TRAIT_SPECIES_WHITELIST(SPECIES_IPC, SPECIES_MOTH) var/mob/living/quirk_holder /datum/quirk/New(mob/living/quirk_mob, spawn_effects) diff --git a/code/datums/traits/negative.dm b/code/datums/traits/negative.dm index db6fdbd75841..c8e3b582511d 100644 --- a/code/datums/traits/negative.dm +++ b/code/datums/traits/negative.dm @@ -23,7 +23,6 @@ gain_text = "You feel your vigor slowly fading away." lose_text = "You feel vigorous again." medical_record_text = "Patient requires regular treatment for blood loss due to low production of blood." - species_lock = TRAIT_SPECIES_BLACKLIST(SPECIES_IPC, SPECIES_JELLYPERSON, SPECIES_PLASMAMAN, SPECIES_VAMPIRE) // These bad boys have NOBLOOD and are roundstart available. /datum/quirk/blooddeficiency/on_process() var/mob/living/carbon/human/H = quirk_holder diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 82cf7eb653de..f6efa0d1193a 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1342,24 +1342,22 @@ GLOBAL_LIST_EMPTY(preferences_datums) /datum/preferences/proc/check_quirk_compatibility(mob/user) var/list/quirk_conflicts = list() var/list/handled_conflicts = list() - for(var/quirk_index in SSquirks.quirk_instances) - var/datum/quirk/quirk_instance = SSquirks.quirk_instances[quirk_index] - if(!quirk_instance) - continue - if(quirk_instance.mood_quirk && CONFIG_GET(flag/disable_human_mood)) - quirk_conflicts[quirk_instance.name] = "Mood and mood quirks are disabled." + for(var/quirk_name in SSquirks.quirks) + var/datum/quirk/quirk_type = SSquirks.quirks[quirk_name] + if(initial(quirk_type.mood_quirk) && CONFIG_GET(flag/disable_human_mood)) + quirk_conflicts[quirk_name] = "Mood and mood quirks are disabled." if(!handled_conflicts["mood"]) handle_quirk_conflict("mood", null, user) handled_conflicts["mood"] = TRUE - if(((quirk_instance.species_lock["type"] == "allowed") && !(pref_species.id in quirk_instance.species_lock)) || (quirk_instance.species_lock["type"] == "blocked" && (pref_species.id in quirk_instance.species_lock))) - quirk_conflicts[quirk_instance.name] = "Quirk unavailable to species." + if((quirk_name in SSquirks.species_blacklist) && (pref_species.id in SSquirks.species_blacklist[quirk_name])) + quirk_conflicts[quirk_name] = "Quirk unavailable to species." if(!handled_conflicts["species"]) handle_quirk_conflict("species", pref_species, user) handled_conflicts["species"] = TRUE for(var/blacklist in SSquirks.quirk_blacklist) for(var/quirk_blacklisted in all_quirks) - if((quirk_blacklisted in blacklist) && !quirk_conflicts[quirk_instance.name] && (quirk_instance.name in blacklist) && !(quirk_instance.name == quirk_blacklisted)) - quirk_conflicts[quirk_instance.name] = "Quirk is mutually exclusive with [quirk_blacklisted]." + if((quirk_blacklisted in blacklist) && !quirk_conflicts[quirk_name] && (quirk_name in blacklist) && !(quirk_name == quirk_blacklisted)) + quirk_conflicts[quirk_name] = "Quirk is mutually exclusive with [quirk_blacklisted]." if(!handled_conflicts["blacklist"]) handle_quirk_conflict("blacklist", null, user) handled_conflicts["blacklist"] = TRUE @@ -1382,24 +1380,24 @@ GLOBAL_LIST_EMPTY(preferences_datums) target_species = additional_argument else return - for(var/quirk_owned in all_quirks) - var/datum/quirk/quirk_owned_instance = SSquirks.quirk_instances[quirk_owned] - balance -= quirk_owned_instance.value + for(var/quirk_name in all_quirks) + var/datum/quirk/quirk_type = SSquirks.quirks[quirk_name] + balance -= initial(quirk_type.value) switch(change_type) if("species") - if(((quirk_owned_instance.species_lock["type"] == "allowed") && !(target_species.id in quirk_owned_instance.species_lock)) || ((quirk_owned_instance.species_lock["type"] == "blocked") && (target_species.id in quirk_owned_instance.species_lock))) - all_quirks_new -= quirk_owned_instance.name - balance += quirk_owned_instance.value + if((quirk_name in SSquirks.species_blacklist) && (pref_species.id in SSquirks.species_blacklist[quirk_name])) + all_quirks_new -= quirk_name + balance += initial(quirk_type.value) if("mood") - if(quirk_owned_instance.mood_quirk) - all_quirks_new -= quirk_owned_instance.name - balance += quirk_owned_instance.value + if(initial(quirk_type.mood_quirk)) + all_quirks_new -= quirk_name + balance += initial(quirk_type.value) if("blacklist") for(var/blacklist in SSquirks.quirk_blacklist) for(var/quirk_blacklisted in all_quirks_new) - if((quirk_blacklisted in blacklist) && (quirk_owned_instance.name in blacklist) && !(quirk_owned_instance.name == quirk_blacklisted)) - all_quirks_new -= quirk_owned_instance.name - balance += quirk_owned_instance.value + if((quirk_blacklisted in blacklist) && (quirk_name in blacklist) && !(quirk_name == quirk_blacklisted)) + all_quirks_new -= quirk_name + balance += initial(quirk_type.value) if(balance < 0) var/list/positive_quirks = list() for(var/quirk_owned in all_quirks_new) From ccc78cebf2b5b8b49117b2b3e5f81f39ab5e3ac3 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 16 Jul 2023 12:18:40 -0500 Subject: [PATCH 019/147] more of em --- code/game/objects/items/devices/geiger_counter.dm | 10 +++++----- code/modules/instruments/songs/_song.dm | 1 + code/modules/ninja/energy_katana.dm | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm index f9399a8f40c4..a2b1938abab2 100644 --- a/code/game/objects/items/devices/geiger_counter.dm +++ b/code/game/objects/items/devices/geiger_counter.dm @@ -38,6 +38,7 @@ soundloop = new(list(src), FALSE) /obj/item/geiger_counter/Destroy() + QDEL_NULL(soundloop) STOP_PROCESSING(SSobj, src) return ..() @@ -108,15 +109,14 @@ icon_state = "geiger_on_5" /obj/item/geiger_counter/proc/update_sound() - var/datum/looping_sound/geiger/loop = soundloop if(!scanning) - loop.stop() + soundloop.stop() return if(!radiation_count) - loop.stop() + soundloop.stop() return - loop.last_radiation = radiation_count - loop.start() + soundloop.last_radiation = radiation_count + soundloop.start() /obj/item/geiger_counter/rad_act(amount) . = ..() diff --git a/code/modules/instruments/songs/_song.dm b/code/modules/instruments/songs/_song.dm index 10b8a019233d..7619cde862fb 100644 --- a/code/modules/instruments/songs/_song.dm +++ b/code/modules/instruments/songs/_song.dm @@ -146,6 +146,7 @@ stop_playing() SSinstruments.on_song_del(src) lines = null + using_instrument.songs_using -= src using_instrument = null allowed_instrument_ids = null parent = null diff --git a/code/modules/ninja/energy_katana.dm b/code/modules/ninja/energy_katana.dm index f6a8b7333f9c..4e26dfa652f5 100644 --- a/code/modules/ninja/energy_katana.dm +++ b/code/modules/ninja/energy_katana.dm @@ -96,6 +96,7 @@ /obj/item/energy_katana/Destroy() QDEL_NULL(spark_system) + QDEL_NULL(jaunt) return ..() /datum/action/innate/dash/ninja From 812529b432acbd88512560463c76241a2618e17f Mon Sep 17 00:00:00 2001 From: AnturK Date: Thu, 11 Jun 2020 16:30:15 +0200 Subject: [PATCH 020/147] Proximity monitor related fixes. (#51544) * Makes cameras create prox monitors only when necessary. * typofix * Makes proximity monitors behave properly on shuttle moves. * Makes transit turfs work without crosslinked levels. --- code/game/area/ai_monitored.dm | 2 +- code/game/machinery/camera/camera.dm | 9 ++++++++- code/game/machinery/camera/presets.dm | 3 +++ code/modules/shuttle/on_move.dm | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/code/game/area/ai_monitored.dm b/code/game/area/ai_monitored.dm index e0d6f18a838b..0490c88def2d 100644 --- a/code/game/area/ai_monitored.dm +++ b/code/game/area/ai_monitored.dm @@ -10,7 +10,7 @@ for (var/obj/machinery/camera/M in src) if(M.isMotion()) motioncameras.Add(M) - M.area_motion = src + M.set_area_motion(src) //Only need to use one camera diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 5ecfdcb5c4f0..8141449f8b10 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -80,7 +80,6 @@ if (isturf(loc)) myarea = get_area(src) LAZYADD(myarea.cameras, src) - proximity_monitor = new(src, 1) if(mapload && prob(3) && !start_active) toggle_cam() @@ -92,6 +91,14 @@ network -= i network += "[REF(port)][i]" +/obj/machinery/proc/create_prox_monitor() + if(!proximity_monitor) + proximity_monitor = new(src, 1) + +/obj/machinery/camera/proc/set_area_motion(area/A) + area_motion = A + create_prox_monitor() + /obj/machinery/camera/Destroy() if(can_use()) toggle_cam(null, 0) //kick anyone viewing out and remove from the camera chunks diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm index b2b8665121f9..29f2910b3746 100644 --- a/code/game/machinery/camera/presets.dm +++ b/code/game/machinery/camera/presets.dm @@ -133,8 +133,11 @@ if(!assembly.proxy_module) assembly.proxy_module = new(assembly) upgrades |= CAMERA_UPGRADE_MOTION + create_prox_monitor() /obj/machinery/camera/proc/removeMotion() if(name == "motion-sensitive security camera") name = "security camera" upgrades &= ~CAMERA_UPGRADE_MOTION + if(!area_motion) + QDEL_NULL(proximity_monitor) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index 413b59dd1a62..748f48b017c7 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -148,6 +148,8 @@ All ShuttleMove procs go here update_light() if(rotation) shuttleRotate(rotation) + if(proximity_monitor) + proximity_monitor.HandleMove() update_parallax_contents() From 7e5b1254d932e2fbad8d296c375127a04733f539 Mon Sep 17 00:00:00 2001 From: Rohesie Date: Fri, 25 Jun 2021 17:36:00 -0300 Subject: [PATCH 021/147] CanPass refactor (#59804) --- code/_onclick/adjacent.dm | 2 +- code/game/atoms.dm | 10 +++--- code/game/atoms_movable.dm | 8 ++--- code/game/machinery/deployable.dm | 2 +- code/game/machinery/doors/door.dm | 2 +- code/game/machinery/doors/firedoor.dm | 4 +-- code/game/machinery/doors/windowdoor.dm | 5 +-- code/game/machinery/recycler.dm | 5 ++- code/game/machinery/shieldgen.dm | 2 +- code/game/machinery/transformer.dm | 2 +- .../mecha/equipment/tools/medical_tools.dm | 34 +++++++------------ code/game/objects/buckling.dm | 7 ++-- .../objects/effects/decals/cleanable/food.dm | 4 +-- code/game/objects/effects/spiders.dm | 4 +-- .../structures/crates_lockers/closets.dm | 2 +- .../structures/crates_lockers/crates.dm | 2 +- code/game/objects/structures/girders.dm | 2 +- code/game/objects/structures/grille.dm | 2 +- code/game/objects/structures/holosign.dm | 8 ++--- code/game/objects/structures/mineral_doors.dm | 2 +- code/game/objects/structures/morgue.dm | 2 +- code/game/objects/structures/plasticflaps.dm | 30 ++++++++-------- code/game/objects/structures/railings.dm | 7 ++-- code/game/objects/structures/tables_racks.dm | 4 +-- .../objects/structures/windoor_assembly.dm | 5 +-- code/game/objects/structures/window.dm | 22 +++++++----- code/game/turfs/open/chasm.dm | 2 +- code/game/turfs/turf.dm | 11 +++--- code/modules/antagonists/blob/blob_mobs.dm | 2 +- .../antagonists/blob/structures/_blob.dm | 4 +-- code/modules/antagonists/revenant/revenant.dm | 4 +-- code/modules/awaymissions/away_props.dm | 8 ++--- code/modules/events/spacevine.dm | 2 +- code/modules/fields/fields.dm | 4 +-- code/modules/fields/peaceborg_dampener.dm | 2 +- code/modules/fields/turf_objects.dm | 8 ++--- code/modules/flufftext/Hallucination.dm | 2 +- code/modules/mining/minebot.dm | 16 ++++----- .../carbon/alien/humanoid/caste/hunter.dm | 2 +- code/modules/mob/living/living_movement.dm | 2 +- .../living/simple_animal/hostile/hostile.dm | 2 +- .../simple_animal/hostile/jungle/mook.dm | 8 ++--- .../hostile/megafauna/bubblegum.dm | 4 +-- .../hostile/megafauna/hierophant.dm | 2 +- .../mob/living/simple_animal/hostile/mimic.dm | 2 +- .../hostile/mining_mobs/curse_blob.dm | 2 +- .../hostile/mining_mobs/elites/elite.dm | 2 +- code/modules/mob/mob_movement.dm | 2 +- .../plumbing/plumbers/grinder_chemical.dm | 5 ++- .../power/singularity/containment_field.dm | 2 +- code/modules/projectiles/guns/misc/medbeam.dm | 30 +++++++++++----- code/modules/projectiles/projectile.dm | 4 +-- code/modules/reagents/reagent_containers.dm | 2 +- .../ruins/objects_and_mobs/necropolis_gate.dm | 4 +-- .../ruins/objects_and_mobs/sin_ruins.dm | 2 +- code/modules/shuttle/special.dm | 2 +- code/modules/spells/spell.dm | 19 ++++++++--- code/modules/spells/spell_types/forcewall.dm | 4 +-- 58 files changed, 183 insertions(+), 163 deletions(-) diff --git a/code/_onclick/adjacent.dm b/code/_onclick/adjacent.dm index 2528c246dcf4..944847959158 100644 --- a/code/_onclick/adjacent.dm +++ b/code/_onclick/adjacent.dm @@ -104,7 +104,7 @@ */ /turf/proc/ClickCross(target_dir, border_only, target_atom = null, atom/movable/mover = null) for(var/obj/O in src) - if((mover && O.CanPass(mover,get_step(src,target_dir))) || (!mover && !O.density)) + if((mover && O.CanPass(mover, target_dir)) || (!mover && !O.density)) continue if(O == target_atom || O == mover || (O.pass_flags_self & LETPASSTHROW)) //check if there's a dense object present on the turf continue // LETPASSTHROW is used for anything you can click through (or the firedoor special case, see above) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index e0f711640db3..d829516fe701 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -333,19 +333,19 @@ P.setAngle(new_angle_s) return TRUE -///Can the mover object pass this atom, while heading for the target turf -/atom/proc/CanPass(atom/movable/mover, turf/target) +/// Whether the mover object can avoid being blocked by this atom, while arriving from (or leaving through) the border_dir. +/atom/proc/CanPass(atom/movable/mover, border_dir) SHOULD_CALL_PARENT(TRUE) SHOULD_BE_PURE(TRUE) if(mover.movement_type & PHASING) return TRUE - . = CanAllowThrough(mover, target) + . = CanAllowThrough(mover, border_dir) // This is cheaper than calling the proc every time since most things dont override CanPassThrough if(!mover.generic_canpass) - return mover.CanPassThrough(src, target, .) + return mover.CanPassThrough(src, REVERSE_DIR(border_dir), .) /// Returns true or false to allow the mover to move through src -/atom/proc/CanAllowThrough(atom/movable/mover, turf/target) +/atom/proc/CanAllowThrough(atom/movable/mover, border_dir) SHOULD_CALL_PARENT(TRUE) //SHOULD_BE_PURE(TRUE) if(mover.pass_flags & pass_flags_self) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index b27aee5e0b06..3dc329f91361 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -550,7 +550,7 @@ /atom/movable/Cross(atom/movable/AM) . = TRUE SEND_SIGNAL(src, COMSIG_MOVABLE_CROSS, AM) - return CanPass(AM, AM.loc, TRUE) + return CanPass(AM, get_dir(src, AM)) ///default byond proc that is deprecated for us in lieu of signals. do not call /atom/movable/Crossed(atom/movable/crossed_atom, oldloc) @@ -858,13 +858,13 @@ /atom/movable/proc/move_crushed(atom/movable/pusher, force = MOVE_FORCE_DEFAULT, direction) return FALSE -/atom/movable/CanAllowThrough(atom/movable/mover, turf/target) +/atom/movable/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(mover in buckled_mobs) return TRUE /// Returns true or false to allow src to move through the blocker, mover has final say -/atom/movable/proc/CanPassThrough(atom/blocker, turf/target, blocker_opinion) +/atom/movable/proc/CanPassThrough(atom/blocker, movement_dir, blocker_opinion) SHOULD_CALL_PARENT(TRUE) SHOULD_BE_PURE(TRUE) return blocker_opinion @@ -889,7 +889,7 @@ return turf else var/atom/movable/AM = A - if(!AM.CanPass(src) || AM.density) + if(AM.density || !AM.CanPass(src, get_dir(src, AM))) if(AM.anchored) return AM dense_object_backup = AM diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index c738256030db..3f62292736da 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -37,7 +37,7 @@ else return ..() -/obj/structure/barricade/CanAllowThrough(atom/movable/mover, turf/target)//So bullets will fly over and stuff. +/obj/structure/barricade/CanAllowThrough(atom/movable/mover, border_dir)//So bullets will fly over and stuff. . = ..() if(locate(/obj/structure/barricade) in get_turf(mover)) return TRUE diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 7d0f5a993183..d5bce4b0fcd6 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -158,7 +158,7 @@ . = ..() move_update_air(T) -/obj/machinery/door/CanAllowThrough(atom/movable/mover, turf/target) +/obj/machinery/door/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(.) return diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 2053d33a3e9a..15eab1793a93 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -398,9 +398,9 @@ return 0 // not big enough to matter return start_point.air.return_pressure() < 20 ? -1 : 1 -/obj/machinery/door/firedoor/border_only/CanAllowThrough(atom/movable/mover, turf/target) +/obj/machinery/door/firedoor/border_only/CanAllowThrough(atom/movable/mover, border_dir) . = ..() - if(!(get_dir(loc, target) == dir)) //Make sure looking at appropriate border + if(!(border_dir == dir)) //Make sure looking at appropriate border return TRUE /obj/machinery/door/firedoor/border_only/proc/on_exit(datum/source, atom/movable/leaving, direction) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 8aed9c5eb709..17cf7a62e539 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -105,11 +105,12 @@ do_animate("deny") return -/obj/machinery/door/window/CanAllowThrough(atom/movable/mover, turf/target) +/obj/machinery/door/window/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(.) return - if(get_dir(loc, target) == dir) //Make sure looking at appropriate border + + if(border_dir == dir) return FALSE if(istype(mover, /obj/structure/window)) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index eabe2c75fa72..16f1205222e2 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -83,12 +83,11 @@ is_powered = FALSE icon_state = icon_name + "[is_powered]" + "[(blood ? "bld" : "")]" // add the blood tag at the end -/obj/machinery/recycler/CanAllowThrough(atom/movable/AM) +/obj/machinery/recycler/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(!anchored) return - var/move_dir = get_dir(loc, AM.loc) - if(move_dir == eat_dir) + if(border_dir == eat_dir) return TRUE /obj/machinery/recycler/proc/on_entered(datum/source, atom/movable/AM) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index f8cebcb08bac..037828518801 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -632,7 +632,7 @@ if(gen_secondary) //using power may cause us to be destroyed gen_secondary.add_load(drain_amount * 0.5) -/obj/machinery/shieldwall/CanAllowThrough(atom/movable/mover, turf/target) +/obj/machinery/shieldwall/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(hardshield == TRUE) if(istype(mover) && (mover.pass_flags & PASSGLASS)) diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index 4b22b6b31e0c..85fd4f69da67 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -54,7 +54,7 @@ do_transform(AM) -/obj/machinery/transformer/CanAllowThrough(atom/movable/mover, turf/target) +/obj/machinery/transformer/CanAllowThrough(atom/movable/mover, border_dir) . = ..() // Allows items to go through, // to stop them from blocking the conveyor belt. diff --git a/code/game/mecha/equipment/tools/medical_tools.dm b/code/game/mecha/equipment/tools/medical_tools.dm index 2309818a995a..6396d07a7ed5 100644 --- a/code/game/mecha/equipment/tools/medical_tools.dm +++ b/code/game/mecha/equipment/tools/medical_tools.dm @@ -443,27 +443,19 @@ output += "Total: [round(reagents.total_volume,0.001)]/[reagents.maximum_volume] - Purge All" return output || "None" -/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/proc/load_syringe(obj/item/reagent_containers/syringe/S) - if(syringes.len= 2) - occupant_message("The syringe is too far away!") - return 0 - for(var/obj/structure/D in S.loc)//Basic level check for structures in the way (Like grilles and windows) - if(!(D.CanPass(S,src.loc))) - occupant_message("Unable to load syringe!") - return 0 - for(var/obj/machinery/door/D in S.loc)//Checks for doors - if(!(D.CanPass(S,src.loc))) - occupant_message("Unable to load syringe!") - return 0 - S.reagents.trans_to(src, S.reagents.total_volume, transfered_by = chassis.occupant) - S.forceMove(src) - syringes += S - occupant_message("Syringe loaded.") - update_equip_info() - return 1 - occupant_message("[src]'s syringe chamber is full!") - return 0 +/obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/proc/load_syringe(obj/item/reagent_containers/syringe/S, mob/user) + if(length(syringes) >= max_syringes) + occupant_message("[src]'s syringe chamber is full!") + return FALSE + if(!chassis.Adjacent(S)) + occupant_message("Unable to load syringe!") + return FALSE + S.reagents.trans_to(src, S.reagents.total_volume, transfered_by = user) + S.forceMove(src) + syringes += S + occupant_message("Syringe loaded.") + update_equip_info() + return TRUE /obj/item/mecha_parts/mecha_equipment/medical/syringe_gun/proc/analyze_reagents(atom/A) if(get_dist(src,A) >= 4) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 845db56a794f..42c32e04fa98 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -74,8 +74,11 @@ var/mob/living/L = M.pulledby L.reset_pull_offsets(M, TRUE) - if(!check_loc && M.loc != loc) - M.forceMove(loc) + if (CanPass(M, get_dir(loc, M))) + M.Move(loc) + else + if (!check_loc && M.loc != loc) + M.forceMove(loc) M.buckling = null M.set_buckled(src) diff --git a/code/game/objects/effects/decals/cleanable/food.dm b/code/game/objects/effects/decals/cleanable/food.dm index a5769f887160..709d7ca12102 100644 --- a/code/game/objects/effects/decals/cleanable/food.dm +++ b/code/game/objects/effects/decals/cleanable/food.dm @@ -32,9 +32,9 @@ icon_state = "salt_pile" var/safepasses = 3 //how many times can this salt pile be passed before dissipating -/obj/effect/decal/cleanable/food/salt/CanAllowThrough(atom/movable/AM, turf/target) +/obj/effect/decal/cleanable/food/salt/CanAllowThrough(atom/movable/mover, border_dir) . = ..() - if(is_species(AM, /datum/species/snail)) + if(is_species(mover, /datum/species/snail)) return FALSE /obj/effect/decal/cleanable/food/salt/Bumped(atom/movable/AM) diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index cc968a6a6b0a..8b70a3a6299f 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -36,7 +36,7 @@ icon_state = "stickyweb2" . = ..() -/obj/structure/spider/stickyweb/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/spider/stickyweb/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(genetic) return @@ -59,7 +59,7 @@ allowed_mob = allowedmob . = ..() -/obj/structure/spider/stickyweb/genetic/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/spider/stickyweb/genetic/CanAllowThrough(atom/movable/mover, border_dir) . = ..() //this is the normal spider web return aka a spider would make this TRUE if(mover == allowed_mob) return TRUE diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 1525ccd62994..30e2e1988280 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -113,7 +113,7 @@ if(HAS_TRAIT(L, TRAIT_SKITTISH)) . += "Ctrl-Shift-click [src] to jump inside." -/obj/structure/closet/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/closet/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(wall_mounted) return TRUE diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index d8f53246fc23..b57129620226 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -25,7 +25,7 @@ opened = TRUE update_icon() -/obj/structure/closet/crate/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/closet/crate/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(!istype(mover, /obj/structure/closet)) var/obj/structure/closet/crate/locatedcrate = locate(/obj/structure/closet/crate) in get_turf(mover) diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index 52b19a23eada..7a8aec8a97f2 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -297,7 +297,7 @@ qdel(src) return TRUE -/obj/structure/girder/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/girder/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if((mover.pass_flags & PASSGRILLE) || istype(mover, /obj/projectile)) return prob(girderpasschance) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index a77d857e020f..9a8e3b8750fd 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -126,7 +126,7 @@ if(!shock(user, 70)) take_damage(20, BRUTE, "melee", 1) -/obj/structure/grille/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/grille/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(!. && istype(mover, /obj/projectile)) return prob(30) diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm index 5ecbd70110d8..f85d57278cf9 100644 --- a/code/game/objects/structures/holosign.dm +++ b/code/game/objects/structures/holosign.dm @@ -85,7 +85,7 @@ max_integrity = 20 var/allow_walk = TRUE //can we pass through it on walk intent -/obj/structure/holosign/barrier/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/holosign/barrier/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(.) return @@ -104,7 +104,7 @@ countdown_color = "#FCFF00" lifespan = 2 MINUTES -/obj/structure/holosign/barrier/wetsign/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/holosign/barrier/wetsign/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(iscarbon(mover)) var/mob/living/carbon/C = mover @@ -164,7 +164,7 @@ . = ..() . += "The biometric scanners are [force_allaccess ? "off" : "on"]." -/obj/structure/holosign/barrier/medical/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/holosign/barrier/medical/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(force_allaccess) return TRUE @@ -193,7 +193,7 @@ return TRUE /obj/structure/holosign/barrier/medical/attack_hand(mob/living/user) - if(CanPass(user) && user.a_intent == INTENT_HELP) + if(user.a_intent == INTENT_HELP && CanPass(user, get_dir(src, user))) force_allaccess = !force_allaccess to_chat(user, "You [force_allaccess ? "deactivate" : "activate"] the biometric scanners.") //warning spans because you can make the station sick! else diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 34f42398d27b..4b3a4e440faf 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -57,7 +57,7 @@ return return TryToSwitchState(user) -/obj/structure/mineral_door/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/mineral_door/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(istype(mover, /obj/effect/beam)) return !opacity diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 3a467ebe5c41..a8ef61f616fe 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -380,7 +380,7 @@ GLOBAL_LIST_EMPTY(crematoriums) icon_state = "morguet" pass_flags_self = PASSTABLE -/obj/structure/tray/m_tray/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/tray/m_tray/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(.) return diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm index 2f385f65a161..4c7625b5dbcb 100644 --- a/code/game/objects/structures/plasticflaps.dm +++ b/code/game/objects/structures/plasticflaps.dm @@ -69,31 +69,33 @@ return CanAStarPass(ID, to_dir, M.pulling) return TRUE //diseases, stings, etc can pass -/obj/structure/plasticflaps/CanAllowThrough(atom/movable/A, turf/T) + +/obj/structure/plasticflaps/CanAllowThrough(atom/movable/mover, border_dir) . = ..() - if(istype(A) && (A.pass_flags & PASSGLASS)) + if(istype(mover) && (mover.pass_flags & PASSGLASS)) return prob(60) - var/obj/structure/bed/B = A - if(istype(A, /obj/structure/bed) && (B.has_buckled_mobs() || B.density))//if it's a bed/chair and is dense or someone is buckled, it will not pass - return FALSE + if(istype(mover, /obj/structure/bed)) + var/obj/structure/bed/bed_mover = mover + if(bed_mover.density || bed_mover.has_buckled_mobs())//if it's a bed/chair and is dense or someone is buckled, it will not pass + return FALSE - if(istype(A, /obj/structure/closet/cardboard)) - var/obj/structure/closet/cardboard/C = A - if(C.move_delay) + else if(istype(mover, /obj/structure/closet/cardboard)) + var/obj/structure/closet/cardboard/cardboard_mover = mover + if(cardboard_mover.move_delay) return FALSE - if(ismecha(A)) + else if(ismecha(mover)) return FALSE - else if(isliving(A)) // You Shall Not Pass! - var/mob/living/M = A - if(isbot(A)) //Bots understand the secrets + else if(isliving(mover)) // You Shall Not Pass! + var/mob/living/living_mover = mover + if(isbot(mover)) //Bots understand the secrets return TRUE - if(M.buckled && istype(M.buckled, /mob/living/simple_animal/bot/mulebot)) // mulebot passenger gets a free pass. + if(living_mover.buckled && istype(living_mover.buckled, /mob/living/simple_animal/bot/mulebot)) // mulebot passenger gets a free pass. return TRUE - if(M.body_position == STANDING_UP && !M.ventcrawler && M.mob_size != MOB_SIZE_TINY) //If your not laying down, or a ventcrawler or a small creature, no pass. + if(living_mover.body_position == STANDING_UP && !living_mover.ventcrawler && living_mover.mob_size != MOB_SIZE_TINY) //If your not laying down, or a ventcrawler or a small creature, no pass. return FALSE /obj/structure/plasticflaps/deconstruct(disassembled = TRUE) diff --git a/code/game/objects/structures/railings.dm b/code/game/objects/structures/railings.dm index 61b07aadb090..6147308cf62e 100644 --- a/code/game/objects/structures/railings.dm +++ b/code/game/objects/structures/railings.dm @@ -82,11 +82,10 @@ to_chat(user, "You [anchored ? "fasten the railing to":"unfasten the railing from"] the floor.") return TRUE -/obj/structure/railing/CanPass(atom/movable/mover, turf/target) +/obj/structure/railing/CanPass(atom/movable/mover, border_dir) . = ..() - if(get_dir(loc, target) & dir) - var/checking = FLYING | FLOATING - return . || mover.throwing || mover.movement_type & checking + if(border_dir & dir) + return . || mover.throwing || mover.movement_type & (FLYING | FLOATING) return TRUE /obj/structure/railing/proc/on_exit(datum/source, atom/movable/leaving, direction) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 5cc0b264538b..5a48d6a1f440 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -97,7 +97,7 @@ /obj/structure/table/attack_tk() return FALSE -/obj/structure/table/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/table/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(.) return @@ -658,7 +658,7 @@ . = ..() . += "It's held together by a couple of bolts." -/obj/structure/rack/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/rack/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(.) return diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index a187b49db9b9..58929f73b922 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -56,9 +56,10 @@ /obj/structure/windoor_assembly/update_icon_state() icon_state = "[facing]_[secure ? "secure_" : ""]windoor_assembly[state]" -/obj/structure/windoor_assembly/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/windoor_assembly/CanAllowThrough(atom/movable/mover, border_dir) . = ..() - if(get_dir(loc, target) == dir) //Make sure looking at appropriate border + + if(border_dir == dir) return if(istype(mover, /obj/structure/window)) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 8c6d1f5c18a8..eef6809f34b4 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -96,7 +96,7 @@ if(current_size >= STAGE_FIVE) deconstruct(FALSE) -/obj/structure/window/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/window/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(.) return @@ -104,7 +104,7 @@ if(fulltile) return FALSE - if(get_dir(loc, target) == dir) + if(border_dir == dir) return FALSE if(istype(mover, /obj/structure/window)) @@ -236,18 +236,24 @@ /obj/structure/window/proc/check_state_and_anchored(checked_state, checked_anchored) return check_state(checked_state) && check_anchored(checked_anchored) + /obj/structure/window/mech_melee_attack(obj/mecha/M) if(!can_be_reached()) return ..() /obj/structure/window/proc/can_be_reached(mob/user) - if(!fulltile) - if(get_dir(user,src) & dir) - for(var/obj/O in loc) - if(!O.CanPass(user, user.loc, 1)) - return 0 - return 1 + if(fulltile) + return TRUE + var/checking_dir = get_dir(user, src) + if(!(checking_dir & dir)) + return TRUE // Only windows on the other side may be blocked by other things. + checking_dir = REVERSE_DIR(checking_dir) + for(var/obj/blocker in loc) + if(!blocker.CanPass(user, checking_dir)) + return FALSE + return TRUE + /obj/structure/window/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1) . = ..() diff --git a/code/game/turfs/open/chasm.dm b/code/game/turfs/open/chasm.dm index 96c90e4a3d64..879e13192a01 100644 --- a/code/game/turfs/open/chasm.dm +++ b/code/game/turfs/open/chasm.dm @@ -17,7 +17,7 @@ AddComponent(/datum/component/chasm, below()) /// Lets people walk into chasms. -/turf/open/chasm/CanAllowThrough(atom/movable/AM, turf/target) +/turf/open/chasm/CanAllowThrough(atom/movable/mover, border_dir) . = ..() return TRUE diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index a440cd951905..53a5a039507e 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -234,15 +234,14 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists) if(density) return TRUE - for(var/atom/movable/content as anything in contents) + for(var/atom/movable/movable_content as anything in contents) // We don't want to block ourselves or consider any ignored atoms. - if((content == source_atom) || (content in ignore_atoms)) + if((movable_content == source_atom) || (movable_content in ignore_atoms)) continue - // If the thing is dense AND we're including mobs or the thing isn't a mob AND if there's a source atom and // it cannot pass through the thing on the turf, we consider the turf blocked. - if(content.density && (!exclude_mobs || !ismob(content))) - if(source_atom && content.CanPass(source_atom, src)) + if(movable_content.density && (!exclude_mobs || !ismob(movable_content))) + if(source_atom && movable_content.CanPass(source_atom, get_dir(src, source_atom))) continue return TRUE return FALSE @@ -352,7 +351,7 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists) // By default byond will call Bump() on the first dense object in contents // Here's hoping it doesn't stay like this for years before we finish conversion to step_ var/atom/firstbump - var/canPassSelf = CanPass(mover, src) + var/canPassSelf = CanPass(mover, get_dir(src, mover)) if(canPassSelf || (mover.movement_type & PHASING) || (mover.pass_flags & pass_flags_self)) for(var/atom/movable/thing as anything in contents) if(QDELETED(mover)) diff --git a/code/modules/antagonists/blob/blob_mobs.dm b/code/modules/antagonists/blob/blob_mobs.dm index 7c21939f89a0..46f71a47477c 100644 --- a/code/modules/antagonists/blob/blob_mobs.dm +++ b/code/modules/antagonists/blob/blob_mobs.dm @@ -62,7 +62,7 @@ else adjustFireLoss(5) -/mob/living/simple_animal/hostile/blob/CanAllowThrough(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/blob/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(istype(mover, /obj/structure/blob)) return TRUE diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm index 1fb0b0b12142..39c0ff8a7f01 100644 --- a/code/modules/antagonists/blob/structures/_blob.dm +++ b/code/modules/antagonists/blob/structures/_blob.dm @@ -160,11 +160,11 @@ playsound(src.loc, 'sound/effects/splat.ogg', 50, TRUE) //Let's give some feedback that we DID try to spawn in space, since players are used to it ConsumeTile() //hit the tile we're in, making sure there are no border objects blocking us - if(!T.CanPass(src, T)) //is the target turf impassable + if(!T.CanPass(src, get_dir(T, src))) //is the target turf impassable make_blob = FALSE T.blob_act(src) //hit the turf if it is for(var/atom/A in T) - if(!A.CanPass(src, T)) //is anything in the turf impassable + if(!A.CanPass(src, get_dir(T, src))) //is anything in the turf impassable make_blob = FALSE A.blob_act(src) //also hit everything in the turf diff --git a/code/modules/antagonists/revenant/revenant.dm b/code/modules/antagonists/revenant/revenant.dm index 99e0605ed092..6460a5073441 100644 --- a/code/modules/antagonists/revenant/revenant.dm +++ b/code/modules/antagonists/revenant/revenant.dm @@ -297,8 +297,8 @@ to_chat(src, "You cannot use abilities from inside of a wall.") return FALSE for(var/obj/O in T) - if(O.density && !O.CanPass(src, T)) - to_chat(src, "You cannot use abilities inside of a dense object.") + if(O.density && !O.CanPass(src, get_dir(T, src))) + to_chat(src, span_revenwarning("You cannot use abilities inside of a dense object.")) return FALSE if(inhibited) to_chat(src, "Your powers have been suppressed by nulling energy!") diff --git a/code/modules/awaymissions/away_props.dm b/code/modules/awaymissions/away_props.dm index 3a53bfac4735..f7eeeb9f7f96 100644 --- a/code/modules/awaymissions/away_props.dm +++ b/code/modules/awaymissions/away_props.dm @@ -6,11 +6,9 @@ invisibility = INVISIBILITY_MAXIMUM anchored = TRUE -/obj/effect/oneway/CanAllowThrough(atom/movable/mover, turf/target) +/obj/effect/oneway/CanAllowThrough(atom/movable/mover, border_dir) . = ..() - var/turf/T = get_turf(src) - var/turf/MT = get_turf(mover) - return . && (T == MT || get_dir(MT,T) == dir) + return . && border_dir == dir /obj/effect/wind @@ -45,7 +43,7 @@ if(blocked_types.len) blocked_types = typecacheof(blocked_types) -/obj/effect/path_blocker/CanAllowThrough(atom/movable/mover, turf/target) +/obj/effect/path_blocker/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(blocked_types.len) var/list/mover_contents = mover.GetAllContents() diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 952f83b36503..45e9551ae25a 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -541,7 +541,7 @@ if(!override) qdel(src) -/obj/structure/spacevine/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/spacevine/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(isvineimmune(mover)) return TRUE diff --git a/code/modules/fields/fields.dm b/code/modules/fields/fields.dm index 13c6f35a69df..7dde4cee5876 100644 --- a/code/modules/fields/fields.dm +++ b/code/modules/fields/fields.dm @@ -126,7 +126,7 @@ setup_edge_turf(T) CHECK_TICK -/datum/proximity_monitor/advanced/proc/field_turf_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F, turf/entering) +/datum/proximity_monitor/advanced/proc/field_turf_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F, border_dir) return TRUE /datum/proximity_monitor/advanced/proc/field_turf_crossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F) @@ -135,7 +135,7 @@ /datum/proximity_monitor/advanced/proc/field_turf_uncrossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F) return TRUE -/datum/proximity_monitor/advanced/proc/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, turf/entering) +/datum/proximity_monitor/advanced/proc/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, border_dir) return TRUE /datum/proximity_monitor/advanced/proc/field_edge_crossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F) diff --git a/code/modules/fields/peaceborg_dampener.dm b/code/modules/fields/peaceborg_dampener.dm index 5a1f14916481..e1d9ed5b3f62 100644 --- a/code/modules/fields/peaceborg_dampener.dm +++ b/code/modules/fields/peaceborg_dampener.dm @@ -106,7 +106,7 @@ staging -= AM return ..() -/datum/proximity_monitor/advanced/peaceborg_dampener/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, turf/entering) +/datum/proximity_monitor/advanced/peaceborg_dampener/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, border_dir) if(istype(AM, /obj/projectile)) staging[AM] = get_turf(AM) . = ..() diff --git a/code/modules/fields/turf_objects.dm b/code/modules/fields/turf_objects.dm index ce872622b0c3..b794e1946038 100644 --- a/code/modules/fields/turf_objects.dm +++ b/code/modules/fields/turf_objects.dm @@ -23,10 +23,10 @@ name = "energy field" desc = "Get off my turf!" -/obj/effect/abstract/proximity_checker/advanced/field_turf/CanAllowThrough(atom/movable/AM, turf/target) +/obj/effect/abstract/proximity_checker/advanced/field_turf/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(parent) - return parent.field_turf_canpass(AM, src, target) + return parent.field_turf_canpass(mover, src, border_dir) /obj/effect/abstract/proximity_checker/advanced/field_turf/on_entered(datum/source, atom/movable/AM) if(parent) @@ -42,10 +42,10 @@ name = "energy field edge" desc = "Edgy description here." -/obj/effect/abstract/proximity_checker/advanced/field_edge/CanAllowThrough(atom/movable/AM, turf/target) +/obj/effect/abstract/proximity_checker/advanced/field_edge/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(parent) - return parent.field_edge_canpass(AM, src, target) + return parent.field_edge_canpass(mover, src, border_dir) /obj/effect/abstract/proximity_checker/advanced/field_edge/on_entered(datum/source, atom/movable/AM) if(parent) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 514f0587da6f..b15b71ee6c15 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -662,7 +662,7 @@ GLOBAL_LIST_INIT(hallucination_list, list( target.playsound_local(get_turf(airlock), 'sound/machines/boltsup.ogg',30,0,3) qdel(src) -/obj/effect/hallucination/fake_door_lock/CanAllowThrough(atom/movable/mover, turf/_target) +/obj/effect/hallucination/fake_door_lock/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(mover == target && airlock.density) return FALSE diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 2230639b5344..3941e690c59d 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -141,16 +141,14 @@ to_chat(M, "[src] has been set to attack hostile wildlife.") return -/mob/living/simple_animal/hostile/mining_drone/CanAllowThrough(atom/movable/O) +/mob/living/simple_animal/hostile/mining_drone/CanAllowThrough(atom/movable/mover, border_dir) . = ..() - if(istype(O, /obj/projectile/kinetic)) - var/obj/projectile/kinetic/K = O - if(K.kinetic_gun) - for(var/A in K.kinetic_gun.get_modkits()) - var/obj/item/borg/upgrade/modkit/M = A - if(istype(M, /obj/item/borg/upgrade/modkit/minebot_passthrough)) - return TRUE - if(istype(O, /obj/projectile/destabilizer)) + if(istype(mover, /obj/projectile/kinetic)) + var/obj/projectile/kinetic/projectile = mover + if(projectile.kinetic_gun) + if (locate(/obj/item/borg/upgrade/modkit/minebot_passthrough) in projectile.kinetic_gun.modkits) + return TRUE + else if(istype(mover, /obj/projectile/destabilizer)) return TRUE /mob/living/simple_animal/hostile/mining_drone/proc/SetCollectBehavior() diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm index 3c1bebae21ac..186dedcc86d5 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm @@ -37,7 +37,7 @@ if(!hit_atom) return if(!isliving(hit_atom)) - if(hit_atom.density && !hit_atom.CanPass(src)) + if(hit_atom.density && !hit_atom.CanPass(src, get_dir(hit_atom, src))) visible_message("[src] smashes into [hit_atom]!", "[src] smashes into [hit_atom]!") Paralyze(40, ignore_canstun = TRUE) return diff --git a/code/modules/mob/living/living_movement.dm b/code/modules/mob/living/living_movement.dm index 709550cbc562..9634040582e0 100644 --- a/code/modules/mob/living/living_movement.dm +++ b/code/modules/mob/living/living_movement.dm @@ -3,7 +3,7 @@ update_turf_movespeed(loc) -/mob/living/CanAllowThrough(atom/movable/mover, turf/target) +/mob/living/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(.) return diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 25e9284b61ca..b83362bf8323 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -659,7 +659,7 @@ Stun((knockdown_time * 2), ignore_canstun = TRUE) charge_end() else if(hit_atom.density && !hit_atom.CanPass(src, get_dir(hit_atom, src))) - visible_message(("[src] smashes into [hit_atom]!")) + visible_message(span_danger("[src] smashes into [hit_atom]!")) Stun((knockdown_time * 2), ignore_canstun = TRUE) if(charge_state) diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm b/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm index a3c384af5472..06b2924033d9 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm @@ -34,11 +34,11 @@ footstep_type = FOOTSTEP_MOB_BAREFOOT -/mob/living/simple_animal/hostile/jungle/mook/CanAllowThrough(atom/movable/O) +/mob/living/simple_animal/hostile/jungle/mook/CanAllowThrough(atom/movable/mover, border_dir) . = ..() - if(istype(O, /mob/living/simple_animal/hostile/jungle/mook)) - var/mob/living/simple_animal/hostile/jungle/mook/M = O - if(M.attack_state == MOOK_ATTACK_ACTIVE && M.throwing) + if(istype(mover, /mob/living/simple_animal/hostile/jungle/mook)) + var/mob/living/simple_animal/hostile/jungle/mook/mook_moover = mover + if(mook_moover.attack_state == MOOK_ATTACK_ACTIVE && mook_moover.throwing) return TRUE /mob/living/simple_animal/hostile/jungle/mook/death() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index 27bdf0b3dd3e..fd810a352380 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -423,7 +423,7 @@ Difficulty: Hard severity = EXPLODE_LIGHT // puny mortals return ..() -/mob/living/simple_animal/hostile/megafauna/bubblegum/CanAllowThrough(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/megafauna/bubblegum/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(istype(mover, /mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination)) return TRUE @@ -525,7 +525,7 @@ Difficulty: Hard new /obj/effect/decal/cleanable/blood(get_turf(src)) . = ..() -/mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/CanAllowThrough(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(istype(mover, /mob/living/simple_animal/hostile/megafauna/bubblegum)) // hallucinations should not be stopping bubblegum or eachother return TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index e26e2a324329..1da36f8787d5 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -535,7 +535,7 @@ Difficulty: Hard QUEUE_SMOOTH_NEIGHBORS(src) return ..() -/obj/effect/temp_visual/hierophant/wall/CanAllowThrough(atom/movable/mover, turf/target) +/obj/effect/temp_visual/hierophant/wall/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(QDELETED(caster)) return FALSE diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index 78c03dfddcf4..9fa8ce52eb49 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -315,7 +315,7 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca AM.forceMove(C) return ..() -/mob/living/simple_animal/hostile/mimic/xenobio/CanAllowThrough(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/mimic/xenobio/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(istype(mover, /obj/structure/closet)) return FALSE diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm index 2b9c781b3bd6..11cdc80c97cc 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm @@ -72,7 +72,7 @@ return //if it's not our target, we ignore it -/mob/living/simple_animal/hostile/asteroid/curseblob/CanAllowThrough(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/asteroid/curseblob/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(mover == set_target) return FALSE diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm index 5bbe307790f2..35599ecdfe43 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm @@ -327,7 +327,7 @@ While using this makes the system rely on OnFire, it still gives options for tim ourelite = null return ..() -/obj/effect/temp_visual/elite_tumor_wall/CanAllowThrough(atom/movable/mover, turf/target) +/obj/effect/temp_visual/elite_tumor_wall/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(mover == ourelite || mover == activator) return FALSE diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 1a861dc304b4..8416a88db726 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -305,7 +305,7 @@ var/mob/M = AM if(M.buckled) continue - if(!AM.CanPass(src) || AM.density) + if(AM.density || !AM.CanPass(src, get_dir(AM, src))) if(AM.anchored) return AM if(pulling == AM) diff --git a/code/modules/plumbing/plumbers/grinder_chemical.dm b/code/modules/plumbing/plumbers/grinder_chemical.dm index e47f24c01044..4a9be6160916 100644 --- a/code/modules/plumbing/plumbers/grinder_chemical.dm +++ b/code/modules/plumbing/plumbers/grinder_chemical.dm @@ -27,12 +27,11 @@ . = ..() eat_dir = newdir -/obj/machinery/plumbing/grinder_chemical/CanAllowThrough(atom/movable/AM) +/obj/machinery/plumbing/grinder_chemical/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(!anchored) return - var/move_dir = get_dir(loc, AM.loc) - if(move_dir == eat_dir) + if(border_dir == eat_dir) return TRUE /obj/machinery/plumbing/grinder_chemical/proc/on_entered(datum/source, atom/movable/AM) diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index b829093edf3e..289c43c3e3bc 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -116,7 +116,7 @@ return -/obj/machinery/field/CanAllowThrough(atom/movable/mover, turf/target) +/obj/machinery/field/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(hasShocked || isliving(mover) || ismachinery(mover) || isstructure(mover) || ismecha(mover)) return FALSE diff --git a/code/modules/projectiles/guns/misc/medbeam.dm b/code/modules/projectiles/guns/misc/medbeam.dm index d0fd3052ed97..7061d7769ba4 100644 --- a/code/modules/projectiles/guns/misc/medbeam.dm +++ b/code/modules/projectiles/guns/misc/medbeam.dm @@ -101,21 +101,33 @@ return 0 var/obj/dummy = new(user_turf) dummy.pass_flags |= PASSTABLE|PASSGLASS|PASSGRILLE //Grille/Glass so it can be used through common windows - for(var/turf/turf in getline(user_turf,target)) - if(mounted && turf == user_turf) + var/turf/previous_step = user_turf + var/first_step = TRUE + for(var/turf/next_step as anything in (getline(user_turf, target) - user_turf)) + if(first_step) + for(var/obj/blocker in user_turf) + if(!blocker.density || !(blocker.flags_1 & ON_BORDER_1)) + continue + if(blocker.CanPass(dummy, get_dir(user_turf, next_step))) + continue + return FALSE // Could not leave the first turf. + first_step = FALSE + if(mounted && next_step == user_turf) + continue //Mechs are dense and thus fail the check - if(turf.density) + if(next_step.density) qdel(dummy) - return 0 - for(var/atom/movable/AM in turf) - if(!AM.CanPass(dummy,turf,1)) + return FALSE + for(var/atom/movable/movable as anything in next_step) + if(!movable.CanPass(dummy, get_dir(next_step, previous_step))) qdel(dummy) - return 0 - for(var/obj/effect/ebeam/medical/B in turf)// Don't cross the str-beams! + return FALSE + for(var/obj/effect/ebeam/medical/B in next_step)// Don't cross the str-beams! if(B.owner.origin != current_beam.origin) explosion(B.loc,0,3,5,8) qdel(dummy) - return 0 + return FALSE + previous_step = next_step qdel(dummy) return 1 diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 27d656da3c76..f926cf013306 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -533,8 +533,8 @@ * Projectile can pass through * Used to not even attempt to Bump() or fail to Cross() anything we already hit. */ -/obj/projectile/CanPassThrough(atom/blocker, turf/target, blocker_opinion) - return impacted[blocker]? TRUE : ..() +/obj/projectile/CanPassThrough(atom/blocker, movement_dir, blocker_opinion) + return impacted[blocker] ? TRUE : ..() /** * Projectile moved: diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 56808470a623..7ebfd07fea1d 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -196,7 +196,7 @@ /obj/item/reagent_containers/proc/bartender_check(atom/target) . = FALSE var/mob/thrown_by = thrownby?.resolve() - if(target.CanPass(src, get_turf(src)) && thrown_by && HAS_TRAIT(thrown_by, TRAIT_BOOZE_SLIDER)) + if(target.CanPass(src, get_dir(target, src)) && thrown_by && HAS_TRAIT(thrown_by, TRAIT_BOOZE_SLIDER)) . = TRUE /obj/item/reagent_containers/proc/SplashReagents(atom/target, thrown = FALSE) diff --git a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm index 7e133dbe5500..7b900dc579d7 100644 --- a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm +++ b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm @@ -61,9 +61,9 @@ /obj/structure/necropolis_gate/singularity_pull() return 0 -/obj/structure/necropolis_gate/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/necropolis_gate/CanAllowThrough(atom/movable/mover, border_dir) . = ..() - if(!(get_dir(loc, target) == dir)) + if(border_dir != dir) return TRUE /obj/structure/necropolis_gate/proc/on_exit(datum/source, atom/movable/leaving, direction) diff --git a/code/modules/ruins/objects_and_mobs/sin_ruins.dm b/code/modules/ruins/objects_and_mobs/sin_ruins.dm index e1e2f97fc7cf..e388a577fe1d 100644 --- a/code/modules/ruins/objects_and_mobs/sin_ruins.dm +++ b/code/modules/ruins/objects_and_mobs/sin_ruins.dm @@ -85,7 +85,7 @@ icon = 'icons/mob/blob.dmi' color = rgb(145, 150, 0) -/obj/effect/gluttony/CanAllowThrough(atom/movable/mover, turf/target)//So bullets will fly over and stuff. +/obj/effect/gluttony/CanAllowThrough(atom/movable/mover, border_dir)//So bullets will fly over and stuff. . = ..() if(ishuman(mover)) var/mob/living/carbon/human/H = mover diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm index 0b23acdce484..c7354f589dec 100644 --- a/code/modules/shuttle/special.dm +++ b/code/modules/shuttle/special.dm @@ -231,7 +231,7 @@ var/static/list/check_times = list() var/list/payees = list() -/obj/machinery/scanner_gate/luxury_shuttle/CanAllowThrough(atom/movable/mover, turf/target) +/obj/machinery/scanner_gate/luxury_shuttle/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(mover in approved_passengers) diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index 532c2de3d7be..869c16a77d99 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -518,11 +518,22 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th //Checks for obstacles from A to B var/obj/dummy = new(A.loc) dummy.pass_flags |= PASSTABLE - for(var/turf/turf in getline(A,B)) - for(var/atom/movable/AM in turf) - if(!AM.CanPass(dummy,turf,1)) + var/turf/previous_step = get_turf(A) + var/first_step = TRUE + for(var/turf/next_step as anything in (getline(A, B) - previous_step)) + if(first_step) + for(var/obj/blocker in previous_step) + if(!blocker.density || !(blocker.flags_1 & ON_BORDER_1)) + continue + if(blocker.CanPass(dummy, get_dir(previous_step, next_step))) + continue + return FALSE // Could not leave the first turf. + first_step = FALSE + for(var/atom/movable/movable as anything in next_step) + if(!movable.CanPass(dummy, get_dir(next_step, previous_step))) qdel(dummy) - return 0 + return FALSE + previous_step = next_step qdel(dummy) return 1 diff --git a/code/modules/spells/spell_types/forcewall.dm b/code/modules/spells/spell_types/forcewall.dm index 64eca54e3d7a..62bd538120e1 100644 --- a/code/modules/spells/spell_types/forcewall.dm +++ b/code/modules/spells/spell_types/forcewall.dm @@ -30,11 +30,11 @@ . = ..() wizard = summoner -/obj/effect/forcefield/wizard/CanAllowThrough(atom/movable/mover, turf/target) +/obj/effect/forcefield/wizard/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(mover == wizard) return TRUE - if(ismob(mover)) + if(isliving(mover)) var/mob/M = mover if(M.anti_magic_check(chargecost = 0)) return TRUE From 4f2f7086f1d5ae6350483c4a6b7374836fa60cb4 Mon Sep 17 00:00:00 2001 From: tgstation-server Date: Tue, 21 Dec 2021 23:02:38 -0800 Subject: [PATCH 022/147] Automatic changelog generation for PR #63276 [ci skip] --- html/changelogs/AutoChangeLog-pr-63276.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 html/changelogs/AutoChangeLog-pr-63276.yml diff --git a/html/changelogs/AutoChangeLog-pr-63276.yml b/html/changelogs/AutoChangeLog-pr-63276.yml new file mode 100644 index 000000000000..d2d64697126a --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-63276.yml @@ -0,0 +1,4 @@ +author: "Pickle-Coding" +delete-after: True +changes: + - bugfix: "Allows the supermatter crystal to produce gases while powered, even in absolutely empty turfs, excluding space turfs." From 707c96d3c14a9ba66cbe3a1849d3c5246fd05ac0 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Wed, 22 Dec 2021 08:49:08 +0100 Subject: [PATCH 023/147] proximity monitors cleanup (plus connect_range and connect_containers components) (#62755) I'm refactoring proximity monitors and fields, removing lots of bloat from both that's hardly even used. Proximity monitors no longer generate effect objects to track the surrounding area, should be less cpu expensive and easier to maintain (or phase out), read and use. This PR also adds a couple components which may be needed for future stuff (for starters, the mirror reflection PR #62638 could use the connect_range comp) Improving old old, ugly old code and adding some useful backend components. Tested and working. --- code/__DEFINES/subsystems.dm | 1 - code/__HELPERS/unsorted.dm | 14 +- .../subsystem/processing/fields.dm | 6 - code/datums/components/connect_containers.dm | 68 ++++ code/datums/components/connect_range.dm | 107 ++++++ code/datums/proximity_monitor/field.dm | 169 +++++++++ .../proximity_monitor}/fields/gravity.dm | 8 +- .../fields/peaceborg_dampener.dm | 78 ++--- .../proximity_monitor}/fields/timestop.dm | 21 +- .../proximity_monitor/proximity_monitor.dm | 78 +++++ code/datums/wires/explosive.dm | 7 +- code/game/atoms.dm | 2 - code/game/atoms_movable.dm | 8 +- code/game/machinery/camera/camera.dm | 4 +- code/game/machinery/camera/motion.dm | 2 +- code/game/machinery/flasher.dm | 6 +- code/game/machinery/hologram.dm | 2 + .../effects/anomalies/anomalies_gravity.dm | 4 +- code/game/objects/effects/proximity.dm | 129 ------- code/game/objects/items/robot/robot_items.dm | 12 +- code/game/turfs/turf.dm | 2 +- code/modules/admin/verbs/secrets.dm | 2 +- code/modules/assembly/proximity.dm | 12 +- code/modules/fields/fields.dm | 324 ------------------ code/modules/fields/turf_objects.dm | 67 ---- code/modules/mining/machine_processing.dm | 2 + code/modules/mining/machine_stacking.dm | 2 + .../carbon/alien/utilities/structures.dm | 6 +- code/modules/shuttle/on_move.dm | 10 - code/modules/unit_tests/create_and_destroy.dm | 2 - shiptest.dme | 14 +- 31 files changed, 528 insertions(+), 641 deletions(-) delete mode 100644 code/controllers/subsystem/processing/fields.dm create mode 100644 code/datums/components/connect_containers.dm create mode 100644 code/datums/components/connect_range.dm create mode 100644 code/datums/proximity_monitor/field.dm rename code/{modules => datums/proximity_monitor}/fields/gravity.dm (74%) rename code/{modules => datums/proximity_monitor}/fields/peaceborg_dampener.dm (65%) rename code/{modules => datums/proximity_monitor}/fields/timestop.dm (92%) create mode 100644 code/datums/proximity_monitor/proximity_monitor.dm delete mode 100644 code/game/objects/effects/proximity.dm delete mode 100644 code/modules/fields/fields.dm delete mode 100644 code/modules/fields/turf_objects.dm diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 51c454da1def..1cff0ba1c87e 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -166,7 +166,6 @@ #define FIRE_PRIORITY_PROCESS 25 #define FIRE_PRIORITY_THROWING 25 #define FIRE_PRIORITY_SPACEDRIFT 30 -#define FIRE_PRIORITY_FIELDS 30 #define FIRE_PRIOTITY_SMOOTHING 35 #define FIRE_PRIORITY_NETWORKS 40 #define FIRE_PRIORITY_OBJ 40 diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 9ca24f24cb7e..ea9ceee0f417 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -379,16 +379,16 @@ Turf and target are separate in case you want to teleport some distance from a t break return turf_to_check -//Returns a list of all locations (except the area) the movable is within. -/proc/get_nested_locs(atom/movable/AM, include_turf = FALSE) +///Returns a list of all locations (except the area) the movable is within. +/proc/get_nested_locs(atom/movable/atom_on_location, include_turf = FALSE) . = list() - var/atom/location = AM.loc - var/turf/turf = get_turf(AM) - while(location && location != turf) + var/atom/location = atom_on_location.loc + var/turf/our_turf = get_turf(atom_on_location) + while(location && location != our_turf) . += location location = location.loc - if(location && include_turf) //At this point, only the turf is left, provided it exists. - . += location + if(our_turf && include_turf) //At this point, only the turf is left, provided it exists. + . += our_turf // returns the turf located at the map edge in the specified direction relative to A // used for mass driver diff --git a/code/controllers/subsystem/processing/fields.dm b/code/controllers/subsystem/processing/fields.dm deleted file mode 100644 index a4c58b883a8a..000000000000 --- a/code/controllers/subsystem/processing/fields.dm +++ /dev/null @@ -1,6 +0,0 @@ -PROCESSING_SUBSYSTEM_DEF(fields) - name = "Fields" - wait = 2 - priority = FIRE_PRIORITY_FIELDS - flags = SS_KEEP_TIMING | SS_NO_INIT - runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME diff --git a/code/datums/components/connect_containers.dm b/code/datums/components/connect_containers.dm new file mode 100644 index 000000000000..c386a096410b --- /dev/null +++ b/code/datums/components/connect_containers.dm @@ -0,0 +1,68 @@ +/// This component behaves similar to connect_loc_behalf, but it's nested and hooks a signal onto all MOVABLES containing this atom. +/datum/component/connect_containers + dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS + + /// An assoc list of signal -> procpath to register to the loc this object is on. + var/list/connections + /** + * The atom the component is tracking. The component will delete itself if the tracked is deleted. + * Signals will also be updated whenever it moves. + */ + var/atom/movable/tracked + +/datum/component/connect_containers/Initialize(atom/movable/tracked, list/connections) + . = ..() + if (!ismovable(tracked)) + return COMPONENT_INCOMPATIBLE + + src.connections = connections + set_tracked(tracked) + +/datum/component/connect_containers/Destroy() + set_tracked(null) + return ..() + +/datum/component/connect_containers/InheritComponent(datum/component/component, original, atom/movable/tracked, list/connections) + // Not equivalent. Checks if they are not the same list via shallow comparison. + if(!compare_list(src.connections, connections)) + stack_trace("connect_containers component attached to [parent] tried to inherit another connect_containers component with different connections") + return + if(src.tracked != tracked) + set_tracked(tracked) + +/datum/component/connect_containers/proc/set_tracked(atom/movable/new_tracked) + if(tracked) + UnregisterSignal(tracked, list(COMSIG_MOVABLE_MOVED, COMSIG_PARENT_QDELETING)) + unregister_signals(tracked.loc) + tracked = new_tracked + if(!tracked) + return + RegisterSignal(tracked, COMSIG_MOVABLE_MOVED, .proc/on_moved) + RegisterSignal(tracked, COMSIG_PARENT_QDELETING, .proc/handle_tracked_qdel) + update_signals(tracked) + +/datum/component/connect_containers/proc/handle_tracked_qdel() + SIGNAL_HANDLER + qdel(src) + +/datum/component/connect_containers/proc/update_signals(atom/movable/listener) + if(!ismovable(listener.loc)) + return + + for(var/atom/movable/container as anything in get_nested_locs(listener)) + RegisterSignal(container, COMSIG_MOVABLE_MOVED, .proc/on_moved) + for(var/signal in connections) + parent.RegisterSignal(container, signal, connections[signal]) + +/datum/component/connect_containers/proc/unregister_signals(atom/movable/location) + if(!ismovable(location)) + return + + for(var/atom/movable/target as anything in (get_nested_locs(location) + location)) + UnregisterSignal(target, COMSIG_MOVABLE_MOVED) + parent.UnregisterSignal(target, connections) + +/datum/component/connect_containers/proc/on_moved(atom/movable/listener, atom/old_loc) + SIGNAL_HANDLER + unregister_signals(old_loc) + update_signals(listener) diff --git a/code/datums/components/connect_range.dm b/code/datums/components/connect_range.dm new file mode 100644 index 000000000000..b40643c57494 --- /dev/null +++ b/code/datums/components/connect_range.dm @@ -0,0 +1,107 @@ +/** + * This component behaves similar to connect_loc_behalf but for all turfs in range, hooking into a signal on each of them. + * Just like connect_loc_behalf, It can react to that signal on behalf of a seperate listener. + * Good for components, though it carries some overhead. Can't be an element as that may lead to bugs. + */ +/datum/component/connect_range + dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS + + /// An assoc list of signal -> procpath to register to the loc this object is on. + var/list/connections + /** + * The atom the component is tracking. The component will delete itself if the tracked is deleted. + * Signals will also be updated whenever it moves (if it's a movable). + */ + var/atom/tracked + + /// The component will hook into signals only on turfs not farther from tracked than this. + var/range + /// Whether the component works when the movable isn't directly located on a turf. + var/works_in_containers + +/datum/component/connect_range/Initialize(atom/tracked, list/connections, range, works_in_containers = TRUE) + if(!isatom(tracked) || isarea(tracked) || range < 0) + return COMPONENT_INCOMPATIBLE + src.connections = connections + src.range = range + set_tracked(tracked) + src.works_in_containers = works_in_containers + +/datum/component/connect_range/Destroy() + set_tracked(null) + return ..() + +/datum/component/connect_range/InheritComponent(datum/component/component, original, atom/tracked, list/connections, range, works_in_containers) + // Not equivalent. Checks if they are not the same list via shallow comparison. + if(!compare_list(src.connections, connections)) + stack_trace("connect_range component attached to [parent] tried to inherit another connect_range component with different connections") + return + if(src.tracked != tracked) + set_tracked(tracked) + if(src.range == range && src.works_in_containers == works_in_containers) + return + //Unregister the signals with the old settings. + unregister_signals(isturf(tracked) ? tracked : tracked.loc) + src.range = range + src.works_in_containers = works_in_containers + //Re-register the signals with the new settings. + update_signals(src.tracked) + +/datum/component/connect_range/proc/set_tracked(atom/new_tracked) + if(tracked) //Unregister the signals from the old tracked and its surroundings + unregister_signals(isturf(tracked) ? tracked : tracked.loc) + UnregisterSignal(tracked, list( + COMSIG_MOVABLE_MOVED, + COMSIG_PARENT_QDELETING, + )) + tracked = new_tracked + if(!tracked) + return + //Register signals on the new tracked atom and its surroundings. + RegisterSignal(tracked, COMSIG_MOVABLE_MOVED, .proc/on_moved) + RegisterSignal(tracked, COMSIG_PARENT_QDELETING, .proc/handle_tracked_qdel) + update_signals(tracked) + +/datum/component/connect_range/proc/handle_tracked_qdel() + SIGNAL_HANDLER + qdel(src) + +/datum/component/connect_range/proc/update_signals(atom/target, atom/old_loc, forced = FALSE) + var/turf/current_turf = get_turf(target) + var/on_same_turf = current_turf == get_turf(old_loc) //Only register/unregister turf signals if it's moved to a new turf. + unregister_signals(old_loc, on_same_turf) + + if(isnull(current_turf)) + return + + if(ismovable(target.loc)) + if(!works_in_containers) + return + //Keep track of possible movement of all movables the target is in. + for(var/atom/movable/container as anything in get_nested_locs(target)) + RegisterSignal(container, COMSIG_MOVABLE_MOVED, .proc/on_moved) + + if(on_same_turf && !forced) + return + for(var/turf/target_turf in RANGE_TURFS(range, current_turf)) + for(var/signal in connections) + parent.RegisterSignal(target_turf, signal, connections[signal]) + +/datum/component/connect_range/proc/unregister_signals(atom/location, on_same_turf = FALSE) + //The location is null or is a container and the component shouldn't have register signals on it + if(isnull(location) || (!works_in_containers && !isturf(location))) + return + + if(ismovable(location)) + for(var/atom/movable/target as anything in (get_nested_locs(location) + location)) + UnregisterSignal(target, COMSIG_MOVABLE_MOVED) + + if(on_same_turf) + return + var/turf/previous_turf = get_turf(location) + for(var/turf/target_turf in RANGE_TURFS(range, previous_turf)) + parent.UnregisterSignal(target_turf, connections) + +/datum/component/connect_range/proc/on_moved(atom/movable/movable, atom/old_loc) + SIGNAL_HANDLER + update_signals(movable, old_loc) diff --git a/code/datums/proximity_monitor/field.dm b/code/datums/proximity_monitor/field.dm new file mode 100644 index 000000000000..43fdb8bb20b4 --- /dev/null +++ b/code/datums/proximity_monitor/field.dm @@ -0,0 +1,169 @@ +#define FIELD_TURFS_KEY "field_turfs" +#define EDGE_TURFS_KEY "edge_turfs" + +/** + * Movable and easily code-modified fields! Allows for custom AOE effects that affect movement + * and anything inside of them, and can do custom turf effects! + * Supports automatic recalculation/reset on movement. + */ +/datum/proximity_monitor/advanced + var/list/turf/field_turfs = list() + var/list/turf/edge_turfs = list() + +/datum/proximity_monitor/advanced/Destroy() + cleanup_field() + return ..() + +/datum/proximity_monitor/advanced/proc/cleanup_field() + for(var/turf/turf as anything in edge_turfs) + cleanup_edge_turf(turf) + for(var/turf/turf as anything in field_turfs) + cleanup_field_turf(turf) + +//Call every time the field moves (done automatically if you use update_center) or a setup specification is changed. +/datum/proximity_monitor/advanced/proc/recalculate_field() + var/list/new_turfs = update_new_turfs() + + var/list/new_field_turfs = new_turfs[FIELD_TURFS_KEY] + var/list/new_edge_turfs = new_turfs[EDGE_TURFS_KEY] + + for(var/turf/old_turf as anything in field_turfs) + if(!(old_turf in new_field_turfs)) + cleanup_field_turf(old_turf) + for(var/turf/old_turf as anything in edge_turfs) + cleanup_edge_turf(old_turf) + + for(var/turf/new_turf as anything in new_field_turfs) + setup_field_turf(new_turf) + for(var/turf/new_turf as anything in new_edge_turfs) + setup_edge_turf(new_turf) + +/datum/proximity_monitor/advanced/on_entered(turf/source, atom/movable/entered) + . = ..() + if(get_dist(source, host) == current_range) + field_edge_crossed(entered, source) + else + field_turf_crossed(entered, source) + +/datum/proximity_monitor/advanced/on_moved(atom/movable/movable, atom/old_loc) + . = ..() + if(ignore_if_not_on_turf) + //Early return if it's not the host that has moved. + if(movable != host) + return + //Cleanup the field if the host was on a turf but isn't anymore. + if(!isturf(host.loc)) + if(isturf(old_loc)) + cleanup_field() + return + recalculate_field() + +/datum/proximity_monitor/advanced/on_uncrossed(turf/source, atom/movable/gone, direction) + if(get_dist(source, host) == current_range) + field_edge_uncrossed(gone, source) + else + field_turf_uncrossed(gone, source) + +/datum/proximity_monitor/advanced/proc/setup_field_turf(turf/target) + field_turfs |= target + +/datum/proximity_monitor/advanced/proc/cleanup_field_turf(turf/target) + field_turfs -= target + +/datum/proximity_monitor/advanced/proc/setup_edge_turf(turf/target) + edge_turfs |= target + +/datum/proximity_monitor/advanced/proc/cleanup_edge_turf(turf/target) + edge_turfs -= target + +/datum/proximity_monitor/advanced/proc/update_new_turfs() + . = list(FIELD_TURFS_KEY = list(), EDGE_TURFS_KEY = list()) + if(ignore_if_not_on_turf && !isturf(host.loc)) + return + var/turf/center = get_turf(host) + for(var/turf/target in RANGE_TURFS(current_range, center)) + if(get_dist(center, target) == current_range) + .[EDGE_TURFS_KEY] += target + else + .[FIELD_TURFS_KEY] += target + +//Gets edge direction/corner, only works with square radius/WDH fields! +/datum/proximity_monitor/advanced/proc/get_edgeturf_direction(turf/T, turf/center_override = null) + var/turf/checking_from = get_turf(host) + if(istype(center_override)) + checking_from = center_override + if(!(T in edge_turfs)) + return + if(((T.x == (checking_from.x + current_range)) || (T.x == (checking_from.x - current_range))) && ((T.y == (checking_from.y + current_range)) || (T.y == (checking_from.y - current_range)))) + return get_dir(checking_from, T) + if(T.x == (checking_from.x + current_range)) + return EAST + if(T.x == (checking_from.x - current_range)) + return WEST + if(T.y == (checking_from.y - current_range)) + return SOUTH + if(T.y == (checking_from.y + current_range)) + return NORTH + +/datum/proximity_monitor/advanced/proc/field_turf_crossed(atom/movable/movable, turf/location) + return + +/datum/proximity_monitor/advanced/proc/field_turf_uncrossed(atom/movable/movable, turf/location) + return + +/datum/proximity_monitor/advanced/proc/field_edge_crossed(atom/movable/movable, turf/location) + return + +/datum/proximity_monitor/advanced/proc/field_edge_uncrossed(atom/movable/movable, turf/location) + return + + +//DEBUG FIELD ITEM +/obj/item/multitool/field_debug + name = "strange multitool" + desc = "Seems to project a colored field!" + var/operating = FALSE + var/datum/proximity_monitor/advanced/debug/current = null + +/obj/item/multitool/field_debug/Destroy() + QDEL_NULL(current) + return ..() + +/obj/item/multitool/field_debug/proc/setup_debug_field() + current = new(src, 5, FALSE) + current.set_fieldturf_color = "#aaffff" + current.set_edgeturf_color = "#ffaaff" + current.recalculate_field() + +/obj/item/multitool/field_debug/attack_self(mob/user) + operating = !operating + to_chat(user, span_notice("You turn [src] [operating? "on":"off"].")) + if(!istype(current) && operating) + setup_debug_field() + else if(!operating) + QDEL_NULL(current) + +//DEBUG FIELDS +/datum/proximity_monitor/advanced/debug + current_range = 5 + var/set_fieldturf_color = "#aaffff" + var/set_edgeturf_color = "#ffaaff" + +/datum/proximity_monitor/advanced/debug/setup_edge_turf(turf/target) + . = ..() + target.color = set_edgeturf_color + +/datum/proximity_monitor/advanced/debug/cleanup_edge_turf(turf/target) + . = ..() + target.color = initial(target.color) + +/datum/proximity_monitor/advanced/debug/setup_field_turf(turf/target) + . = ..() + target.color = set_fieldturf_color + +/datum/proximity_monitor/advanced/debug/cleanup_field_turf(turf/target) + . = ..() + target.color = initial(target.color) + +#undef FIELD_TURFS_KEY +#undef EDGE_TURFS_KEY diff --git a/code/modules/fields/gravity.dm b/code/datums/proximity_monitor/fields/gravity.dm similarity index 74% rename from code/modules/fields/gravity.dm rename to code/datums/proximity_monitor/fields/gravity.dm index 930c524081ff..ccac71a6d850 100644 --- a/code/modules/fields/gravity.dm +++ b/code/datums/proximity_monitor/fields/gravity.dm @@ -1,9 +1,11 @@ /datum/proximity_monitor/advanced/gravity - name = "modified gravity zone" - setup_field_turfs = TRUE var/gravity_value = 0 var/list/modified_turfs = list() - field_shape = FIELD_SHAPE_RADIUS_SQUARE + +/datum/proximity_monitor/advanced/gravity/New(atom/_host, range, _ignore_if_not_on_turf = TRUE, gravity) + . = ..() + gravity_value = gravity + recalculate_field() /datum/proximity_monitor/advanced/gravity/setup_field_turf(turf/T) . = ..() diff --git a/code/modules/fields/peaceborg_dampener.dm b/code/datums/proximity_monitor/fields/peaceborg_dampener.dm similarity index 65% rename from code/modules/fields/peaceborg_dampener.dm rename to code/datums/proximity_monitor/fields/peaceborg_dampener.dm index e1d9ed5b3f62..16b637afadad 100644 --- a/code/modules/fields/peaceborg_dampener.dm +++ b/code/datums/proximity_monitor/fields/peaceborg_dampener.dm @@ -2,11 +2,6 @@ //Projectile dampening field that slows projectiles and lowers their damage for an energy cost deducted every 1/5 second. //Only use square radius for this! /datum/proximity_monitor/advanced/peaceborg_dampener - name = "\improper Hyperkinetic Dampener Field" - setup_edge_turfs = TRUE - setup_field_turfs = TRUE - requires_processing = TRUE - field_shape = FIELD_SHAPE_RADIUS_SQUARE var/static/image/edgeturf_south = image('icons/effects/fields.dmi', icon_state = "projectile_dampen_south") var/static/image/edgeturf_north = image('icons/effects/fields.dmi', icon_state = "projectile_dampen_north") var/static/image/edgeturf_west = image('icons/effects/fields.dmi', icon_state = "projectile_dampen_west") @@ -17,21 +12,26 @@ var/static/image/southeast_corner = image('icons/effects/fields.dmi', icon_state = "projectile_dampen_southeast") var/static/image/generic_edge = image('icons/effects/fields.dmi', icon_state = "projectile_dampen_generic") var/obj/item/borg/projectile_dampen/projector = null - var/list/obj/projectile/tracked - var/list/obj/projectile/staging - use_host_turf = TRUE + var/list/obj/projectile/tracked = list() + var/list/obj/projectile/staging = list() + // lazylist that keeps track of the overlays added to the edge of the field + var/list/edgeturf_effects -/datum/proximity_monitor/advanced/peaceborg_dampener/New() - tracked = list() - staging = list() +/datum/proximity_monitor/advanced/peaceborg_dampener/New(atom/_host, range, _ignore_if_not_on_turf = TRUE, obj/item/borg/projectile_dampen/projector) ..() + src.projector = projector + recalculate_field() + START_PROCESSING(SSfastprocess, src) /datum/proximity_monitor/advanced/peaceborg_dampener/Destroy() + projector = null + STOP_PROCESSING(SSfastprocess, src) return ..() /datum/proximity_monitor/advanced/peaceborg_dampener/process() if(!istype(projector)) qdel(src) + return var/list/ranged = list() for(var/obj/projectile/P in range(current_range, get_turf(host))) ranged += P @@ -41,23 +41,28 @@ for(var/mob/living/silicon/robot/R in range(current_range, get_turf(host))) if(R.has_buckled_mobs()) for(var/mob/living/L in R.buckled_mobs) - L.visible_message("[L] is knocked off of [R] by the charge in [R]'s chassis induced by [name]!") //I know it's bad. + L.visible_message(span_warning("[L] is knocked off of [R] by the charge in [R]'s chassis induced by the hyperkinetic dampener field!")) //I know it's bad. L.Paralyze(10) R.unbuckle_mob(L) do_sparks(5, 0, L) ..() -/datum/proximity_monitor/advanced/peaceborg_dampener/setup_edge_turf(turf/T) - ..() - var/image/I = get_edgeturf_overlay(get_edgeturf_direction(T)) - var/obj/effect/abstract/proximity_checker/advanced/F = edge_turfs[T] - F.appearance = I.appearance - F.invisibility = 0 - F.mouse_opacity = MOUSE_OPACITY_TRANSPARENT - F.layer = 5 +/datum/proximity_monitor/advanced/peaceborg_dampener/setup_edge_turf(turf/target) + . = ..() + var/image/overlay = get_edgeturf_overlay(get_edgeturf_direction(target)) + var/obj/effect/abstract/effect = new(target) // Makes the field visible to players. + effect.icon = overlay.icon + effect.icon_state = overlay.icon_state + effect.mouse_opacity = MOUSE_OPACITY_TRANSPARENT + effect.layer = ABOVE_ALL_MOB_LAYER + LAZYSET(edgeturf_effects, target, effect) -/datum/proximity_monitor/advanced/peaceborg_dampener/cleanup_edge_turf(turf/T) - ..() +/datum/proximity_monitor/advanced/peaceborg_dampener/cleanup_edge_turf(turf/target) + . = ..() + var/obj/effect/abstract/effect = LAZYACCESS(edgeturf_effects, target) + LAZYREMOVE(edgeturf_effects, target) + if(effect) + qdel(effect) /datum/proximity_monitor/advanced/peaceborg_dampener/proc/get_edgeturf_overlay(direction) switch(direction) @@ -91,24 +96,13 @@ projector.restore_projectile(P) tracked -= P -/datum/proximity_monitor/advanced/peaceborg_dampener/field_edge_uncrossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F) - if(!is_turf_in_field(get_turf(AM), src)) - if(istype(AM, /obj/projectile)) - if(AM in tracked) - release_projectile(AM) - else - capture_projectile(AM, FALSE) - return ..() - -/datum/proximity_monitor/advanced/peaceborg_dampener/field_edge_crossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F) - if(istype(AM, /obj/projectile) && !(AM in tracked) && staging[AM] && !is_turf_in_field(staging[AM], src)) - capture_projectile(AM) - staging -= AM - return ..() +/datum/proximity_monitor/advanced/peaceborg_dampener/field_edge_uncrossed(atom/movable/movable, turf/location) + if(istype(movable, /obj/projectile) && get_dist(movable, host) > current_range) + if(movable in tracked) + release_projectile(movable) + else + capture_projectile(movable, FALSE) -/datum/proximity_monitor/advanced/peaceborg_dampener/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, border_dir) - if(istype(AM, /obj/projectile)) - staging[AM] = get_turf(AM) - . = ..() - if(!.) - staging -= AM //This one ain't goin' through. +/datum/proximity_monitor/advanced/peaceborg_dampener/field_edge_crossed(atom/movable/movable, turf/location) + if(istype(movable, /obj/projectile) && !(movable in tracked)) + capture_projectile(movable) diff --git a/code/modules/fields/timestop.dm b/code/datums/proximity_monitor/fields/timestop.dm similarity index 92% rename from code/modules/fields/timestop.dm rename to code/datums/proximity_monitor/fields/timestop.dm index d720868b07ec..06ed1f113311 100644 --- a/code/modules/fields/timestop.dm +++ b/code/datums/proximity_monitor/fields/timestop.dm @@ -43,17 +43,13 @@ /obj/effect/timestop/proc/timestop() target = get_turf(src) playsound(src, 'sound/magic/timeparadox2.ogg', 75, TRUE, -1) - chronofield = make_field(/datum/proximity_monitor/advanced/timestop, list("current_range" = freezerange, "host" = src, "immune" = immune, "check_anti_magic" = check_anti_magic, "check_holy" = check_holy)) + chronofield = new (src, freezerange, TRUE, immune, check_anti_magic, check_holy) QDEL_IN(src, duration) /obj/effect/timestop/magic check_anti_magic = TRUE /datum/proximity_monitor/advanced/timestop - name = "chronofield" - setup_field_turfs = TRUE - field_shape = FIELD_SHAPE_RADIUS_SQUARE - requires_processing = TRUE var/list/immune = list() var/list/frozen_things = list() var/list/frozen_mobs = list() //cached separately for processing @@ -64,12 +60,21 @@ var/static/list/global_frozen_atoms = list() +/datum/proximity_monitor/advanced/timestop/New(atom/_host, range, _ignore_if_not_on_turf = TRUE, list/immune, check_anti_magic, check_holy) + ..() + src.immune = immune + src.check_anti_magic = check_anti_magic + src.check_holy = check_holy + recalculate_field() + START_PROCESSING(SSfastprocess, src) + /datum/proximity_monitor/advanced/timestop/Destroy() unfreeze_all() + STOP_PROCESSING(SSfastprocess, src) return ..() -/datum/proximity_monitor/advanced/timestop/field_turf_crossed(atom/movable/AM) - freeze_atom(AM) +/datum/proximity_monitor/advanced/timestop/field_turf_crossed(atom/movable/movable, turf/location) + freeze_atom(movable) /datum/proximity_monitor/advanced/timestop/proc/freeze_atom(atom/movable/A) if(immune[A] || global_frozen_atoms[A] || !istype(A)) @@ -167,10 +172,10 @@ m.Stun(20, ignore_canstun = TRUE) /datum/proximity_monitor/advanced/timestop/setup_field_turf(turf/T) + . = ..() for(var/i in T.contents) freeze_atom(i) freeze_turf(T) - return ..() /datum/proximity_monitor/advanced/timestop/proc/freeze_projectile(obj/projectile/P) diff --git a/code/datums/proximity_monitor/proximity_monitor.dm b/code/datums/proximity_monitor/proximity_monitor.dm new file mode 100644 index 000000000000..6bc78a39c835 --- /dev/null +++ b/code/datums/proximity_monitor/proximity_monitor.dm @@ -0,0 +1,78 @@ +/datum/proximity_monitor + ///The atom we are tracking + var/atom/host + ///The atom that will receive HasProximity calls. + var/atom/hasprox_receiver + ///The range of the proximity monitor. Things moving wihin it will trigger HasProximity calls. + var/current_range + ///If we don't check turfs in range if the host's loc isn't a turf + var/ignore_if_not_on_turf + ///The signals of the connect range component, needed to monitor the turfs in range. + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + COMSIG_ATOM_EXITED =.proc/on_uncrossed, + ) + +/datum/proximity_monitor/New(atom/_host, range, _ignore_if_not_on_turf = TRUE) + ignore_if_not_on_turf = _ignore_if_not_on_turf + current_range = range + set_host(_host) + +/datum/proximity_monitor/proc/set_host(atom/new_host, atom/new_receiver) + if(new_host == host) + return + if(host) //No need to delete the connect range and containers comps. They'll be updated with the new tracked host. + UnregisterSignal(host, list(COMSIG_MOVABLE_MOVED, COMSIG_PARENT_QDELETING)) + if(hasprox_receiver) + UnregisterSignal(hasprox_receiver, COMSIG_PARENT_QDELETING) + if(new_receiver) + hasprox_receiver = new_receiver + if(new_receiver != new_host) + RegisterSignal(new_receiver, COMSIG_PARENT_QDELETING, .proc/on_host_or_receiver_del) + else if(hasprox_receiver == host) //Default case + hasprox_receiver = new_host + host = new_host + RegisterSignal(new_host, COMSIG_PARENT_QDELETING, .proc/on_host_or_receiver_del) + var/static/list/containers_connections = list(COMSIG_MOVABLE_MOVED = .proc/on_moved) + AddComponent(/datum/component/connect_containers, host, containers_connections) + RegisterSignal(host, COMSIG_MOVABLE_MOVED, .proc/on_moved) + set_range(current_range, TRUE) + +/datum/proximity_monitor/proc/on_host_or_receiver_del(datum/source) + SIGNAL_HANDLER + qdel(src) + +/datum/proximity_monitor/Destroy() + host = null + hasprox_receiver = null + return ..() + +/datum/proximity_monitor/proc/set_range(range, force_rebuild = FALSE) + if(!force_rebuild && range == current_range) + return FALSE + . = TRUE + current_range = range + + //If the connect_range component exists already, this will just update its range. No errors or duplicates. + AddComponent(/datum/component/connect_range, host, loc_connections, range, !ignore_if_not_on_turf) + +/datum/proximity_monitor/proc/on_moved(atom/movable/source, atom/old_loc) + SIGNAL_HANDLER + if(source == host) + hasprox_receiver?.HasProximity(host) + +/datum/proximity_monitor/proc/set_ignore_if_not_on_turf(does_ignore = TRUE) + if(ignore_if_not_on_turf == does_ignore) + return + ignore_if_not_on_turf = does_ignore + //Update the ignore_if_not_on_turf + AddComponent(/datum/component/connect_range, host, loc_connections, current_range, ignore_if_not_on_turf) + +/datum/proximity_monitor/proc/on_uncrossed() + SIGNAL_HANDLER + return //Used by the advanced subtype for effect fields. + +/datum/proximity_monitor/proc/on_entered(atom/source, atom/movable/arrived) + SIGNAL_HANDLER + if(source != host) + hasprox_receiver?.HasProximity(arrived) diff --git a/code/datums/wires/explosive.dm b/code/datums/wires/explosive.dm index e3f73d287b72..a8e9873150ea 100644 --- a/code/datums/wires/explosive.dm +++ b/code/datums/wires/explosive.dm @@ -31,9 +31,10 @@ var/obj/item/assembly/timer/T = S G.det_time = T.saved_time*10 else if(istype(S,/obj/item/assembly/prox_sensor)) - var/obj/item/grenade/chem_grenade/G = holder - G.landminemode = S - S.proximity_monitor.wire = TRUE + var/obj/item/assembly/prox_sensor/sensor = S + var/obj/item/grenade/chem_grenade/grenade = holder + grenade.landminemode = sensor + sensor.proximity_monitor.set_ignore_if_not_on_turf(FALSE) fingerprint = S.fingerprintslast return ..() diff --git a/code/game/atoms.dm b/code/game/atoms.dm index d829516fe701..df119810bc5f 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -55,8 +55,6 @@ ///overlays managed by [update_overlays][/atom/proc/update_overlays] to prevent removing overlays that weren't added by the same proc var/list/managed_overlays - ///Proximity monitor associated with this atom - var/datum/proximity_monitor/proximity_monitor ///Cooldown tick timer for buckle messages var/buckle_message_cooldown = 0 ///Last fingerprints to touch this atom diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 3dc329f91361..ec7387251dc2 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -94,12 +94,8 @@ /atom/movable/Destroy(force) - if(proximity_monitor) - QDEL_NULL(proximity_monitor) - if(language_holder) - QDEL_NULL(language_holder) - if(em_block) - QDEL_NULL(em_block) + QDEL_NULL(language_holder) + QDEL_NULL(em_block) unbuckle_all_mobs(force = TRUE) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 8141449f8b10..c5c0d9e6052c 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -42,6 +42,8 @@ var/datum/component/empprotection/emp_component var/internal_light = TRUE //Whether it can light up when an AI views it + ///Proximity monitor associated with this atom, for motion sensitive cameras. + var/datum/proximity_monitor/proximity_monitor /obj/machinery/camera/preset/toxins //Bomb test site in space name = "Hardened Bomb-Test Camera" @@ -91,7 +93,7 @@ network -= i network += "[REF(port)][i]" -/obj/machinery/proc/create_prox_monitor() +/obj/machinery/camera/proc/create_prox_monitor() if(!proximity_monitor) proximity_monitor = new(src, 1) diff --git a/code/game/machinery/camera/motion.dm b/code/game/machinery/camera/motion.dm index a5f531cfd603..a3e73db90863 100644 --- a/code/game/machinery/camera/motion.dm +++ b/code/game/machinery/camera/motion.dm @@ -84,7 +84,7 @@ /obj/machinery/camera/motion/thunderdome/Initialize() . = ..() - proximity_monitor.SetRange(7) + proximity_monitor.set_range(7) /obj/machinery/camera/motion/thunderdome/HasProximity(atom/movable/AM as mob|obj) if (!isliving(AM) || get_area(AM) != get_area(src)) diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index c6a283d5aa1e..bd2cf4f46156 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -28,6 +28,8 @@ light_system = MOVABLE_LIGHT //Used as a flash here. light_range = FLASH_LIGHT_RANGE light_on = FALSE + ///Proximity monitor associated with this atom, needed for proximity checks. + var/datum/proximity_monitor/proximity_monitor /obj/machinery/flasher/Initialize(mapload, ndir = 0, built = 0) . = ..() // ..() is EXTREMELY IMPORTANT, never forget to add it @@ -186,13 +188,13 @@ add_overlay("[base_state]-s") set_anchored(TRUE) power_change() - proximity_monitor.SetRange(range) + proximity_monitor.set_range(range) else to_chat(user, "[src] can now be moved.") cut_overlays() set_anchored(FALSE) power_change() - proximity_monitor.SetRange(0) + proximity_monitor.set_range(0) else return ..() diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 2e9478c040e7..e70734077822 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -97,6 +97,8 @@ Possible to do for anyone motivated enough: resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF flags_1 = NODECONSTRUCT_1 on_network = FALSE + ///Proximity monitor associated with this atom, needed for proximity checks. + var/datum/proximity_monitor/proximity_monitor var/proximity_range = 1 /obj/machinery/holopad/tutorial/Initialize(mapload) diff --git a/code/game/objects/effects/anomalies/anomalies_gravity.dm b/code/game/objects/effects/anomalies/anomalies_gravity.dm index b5668732f52b..cfe9d748db22 100644 --- a/code/game/objects/effects/anomalies/anomalies_gravity.dm +++ b/code/game/objects/effects/anomalies/anomalies_gravity.dm @@ -84,14 +84,14 @@ /obj/effect/anomaly/grav/high effectrange = 5 - var/grav_field + var/datum/proximity_monitor/advanced/gravity/grav_field /obj/effect/anomaly/grav/high/Initialize(mapload, new_lifespan) . = ..() INVOKE_ASYNC(src, .proc/setup_grav_field) /obj/effect/anomaly/grav/high/proc/setup_grav_field() - grav_field = make_field(/datum/proximity_monitor/advanced/gravity, list("current_range" = effectrange, "host" = src, "gravity_value" = 2)) + grav_field = grav_field = new(src, effectrange, TRUE, 2) /obj/effect/anomaly/grav/high/Destroy() QDEL_NULL(grav_field) diff --git a/code/game/objects/effects/proximity.dm b/code/game/objects/effects/proximity.dm deleted file mode 100644 index 7af165868ecb..000000000000 --- a/code/game/objects/effects/proximity.dm +++ /dev/null @@ -1,129 +0,0 @@ -/datum/proximity_monitor - var/atom/host //the atom we are tracking - var/atom/hasprox_receiver //the atom that will receive HasProximity calls. - var/atom/last_host_loc - var/list/checkers //list of /obj/effect/abstract/proximity_checkers - var/current_range - var/ignore_if_not_on_turf //don't check turfs in range if the host's loc isn't a turf - var/wire = FALSE - -/datum/proximity_monitor/New(atom/_host, range, _ignore_if_not_on_turf = TRUE) - checkers = list() - last_host_loc = _host.loc - ignore_if_not_on_turf = _ignore_if_not_on_turf - current_range = range - SetHost(_host) - -/datum/proximity_monitor/proc/SetHost(atom/H,atom/R) - if(H == host) - return - if(host) - UnregisterSignal(host, COMSIG_MOVABLE_MOVED) - if(R) - hasprox_receiver = R - else if(hasprox_receiver == host) //Default case - hasprox_receiver = H - host = H - RegisterSignal(host, COMSIG_MOVABLE_MOVED, .proc/HandleMove) - last_host_loc = host.loc - SetRange(current_range,TRUE) - -/datum/proximity_monitor/Destroy() - host = null - last_host_loc = null - hasprox_receiver = null - QDEL_LAZYLIST(checkers) - return ..() - -/datum/proximity_monitor/proc/HandleMove() - SIGNAL_HANDLER - - var/atom/_host = host - var/atom/new_host_loc = _host.loc - if(last_host_loc != new_host_loc) - last_host_loc = new_host_loc //hopefully this won't cause GC issues with containers - var/curr_range = current_range - SetRange(curr_range, TRUE) - if(curr_range) - testing("HasProx: [host] -> [host]") - hasprox_receiver.HasProximity(host) //if we are processing, we're guaranteed to be a movable - -/datum/proximity_monitor/proc/SetRange(range, force_rebuild = FALSE) - if(!force_rebuild && range == current_range) - return FALSE - . = TRUE - - current_range = range - - var/list/checkers_local = checkers - var/old_checkers_len = checkers_local.len - - var/atom/_host = host - - var/atom/loc_to_use = ignore_if_not_on_turf ? _host.loc : get_turf(_host) - if(wire && !isturf(loc_to_use)) //it makes assemblies attached on wires work - loc_to_use = get_turf(loc_to_use) - if(!isturf(loc_to_use)) //only check the host's loc - if(range) - var/obj/effect/abstract/proximity_checker/pc - if(old_checkers_len) - pc = checkers_local[old_checkers_len] - --checkers_local.len - QDEL_LAZYLIST(checkers_local) - else - pc = new(loc_to_use, src) - - checkers_local += pc //only check the host's loc - return - - var/list/turfs = RANGE_TURFS(range, loc_to_use) - var/turfs_len = turfs.len - var/old_checkers_used = min(turfs_len, old_checkers_len) - - //reuse what we can - for(var/I in 1 to old_checkers_len) - var/obj/effect/abstract/proximity_checker/pc = checkers_local[I] - if(I > old_checkers_used) - qdel(pc) //delete the leftovers - else if(QDELETED(pc)) - checkers_local[I] = new /obj/effect/abstract/proximity_checker(turfs[I], src) - else - pc.forceMove(turfs[I]) - - if(old_checkers_len < turfs_len) - //create what we lack - for(var/I in (old_checkers_used + 1) to turfs_len) - checkers_local += new /obj/effect/abstract/proximity_checker(turfs[I], src) - else - checkers_local.Cut(old_checkers_used + 1, old_checkers_len) - -/obj/effect/abstract/proximity_checker - invisibility = INVISIBILITY_ABSTRACT - anchored = TRUE - var/datum/proximity_monitor/monitor - -/obj/effect/abstract/proximity_checker/Initialize(mapload, datum/proximity_monitor/_monitor) - . = ..() - if(_monitor) - monitor = _monitor - else - stack_trace("proximity_checker created without host") - return INITIALIZE_HINT_QDEL - var/static/list/loc_connections = list( - COMSIG_ATOM_ENTERED = .proc/on_entered, - COMSIG_ATOM_EXITED =.proc/on_uncrossed - ) - AddElement(/datum/element/connect_loc, loc_connections) - -/obj/effect/abstract/proximity_checker/proc/on_uncrossed(datum/source, atom/movable/gone, direction) - SIGNAL_HANDLER - return - -/obj/effect/abstract/proximity_checker/Destroy() - monitor = null - return ..() - -/obj/effect/abstract/proximity_checker/proc/on_entered(datum/source, atom/movable/AM) - SIGNAL_HANDLER - - monitor?.hasprox_receiver?.HasProximity(AM) diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 91dcf5f25e0d..ec40e2332bdd 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -549,7 +549,7 @@ var/energy_recharge_cyborg_drain_coefficient = 0.4 var/cyborg_cell_critical_percentage = 0.05 var/mob/living/silicon/robot/host = null - var/datum/proximity_monitor/advanced/dampening_field + var/datum/proximity_monitor/advanced/peaceborg_dampener/dampening_field var/projectile_damage_coefficient = 0.5 var/projectile_damage_tick_ecost_coefficient = 2 //Lasers get half their damage chopped off, drains 50 power/tick. Note that fields are processed 5 times per second. var/projectile_speed_coefficient = 1.5 //Higher the coefficient slower the projectile. @@ -598,10 +598,9 @@ /obj/item/borg/projectile_dampen/proc/activate_field() if(istype(dampening_field)) QDEL_NULL(dampening_field) - dampening_field = make_field(/datum/proximity_monitor/advanced/peaceborg_dampener, list("current_range" = field_radius, "host" = src, "projector" = src)) var/mob/living/silicon/robot/owner = get_host() - if(owner) - owner.module.allow_riding = FALSE + dampening_field = new(owner, field_radius, TRUE, src) + owner?.module.allow_riding = FALSE active = TRUE /obj/item/borg/projectile_dampen/proc/deactivate_field() @@ -642,11 +641,6 @@ /obj/item/borg/projectile_dampen/process() process_recharge() process_usage() - update_location() - -/obj/item/borg/projectile_dampen/proc/update_location() - if(dampening_field) - dampening_field.HandleMove() /obj/item/borg/projectile_dampen/proc/process_usage() var/usage = 0 diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 53a5a039507e..606c74f07056 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -355,7 +355,7 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists) if(canPassSelf || (mover.movement_type & PHASING) || (mover.pass_flags & pass_flags_self)) for(var/atom/movable/thing as anything in contents) if(QDELETED(mover)) - return FALSE //We were deleted, do not attempt to proceed with movement. + return FALSE //We were deleted, do not attempt to proceed with movement. if(thing == mover || thing == mover.loc) // Multi tile objects and moving out of other objects continue if(!thing.Cross(mover)) diff --git a/code/modules/admin/verbs/secrets.dm b/code/modules/admin/verbs/secrets.dm index 6b4ee958acf2..18a572c7477b 100644 --- a/code/modules/admin/verbs/secrets.dm +++ b/code/modules/admin/verbs/secrets.dm @@ -172,7 +172,7 @@ for(var/mob/living/mob in thunderdome) qdel(mob) //Clear mobs for(var/obj/obj in thunderdome) - if(!istype(obj, /obj/machinery/camera) && !istype(obj, /obj/effect/abstract/proximity_checker)) + if(!istype(obj, /obj/machinery/camera)) qdel(obj) //Clear objects var/area/template = GLOB.areas_by_type[/area/tdome/arena_source] diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index 5877f1d9c687..99c4afaca743 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -11,6 +11,8 @@ var/time = 10 var/sensitivity = 1 var/hearing_range = 3 + ///Proximity monitor associated with this atom, needed for it to work. + var/datum/proximity_monitor/proximity_monitor /obj/item/assembly/prox_sensor/Initialize() . = ..() @@ -40,19 +42,19 @@ if(!.) return else - proximity_monitor.SetHost(src,src) + proximity_monitor.set_host(src, src) /obj/item/assembly/prox_sensor/toggle_secure() secured = !secured if(!secured) if(scanning) toggle_scan() - proximity_monitor.SetHost(src,src) + proximity_monitor.set_host(src, src) timing = FALSE STOP_PROCESSING(SSobj, src) else START_PROCESSING(SSobj, src) - proximity_monitor.SetHost(loc,src) + proximity_monitor.set_host(loc,src) update_icon() return secured @@ -84,13 +86,13 @@ if(!secured) return FALSE scanning = scan - proximity_monitor.SetRange(scanning ? sensitivity : 0) + proximity_monitor.set_range(scanning ? sensitivity : 0) update_icon() /obj/item/assembly/prox_sensor/proc/sensitivity_change(value) var/sense = min(max(sensitivity + value, 0), 5) sensitivity = sense - if(scanning && proximity_monitor.SetRange(sense)) + if(scanning && proximity_monitor.set_range(sense)) sense() /obj/item/assembly/prox_sensor/update_icon() diff --git a/code/modules/fields/fields.dm b/code/modules/fields/fields.dm deleted file mode 100644 index 7dde4cee5876..000000000000 --- a/code/modules/fields/fields.dm +++ /dev/null @@ -1,324 +0,0 @@ - -//Movable and easily code-modified fields! Allows for custom AOE effects that affect movement and anything inside of them, and can do custom turf effects! -//Supports automatic recalculation/reset on movement. -//If there's any way to make this less CPU intensive than I've managed, gimme a call or do it yourself! - kevinz000 - -//Field shapes -#define FIELD_NO_SHAPE 0 //Does not update turfs automatically -#define FIELD_SHAPE_RADIUS_SQUARE 1 //Uses current_range and square_depth_up/down -#define FIELD_SHAPE_CUSTOM_SQUARE 2 //Uses square_height and square_width and square_depth_up/down - -//Proc to make fields. make_field(field_type, field_params_in_associative_list) -/proc/make_field(field_type, list/field_params, override_checks = FALSE, start_field = TRUE) - var/datum/proximity_monitor/advanced/F = new field_type() - if(!F.assume_params(field_params) && !override_checks) - QDEL_NULL(F) - if(!F.check_variables() && !override_checks) - QDEL_NULL(F) - if(start_field && (F || override_checks)) - F.begin_field() - return F - -/datum/proximity_monitor/advanced - var/name = "\improper Energy Field" - //Field setup specifications - var/field_shape = FIELD_NO_SHAPE - var/square_height = 0 - var/square_width = 0 - var/square_depth_up = 0 - var/square_depth_down = 0 - //Processing - var/process_inner_turfs = FALSE //Don't do this unless it's absolutely necessary - var/process_edge_turfs = FALSE //Don't do this either unless it's absolutely necessary, you can just track what things are inside manually or on the initial setup. - var/requires_processing = FALSE - var/setup_edge_turfs = FALSE //Setup edge turfs/all field turfs. Set either or both to ON when you need it, it's defaulting to off unless you do to save CPU. - var/setup_field_turfs = FALSE - var/use_host_turf = FALSE //For fields from items carried on mobs to check turf instead of loc... - - var/list/turf/field_turfs = list() - var/list/turf/edge_turfs = list() - var/list/turf/field_turfs_new = list() - var/list/turf/edge_turfs_new = list() - -/datum/proximity_monitor/advanced/Destroy() - full_cleanup() - STOP_PROCESSING(SSfields, src) - return ..() - -/datum/proximity_monitor/advanced/proc/assume_params(list/field_params) - var/pass_check = TRUE - for(var/param in field_params) - if(vars[param] || isnull(vars[param]) || (param in vars)) - vars[param] = field_params[param] - else - pass_check = FALSE - return pass_check - -/datum/proximity_monitor/advanced/proc/check_variables() - var/pass = TRUE - if(field_shape == FIELD_NO_SHAPE) //If you're going to make a manually updated field you shouldn't be using automatic checks so don't. - pass = FALSE - if(current_range < 0 || square_height < 0 || square_width < 0 || square_depth_up < 0 || square_depth_down < 0) - pass = FALSE - if(!istype(host)) - pass = FALSE - return pass - -/datum/proximity_monitor/advanced/process() - if(process_inner_turfs) - for(var/turf/T in field_turfs) - process_inner_turf(T) - CHECK_TICK //Really crappy lagchecks, needs improvement once someone starts using processed fields. - if(process_edge_turfs) - for(var/turf/T in edge_turfs) - process_edge_turf(T) - CHECK_TICK //Same here. - -/datum/proximity_monitor/advanced/proc/process_inner_turf(turf/T) - -/datum/proximity_monitor/advanced/proc/process_edge_turf(turf/T) - -/datum/proximity_monitor/advanced/New() - if(requires_processing) - START_PROCESSING(SSfields, src) - -/datum/proximity_monitor/advanced/proc/begin_field() - setup_field() - post_setup_field() - -/datum/proximity_monitor/advanced/proc/full_cleanup() //Full cleanup for when you change something that would require complete resetting. - for(var/turf/T in edge_turfs) - cleanup_edge_turf(T) - for(var/turf/T in field_turfs) - cleanup_field_turf(T) - -/datum/proximity_monitor/advanced/proc/check_movement() - if(!use_host_turf) - if(host.loc != last_host_loc) - last_host_loc = host.loc - return TRUE - else - if(get_turf(host) != last_host_loc) - last_host_loc = get_turf(host) - return TRUE - return FALSE - -/datum/proximity_monitor/advanced/proc/recalculate_field(ignore_movement_check = FALSE) //Call every time the field moves (done automatically if you use update_center) or a setup specification is changed. - if(!(ignore_movement_check || check_movement()) && (field_shape != FIELD_NO_SHAPE)) - return - update_new_turfs() - var/list/turf/needs_setup = field_turfs_new.Copy() - if(setup_field_turfs) - for(var/turf/T in field_turfs) - if(!(T in needs_setup)) - cleanup_field_turf(T) - else - needs_setup -= T - CHECK_TICK - for(var/turf/T in needs_setup) - setup_field_turf(T) - CHECK_TICK - if(setup_edge_turfs) - for(var/turf/T in edge_turfs) - cleanup_edge_turf(T) - CHECK_TICK - for(var/turf/T in edge_turfs_new) - setup_edge_turf(T) - CHECK_TICK - -/datum/proximity_monitor/advanced/proc/field_turf_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F, border_dir) - return TRUE - -/datum/proximity_monitor/advanced/proc/field_turf_crossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F) - return TRUE - -/datum/proximity_monitor/advanced/proc/field_turf_uncrossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F) - return TRUE - -/datum/proximity_monitor/advanced/proc/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, border_dir) - return TRUE - -/datum/proximity_monitor/advanced/proc/field_edge_crossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F) - return TRUE - -/datum/proximity_monitor/advanced/proc/field_edge_uncrossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F) - return TRUE - -/datum/proximity_monitor/advanced/HandleMove() - var/atom/_host = host - var/atom/new_host_loc = _host.loc - if(last_host_loc != new_host_loc) - INVOKE_ASYNC(src, .proc/recalculate_field) - -/datum/proximity_monitor/advanced/proc/post_setup_field() - -/datum/proximity_monitor/advanced/proc/setup_field() - update_new_turfs() - if(setup_field_turfs) - for(var/turf/T in field_turfs_new) - setup_field_turf(T) - CHECK_TICK - if(setup_edge_turfs) - for(var/turf/T in edge_turfs_new) - setup_edge_turf(T) - CHECK_TICK - -/datum/proximity_monitor/advanced/proc/cleanup_field_turf(turf/T) - qdel(field_turfs[T]) - field_turfs -= T - -/datum/proximity_monitor/advanced/proc/cleanup_edge_turf(turf/T) - qdel(edge_turfs[T]) - edge_turfs -= T - -/datum/proximity_monitor/advanced/proc/setup_field_turf(turf/T) - field_turfs[T] = new /obj/effect/abstract/proximity_checker/advanced/field_turf(T, src) - -/datum/proximity_monitor/advanced/proc/setup_edge_turf(turf/T) - edge_turfs[T] = new /obj/effect/abstract/proximity_checker/advanced/field_edge(T, src) - -/datum/proximity_monitor/advanced/proc/update_new_turfs() - if(!istype(host)) - return FALSE - var/turf/center = get_turf(host) - field_turfs_new = list() - edge_turfs_new = list() - switch(field_shape) - if(FIELD_NO_SHAPE) - return FALSE - if(FIELD_SHAPE_RADIUS_SQUARE) - for(var/turf/T in block(locate(center.x-current_range,center.y-current_range,center.z-square_depth_down),locate(center.x+current_range, center.y+current_range,center.z+square_depth_up))) - field_turfs_new += T - edge_turfs_new = field_turfs_new.Copy() - if(current_range >= 1) - var/list/turf/center_turfs = list() - for(var/turf/T in block(locate(center.x-current_range+1,center.y-current_range+1,center.z-square_depth_down),locate(center.x+current_range-1, center.y+current_range-1,center.z+square_depth_up))) - center_turfs += T - for(var/turf/T in center_turfs) - edge_turfs_new -= T - if(FIELD_SHAPE_CUSTOM_SQUARE) - for(var/turf/T in block(locate(center.x-square_width,center.y-square_height,center.z-square_depth_down),locate(center.x+square_width, center.y+square_height,center.z+square_depth_up))) - field_turfs_new += T - edge_turfs_new = field_turfs_new.Copy() - if(square_height >= 1 && square_width >= 1) - var/list/turf/center_turfs = list() - for(var/turf/T in block(locate(center.x-square_width+1,center.y-square_height+1,center.z-square_depth_down),locate(center.x+square_width-1, center.y+square_height-1,center.z+square_depth_up))) - center_turfs += T - for(var/turf/T in center_turfs) - edge_turfs_new -= T - -//Gets edge direction/corner, only works with square radius/WDH fields! -/datum/proximity_monitor/advanced/proc/get_edgeturf_direction(turf/T, turf/center_override = null) - var/turf/checking_from = get_turf(host) - if(istype(center_override)) - checking_from = center_override - if(field_shape != FIELD_SHAPE_RADIUS_SQUARE && field_shape != FIELD_SHAPE_CUSTOM_SQUARE) - return - if(!(T in edge_turfs)) - return - switch(field_shape) - if(FIELD_SHAPE_RADIUS_SQUARE) - if(((T.x == (checking_from.x + current_range)) || (T.x == (checking_from.x - current_range))) && ((T.y == (checking_from.y + current_range)) || (T.y == (checking_from.y - current_range)))) - return get_dir(checking_from, T) - if(T.x == (checking_from.x + current_range)) - return EAST - if(T.x == (checking_from.x - current_range)) - return WEST - if(T.y == (checking_from.y - current_range)) - return SOUTH - if(T.y == (checking_from.y + current_range)) - return NORTH - if(FIELD_SHAPE_CUSTOM_SQUARE) - if(((T.x == (checking_from.x + square_width)) || (T.x == (checking_from.x - square_width))) && ((T.y == (checking_from.y + square_height)) || (T.y == (checking_from.y - square_height)))) - return get_dir(checking_from, T) - if(T.x == (checking_from.x + square_width)) - return EAST - if(T.x == (checking_from.x - square_width)) - return WEST - if(T.y == (checking_from.y - square_height)) - return SOUTH - if(T.y == (checking_from.y + square_height)) - return NORTH - -//DEBUG FIELDS -/datum/proximity_monitor/advanced/debug - name = "\improper Color Matrix Field" - field_shape = FIELD_SHAPE_RADIUS_SQUARE - current_range = 5 - var/set_fieldturf_color = "#aaffff" - var/set_edgeturf_color = "#ffaaff" - setup_field_turfs = TRUE - setup_edge_turfs = TRUE - - -/datum/proximity_monitor/advanced/debug/setup_edge_turf(turf/T) - T.color = set_edgeturf_color - ..() - -/datum/proximity_monitor/advanced/debug/cleanup_edge_turf(turf/T) - T.color = initial(T.color) - ..() - if(T in field_turfs) - T.color = set_fieldturf_color - -/datum/proximity_monitor/advanced/debug/setup_field_turf(turf/T) - T.color = set_fieldturf_color - ..() - -/datum/proximity_monitor/advanced/debug/cleanup_field_turf(turf/T) - T.color = initial(T.color) - ..() - -//DEBUG FIELD ITEM -/obj/item/multitool/field_debug - name = "strange multitool" - desc = "Seems to project a colored field!" - var/list/field_params = list("field_shape" = FIELD_SHAPE_RADIUS_SQUARE, "current_range" = 5, "set_fieldturf_color" = "#aaffff", "set_edgeturf_color" = "#ffaaff") - var/field_type = /datum/proximity_monitor/advanced/debug - var/operating = FALSE - var/datum/proximity_monitor/advanced/current = null - var/mob/listeningTo - -/obj/item/multitool/field_debug/Initialize() - . = ..() - START_PROCESSING(SSobj, src) - -/obj/item/multitool/field_debug/Destroy() - STOP_PROCESSING(SSobj, src) - QDEL_NULL(current) - listeningTo = null - return ..() - -/obj/item/multitool/field_debug/proc/setup_debug_field() - var/list/new_params = field_params.Copy() - new_params["host"] = src - current = make_field(field_type, new_params) - -/obj/item/multitool/field_debug/attack_self(mob/user) - operating = !operating - to_chat(user, "You turn [src] [operating? "on":"off"].") - UnregisterSignal(listeningTo, COMSIG_MOVABLE_MOVED) - listeningTo = null - if(!istype(current) && operating) - RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/on_mob_move) - listeningTo = user - setup_debug_field() - else if(!operating) - QDEL_NULL(current) - -/obj/item/multitool/field_debug/dropped() - . = ..() - if(listeningTo) - UnregisterSignal(listeningTo, COMSIG_MOVABLE_MOVED) - listeningTo = null - -/obj/item/multitool/field_debug/proc/on_mob_move() - SIGNAL_HANDLER - - check_turf(get_turf(src)) - -/obj/item/multitool/field_debug/process() - check_turf(get_turf(src)) - -/obj/item/multitool/field_debug/proc/check_turf(turf/T) - current.HandleMove() diff --git a/code/modules/fields/turf_objects.dm b/code/modules/fields/turf_objects.dm deleted file mode 100644 index b794e1946038..000000000000 --- a/code/modules/fields/turf_objects.dm +++ /dev/null @@ -1,67 +0,0 @@ - -/obj/effect/abstract/proximity_checker/advanced - name = "field" - desc = "Why can you see energy fields?!" - icon = null - icon_state = null - alpha = 0 - invisibility = INVISIBILITY_ABSTRACT - flags_1 = ON_BORDER_1 - mouse_opacity = MOUSE_OPACITY_TRANSPARENT - var/datum/proximity_monitor/advanced/parent = null - -/obj/effect/abstract/proximity_checker/advanced/Initialize(mapload, _monitor) - if(_monitor) - parent = _monitor - return ..() - -/obj/effect/abstract/proximity_checker/advanced/center - name = "field anchor" - desc = "No." - -/obj/effect/abstract/proximity_checker/advanced/field_turf - name = "energy field" - desc = "Get off my turf!" - -/obj/effect/abstract/proximity_checker/advanced/field_turf/CanAllowThrough(atom/movable/mover, border_dir) - . = ..() - if(parent) - return parent.field_turf_canpass(mover, src, border_dir) - -/obj/effect/abstract/proximity_checker/advanced/field_turf/on_entered(datum/source, atom/movable/AM) - if(parent) - return parent.field_turf_crossed(AM, src) - return TRUE - -/obj/effect/abstract/proximity_checker/advanced/field_turf/on_uncrossed(datum/source, atom/movable/AM) - if(parent) - return parent.field_turf_uncrossed(AM, src) - return TRUE - -/obj/effect/abstract/proximity_checker/advanced/field_edge - name = "energy field edge" - desc = "Edgy description here." - -/obj/effect/abstract/proximity_checker/advanced/field_edge/CanAllowThrough(atom/movable/mover, border_dir) - . = ..() - if(parent) - return parent.field_edge_canpass(mover, src, border_dir) - -/obj/effect/abstract/proximity_checker/advanced/field_edge/on_entered(datum/source, atom/movable/AM) - if(parent) - return parent.field_edge_crossed(AM, src) - return TRUE - -/obj/effect/abstract/proximity_checker/advanced/field_edge/on_uncrossed(datum/source, atom/movable/AM) - if(parent) - return parent.field_edge_uncrossed(AM, src) - return TRUE - -/proc/is_turf_in_field(turf/T, datum/proximity_monitor/advanced/F) //Looking for ways to optimize this! - for(var/obj/effect/abstract/proximity_checker/advanced/O in T) - if(istype(O, /obj/effect/abstract/proximity_checker/advanced/field_edge)) - if(O.parent == F) - return FIELD_EDGE - if(O.parent == F) - return FIELD_TURF - return FALSE diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index 508cea2c3507..a689cf672cc1 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -135,6 +135,8 @@ var/datum/material/selected_material = null var/selected_alloy = null var/datum/techweb/stored_research + ///Proximity monitor associated with this atom, needed for proximity checks. + var/datum/proximity_monitor/proximity_monitor /obj/machinery/mineral/processing_unit/Initialize() . = ..() diff --git a/code/modules/mining/machine_stacking.dm b/code/modules/mining/machine_stacking.dm index f7d9e19cf9c2..4f1cc8a08bc1 100644 --- a/code/modules/mining/machine_stacking.dm +++ b/code/modules/mining/machine_stacking.dm @@ -91,6 +91,8 @@ var/stack_amt = 50 //amount to stack before releassing var/datum/component/remote_materials/materials var/force_connect = FALSE + ///Proximity monitor associated with this atom, needed for proximity checks. + var/datum/proximity_monitor/proximity_monitor /obj/machinery/mineral/stacking_machine/Initialize(mapload) . = ..() diff --git a/code/modules/mob/living/carbon/alien/utilities/structures.dm b/code/modules/mob/living/carbon/alien/utilities/structures.dm index 344a689f731f..cf314532f6e2 100644 --- a/code/modules/mob/living/carbon/alien/utilities/structures.dm +++ b/code/modules/mob/living/carbon/alien/utilities/structures.dm @@ -310,6 +310,8 @@ var/status = GROWING //can be GROWING, GROWN or BURST; all mutually exclusive layer = MOB_LAYER var/mob/living/simple_animal/hostile/facehugger/child + ///Proximity monitor associated with this atom, needed for proximity checks. + var/datum/proximity_monitor/proximity_monitor /obj/structure/alien/egg/Initialize(mapload) . = ..() @@ -363,13 +365,13 @@ /obj/structure/alien/egg/proc/Grow() status = GROWN update_icon() - proximity_monitor.SetRange(1) + proximity_monitor.set_range(1) //drops and kills the hugger if any is remaining /obj/structure/alien/egg/proc/Burst(kill = TRUE) if(status == GROWN || status == GROWING) - proximity_monitor.SetRange(0) status = BURST + proximity_monitor.set_range(0) update_icon() flick("egg_opening", src) addtimer(CALLBACK(src, .proc/finish_bursting, kill), 15) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index 748f48b017c7..388c9e3cf8c4 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -148,8 +148,6 @@ All ShuttleMove procs go here update_light() if(rotation) shuttleRotate(rotation) - if(proximity_monitor) - proximity_monitor.HandleMove() update_parallax_contents() @@ -412,11 +410,3 @@ All ShuttleMove procs go here if((!(src in moving_dock.docking_points) || !towed_shuttles[docked]) && !moving_dock.can_move_docking_ports) return FALSE . = ..() - -/obj/effect/abstract/proximity_checker/onShuttleMove(turf/newT, turf/oldT, list/movement_force, move_dir, obj/docking_port/stationary/old_dock, obj/docking_port/mobile/moving_dock, list/obj/docking_port/mobile/towed_shuttles) - . = ..() - //timer so it only happens once - if(!monitor) - qdel(src) - return - addtimer(CALLBACK(monitor, /datum/proximity_monitor/proc/SetRange, monitor.current_range, TRUE), 0, TIMER_UNIQUE) diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 4913c1b6b89d..40b716d80ae8 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -55,8 +55,6 @@ ignore += typesof(/obj/item/modular_computer/tablet/integrated) //This one demands a computer, ditto ignore += typesof(/obj/item/modular_computer/processor) - //Needs special input, let's be nice - ignore += typesof(/obj/effect/abstract/proximity_checker) //Very finiky, blacklisting to make things easier ignore += typesof(/obj/item/poster/wanted) //We can't pass a mind into this diff --git a/shiptest.dme b/shiptest.dme index 77914966120d..5529102b065d 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -362,7 +362,6 @@ #include "code\controllers\subsystem\vote.dm" #include "code\controllers\subsystem\weather.dm" #include "code\controllers\subsystem\processing\fastprocess.dm" -#include "code\controllers\subsystem\processing\fields.dm" #include "code\controllers\subsystem\processing\fluids.dm" #include "code\controllers\subsystem\processing\instruments.dm" #include "code\controllers\subsystem\processing\nanites.dm" @@ -449,7 +448,9 @@ #include "code\datums\components\butchering.dm" #include "code\datums\components\caltrop.dm" #include "code\datums\components\chasm.dm" +#include "code\datums\components\connect_containers.dm" #include "code\datums\components\connect_loc_behalf.dm" +#include "code\datums\components\connect_range.dm" #include "code\datums\components\construction.dm" #include "code\datums\components\creamed.dm" #include "code\datums\components\deadchat_control.dm" @@ -703,6 +704,11 @@ #include "code\datums\mutations\telekinesis.dm" #include "code\datums\mutations\touch.dm" #include "code\datums\ruins\beachplanet.dm" +#include "code\datums\proximity_monitor\field.dm" +#include "code\datums\proximity_monitor\proximity_monitor.dm" +#include "code\datums\proximity_monitor\fields\gravity.dm" +#include "code\datums\proximity_monitor\fields\peaceborg_dampener.dm" +#include "code\datums\proximity_monitor\fields\timestop.dm" #include "code\datums\ruins\icemoon.dm" #include "code\datums\ruins\jungle.dm" #include "code\datums\ruins\lavaland.dm" @@ -1016,7 +1022,6 @@ #include "code\game\objects\effects\overlays.dm" #include "code\game\objects\effects\particle_emitter.dm" #include "code\game\objects\effects\portals.dm" -#include "code\game\objects\effects\proximity.dm" #include "code\game\objects\effects\radiation.dm" #include "code\game\objects\effects\spiderperson_web.dm" #include "code\game\objects\effects\spiders.dm" @@ -2075,11 +2080,6 @@ #include "code\modules\events\wizard\rpgloot.dm" #include "code\modules\events\wizard\shuffle.dm" #include "code\modules\events\wizard\summons.dm" -#include "code\modules\fields\fields.dm" -#include "code\modules\fields\gravity.dm" -#include "code\modules\fields\peaceborg_dampener.dm" -#include "code\modules\fields\timestop.dm" -#include "code\modules\fields\turf_objects.dm" #include "code\modules\fishing\bait.dm" #include "code\modules\fishing\fish_catalog.dm" #include "code\modules\fishing\fishing_equipment.dm" From 8a73ae6967df57007f2829010716dd403d2740f4 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 16 Jul 2023 14:12:04 -0500 Subject: [PATCH 024/147] fix --- code/datums/hud.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/hud.dm b/code/datums/hud.dm index 32e93a2d1c45..abc82ea6806e 100644 --- a/code/datums/hud.dm +++ b/code/datums/hud.dm @@ -79,7 +79,7 @@ GLOBAL_LIST_INIT(huds, list( if(!M || !M.client || !A) return for(var/i in hud_icons) - M.client.images -= A.hud_list[i] + M.client.images -= A.hud_list?[i] /datum/atom_hud/proc/add_hud_to(mob/M) if(!M) From 6d88f350960c449b0e9690d53fc3e2a4d7b06977 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 16 Jul 2023 14:17:31 -0500 Subject: [PATCH 025/147] let's not have this on by default actually --- code/_compile_options.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index a1db7ae6f98f..224367aaa9cf 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -33,7 +33,7 @@ /// If this is uncommented, we set up the ref tracker to be used in a live environment /// And to log events to [log_dir]/harddels.log -#define REFERENCE_DOING_IT_LIVE +//#define REFERENCE_DOING_IT_LIVE #ifdef REFERENCE_DOING_IT_LIVE // compile the backend #define REFERENCE_TRACKING From ff6576ba0e79dfbe3dd02cb2aad6a84da90497b0 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Mon, 17 Jul 2023 16:47:50 -0500 Subject: [PATCH 026/147] more fixes --- code/datums/components/udder.dm | 4 +- code/game/area/areas/shuttles.dm | 2 +- code/game/machinery/_machinery.dm | 6 +-- code/game/machinery/computer/_computer.dm | 4 -- code/game/machinery/roulette_machine.dm | 5 +++ code/game/mecha/mecha.dm | 42 +++++++++++-------- code/game/objects/effects/countdown.dm | 12 +++--- .../objects/effects/spawners/gibspawner.dm | 9 +++- code/game/objects/items/cash.dm | 2 +- code/game/objects/structures/bedsheet_bin.dm | 4 +- .../objects/structures/ghost_role_spawners.dm | 2 +- code/modules/antagonists/blob/blob_mobs.dm | 7 ++-- .../atmospherics/machinery/datum_pipeline.dm | 2 - .../kitchen_machinery/deep_fryer.dm | 5 +++ .../kitchen_machinery/grill.dm | 5 ++- .../kitchen_machinery/microwave.dm | 2 + code/modules/instruments/songs/_song.dm | 5 ++- .../carbon/human/species_types/zombies.dm | 1 - .../modules/mob/living/silicon/robot/robot.dm | 6 +-- .../mob/living/simple_animal/hostile/goose.dm | 5 ++- code/modules/ninja/energy_katana.dm | 2 +- code/modules/overmap/overmap_token.dm | 2 + .../overmap/ships/controlled_ship_datum.dm | 2 + code/modules/research/designs.dm | 13 +++--- code/modules/shuttle/shuttle.dm | 3 ++ .../surgery/bodyparts/robot_bodyparts.dm | 7 +++- code/modules/unit_tests/create_and_destroy.dm | 4 ++ code/modules/unit_tests/ship_placement.dm | 6 ++- shiptest.dme | 2 +- 29 files changed, 107 insertions(+), 64 deletions(-) diff --git a/code/datums/components/udder.dm b/code/datums/components/udder.dm index ae2ceb6ec7e9..d8358be3c6b2 100644 --- a/code/datums/components/udder.dm +++ b/code/datums/components/udder.dm @@ -72,6 +72,8 @@ ///type of reagent this udder will generate /obj/item/udder/Initialize(mapload, udder_mob, on_generate_callback, reagent_produced_typepath = /datum/reagent/consumable/milk) + if(!udder_mob) + return INITIALIZE_HINT_QDEL src.udder_mob = udder_mob src.on_generate_callback = on_generate_callback create_reagents(size) @@ -134,8 +136,6 @@ name = "\proper nutrient sac" /obj/item/udder/gutlunch/initial_conditions() - if(!udder_mob) - return if(udder_mob.gender == FEMALE) START_PROCESSING(SSobj, src) RegisterSignal(udder_mob, COMSIG_HOSTILE_ATTACKINGTARGET, .proc/on_mob_attacking) diff --git a/code/game/area/areas/shuttles.dm b/code/game/area/areas/shuttles.dm index 5587837368fb..a9d7220bd3ca 100644 --- a/code/game/area/areas/shuttles.dm +++ b/code/game/area/areas/shuttles.dm @@ -24,7 +24,7 @@ mobile_port = null . = ..() -/area/shuttle/PlaceOnTopReact(list/new_baseturfs, turf/fake_turf_type, flags) +/area/shuttle/PlaceOnTopReact(turf/T, list/new_baseturfs, turf/fake_turf_type, flags) . = ..() if(length(new_baseturfs) > 1 || fake_turf_type) return // More complicated larger changes indicate this isn't a player diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 06dd63a41e95..c7158a4e80c5 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -170,10 +170,8 @@ Class Procs: GLOB.machines.Remove(src) end_processing() dropContents() - if(length(component_parts)) - for(var/atom/A in component_parts) - qdel(A) - component_parts.Cut() + QDEL_NULL(circuit) + QDEL_LIST(component_parts) return ..() /obj/machinery/proc/locate_machinery() diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm index bfed7c72602b..aa9fabbcfd77 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -29,10 +29,6 @@ circuit = C C.moveToNullspace() -/obj/machinery/computer/Destroy() - QDEL_NULL(circuit) - return ..() - /obj/machinery/computer/process() if(machine_stat & (NOPOWER|BROKEN)) return 0 diff --git a/code/game/machinery/roulette_machine.dm b/code/game/machinery/roulette_machine.dm index 5ce00a0627a0..108c5efc1410 100644 --- a/code/game/machinery/roulette_machine.dm +++ b/code/game/machinery/roulette_machine.dm @@ -54,6 +54,11 @@ jackpot_loop = new(list(src), FALSE) wires = new /datum/wires/roulette(src) +/obj/machinery/roulette/Destroy() + QDEL_NULL(jackpot_loop) + QDEL_NULL(wires) + return ..() + /obj/machinery/roulette/obj_break(damage_flag) prize_theft(0.05) . = ..() diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 35ea91edfa51..72bb8c833e36 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -169,29 +169,37 @@ for(var/obj/item/mecha_parts/mecha_equipment/E in equipment) E.detach(loc) qdel(E) - if(cell) - qdel(cell) - if(scanmod) - qdel(scanmod) - if(capacitor) - qdel(capacitor) - if(internal_tank) - qdel(internal_tank) if(AI) AI.gib() //No wreck, no AI to recover + AI = null STOP_PROCESSING(SSobj, src) GLOB.poi_list.Remove(src) equipment.Cut() - cell = null - scanmod = null - capacitor = null - internal_tank = null + + QDEL_NULL(cell) + QDEL_NULL(scanmod) + QDEL_NULL(capacitor) + QDEL_NULL(internal_tank) + QDEL_NULL(spark_system) + QDEL_NULL(smoke_system) + QDEL_NULL(radio) + + QDEL_NULL(eject_action) + QDEL_NULL(internals_action) + QDEL_NULL(cycle_action) + QDEL_NULL(lights_action) + QDEL_NULL(stats_action) + QDEL_NULL(defense_action) + QDEL_NULL(overload_action) + QDEL_NULL(smoke_system) + QDEL_NULL(smoke_action) + QDEL_NULL(zoom_action) + QDEL_NULL(switch_damtype_action) + QDEL_NULL(phasing_action) + QDEL_NULL(strafing_action) + assume_air(cabin_air) - cabin_air = null - qdel(spark_system) - spark_system = null - qdel(smoke_system) - smoke_system = null + QDEL_NULL(cabin_air) GLOB.mechas_list -= src //global mech list return ..() diff --git a/code/game/objects/effects/countdown.dm b/code/game/objects/effects/countdown.dm index df26388b9ddb..c47b95e99b49 100644 --- a/code/game/objects/effects/countdown.dm +++ b/code/game/objects/effects/countdown.dm @@ -146,11 +146,13 @@ return round(time_left) /obj/effect/countdown/holosign/Destroy(...) - if(attached_to) - var/obj/structure/holosign/H = attached_to - if(H.countdown) - H.countdown = null - return ..() + if(!attached_to) + return ..() + var/obj/structure/holosign/H = attached_to + if(!istype(H) || !H.countdown) + return ..() + H.countdown = null + return ..() /obj/effect/countdown/hourglass name = "hourglass countdown" diff --git a/code/game/objects/effects/spawners/gibspawner.dm b/code/game/objects/effects/spawners/gibspawner.dm index 28d9a16e0545..d1dbee424066 100644 --- a/code/game/objects/effects/spawners/gibspawner.dm +++ b/code/game/objects/effects/spawners/gibspawner.dm @@ -153,8 +153,8 @@ return ..() /obj/effect/gibspawner/robot/bodypartless - gibtypes = list(/obj/effect/decal/cleanable/robot_debris/up, /obj/effect/decal/cleanable/robot_debris/down, /obj/effect/decal/cleanable/robot_debris, /obj/effect/decal/cleanable/robot_debris, /obj/effect/decal/cleanable/robot_debris) - gibamounts = list(1, 1, 1, 1, 1) + gibtypes = list(/obj/effect/decal/cleanable/robot_debris/up, /obj/effect/decal/cleanable/robot_debris/down, /obj/effect/decal/cleanable/robot_debris, /obj/effect/decal/cleanable/robot_debris, /obj/effect/decal/cleanable/robot_debris, /obj/effect/decal/cleanable/robot_debris) + gibamounts = list(1, 1, 1, 1, 1, 1) /obj/effect/gibspawner/robot/bodypartless/Initialize() if(!gibdirections.len) @@ -164,3 +164,8 @@ /obj/effect/gibspawner/generic/crystal gibtypes = list(/obj/effect/decal/cleanable/glass/strange, /obj/effect/decal/cleanable/blood/gibs, /obj/effect/decal/cleanable/blood/gibs, /obj/effect/decal/cleanable/blood/gibs/core) gibamounts = list(5, 2, 2, 1) + +/obj/effect/gibspawner/generic/crystal/Initialize() + if(!gibdirections.len) + gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs) + return ..() diff --git a/code/game/objects/items/cash.dm b/code/game/objects/items/cash.dm index 0ec1885ed7e6..9528b47ea076 100644 --- a/code/game/objects/items/cash.dm +++ b/code/game/objects/items/cash.dm @@ -17,7 +17,7 @@ grind_results = list(/datum/reagent/iron = 10) /obj/item/spacecash/Initialize(mapload, amount) - ..() + . = ..() if(amount) value = amount update_icon() diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index fe6bd364bae1..c8551710d5b1 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -266,8 +266,8 @@ LINEN BINS dying_key = DYE_REGISTRY_DOUBLE_BEDSHEET /obj/item/bedsheet/double/Initialize() - ..() - desc += " This one is double." + . = ..() + desc += " This one is double-sized." /obj/item/bedsheet/double/blue icon_state = "double_sheetblue" diff --git a/code/game/objects/structures/ghost_role_spawners.dm b/code/game/objects/structures/ghost_role_spawners.dm index 4bdbc29290dd..43296195b5b6 100644 --- a/code/game/objects/structures/ghost_role_spawners.dm +++ b/code/game/objects/structures/ghost_role_spawners.dm @@ -402,7 +402,7 @@ /obj/effect/mob_spawn/human/hotel_staff/Destroy() new/obj/structure/fluff/empty_sleeper/syndicate(get_turf(src)) - ..() + return ..() /obj/effect/mob_spawn/human/demonic_friend name = "Essence of friendship" diff --git a/code/modules/antagonists/blob/blob_mobs.dm b/code/modules/antagonists/blob/blob_mobs.dm index 46f71a47477c..639017e100f3 100644 --- a/code/modules/antagonists/blob/blob_mobs.dm +++ b/code/modules/antagonists/blob/blob_mobs.dm @@ -117,9 +117,10 @@ var/is_zombie = FALSE /mob/living/simple_animal/hostile/blob/blobspore/Initialize(mapload, obj/structure/blob/factory/linked_node) - if(istype(linked_node)) - factory = linked_node - factory.spores += src + if(!istype(linked_node)) + return INITIALIZE_HINT_QDEL + factory = linked_node + factory.spores += src . = ..() if(linked_node.overmind && istype(linked_node.overmind.blobstrain, /datum/blobstrain/reagent/distributed_neurons) && !istype(src, /mob/living/simple_animal/hostile/blob/blobspore/weak)) notify_ghosts("A controllable spore has been created in \the [get_area(src)].", source = src, action = NOTIFY_ORBIT, flashwindow = FALSE, header = "Sentient Spore Created") diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index 29c0ff985c9c..7742f0e37a85 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -254,13 +254,11 @@ if(V.on) PL |= V.parents[1] PL |= V.parents[2] -//BeginWS Edit - Porting Relief Valves else if (istype(atmosmch,/obj/machinery/atmospherics/components/binary/relief_valve)) var/obj/machinery/atmospherics/components/binary/relief_valve/V = atmosmch if(V.opened) PL |= V.parents[1] PL |= V.parents[2] -//EndWS Edit - Porting Relief Valves else if (istype(atmosmch, /obj/machinery/atmospherics/components/unary/portables_connector)) var/obj/machinery/atmospherics/components/unary/portables_connector/C = atmosmch if(C.connected_device) diff --git a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm index 82b0105c2612..5063a87217e8 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm @@ -58,6 +58,11 @@ RefreshParts() fry_loop = new(list(src), FALSE) +/obj/machinery/deepfryer/Destroy() + QDEL_NULL(frying) + QDEL_NULL(fry_loop) + return ..() + /obj/machinery/deepfryer/RefreshParts() var/oil_efficiency for(var/obj/item/stock_parts/micro_laser/M in component_parts) diff --git a/code/modules/food_and_drinks/kitchen_machinery/grill.dm b/code/modules/food_and_drinks/kitchen_machinery/grill.dm index 89efb1b1cf8d..fd4f6b07d6c9 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/grill.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/grill.dm @@ -91,8 +91,9 @@ . = ..() /obj/machinery/grill/Destroy() - grilled_item = null - . = ..() + QDEL_NULL(grilled_item) + QDEL_NULL(grill_loop) + return ..() /obj/machinery/grill/handle_atom_del(atom/A) if(A == grilled_item) diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index 237d4ad2c832..5a03c5097266 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -40,6 +40,8 @@ /obj/machinery/microwave/Destroy() eject() + QDEL_NULL(soundloop) + QDEL_LIST(ingredients) if(wires) QDEL_NULL(wires) . = ..() diff --git a/code/modules/instruments/songs/_song.dm b/code/modules/instruments/songs/_song.dm index 7619cde862fb..99eae15ba9ca 100644 --- a/code/modules/instruments/songs/_song.dm +++ b/code/modules/instruments/songs/_song.dm @@ -146,8 +146,9 @@ stop_playing() SSinstruments.on_song_del(src) lines = null - using_instrument.songs_using -= src - using_instrument = null + if(using_instrument) + using_instrument.songs_using -= src + using_instrument = null allowed_instrument_ids = null parent = null return ..() diff --git a/code/modules/mob/living/carbon/human/species_types/zombies.dm b/code/modules/mob/living/carbon/human/species_types/zombies.dm index 96410f0cdcb7..88b38eed0b3d 100644 --- a/code/modules/mob/living/carbon/human/species_types/zombies.dm +++ b/code/modules/mob/living/carbon/human/species_types/zombies.dm @@ -121,7 +121,6 @@ BP.is_dimorphic = TRUE BP.skin_tone ||= skintone BP.limb_id = SPECIES_HUMAN - BP.should_draw_greyscale = TRUE BP.name = "human [parse_zone(BP.body_zone)]" BP.update_limb() diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 333b8e7a9c52..84ac57c12ef3 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -439,11 +439,11 @@ return update_icons() /mob/living/silicon/robot/update_icons() + if(QDELETED(src)) + return cut_overlays() icon_state = module.cyborg_base_icon - //WS changes - Thanks Cit - Allows modules to use different icon files icon = (module.cyborg_icon_override ? module.cyborg_icon_override : initial(icon)) - //EndWS Changes if(module.cyborg_base_icon == "robot") icon = 'icons/mob/robots.dmi' pixel_x = initial(pixel_x) @@ -1147,7 +1147,7 @@ /mob/living/silicon/robot/proc/logevent(string = "") if(!string) return - if(stat == DEAD) //Dead borgs log no longer + if(stat == DEAD || QDELETED(src)) //Dead borgs log no longer //Gone return if(!modularInterface) stack_trace("Cyborg [src] ([type]) was somehow missing their integrated tablet. Please make a bug report.") diff --git a/code/modules/mob/living/simple_animal/hostile/goose.dm b/code/modules/mob/living/simple_animal/hostile/goose.dm index 64c74b5700e7..794c9762534b 100644 --- a/code/modules/mob/living/simple_animal/hostile/goose.dm +++ b/code/modules/mob/living/simple_animal/hostile/goose.dm @@ -42,6 +42,10 @@ . = ..() RegisterSignal(src, COMSIG_MOVABLE_MOVED, .proc/goosement) +/mob/living/simple_animal/hostile/retaliate/goose/Destroy() + UnregisterSignal(src, COMSIG_MOVABLE_MOVED) + return ..() + /mob/living/simple_animal/hostile/retaliate/goose/proc/goosement(atom/movable/AM, OldLoc, Dir, Forced) if(stat == DEAD) return @@ -106,7 +110,6 @@ deadchat_plays_goose() /mob/living/simple_animal/hostile/retaliate/goose/vomit/Destroy() - UnregisterSignal(src, COMSIG_MOVABLE_MOVED) QDEL_NULL(goosevomit) return ..() diff --git a/code/modules/ninja/energy_katana.dm b/code/modules/ninja/energy_katana.dm index 4e26dfa652f5..c00d32d25809 100644 --- a/code/modules/ninja/energy_katana.dm +++ b/code/modules/ninja/energy_katana.dm @@ -49,7 +49,7 @@ /obj/item/energy_katana/dropped(mob/user) . = ..() - jaunt.Remove(user) + jaunt?.Remove(user) user.update_icons() //If we hit the Ninja who owns this Katana, they catch it. diff --git a/code/modules/overmap/overmap_token.dm b/code/modules/overmap/overmap_token.dm index 45f50f9e41c1..525b1b131512 100644 --- a/code/modules/overmap/overmap_token.dm +++ b/code/modules/overmap/overmap_token.dm @@ -44,6 +44,8 @@ QDEL_NULL(cam_screen) QDEL_NULL(cam_plane_master) QDEL_NULL(cam_background) + for(var/obj/overmap/content as anything in contents) + qdel(content.parent) return ..() /obj/overmap/attack_ghost(mob/user) diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index 1894642fedb4..eaafdfac3559 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -108,7 +108,9 @@ /datum/overmap/ship/controlled/Destroy() SSovermap.controlled_ships -= src if(!QDELETED(shuttle_port)) + shuttle_port.current_ship = null shuttle_port.intoTheSunset() + shuttle_port = null if(!QDELETED(ship_account)) QDEL_NULL(ship_account) for(var/a_key in applications) diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index a2f5979fa7da..d7bb419a3020 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -98,6 +98,7 @@ other types of metals and chemistry for reagents). illustration = "design" custom_materials = list(/datum/material/iron =300, /datum/material/glass =100) var/list/blueprints = list() + var/list/starting_blueprints = list() var/max_blueprints = 1 /obj/item/disk/design_disk/Initialize() @@ -160,12 +161,10 @@ other types of metals and chemistry for reagents). illustration = "gun" max_blueprints = 2 -/obj/item/disk/design_disk/disposable_gun/Initialize() +/obj/item/disk/design_disk/adv/disposable_gun/Initialize() . = ..() - var/datum/design/disposable_gun/G = new - var/datum/design/pizza_disposable_gun/P = new - blueprints[1] = G - blueprints[2] = P + blueprints[1] = new /datum/design/disposable_gun() + blueprints[2] = new /datum/design/pizza_disposable_gun() /obj/item/disk/design_disk/cmm_mechs name = "design disk - CMM mecha modifications" @@ -175,5 +174,5 @@ other types of metals and chemistry for reagents). /obj/item/disk/design_disk/cmm_mechs/Initialize() . = ..() - blueprints[1] = new /datum/design/cmm_ripley_upgrade - blueprints[2] = new /datum/design/cmm_durand_upgrade + blueprints[1] = new /datum/design/cmm_ripley_upgrade() + blueprints[2] = new /datum/design/cmm_durand_upgrade() diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 073583d45c10..8c69a9dba06e 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -605,6 +605,9 @@ for(var/obj/docking_port/mobile/shuttle in all_towed_shuttles) qdel(shuttle, force=TRUE) + all_towed_shuttles.Cut() + qdel(src, TRUE) + /obj/docking_port/mobile/proc/intoTheSunset() // Loop over mobs for(var/t in return_turfs()) diff --git a/code/modules/surgery/bodyparts/robot_bodyparts.dm b/code/modules/surgery/bodyparts/robot_bodyparts.dm index 990a9a693d13..398d937cc586 100644 --- a/code/modules/surgery/bodyparts/robot_bodyparts.dm +++ b/code/modules/surgery/bodyparts/robot_bodyparts.dm @@ -509,11 +509,16 @@ static_icon = 'icons/mob/augmentation/augments_vox.dmi' bodytype = BODYTYPE_VOX | BODYTYPE_ROBOTIC -/obj/item/bodypart/leg/robot/vox +/obj/item/bodypart/leg/left/robot/vox name = "prosthetic vox left leg" static_icon = 'icons/mob/augmentation/augments_vox.dmi' bodytype = BODYTYPE_VOX | BODYTYPE_ROBOTIC +/obj/item/bodypart/leg/right/robot/vox + name = "prosthetic vox right leg" + static_icon = 'icons/mob/augmentation/augments_vox.dmi' + bodytype = BODYTYPE_VOX | BODYTYPE_ROBOTIC + // Surplus Vox Robotic /obj/item/bodypart/l_arm/robot/surplus/vox name = "surplus prosthetic vox left arm" diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 40b716d80ae8..b55742574a97 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -7,6 +7,8 @@ //We'll spawn everything here var/turf/spawn_at = run_loc_bottom_left var/list/ignore = list( + //No-op + /turf/template_noop, //Never meant to be created, errors out the ass for mobcode reasons /mob/living/carbon, //And another @@ -49,6 +51,8 @@ //This turf existing is an error in and of itself ignore += typesof(/turf/baseturf_skipover) ignore += typesof(/turf/baseturf_bottom) + //Don't spam out baseturfs + ignore += typesof(/obj/effect/baseturf_helper) //Needs a contractee ignore += typesof(/obj/item/paper/contract) //This demands a borg, so we'll let if off easy diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index 7261fa5efd47..c7269690c085 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -1,9 +1,10 @@ /datum/unit_test/ship_placement/Run() SSair.is_test_loading = TRUE + var/list/spawned_ships = list() for(var/mapname as anything in SSmapping.ship_purchase_list) var/datum/map_template/shuttle/map = SSmapping.ship_purchase_list[mapname] try - new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) + spawned_ships += new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) catch(var/exception/e) Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE @@ -11,5 +12,8 @@ var/list/errors = atmosscan(TRUE) errors += powerdebug(TRUE) + for(var/datum/overmap/ship/controlled/spawned_ship as anything in spawned_ships) + qdel(spawned_ship) + for(var/error in errors) Fail("[error]") diff --git a/shiptest.dme b/shiptest.dme index 5529102b065d..732f3e8a936e 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -703,12 +703,12 @@ #include "code\datums\mutations\speech.dm" #include "code\datums\mutations\telekinesis.dm" #include "code\datums\mutations\touch.dm" -#include "code\datums\ruins\beachplanet.dm" #include "code\datums\proximity_monitor\field.dm" #include "code\datums\proximity_monitor\proximity_monitor.dm" #include "code\datums\proximity_monitor\fields\gravity.dm" #include "code\datums\proximity_monitor\fields\peaceborg_dampener.dm" #include "code\datums\proximity_monitor\fields\timestop.dm" +#include "code\datums\ruins\beachplanet.dm" #include "code\datums\ruins\icemoon.dm" #include "code\datums\ruins\jungle.dm" #include "code\datums\ruins\lavaland.dm" From aba70ee42529c6b9fb3a50dec3db35eeebe501ae Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Mon, 17 Jul 2023 22:26:02 -0500 Subject: [PATCH 027/147] circuitboard fix --- code/game/machinery/_machinery.dm | 4 +++- code/game/machinery/constructable_frame.dm | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index c7158a4e80c5..4cd196f98f75 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -408,7 +408,9 @@ Class Procs: /obj/machinery/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) on_deconstruction() - if(component_parts && component_parts.len) + if(circuit) + circuit.forceMove(loc) + if(length(component_parts)) spawn_frame(disassembled) for(var/obj/item/I in component_parts) I.forceMove(loc) diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index dfdc2969d119..f196fc6dc770 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -183,7 +183,7 @@ break if(component_check) P.play_tool_sound(src) - var/obj/machinery/new_machine = new circuit.build_path(loc) //Let this comment be a reminder that literally 100% of the problems with fundamental code have been because we're chained to Whitesands' desecrated, rotting corpse. + var/obj/machinery/new_machine = new circuit.build_path(loc) if(new_machine.circuit) QDEL_NULL(new_machine.circuit) new_machine.circuit = circuit From 0be5b59bb04989a7effea080ed84fad916babda7 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 18 Jul 2023 00:21:41 -0500 Subject: [PATCH 028/147] uhhh --- code/__DEFINES/flags.dm | 2 + code/__DEFINES/obj_flags.dm | 23 ++-- code/_globalvars/bitfields.dm | 8 +- code/controllers/subsystem/shuttle.dm | 8 +- code/datums/components/tackle.dm | 2 +- code/datums/components/udder.dm | 3 +- code/game/atoms.dm | 10 +- code/game/machinery/_machinery.dm | 1 + code/game/machinery/autolathe.dm | 4 +- code/game/machinery/cryopod.dm | 1 + code/game/machinery/shuttle/shuttle_engine.dm | 8 -- .../objects/effects/spawners/gibspawner.dm | 13 +-- code/game/objects/items/grenades/festive.dm | 2 +- code/game/objects/items/grenades/plastic.dm | 5 +- code/game/objects/objs.dm | 2 +- code/modules/admin/verbs/shuttlepanel.dm | 9 +- .../view_variables/reference_tracking.dm | 2 + code/modules/antagonists/cult/cult_items.dm | 2 +- .../atmospherics/machinery/datum_pipeline.dm | 1 + code/modules/awaymissions/capture_the_flag.dm | 2 +- .../carbon/human/species_types/zombies.dm | 17 --- code/modules/overmap/helm.dm | 14 +-- .../overmap/ships/controlled_ship_datum.dm | 3 +- code/modules/power/singularity/narsie.dm | 1 + code/modules/power/singularity/singularity.dm | 2 +- code/modules/shuttle/on_move.dm | 14 +-- code/modules/shuttle/shuttle.dm | 110 ++++++++---------- code/modules/unit_tests/create_and_destroy.dm | 2 + code/modules/unit_tests/ship_placement.dm | 3 + 29 files changed, 122 insertions(+), 152 deletions(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 9b9ecd05cb91..87b348ea8b3e 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -141,6 +141,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define INDESTRUCTIBLE (1<<6) /// can't be frozen #define FREEZE_PROOF (1<<7) +/// Should this object not be destroyed when a shuttle lands on it? +#define LANDING_PROOF (1<<8) //tesla_zap #define ZAP_MACHINE_EXPLOSIVE (1<<0) diff --git a/code/__DEFINES/obj_flags.dm b/code/__DEFINES/obj_flags.dm index d9c57e5d3efa..b9ac7df409e3 100644 --- a/code/__DEFINES/obj_flags.dm +++ b/code/__DEFINES/obj_flags.dm @@ -2,18 +2,19 @@ #define EMAGGED (1<<0) -#define IN_USE (1<<1) // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING! -#define CAN_BE_HIT (1<<2) //can this be bludgeoned by items? -#define BEING_SHOCKED (1<<3) // Whether this thing is currently (already) being shocked by a tesla -#define DANGEROUS_POSSESSION (1<<4) //Admin possession yes/no -#define ON_BLUEPRINTS (1<<5) //Are we visible on the station blueprints at roundstart? -#define UNIQUE_RENAME (1<<6) // can you customize the description/name of the thing? -#define USES_TGUI (1<<7) //put on things that use tgui on ui_interact instead of custom/old UI. +#define IN_USE (1<<1) //! If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING! +#define CAN_BE_HIT (1<<2) //! can this be bludgeoned by items? +#define BEING_SHOCKED (1<<3) //! Whether this thing is currently (already) being shocked by a tesla +#define DANGEROUS_POSSESSION (1<<4) //! Admin possession yes/no +#define ON_BLUEPRINTS (1<<5) //! Are we visible on the station blueprints at roundstart? +#define UNIQUE_RENAME (1<<6) //! can you customize the description/name of the thing? +#define USES_TGUI (1<<7) //! put on things that use tgui on ui_interact instead of custom/old UI. #define FROZEN (1<<8) -#define BLOCK_Z_OUT_DOWN (1<<9) // Should this object block z falling from loc? -#define BLOCK_Z_OUT_UP (1<<10) // Should this object block z uprise from loc? -#define BLOCK_Z_IN_DOWN (1<<11) // Should this object block z falling from above? -#define BLOCK_Z_IN_UP (1<<12) // Should this object block z uprise from below? +#define BLOCK_Z_OUT_DOWN (1<<9) //! Should this object block z falling from loc? +#define BLOCK_Z_OUT_UP (1<<10) //! Should this object block z uprise from loc? +#define BLOCK_Z_IN_DOWN (1<<11) //! Should this object block z falling from above? +#define BLOCK_Z_IN_UP (1<<12) //! Should this object block z uprise from below? + // If you add new ones, be sure to add them to /obj/Initialize as well for complete mapping support diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index afba722f811b..3b180dd91dda 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -203,6 +203,11 @@ DEFINE_BITFIELD(obj_flags, list( "ON_BLUEPRINTS" = ON_BLUEPRINTS, "UNIQUE_RENAME" = UNIQUE_RENAME, "USES_TGUI" = USES_TGUI, + "FROZEN" = FROZEN, + "BLOCK_Z_OUT_DOWN" = BLOCK_Z_OUT_DOWN, + "BLOCK_Z_OUT_UP" = BLOCK_Z_OUT_UP, + "BLOCK_Z_IN_DOWN" = BLOCK_Z_IN_DOWN, + "BLOCK_Z_IN_UP" = BLOCK_Z_IN_UP, )) DEFINE_BITFIELD(pass_flags, list( @@ -223,7 +228,8 @@ DEFINE_BITFIELD(resistance_flags, list( "UNACIDABLE" = UNACIDABLE, "ACID_PROOF" = ACID_PROOF, "INDESTRUCTIBLE" = INDESTRUCTIBLE, - "FREEZE_PROOF" = FREEZE_PROOF + "FREEZE_PROOF" = FREEZE_PROOF, + "LANDING_PROOF" = LANDING_PROOF, )) DEFINE_BITFIELD(sight, list( diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index a2609795d503..f0601935b1dd 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -252,7 +252,7 @@ SUBSYSTEM_DEF(shuttle) var/result = new_shuttle.canDock(destination_port) if((result != SHUTTLE_CAN_DOCK)) WARNING("Template shuttle [new_shuttle] cannot dock at [destination_port] ([result]).") - new_shuttle.jumpToNullSpace() + qdel(new_shuttle) return new_shuttle.initiate_docking(destination_port) return new_shuttle @@ -276,7 +276,7 @@ SUBSYSTEM_DEF(shuttle) if((result != SHUTTLE_CAN_DOCK) && (result != SHUTTLE_SOMEONE_ELSE_DOCKED)) //Someone else /IS/ docked, the old shuttle! WARNING("Template shuttle [new_shuttle] cannot dock at [old_shuttle_location] ([result]).") - new_shuttle.jumpToNullSpace() + qdel(new_shuttle) return new_shuttle.timer = to_replace.timer //Copy some vars from the old shuttle @@ -288,7 +288,7 @@ SUBSYSTEM_DEF(shuttle) to_replace.assigned_transit = null new_shuttle.assigned_transit = old_shuttle_location - to_replace.jumpToNullSpace() //This will destroy the old shuttle + qdel(to_replace) new_shuttle.initiate_docking(old_shuttle_location) //This will spawn the new shuttle return new_shuttle @@ -355,7 +355,7 @@ SUBSYSTEM_DEF(shuttle) var/result = new_shuttle.canDock(transit_dock) if((result != SHUTTLE_CAN_DOCK)) WARNING("Template shuttle [new_shuttle] cannot dock at [transit_dock] ([result]).") - new_shuttle.jumpToNullSpace() + qdel(src) return new_shuttle.initiate_docking(transit_dock) diff --git a/code/datums/components/tackle.dm b/code/datums/components/tackle.dm index 0803102bc4f8..249d6df24c57 100644 --- a/code/datums/components/tackle.dm +++ b/code/datums/components/tackle.dm @@ -51,7 +51,7 @@ /datum/component/tackler/Destroy() var/mob/P = parent to_chat(P, "You can no longer tackle.") - ..() + return ..() /datum/component/tackler/RegisterWithParent() RegisterSignal(parent, COMSIG_MOB_CLICKON, .proc/checkTackle) diff --git a/code/datums/components/udder.dm b/code/datums/components/udder.dm index d8358be3c6b2..f954559d9df2 100644 --- a/code/datums/components/udder.dm +++ b/code/datums/components/udder.dm @@ -141,7 +141,8 @@ RegisterSignal(udder_mob, COMSIG_HOSTILE_ATTACKINGTARGET, .proc/on_mob_attacking) /obj/item/udder/gutlunch/Destroy() - UnregisterSignal(udder_mob, COMSIG_HOSTILE_ATTACKINGTARGET) + if(udder_mob) + UnregisterSignal(udder_mob, COMSIG_HOSTILE_ATTACKINGTARGET) . = ..() /obj/item/udder/gutlunch/process(delta_time) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index df119810bc5f..a11a2845a820 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -247,9 +247,10 @@ if (length(no_connector_typecache)) no_connector_typecache = SSicon_smooth.get_no_connector_typecache(src.type, no_connector_typecache, connector_strict_typing) - var/area/ship/current_ship_area = get_area(src) - if(!mapload && istype(current_ship_area) && current_ship_area.mobile_port) - connect_to_shuttle(current_ship_area.mobile_port, current_ship_area.mobile_port.docked) + if(!mapload) + var/area/ship/current_ship_area = get_area(src) + if(istype(current_ship_area) && current_ship_area.mobile_port) + connect_to_shuttle(current_ship_area.mobile_port, current_ship_area.mobile_port.docked) var/temp_list = list() for(var/i in custom_materials) @@ -1313,6 +1314,9 @@ /atom/proc/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) return +/atom/proc/disconnect_from_shuttle(obj/docking_port/mobile/port) + return + /// Generic logging helper /atom/proc/log_message(message, message_type, color=null, log_globally=TRUE) if(!log_globally) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 4cd196f98f75..02423ac74455 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -410,6 +410,7 @@ Class Procs: on_deconstruction() if(circuit) circuit.forceMove(loc) + circuit = null if(length(component_parts)) spawn_frame(disassembled) for(var/obj/item/I in component_parts) diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 412a9264e38c..c31b00e672d4 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -57,9 +57,7 @@ matching_designs = list() /obj/machinery/autolathe/Destroy() - if(d_disk) // Drops the design disk on the floor when destroyed - d_disk.forceMove(get_turf(src)) - d_disk = null + QDEL_NULL(d_disk) QDEL_NULL(wires) return ..() diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 5b2129794210..22b408c6eb9b 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -175,6 +175,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/cryopod/retro, 17) /obj/machinery/cryopod/Destroy() linked_ship?.spawn_points -= src + linked_ship = null return ..() /obj/machinery/cryopod/LateInitialize() diff --git a/code/game/machinery/shuttle/shuttle_engine.dm b/code/game/machinery/shuttle/shuttle_engine.dm index 0f8802f65a73..29ea7ccf5ec3 100644 --- a/code/game/machinery/shuttle/shuttle_engine.dm +++ b/code/game/machinery/shuttle/shuttle_engine.dm @@ -14,8 +14,6 @@ var/thrust = 0 ///I don't really know what this is but it's used a lot var/thruster_active = FALSE - ///Used to store which ship currently has this engine in their thruster list, for Destroy() reasons - var/obj/docking_port/mobile/parent_shuttle /** * Uses up a specified percentage of the fuel cost, and returns the amount of thrust if successful. @@ -67,12 +65,6 @@ /obj/machinery/power/shuttle/engine/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) . = ..() port.engine_list |= WEAKREF(src) - parent_shuttle = port - -/obj/machinery/power/shuttle/engine/Destroy() - if(parent_shuttle) - parent_shuttle.engine_list -= WEAKREF(src) - return ..() /obj/machinery/power/shuttle/engine/on_construction() . = ..() diff --git a/code/game/objects/effects/spawners/gibspawner.dm b/code/game/objects/effects/spawners/gibspawner.dm index d1dbee424066..e8f94bc8e3ab 100644 --- a/code/game/objects/effects/spawners/gibspawner.dm +++ b/code/game/objects/effects/spawners/gibspawner.dm @@ -20,8 +20,6 @@ stack_trace("Gib list dir length mismatch!") return - var/obj/effect/decal/cleanable/blood/gibs/gib = null - if(sound_to_play && isnum(sound_vol)) playsound(src, sound_to_play, sound_vol, TRUE) @@ -46,14 +44,13 @@ if(gibamounts[i]) for(var/j = 1, j<= gibamounts[i], j++) var/gibType = gibtypes[i] - gib = new gibType(loc, diseases) + var/obj/effect/decal/cleanable/blood/gibs/gib = new gibType(loc, diseases) gib.add_blood_DNA(dna_to_add) var/list/directions = gibdirections[i] - if(isturf(loc)) - if(directions.len) - gib.streak(directions) + if(isturf(loc) && length(directions) && istype(gib)) + gib.streak(directions) return INITIALIZE_HINT_QDEL @@ -158,7 +155,7 @@ /obj/effect/gibspawner/robot/bodypartless/Initialize() if(!gibdirections.len) - gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs) + gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs, GLOB.alldirs) return ..() /obj/effect/gibspawner/generic/crystal @@ -167,5 +164,5 @@ /obj/effect/gibspawner/generic/crystal/Initialize() if(!gibdirections.len) - gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),list(EAST, NORTHEAST, SOUTHEAST), GLOB.alldirs) + gibdirections = list(list(NORTH, NORTHEAST, NORTHWEST),list(SOUTH, SOUTHEAST, SOUTHWEST),list(WEST, NORTHWEST, SOUTHWEST),GLOB.alldirs) return ..() diff --git a/code/game/objects/items/grenades/festive.dm b/code/game/objects/items/grenades/festive.dm index cedcb23dcca6..46e78b48ff23 100644 --- a/code/game/objects/items/grenades/festive.dm +++ b/code/game/objects/items/grenades/festive.dm @@ -47,7 +47,7 @@ /obj/item/sparkler/Destroy() STOP_PROCESSING(SSobj, src) - ..() + return ..() /obj/item/sparkler/ignition_effect(atom/A, mob/user) . = "[user] gracefully lights [A] with [src]." diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm index a1b169189d3f..ca2aa8077d81 100644 --- a/code/game/objects/items/grenades/plastic.dm +++ b/code/game/objects/items/grenades/plastic.dm @@ -28,10 +28,9 @@ AddComponent(/datum/component/empprotection, EMP_PROTECT_WIRES) /obj/item/grenade/c4/Destroy() - qdel(wires) - wires = null + QDEL_NULL(wires) target = null - ..() + return ..() /obj/item/grenade/c4/attackby(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_SCREWDRIVER) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index ff33571efc42..391a1c255198 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -15,7 +15,7 @@ ///Damage under this value will be completely ignored var/damage_deflection = 0 - var/resistance_flags = NONE // INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ON_FIRE | UNACIDABLE | ACID_PROOF + var/resistance_flags = NONE // INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ON_FIRE | UNACIDABLE | ACID_PROOF | LANDING_PROOF var/acid_level = 0 //how much acid is on that obj diff --git a/code/modules/admin/verbs/shuttlepanel.dm b/code/modules/admin/verbs/shuttlepanel.dm index 73049adf562c..9cec1d0ef0b7 100644 --- a/code/modules/admin/verbs/shuttlepanel.dm +++ b/code/modules/admin/verbs/shuttlepanel.dm @@ -22,7 +22,6 @@ options += "--------" options += "Infinite Transit" options += "Delete Shuttle" - options += "Into The Sunset (delete & greentext 'escape')" var/selection = input(user, "Select where to fly [name]:", "Fly Shuttle") as null|anything in options if(!selection) @@ -38,15 +37,9 @@ if("Delete Shuttle") if(alert(user, "Really delete [name]?", "Delete Shuttle", "Cancel", "Really!") != "Really!") return - jumpToNullSpace() + qdel(src) message_admins("\[SHUTTLE]: [key_name_admin(user)] has deleted [name].") - if("Into The Sunset (delete & greentext 'escape')") - if(alert(user, "Really delete [name] and greentext escape objectives?", "Delete Shuttle", "Cancel", "Really!") != "Really!") - return - intoTheSunset() - message_admins("\[SHUTTLE]: [key_name_admin(user)] has deleted [name], and granted the crew greentext.") - else if(options[selection]) initiate_docking(options[selection]) diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 613150cee8eb..ce1673473c2a 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -12,9 +12,11 @@ SSgarbage.next_fire = world.time + world.tick_lag return + #ifndef FIND_REF_NO_CHECK_TICK if(!skip_alert && alert("Running this will lock everything up for about 5 minutes. Would you like to begin the search?", "Find References", "Yes", "No") != "Yes") running_find_references = null return + #endif //this keeps the garbage collector from failing to collect objects being searched for in here SSgarbage.can_fire = FALSE diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index ac506ff1eeb5..df33ca984e39 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -627,7 +627,7 @@ /obj/item/cult_spear/Destroy() if(spear_act) qdel(spear_act) - ..() + return ..() /obj/item/cult_spear/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) var/turf/T = get_turf(hit_atom) diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index 7742f0e37a85..b76b7e807df8 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -27,6 +27,7 @@ if(QDELETED(P)) continue SSair.add_to_rebuild_queue(P) + members.Cut() for(var/obj/machinery/atmospherics/components/C in other_atmosmch) C.nullifyPipenet(src) return ..() diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index f8aa89357729..abf9ba4f5e16 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -198,7 +198,7 @@ /obj/machinery/capture_the_flag/Destroy() GLOB.poi_list.Remove(src) - ..() + return ..() /obj/machinery/capture_the_flag/process() for(var/i in spawned_mobs) diff --git a/code/modules/mob/living/carbon/human/species_types/zombies.dm b/code/modules/mob/living/carbon/human/species_types/zombies.dm index 88b38eed0b3d..8c53a6ca9a07 100644 --- a/code/modules/mob/living/carbon/human/species_types/zombies.dm +++ b/code/modules/mob/living/carbon/human/species_types/zombies.dm @@ -108,21 +108,4 @@ species_l_leg = /obj/item/bodypart/leg/left/zombie species_r_leg = /obj/item/bodypart/leg/right/zombie -/datum/species/human/krokodil_addict/replace_body(mob/living/carbon/C, datum/species/new_species, robotic = FALSE) - ..() - var/skintone - if(ishuman(C)) - var/mob/living/carbon/human/H = C - skintone = H.skin_tone - - for(var/obj/item/bodypart/BP as anything in C.bodyparts) - if(IS_ORGANIC_LIMB(BP)) - if(BP.body_zone == BODY_ZONE_HEAD || BP.body_zone == BODY_ZONE_CHEST) - BP.is_dimorphic = TRUE - BP.skin_tone ||= skintone - BP.limb_id = SPECIES_HUMAN - BP.name = "human [parse_zone(BP.body_zone)]" - BP.update_limb() - - #undef REGENERATION_DELAY diff --git a/code/modules/overmap/helm.dm b/code/modules/overmap/helm.dm index 974de8e40d63..dee18633f12e 100644 --- a/code/modules/overmap/helm.dm +++ b/code/modules/overmap/helm.dm @@ -81,7 +81,7 @@ current_ship = null /obj/machinery/computer/helm/proc/cancel_jump() - priority_announce("Bluespace Pylon spooling down. Jump calibration aborted.", sender_override="[current_ship.name] Bluespace Pylon", zlevel=virtual_z()) + priority_announce("Bluespace Pylon spooling down. Jump calibration aborted.", sender_override = "[current_ship.name] Bluespace Pylon", zlevel = virtual_z()) calibrating = FALSE deltimer(jump_timer) @@ -92,20 +92,20 @@ SStgui.close_uis(src) if(JUMP_STATE_CHARGING) jump_state = JUMP_STATE_IONIZING - priority_announce("Bluespace Jump Calibration completed. Ionizing Bluespace Pylon.", sender_override="[current_ship.name] Bluespace Pylon", zlevel=virtual_z()) + priority_announce("Bluespace Jump Calibration completed. Ionizing Bluespace Pylon.", sender_override = "[current_ship.name] Bluespace Pylon", zlevel = virtual_z()) if(JUMP_STATE_IONIZING) jump_state = JUMP_STATE_FIRING - priority_announce("Bluespace Ionization finalized; preparing to fire Bluespace Pylon.", sender_override="[current_ship.name] Bluespace Pylon", zlevel=virtual_z()) + priority_announce("Bluespace Ionization finalized; preparing to fire Bluespace Pylon.", sender_override = "[current_ship.name] Bluespace Pylon", zlevel = virtual_z()) if(JUMP_STATE_FIRING) jump_state = JUMP_STATE_FINALIZED - priority_announce("Bluespace Pylon launched.", sender_override="[current_ship.name] Bluespace Pylon", sound='sound/magic/lightning_chargeup.ogg', zlevel=virtual_z()) + priority_announce("Bluespace Pylon launched.", sender_override = "[current_ship.name] Bluespace Pylon", sound = 'sound/magic/lightning_chargeup.ogg', zlevel = virtual_z()) addtimer(CALLBACK(src, .proc/do_jump), 10 SECONDS) return - addtimer(CALLBACK(src, .proc/jump_sequence, TRUE), JUMP_CHARGE_DELAY) + jump_timer = addtimer(CALLBACK(src, .proc/jump_sequence, TRUE), JUMP_CHARGE_DELAY, TIMER_STOPPABLE) /obj/machinery/computer/helm/proc/do_jump() - priority_announce("Bluespace Jump Initiated.", sender_override="[current_ship.name] Bluespace Pylon", sound='sound/magic/lightningbolt.ogg', zlevel=virtual_z()) - current_ship.shuttle_port.intoTheSunset() + priority_announce("Bluespace Jump Initiated.", sender_override = "[current_ship.name] Bluespace Pylon", sound = 'sound/magic/lightningbolt.ogg', zlevel = virtual_z()) + qdel(current_ship) /obj/machinery/computer/helm/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) if(current_ship && current_ship != port.current_ship) diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index eaafdfac3559..90737423256c 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -109,13 +109,14 @@ SSovermap.controlled_ships -= src if(!QDELETED(shuttle_port)) shuttle_port.current_ship = null - shuttle_port.intoTheSunset() + QDEL_NULL(shuttle_port) shuttle_port = null if(!QDELETED(ship_account)) QDEL_NULL(ship_account) for(var/a_key in applications) // it handles removal itself qdel(applications[a_key]) + LAZYCLEARLIST(applications) // set ourselves to ownerless to unregister signals set_owner_mob(null) return ..() diff --git a/code/modules/power/singularity/narsie.dm b/code/modules/power/singularity/narsie.dm index 995beb23eb07..ee61bccbad51 100644 --- a/code/modules/power/singularity/narsie.dm +++ b/code/modules/power/singularity/narsie.dm @@ -16,6 +16,7 @@ light_range = 15 light_color = COLOR_RED gender = FEMALE + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF /obj/singularity/narsie/large name = "Nar'Sie" diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index e10a79eaf74a..17e16aa29284 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -28,7 +28,7 @@ var/last_warning var/consumedSupermatter = 0 //If the singularity has eaten a supermatter shard and can go to stage six var/drifting_dir = 0 // Chosen direction to drift in - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | LANDING_PROOF obj_flags = CAN_BE_HIT | DANGEROUS_POSSESSION /obj/singularity/Initialize(mapload, starting_energy = 50) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index 388c9e3cf8c4..e32a8bf76982 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -20,8 +20,7 @@ All ShuttleMove procs go here if(!(. & MOVE_TURF)) return - for(var/i in contents) - var/atom/movable/thing = i + for(var/atom/movable/thing as anything in contents) if(ismob(thing)) if(isliving(thing)) var/mob/living/M = thing @@ -40,12 +39,13 @@ All ShuttleMove procs go here else //non-living mobs shouldn't be affected by shuttles, which is why this is an else - if(istype(thing, /obj/singularity) && !istype(thing, /obj/singularity/narsie)) //it's a singularity but not a god, ignore it. - continue - if(!thing.anchored) - qdel(thing) - else + if(!isobj(thing)) qdel(thing) + continue + var/obj/object = thing + if(object.resistance_flags & LANDING_PROOF) + continue + qdel(thing) // Called on the old turf to move the turf data /turf/proc/onShuttleMove(turf/newT, list/movement_force, move_dir, shuttle_layers) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 8c69a9dba06e..0fe49eee9ee0 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -9,7 +9,7 @@ icon = 'icons/obj/device.dmi' icon_state = "pinonfar" - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | LANDING_PROOF anchored = TRUE ///Common standard is for this to point -away- from the dockingport door, ie towards the ship @@ -29,18 +29,11 @@ //The shuttle docked here/dock we're parked at. var/obj/docking_port/docked - //these objects are indestructible /obj/docking_port/Destroy(force) - // unless you assert that you know what you're doing. Horrible things - // may result. - if(force) - if(docked) - docked.docked = null - docked = null - ..() - . = QDEL_HINT_QUEUE - else - return QDEL_HINT_LETMELIVE + if(docked) + docked.docked = null + docked = null + return ..() /obj/docking_port/has_gravity(turf/T) return FALSE @@ -236,8 +229,8 @@ #endif /obj/docking_port/stationary/Destroy(force) - if(force) - SSshuttle.stationary -= src + SSshuttle.stationary -= src + owner_ship?.towed_shuttles -= src . = ..() /obj/docking_port/stationary/proc/load_roundstart() @@ -263,18 +256,15 @@ transit_dock_counter++ name = "transit dock [transit_dock_counter]" -/obj/docking_port/stationary/transit/Destroy(force=FALSE) - if(force) - if(docked) - log_world("A transit dock was destroyed while something was docked to it.") - SSshuttle.transit -= src - if(owner) - if(owner.assigned_transit == src) - owner.assigned_transit = null - owner = null - if(!QDELETED(reserved_mapzone)) - qdel(reserved_mapzone) - reserved_mapzone = null +/obj/docking_port/stationary/transit/Destroy(force) + if(!QDELETED(docked)) + log_world("A transit dock was destroyed while something was docked to it.") + SSshuttle.transit -= src + if(owner?.assigned_transit == src) + owner.assigned_transit = null + owner = null + if(!QDELETED(reserved_mapzone)) + QDEL_NULL(reserved_mapzone) return ..() /obj/docking_port/mobile @@ -361,22 +351,32 @@ SSshuttle.mobile += src /obj/docking_port/mobile/Destroy(force) - if(force) - SSshuttle.mobile -= src - destination = null - previous = null - if(!QDELETED(current_ship)) - QDEL_NULL(current_ship) - qdel(assigned_transit, TRUE) //don't need it where we're goin'! - assigned_transit = null - for(var/obj/docking_port/stationary/docking_point as anything in docking_points) - qdel(docking_point, TRUE) - docking_points = null - shuttle_areas = null //TODO: This is nowhere near enough to clear references, lol. We need an /atom/proc/disconnect_from_shuttle() proc to clear references. - towed_shuttles = null - underlying_turf_area = null - remove_ripples() - . = ..() + spawn_points.Cut() + + SSshuttle.mobile -= src + + destination = null + previous = null + + if(!QDELETED(current_ship)) + QDEL_NULL(current_ship) + + QDEL_NULL(assigned_transit) //don't need it where we're goin'! + + QDEL_LIST(docking_points) + QDEL_LIST(towed_shuttles) + + for(var/area/ship/shuttle_area in shuttle_areas) //TODO: make a disconnect_from_shuttle() proc + shuttle_area.mobile_port = null + shuttle_areas.Cut() + shuttle_areas = null + + underlying_turf_area = null + + remove_ripples() + jump_to_null_space() + + return ..() /obj/docking_port/mobile/Initialize(mapload) . = ..() @@ -568,7 +568,7 @@ play_engine_sound(src, launch_sound) -/obj/docking_port/mobile/proc/jumpToNullSpace() +/obj/docking_port/mobile/proc/jump_to_null_space() // Destroys the docking port and the shuttle contents. // Not in a fancy way, it just ceases. @@ -582,8 +582,7 @@ for(var/obj/docking_port/mobile/M in all_towed_shuttles) all_shuttle_areas += M.shuttle_areas - for(var/i in 1 to old_turfs.len) - var/turf/oldT = old_turfs[i] + for(var/turf/oldT as anything in old_turfs) if(!all_shuttle_areas[oldT?.loc]) continue var/area/old_area = oldT.loc @@ -602,27 +601,10 @@ oldT.ScrapeAway(baseturf_cache.len - k + 1) break - for(var/obj/docking_port/mobile/shuttle in all_towed_shuttles) - qdel(shuttle, force=TRUE) + for(var/obj/docking_port/mobile/shuttle in all_towed_shuttles - src) + qdel(shuttle) all_towed_shuttles.Cut() - qdel(src, TRUE) - -/obj/docking_port/mobile/proc/intoTheSunset() - // Loop over mobs - for(var/t in return_turfs()) - var/turf/T = t - for(var/mob/living/M in T.GetAllContents()) - // If they have a mind and they're not in the brig, they escaped - if(M.mind && !istype(t, /turf/open/floor/mineral/plastitanium/red/brig)) - M.mind.force_escaped = TRUE - // Ghostize them and put them in nullspace stasis (for stat & possession checks) - M.notransform = TRUE - M.ghostize(FALSE) - M.moveToNullspace() - - // Now that mobs are stowed, delete the shuttle - jumpToNullSpace() /obj/docking_port/mobile/proc/create_ripples(obj/docking_port/stationary/S1, animate_time) var/list/turfs = ripple_area(S1) diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index b55742574a97..d8b307795f1e 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -7,6 +7,8 @@ //We'll spawn everything here var/turf/spawn_at = run_loc_bottom_left var/list/ignore = list( + //Should never exist + /turf, //No-op /turf/template_noop, //Never meant to be created, errors out the ass for mobcode reasons diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index c7269690c085..d0abab8020b9 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -1,3 +1,6 @@ +/datum/unit_test/ship_placement + focus = TRUE + /datum/unit_test/ship_placement/Run() SSair.is_test_loading = TRUE var/list/spawned_ships = list() From 574cd13e5eddc76555671c9bb05706fe57e46262 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 18 Jul 2023 00:27:09 -0500 Subject: [PATCH 029/147] oops --- code/modules/unit_tests/ship_placement.dm | 3 --- 1 file changed, 3 deletions(-) diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index d0abab8020b9..c7269690c085 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -1,6 +1,3 @@ -/datum/unit_test/ship_placement - focus = TRUE - /datum/unit_test/ship_placement/Run() SSair.is_test_loading = TRUE var/list/spawned_ships = list() From c0f56bafafc9979695f8b1c22bc97f6aa95cc27c Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 00:40:34 -0500 Subject: [PATCH 030/147] ALMOST DONE --- code/game/machinery/_machinery.dm | 5 +-- code/game/machinery/doors/airlock.dm | 3 ++ code/game/mecha/mecha.dm | 5 ++- .../effects/anomalies/anomalies_gravity.dm | 2 +- .../atmospherics/machinery/atmosmachinery.dm | 8 ++--- .../machinery/components/components_base.dm | 32 ++++++++++++------- .../unary_devices/outlet_injector.dm | 17 +++++----- .../atmospherics/machinery/datum_pipeline.dm | 3 ++ .../machinery/pipes/layermanifold.dm | 2 +- .../atmospherics/machinery/pipes/pipes.dm | 6 ++-- code/modules/atmospherics/multiz.dm | 2 +- .../mob/living/simple_animal/hostile/goose.dm | 10 +++--- .../overmap/ships/controlled_ship_datum.dm | 7 ++-- code/modules/shuttle/shuttle.dm | 16 +++++----- code/modules/unit_tests/open_air.dm | 2 +- 15 files changed, 72 insertions(+), 48 deletions(-) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 02423ac74455..904e8ae95c7c 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -139,9 +139,10 @@ Class Procs: . = ..() GLOB.machines += src RegisterSignal(src, COMSIG_MOVABLE_Z_CHANGED, .proc/power_change) - if(ispath(circuit, /obj/item/circuitboard) && (mapload || apply_default_parts)) + if(ispath(circuit, /obj/item/circuitboard)) circuit = new circuit - circuit.apply_default_parts(src) + if(mapload || apply_default_parts) + circuit.apply_default_parts(src) if(processing_flags & START_PROCESSING_ON_INIT) begin_processing() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 680e0f898919..e5f2b11a8fbb 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -393,6 +393,9 @@ /obj/machinery/door/airlock/Destroy() QDEL_NULL(wires) QDEL_NULL(electronics) + if(closeOther) + closeOther.closeOther = null + closeOther = null if (cyclelinkedairlock) if (cyclelinkedairlock.cyclelinkedairlock == src) cyclelinkedairlock.cyclelinkedairlock = null diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 72bb8c833e36..2075e365bd67 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -175,7 +175,10 @@ STOP_PROCESSING(SSobj, src) GLOB.poi_list.Remove(src) equipment.Cut() - + + for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) + diag_hud.remove_from_hud(src) + QDEL_NULL(cell) QDEL_NULL(scanmod) QDEL_NULL(capacitor) diff --git a/code/game/objects/effects/anomalies/anomalies_gravity.dm b/code/game/objects/effects/anomalies/anomalies_gravity.dm index cfe9d748db22..e8bdd61dd3fc 100644 --- a/code/game/objects/effects/anomalies/anomalies_gravity.dm +++ b/code/game/objects/effects/anomalies/anomalies_gravity.dm @@ -91,7 +91,7 @@ INVOKE_ASYNC(src, .proc/setup_grav_field) /obj/effect/anomaly/grav/high/proc/setup_grav_field() - grav_field = grav_field = new(src, effectrange, TRUE, 2) + grav_field = new(src, effectrange, TRUE, 2) /obj/effect/anomaly/grav/high/Destroy() QDEL_NULL(grav_field) diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 6e647fe9da15..ea68ab89bd8e 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -158,7 +158,7 @@ return TRUE return FALSE -/obj/machinery/atmospherics/proc/pipeline_expansion() +/obj/machinery/atmospherics/proc/pipeline_expansion(datum/pipeline/reference) return nodes /obj/machinery/atmospherics/proc/SetInitDirections() @@ -170,13 +170,13 @@ /obj/machinery/atmospherics/proc/returnPipenet() return -/obj/machinery/atmospherics/proc/returnPipenetAirs() +/obj/machinery/atmospherics/proc/returnPipenetAirs(datum/pipeline/reference) return -/obj/machinery/atmospherics/proc/setPipenet() +/obj/machinery/atmospherics/proc/setPipenet(datum/pipeline/reference, obj/machinery/atmospherics/connection) return -/obj/machinery/atmospherics/proc/replacePipenet() +/obj/machinery/atmospherics/proc/replacePipenet(datum/pipeline/old_pipeline, datum/pipeline/new_pipeline) return /obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference) diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index 46ecc06af84b..e978ee2f56e7 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -99,9 +99,14 @@ /obj/machinery/atmospherics/components/proc/nullifyPipenet(datum/pipeline/reference) if(!reference) CRASH("nullifyPipenet(null) called by [type] on [COORD(src)]") - var/i = parents.Find(reference) - reference.other_airs -= airs[i] + + for (var/i in 1 to length(parents)) + if (parents[i] == reference) + reference.other_airs -= airs[i] // Disconnects from the pipeline side + parents[i] = null // Disconnects from the machinery side. + reference.other_atmosmch -= src + /* We explicitly qdel pipeline when this particular pipeline is projected to have no member and cause GC problems. @@ -109,12 +114,10 @@ while pipes must and will happily wreck and rebuild everything again every time they are qdeleted. */ - if(!length(reference.other_atmosmch) && !length(reference.members)) - if(QDESTROYING(reference)) - parents[i] = null - CRASH("nullifyPipenet() called on qdeleting [reference] indexed on parents\[[i]\]") - qdel(reference) - parents[i] = null + if(length(reference.other_atmosmch) || length(reference.members) || QDESTROYING(reference)) + return + + qdel(reference) /obj/machinery/atmospherics/components/returnPipenetAirs(datum/pipeline/reference) var/list/returned_air = list() @@ -129,14 +132,19 @@ return list(nodes[parents.Find(reference)]) return ..() -/obj/machinery/atmospherics/components/setPipenet(datum/pipeline/reference, obj/machinery/atmospherics/A) - parents[nodes.Find(A)] = reference +/obj/machinery/atmospherics/components/setPipenet(datum/pipeline/reference, obj/machinery/atmospherics/connection) + var/connection_index = nodes.Find(connection) + var/list/datum/pipeline/to_replace = parents[connection_index] + //Some references to clean up if it isn't empty + if(to_replace) + nullifyPipenet(to_replace) + parents[connection_index] = reference /obj/machinery/atmospherics/components/returnPipenet(obj/machinery/atmospherics/A = nodes[1]) //returns parents[1] if called without argument return parents[nodes.Find(A)] -/obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/Old, datum/pipeline/New) - parents[parents.Find(Old)] = New +/obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/old_pipeline, datum/pipeline/new_pipeline) + parents[parents.Find(old_pipeline)] = new_pipeline /obj/machinery/atmospherics/components/unsafe_pressure_release(mob/user, pressures) ..() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index bc424d1b7ecc..1d596e91ae44 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -57,19 +57,20 @@ /obj/machinery/atmospherics/components/unary/outlet_injector/process_atmos() ..() - injecting = 0 + injecting = TRUE - if(!on || !is_operational) + if(!on || !is_operational || !isopenturf(loc)) return var/datum/gas_mixture/air_contents = airs[1] - if(air_contents != null) - if(air_contents.return_temperature() > 0) - loc.assume_air_ratio(air_contents, volume_rate / air_contents.return_volume()) - air_update_turf() + if(!air_contents || air_contents.return_temperature() <= 0) + return - update_parents() + loc.assume_air_ratio(air_contents, volume_rate / air_contents.return_volume()) + air_update_turf() + + update_parents() /obj/machinery/atmospherics/components/unary/outlet_injector/proc/inject() @@ -78,7 +79,7 @@ var/datum/gas_mixture/air_contents = airs[1] - injecting = 1 + injecting = TRUE if(air_contents.return_temperature() > 0) loc.assume_air_ratio(air_contents, volume_rate / air_contents.return_volume()) diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index b76b7e807df8..57299fe2bc71 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -30,6 +30,7 @@ members.Cut() for(var/obj/machinery/atmospherics/components/C in other_atmosmch) C.nullifyPipenet(src) + other_atmosmch.Cut() return ..() /datum/pipeline/process() @@ -91,6 +92,8 @@ possible_expansions += item volume += item.volume + if(!QDELETED(item.parent)) + qdel(item.parent) item.parent = src if(item.air_temporary) diff --git a/code/modules/atmospherics/machinery/pipes/layermanifold.dm b/code/modules/atmospherics/machinery/pipes/layermanifold.dm index 4e838eee617f..2ea600ab532f 100644 --- a/code/modules/atmospherics/machinery/pipes/layermanifold.dm +++ b/code/modules/atmospherics/machinery/pipes/layermanifold.dm @@ -106,7 +106,7 @@ /obj/machinery/atmospherics/pipe/layer_manifold/setPipingLayer() piping_layer = PIPING_LAYER_DEFAULT -/obj/machinery/atmospherics/pipe/layer_manifold/pipeline_expansion() +/obj/machinery/atmospherics/pipe/layer_manifold/pipeline_expansion(datum/pipeline/reference) return get_all_connected_nodes() /obj/machinery/atmospherics/pipe/layer_manifold/disconnect(obj/machinery/atmospherics/reference) diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm index 720d22f6bff2..8f28258c57b9 100644 --- a/code/modules/atmospherics/machinery/pipes/pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/pipes.dm @@ -79,8 +79,10 @@ /obj/machinery/atmospherics/pipe/returnPipenet() return parent -/obj/machinery/atmospherics/pipe/setPipenet(datum/pipeline/P) - parent = P +/obj/machinery/atmospherics/pipe/setPipenet(datum/pipeline/reference, obj/machinery/atmospherics/connection) + if(!QDELETED(parent)) + qdel(parent) + parent = reference /obj/machinery/atmospherics/pipe/Destroy() QDEL_NULL(parent) diff --git a/code/modules/atmospherics/multiz.dm b/code/modules/atmospherics/multiz.dm index ab2753809f70..41a40b332f80 100644 --- a/code/modules/atmospherics/multiz.dm +++ b/code/modules/atmospherics/multiz.dm @@ -14,7 +14,7 @@ add_overlay(multiz_overlay_node) ///Attempts to locate a multiz pipe that's above us, if it finds one it merges us into its pipenet -/obj/machinery/atmospherics/pipe/simple/multiz/pipeline_expansion() +/obj/machinery/atmospherics/pipe/simple/multiz/pipeline_expansion(datum/pipeline/reference) icon = 'icons/obj/atmos.dmi' //Just to refresh. var/turf/T = get_turf(src) var/obj/machinery/atmospherics/pipe/simple/multiz/above = locate(/obj/machinery/atmospherics/pipe/simple/multiz) in(T.above()) diff --git a/code/modules/mob/living/simple_animal/hostile/goose.dm b/code/modules/mob/living/simple_animal/hostile/goose.dm index 794c9762534b..2419b79e68e1 100644 --- a/code/modules/mob/living/simple_animal/hostile/goose.dm +++ b/code/modules/mob/living/simple_animal/hostile/goose.dm @@ -37,6 +37,7 @@ var/message_cooldown = 0 var/list/nummies = list() var/choking = FALSE + var/moved /mob/living/simple_animal/hostile/retaliate/goose/Initialize() . = ..() @@ -49,20 +50,21 @@ /mob/living/simple_animal/hostile/retaliate/goose/proc/goosement(atom/movable/AM, OldLoc, Dir, Forced) if(stat == DEAD) return - nummies.Cut() - nummies += loc.contents + moved = TRUE if(prob(5) && random_retaliate) Retaliate() /mob/living/simple_animal/hostile/retaliate/goose/handle_automated_action() - if(length(nummies)) + if(moved && length(loc.contents)) + moved = FALSE var/obj/item/E = locate() in nummies if(E && E.loc == loc) feed(E) nummies -= E /mob/living/simple_animal/hostile/retaliate/goose/vomit/handle_automated_action() - if(length(nummies)) + if(moved && length(loc.contents)) + var/list/nummies = loc.contents var/obj/item/E = pick(nummies) if(!(E.custom_materials && E.custom_materials[SSmaterials.GetMaterialRef(/datum/material/plastic)])) nummies -= E // remove non-plastic item from queue diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index 90737423256c..ecfded251fdf 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -110,7 +110,6 @@ if(!QDELETED(shuttle_port)) shuttle_port.current_ship = null QDEL_NULL(shuttle_port) - shuttle_port = null if(!QDELETED(ship_account)) QDEL_NULL(ship_account) for(var/a_key in applications) @@ -292,8 +291,10 @@ owner_mind = null if(owner_act) QDEL_NULL(owner_act) - // this gets automatically deleted in /datum/Destroy() if we are being destroyed - owner_check_timer_id = addtimer(CALLBACK(src, .proc/check_owner), 5 MINUTES, TIMER_STOPPABLE|TIMER_LOOP|TIMER_DELETE_ME) + // turns out that timers don't get added to active_timers if the datum is getting qdeleted. + // so this timer was sitting around after deletion and clogging up runtime logs. thus, the QDELING() check. oops! + if(!owner_check_timer_id && !QDELING(src)) + owner_check_timer_id = addtimer(CALLBACK(src, .proc/check_owner), 5 MINUTES, TIMER_STOPPABLE|TIMER_LOOP|TIMER_DELETE_ME) return owner_mob = new_owner diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 0fe49eee9ee0..14f55c1209c9 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -362,19 +362,20 @@ QDEL_NULL(current_ship) QDEL_NULL(assigned_transit) //don't need it where we're goin'! - QDEL_LIST(docking_points) - QDEL_LIST(towed_shuttles) + + //VERY important proc. Should probably get folded into this one, but oh well. + //Requires the shuttle areas list and the towed_shuttles list, and will clear the latter. + jump_to_null_space() for(var/area/ship/shuttle_area in shuttle_areas) //TODO: make a disconnect_from_shuttle() proc shuttle_area.mobile_port = null shuttle_areas.Cut() shuttle_areas = null - underlying_turf_area = null - remove_ripples() - jump_to_null_space() + + underlying_turf_area = null return ..() @@ -583,7 +584,7 @@ all_shuttle_areas += M.shuttle_areas for(var/turf/oldT as anything in old_turfs) - if(!all_shuttle_areas[oldT?.loc]) + if(!(oldT?.loc in all_shuttle_areas)) continue var/area/old_area = oldT.loc for(var/obj/docking_port/mobile/bottom_shuttle in all_towed_shuttles) @@ -603,8 +604,7 @@ for(var/obj/docking_port/mobile/shuttle in all_towed_shuttles - src) qdel(shuttle) - - all_towed_shuttles.Cut() + towed_shuttles.Cut() /obj/docking_port/mobile/proc/create_ripples(obj/docking_port/stationary/S1, animate_time) var/list/turfs = ripple_area(S1) diff --git a/code/modules/unit_tests/open_air.dm b/code/modules/unit_tests/open_air.dm index d2ead5c53ed4..97a6f4132f36 100644 --- a/code/modules/unit_tests/open_air.dm +++ b/code/modules/unit_tests/open_air.dm @@ -24,4 +24,4 @@ var/datum/virtual_level/vlevel = mapzone.virtual_levels[1] for(var/turf/T in vlevel.get_block()) T.Initalize_Atmos(0) - ..() + return ..() From 90f95cc452cb0e7bc072c80c3287bf6a595c5d03 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 00:45:34 -0500 Subject: [PATCH 031/147] temporary revert --- code/modules/unit_tests/ship_placement.dm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index c7269690c085..7261fa5efd47 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -1,10 +1,9 @@ /datum/unit_test/ship_placement/Run() SSair.is_test_loading = TRUE - var/list/spawned_ships = list() for(var/mapname as anything in SSmapping.ship_purchase_list) var/datum/map_template/shuttle/map = SSmapping.ship_purchase_list[mapname] try - spawned_ships += new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) + new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) catch(var/exception/e) Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE @@ -12,8 +11,5 @@ var/list/errors = atmosscan(TRUE) errors += powerdebug(TRUE) - for(var/datum/overmap/ship/controlled/spawned_ship as anything in spawned_ships) - qdel(spawned_ship) - for(var/error in errors) Fail("[error]") From b2b3814af6c1a08accf0ab82f52867dcaa94064e Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 00:49:24 -0500 Subject: [PATCH 032/147] Revert "temporary revert" This reverts commit 4533e4d65fd72ae4ce2613f29780424a4ad886e3. --- code/modules/unit_tests/ship_placement.dm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index 7261fa5efd47..c7269690c085 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -1,9 +1,10 @@ /datum/unit_test/ship_placement/Run() SSair.is_test_loading = TRUE + var/list/spawned_ships = list() for(var/mapname as anything in SSmapping.ship_purchase_list) var/datum/map_template/shuttle/map = SSmapping.ship_purchase_list[mapname] try - new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) + spawned_ships += new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) catch(var/exception/e) Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE @@ -11,5 +12,8 @@ var/list/errors = atmosscan(TRUE) errors += powerdebug(TRUE) + for(var/datum/overmap/ship/controlled/spawned_ship as anything in spawned_ships) + qdel(spawned_ship) + for(var/error in errors) Fail("[error]") From 64490d11d5d56fefb86df143558a1cd06559974c Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 11:41:35 -0500 Subject: [PATCH 033/147] sigh --- code/controllers/subsystem/shuttle.dm | 8 +++---- code/modules/admin/verbs/shuttlepanel.dm | 2 +- .../mob/living/simple_animal/hostile/goose.dm | 4 ++-- .../overmap/ships/controlled_ship_datum.dm | 3 ++- code/modules/shuttle/shuttle.dm | 21 +++++++++++++++---- code/modules/unit_tests/ship_placement.dm | 6 +----- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index f0601935b1dd..852443001d96 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -252,7 +252,7 @@ SUBSYSTEM_DEF(shuttle) var/result = new_shuttle.canDock(destination_port) if((result != SHUTTLE_CAN_DOCK)) WARNING("Template shuttle [new_shuttle] cannot dock at [destination_port] ([result]).") - qdel(new_shuttle) + qdel(new_shuttle, TRUE) return new_shuttle.initiate_docking(destination_port) return new_shuttle @@ -276,7 +276,7 @@ SUBSYSTEM_DEF(shuttle) if((result != SHUTTLE_CAN_DOCK) && (result != SHUTTLE_SOMEONE_ELSE_DOCKED)) //Someone else /IS/ docked, the old shuttle! WARNING("Template shuttle [new_shuttle] cannot dock at [old_shuttle_location] ([result]).") - qdel(new_shuttle) + qdel(new_shuttle, TRUE) return new_shuttle.timer = to_replace.timer //Copy some vars from the old shuttle @@ -288,7 +288,7 @@ SUBSYSTEM_DEF(shuttle) to_replace.assigned_transit = null new_shuttle.assigned_transit = old_shuttle_location - qdel(to_replace) + qdel(to_replace, TRUE) new_shuttle.initiate_docking(old_shuttle_location) //This will spawn the new shuttle return new_shuttle @@ -355,7 +355,7 @@ SUBSYSTEM_DEF(shuttle) var/result = new_shuttle.canDock(transit_dock) if((result != SHUTTLE_CAN_DOCK)) WARNING("Template shuttle [new_shuttle] cannot dock at [transit_dock] ([result]).") - qdel(src) + qdel(src, TRUE) return new_shuttle.initiate_docking(transit_dock) diff --git a/code/modules/admin/verbs/shuttlepanel.dm b/code/modules/admin/verbs/shuttlepanel.dm index 9cec1d0ef0b7..80502185d7f9 100644 --- a/code/modules/admin/verbs/shuttlepanel.dm +++ b/code/modules/admin/verbs/shuttlepanel.dm @@ -37,7 +37,7 @@ if("Delete Shuttle") if(alert(user, "Really delete [name]?", "Delete Shuttle", "Cancel", "Really!") != "Really!") return - qdel(src) + qdel(src, TRUE) message_admins("\[SHUTTLE]: [key_name_admin(user)] has deleted [name].") else diff --git a/code/modules/mob/living/simple_animal/hostile/goose.dm b/code/modules/mob/living/simple_animal/hostile/goose.dm index 2419b79e68e1..bf0337488dcb 100644 --- a/code/modules/mob/living/simple_animal/hostile/goose.dm +++ b/code/modules/mob/living/simple_animal/hostile/goose.dm @@ -55,7 +55,7 @@ Retaliate() /mob/living/simple_animal/hostile/retaliate/goose/handle_automated_action() - if(moved && length(loc.contents)) + if(moved && length(loc?.contents)) moved = FALSE var/obj/item/E = locate() in nummies if(E && E.loc == loc) @@ -63,7 +63,7 @@ nummies -= E /mob/living/simple_animal/hostile/retaliate/goose/vomit/handle_automated_action() - if(moved && length(loc.contents)) + if(moved && length(loc?.contents)) var/list/nummies = loc.contents var/obj/item/E = pick(nummies) if(!(E.custom_materials && E.custom_materials[SSmaterials.GetMaterialRef(/datum/material/plastic)])) diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index ecfded251fdf..dee7e462ac67 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -109,7 +109,8 @@ SSovermap.controlled_ships -= src if(!QDELETED(shuttle_port)) shuttle_port.current_ship = null - QDEL_NULL(shuttle_port) + qdel(shuttle_port, TRUE) + shuttle_port = null if(!QDELETED(ship_account)) QDEL_NULL(ship_account) for(var/a_key in applications) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 14f55c1209c9..3039ac3b37ec 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -30,6 +30,9 @@ var/obj/docking_port/docked /obj/docking_port/Destroy(force) + if(!force) + stack_trace("Shuttle not force deleted!") + return QDEL_HINT_LETMELIVE if(docked) docked.docked = null docked = null @@ -229,9 +232,11 @@ #endif /obj/docking_port/stationary/Destroy(force) + if(!force) + return ..() SSshuttle.stationary -= src owner_ship?.towed_shuttles -= src - . = ..() + return ..() /obj/docking_port/stationary/proc/load_roundstart() if(roundstart_template) // passed a PATH @@ -257,6 +262,8 @@ name = "transit dock [transit_dock_counter]" /obj/docking_port/stationary/transit/Destroy(force) + if(!force) + return ..() if(!QDELETED(docked)) log_world("A transit dock was destroyed while something was docked to it.") SSshuttle.transit -= src @@ -351,6 +358,9 @@ SSshuttle.mobile += src /obj/docking_port/mobile/Destroy(force) + if(!force) + return ..() + spawn_points.Cut() SSshuttle.mobile -= src @@ -361,8 +371,11 @@ if(!QDELETED(current_ship)) QDEL_NULL(current_ship) - QDEL_NULL(assigned_transit) //don't need it where we're goin'! - QDEL_LIST(docking_points) + qdel(assigned_transit, TRUE) //don't need it where we're goin'! + assigned_transit = null + for(var/port in docking_points) + qdel(port, TRUE) + docking_points.Cut() //VERY important proc. Should probably get folded into this one, but oh well. //Requires the shuttle areas list and the towed_shuttles list, and will clear the latter. @@ -603,7 +616,7 @@ break for(var/obj/docking_port/mobile/shuttle in all_towed_shuttles - src) - qdel(shuttle) + qdel(shuttle, TRUE) towed_shuttles.Cut() /obj/docking_port/mobile/proc/create_ripples(obj/docking_port/stationary/S1, animate_time) diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index c7269690c085..7261fa5efd47 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -1,10 +1,9 @@ /datum/unit_test/ship_placement/Run() SSair.is_test_loading = TRUE - var/list/spawned_ships = list() for(var/mapname as anything in SSmapping.ship_purchase_list) var/datum/map_template/shuttle/map = SSmapping.ship_purchase_list[mapname] try - spawned_ships += new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) + new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) catch(var/exception/e) Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE @@ -12,8 +11,5 @@ var/list/errors = atmosscan(TRUE) errors += powerdebug(TRUE) - for(var/datum/overmap/ship/controlled/spawned_ship as anything in spawned_ships) - qdel(spawned_ship) - for(var/error in errors) Fail("[error]") From 47764c3534043bfcd978e07e8f5367410d34291a Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 15:27:00 -0500 Subject: [PATCH 034/147] aaugh --- code/controllers/subsystem/shuttle.dm | 7 +++---- code/modules/shuttle/shuttle.dm | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index 852443001d96..13024e0b44b5 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -337,8 +337,7 @@ SUBSYSTEM_DEF(shuttle) T0.empty() message_admins(msg) - WARNING(msg) - return + CRASH(msg) new_shuttle.docking_points = stationary_ports new_shuttle.current_ship = parent //for any ships that spawn on top of us @@ -350,13 +349,13 @@ SUBSYSTEM_DEF(shuttle) var/obj/docking_port/mobile/transit_dock = generate_transit_dock(new_shuttle) if(!transit_dock) + qdel(src, TRUE) CRASH("No dock found/could be created for shuttle ([template.name]), aborting.") var/result = new_shuttle.canDock(transit_dock) if((result != SHUTTLE_CAN_DOCK)) - WARNING("Template shuttle [new_shuttle] cannot dock at [transit_dock] ([result]).") qdel(src, TRUE) - return + CRASH("Template shuttle [new_shuttle] cannot dock at [transit_dock] ([result]).") new_shuttle.initiate_docking(transit_dock) new_shuttle.linkup(transit_dock, parent) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 3039ac3b37ec..eb5881cdf8ac 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -235,7 +235,8 @@ if(!force) return ..() SSshuttle.stationary -= src - owner_ship?.towed_shuttles -= src + owner_ship?.towed_shuttles -= docked + owner_ship?.docking_points -= src return ..() /obj/docking_port/stationary/proc/load_roundstart() @@ -361,6 +362,9 @@ if(!force) return ..() + . = QDEL_HINT_LETMELIVE + CRASH("Ship deletion temporarily suspended.") + spawn_points.Cut() SSshuttle.mobile -= src From 054c7761a883f56c42f0e17b1aac63d312519d73 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 15:30:49 -0500 Subject: [PATCH 035/147] just one more thing --- code/datums/mind.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 6d96f477099a..596276cb0d6c 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -103,6 +103,7 @@ QDEL_LIST(antag_datums) QDEL_NULL(language_holder) set_current(null) + soulOwner = null return ..() /datum/mind/proc/set_current(mob/new_current) From 48c73fe0a303e18a700876e6fcccf941dc47fc69 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 16:54:02 -0500 Subject: [PATCH 036/147] you're FUCKING KIDDING ME --- code/modules/overmap/_overmap_datum.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/overmap/_overmap_datum.dm b/code/modules/overmap/_overmap_datum.dm index ba352c402eaf..46b0dee70ec6 100644 --- a/code/modules/overmap/_overmap_datum.dm +++ b/code/modules/overmap/_overmap_datum.dm @@ -327,7 +327,7 @@ docked_to.contents -= src var/datum/overmap/old_docked_to = docked_to docked_to = null - token.Move(OVERMAP_TOKEN_TURF(x, y)) + token.forceMove(OVERMAP_TOKEN_TURF(x, y)) INVOKE_ASYNC(old_docked_to, .proc/post_undocked, src) docking = FALSE SEND_SIGNAL(src, COMSIG_OVERMAP_UNDOCK, old_docked_to) From 06461d4a275f560fa6af0c9187a8ccb72e8b69f4 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 17:12:46 -0500 Subject: [PATCH 037/147] goowah --- code/modules/shuttle/shuttle.dm | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index eb5881cdf8ac..dcfdcb8723a6 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -30,9 +30,6 @@ var/obj/docking_port/docked /obj/docking_port/Destroy(force) - if(!force) - stack_trace("Shuttle not force deleted!") - return QDEL_HINT_LETMELIVE if(docked) docked.docked = null docked = null @@ -232,8 +229,6 @@ #endif /obj/docking_port/stationary/Destroy(force) - if(!force) - return ..() SSshuttle.stationary -= src owner_ship?.towed_shuttles -= docked owner_ship?.docking_points -= src @@ -263,8 +258,6 @@ name = "transit dock [transit_dock_counter]" /obj/docking_port/stationary/transit/Destroy(force) - if(!force) - return ..() if(!QDELETED(docked)) log_world("A transit dock was destroyed while something was docked to it.") SSshuttle.transit -= src @@ -359,12 +352,6 @@ SSshuttle.mobile += src /obj/docking_port/mobile/Destroy(force) - if(!force) - return ..() - - . = QDEL_HINT_LETMELIVE - CRASH("Ship deletion temporarily suspended.") - spawn_points.Cut() SSshuttle.mobile -= src From b2c788a84d8a5380708757bdb765e0b04c317f45 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 18:27:03 -0500 Subject: [PATCH 038/147] wahooey --- code/__DEFINES/flags.dm | 2 ++ code/_globalvars/bitfields.dm | 1 + code/game/objects/effects/effects.dm | 2 +- code/game/objects/objs.dm | 2 +- code/game/turfs/open/space/transit.dm | 16 ++++++++-------- code/modules/power/singularity/singularity.dm | 2 +- code/modules/shuttle/shuttle.dm | 2 +- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 87b348ea8b3e..32a60539eab3 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -143,6 +143,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define FREEZE_PROOF (1<<7) /// Should this object not be destroyed when a shuttle lands on it? #define LANDING_PROOF (1<<8) +/// Should this object be able to be in hyperspace without being deleted? +#define HYPERSPACE_PROOF (1<<9) //tesla_zap #define ZAP_MACHINE_EXPLOSIVE (1<<0) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 3b180dd91dda..dc133f6b12aa 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -230,6 +230,7 @@ DEFINE_BITFIELD(resistance_flags, list( "INDESTRUCTIBLE" = INDESTRUCTIBLE, "FREEZE_PROOF" = FREEZE_PROOF, "LANDING_PROOF" = LANDING_PROOF, + "HYPERSPACE_PROOF" = HYPERSPACE_PROOF, )) DEFINE_BITFIELD(sight, list( diff --git a/code/game/objects/effects/effects.dm b/code/game/objects/effects/effects.dm index 7e18077c841b..f3ce881ba4c7 100644 --- a/code/game/objects/effects/effects.dm +++ b/code/game/objects/effects/effects.dm @@ -3,7 +3,7 @@ //Effects are mostly temporary visual effects like sparks, smoke, as well as decals, etc... /obj/effect icon = 'icons/effects/effects.dmi' - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | LANDING_PROOF | HYPERSPACE_PROOF move_resist = INFINITY obj_flags = 0 vis_flags = VIS_INHERIT_PLANE diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 391a1c255198..d2d1325e435b 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -15,7 +15,7 @@ ///Damage under this value will be completely ignored var/damage_deflection = 0 - var/resistance_flags = NONE // INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ON_FIRE | UNACIDABLE | ACID_PROOF | LANDING_PROOF + var/resistance_flags = NONE // INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ON_FIRE | UNACIDABLE | ACID_PROOF | LANDING_PROOF | HYPERSPACE_PROOF var/acid_level = 0 //how much acid is on that obj diff --git a/code/game/turfs/open/space/transit.dm b/code/game/turfs/open/space/transit.dm index bc9789cf4f3a..5e85d3ec2b38 100644 --- a/code/game/turfs/open/space/transit.dm +++ b/code/game/turfs/open/space/transit.dm @@ -32,16 +32,16 @@ AM.throw_atom_into_space() /atom/proc/throw_atom_into_space() - if(istype(src, /obj/docking_port)) - return - if(iseffect(src)) - return - if(isliving(src)) - var/mob/living/poor_soul = src // This may not seem like much, but if you toss someone out - poor_soul.apply_damage_type(25, BRUTE) // and they go through like four tiles, they're goners - return qdel(src) +/obj/throw_atom_into_space() + if(resistance_flags & HYPERSPACE_PROOF) + return + return ..() + +/mob/living/throw_atom_into_space() + apply_damage_type(25, BRUTE) // This may not seem like much, but if you toss someone out and they go through like four tiles, they're goners + /turf/open/space/transit/CanBuildHere() return SSshuttle.is_in_shuttle_bounds(src) diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 17e16aa29284..d14bacdf0a0e 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -28,7 +28,7 @@ var/last_warning var/consumedSupermatter = 0 //If the singularity has eaten a supermatter shard and can go to stage six var/drifting_dir = 0 // Chosen direction to drift in - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | LANDING_PROOF + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | LANDING_PROOF | HYPERSPACE_PROOF obj_flags = CAN_BE_HIT | DANGEROUS_POSSESSION /obj/singularity/Initialize(mapload, starting_energy = 50) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index dcfdcb8723a6..1d2e56925c49 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -9,7 +9,7 @@ icon = 'icons/obj/device.dmi' icon_state = "pinonfar" - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | LANDING_PROOF + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | LANDING_PROOF | HYPERSPACE_PROOF anchored = TRUE ///Common standard is for this to point -away- from the dockingport door, ie towards the ship From 51bf11eb3a24ad583286401c4f466d7b05c78e3c Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 22:51:45 -0500 Subject: [PATCH 039/147] whar --- code/game/objects/items/melee/misc.dm | 7 +++---- code/modules/mapping/mapping_helpers.dm | 7 +++---- code/modules/mob/living/carbon/carbon.dm | 1 + code/modules/mob/transform_procs.dm | 6 +++--- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index 2b1ebe02e6bf..218c87c9c122 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -344,7 +344,7 @@ /obj/item/melee/classic_baton/telescopic/suicide_act(mob/user) var/mob/living/carbon/human/H = user - var/obj/item/organ/brain/B = H.getorgan(/obj/item/organ/brain) + var/obj/item/organ/brain/ded_brain = H.getorgan(/obj/item/organ/brain) user.visible_message("[user] stuffs [src] up [user.p_their()] nose and presses the 'extend' button! It looks like [user.p_theyre()] trying to clear [user.p_their()] mind.") if(!on) @@ -354,9 +354,8 @@ add_fingerprint(user) sleep(3) if (!QDELETED(H)) - if(!QDELETED(B)) - H.internal_organs -= B - qdel(B) + if(!QDELETED(ded_brain)) + qdel(ded_brain) new /obj/effect/gibspawner/generic(H.drop_location(), H) return (BRUTELOSS) diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index 706c88637b34..760477284b06 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -242,12 +242,11 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) var/obj/structure/bodycontainer/morgue/j = pick(trays) var/mob/living/carbon/human/h = new /mob/living/carbon/human(j, 1) h.death() - for (var/part in h.internal_organs) //randomly remove organs from each body, set those we keep to be in stasis + for (var/obj/item/organ/internal_organ as anything in h.internal_organs) //randomly remove organs from each body, set those we keep to be in stasis if (prob(40)) - qdel(part) + qdel(internal_organ) else - var/obj/item/organ/O = part - O.organ_flags |= ORGAN_FROZEN + internal_organ.organ_flags |= ORGAN_FROZEN j.update_icon() qdel(src) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 27d67da106be..9b7684b2d295 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -11,6 +11,7 @@ QDEL_LIST(hand_bodyparts) QDEL_LIST(internal_organs) + internal_organs_slot.Cut() QDEL_LIST(bodyparts) QDEL_LIST(implants) remove_from_all_data_huds() diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 636f3a13b030..3795d882e8c3 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -94,7 +94,7 @@ if(tr_flags & TR_KEEPORGANS) for(var/X in O.internal_organs) var/obj/item/organ/I = X - I.Remove(O, 1) + I.Remove(O, TRUE) if(mind) mind.transfer_to(O) @@ -107,11 +107,11 @@ for(var/X in internal_organs) var/obj/item/organ/I = X int_organs += I - I.Remove(src, 1) + I.Remove(src, TRUE) for(var/X in int_organs) var/obj/item/organ/I = X - I.Insert(O, 1) + I.Insert(O, TRUE) var/obj/item/bodypart/chest/torso = O.get_bodypart(BODY_ZONE_CHEST) if(cavity_object) From 5aff0c445b712590e85b0497c3d7d1be762b7be6 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 23:14:53 -0500 Subject: [PATCH 040/147] weh --- .../game/objects/structures/crates_lockers/closets.dm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 30e2e1988280..7d8199e5ae50 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -42,15 +42,22 @@ /obj/structure/closet/Initialize(mapload) - if(mapload && !opened) // if closed, any item at the crate's loc is put in the contents - addtimer(CALLBACK(src, .proc/take_contents), 0) . = ..() + + // if closed, any item at the crate's loc is put in the contents + if (mapload && !opened) + . = INITIALIZE_HINT_LATELOAD + update_icon() if(populate) PopulateContents() RegisterSignal(src, COMSIG_ATOM_CANREACH, .proc/canreach_react) +/obj/structure/closet/LateInitialize() + take_contents() + return ..() + /obj/structure/closet/proc/canreach_react(datum/source, list/next) return COMPONENT_BLOCK_REACH //closed block, open have nothing inside. From 258ae5c5654807a12a4dc88f302d520c84c80a04 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 19 Jul 2023 23:35:11 -0500 Subject: [PATCH 041/147] hmm --- code/datums/elements/connect_loc.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/elements/connect_loc.dm b/code/datums/elements/connect_loc.dm index fee9072f751d..cfadedd5980d 100644 --- a/code/datums/elements/connect_loc.dm +++ b/code/datums/elements/connect_loc.dm @@ -1,7 +1,7 @@ /// This element hooks a signal onto the loc the current object is on. /// When the object moves, it will unhook the signal and rehook it to the new object. /datum/element/connect_loc - element_flags = ELEMENT_BESPOKE + element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH id_arg_index = 2 /// An assoc list of signal -> procpath to register to the loc this object is on. From a1814cd0262c720fa2d70719de7a5d6a339dd522 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 20 Jul 2023 00:32:37 -0500 Subject: [PATCH 042/147] a wee bit more --- code/datums/components/caltrop.dm | 2 ++ code/game/machinery/doors/firedoor.dm | 18 ++++++++++++------ code/modules/buildmode/buildmode.dm | 4 ++++ code/modules/hydroponics/seeds.dm | 4 ++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/code/datums/components/caltrop.dm b/code/datums/components/caltrop.dm index 2a2cc55d2a22..aac5f65a3956 100644 --- a/code/datums/components/caltrop.dm +++ b/code/datums/components/caltrop.dm @@ -111,3 +111,5 @@ /datum/component/caltrop/UnregisterFromParent() if(ismovable(parent)) qdel(GetComponent(/datum/component/connect_loc_behalf)) + else + UnregisterSignal(get_turf(parent), list(COMSIG_ATOM_ENTERED)) diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 15eab1793a93..ce132893a74b 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -71,6 +71,7 @@ /obj/machinery/door/firedoor/Destroy() remove_from_areas() + density = FALSE air_update_turf(1) affecting_areas.Cut() return ..() @@ -400,8 +401,14 @@ /obj/machinery/door/firedoor/border_only/CanAllowThrough(atom/movable/mover, border_dir) . = ..() - if(!(border_dir == dir)) //Make sure looking at appropriate border - return TRUE + + if(.) + return + + if(border_dir == dir) //Make sure looking at appropriate border + return FALSE + + return TRUE /obj/machinery/door/firedoor/border_only/proc/on_exit(datum/source, atom/movable/leaving, direction) SIGNAL_HANDLER @@ -416,10 +423,9 @@ return COMPONENT_ATOM_BLOCK_EXIT /obj/machinery/door/firedoor/border_only/CanAtmosPass(turf/T) - if(get_dir(loc, T) == dir) - return !density - else + if(!density) return TRUE + return !(dir == get_dir(loc, T)) /obj/machinery/door/firedoor/proc/emergency_pressure_close() SHOULD_NOT_SLEEP(TRUE) @@ -729,7 +735,7 @@ firelock_type = /obj/machinery/door/firedoor/border_only/closed flags_1 = ON_BORDER_1 -/obj/machinery/door/firedoor/border_only/Initialize() +/obj/structure/firelock_frame/border/Initialize() . = ..() var/static/list/loc_connections = list( diff --git a/code/modules/buildmode/buildmode.dm b/code/modules/buildmode/buildmode.dm index 921d1e057bbc..c17c7a46bc79 100644 --- a/code/modules/buildmode/buildmode.dm +++ b/code/modules/buildmode/buildmode.dm @@ -45,9 +45,13 @@ /datum/buildmode/Destroy() close_switchstates() holder.player_details.post_login_callbacks -= li_cb + QDEL_NULL(li_cb) holder = null + buttons.Cut() QDEL_NULL(mode) + QDEL_NULL(modebutton) QDEL_LIST(modeswitch_buttons) + QDEL_NULL(dirbutton) QDEL_LIST(dirswitch_buttons) return ..() diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index e108ea53b4aa..1d83af3e63fd 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -75,6 +75,10 @@ genes += new /datum/plant_gene/reagent(reag_id, reagents_add[reag_id]) reagents_from_genes() //quality coding +/obj/item/seeds/Destroy() + QDEL_LIST(genes) + return ..() + /obj/item/seeds/examine(mob/user) . = ..() . += "Use a pen on it to rename it or change its description." From e2067234f3b6b09727f9f70436a6a1ad63a799fe Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 20 Jul 2023 01:22:28 -0500 Subject: [PATCH 043/147] final touches --- code/modules/overmap/_overmap_datum.dm | 1 + code/modules/overmap/overmap_token.dm | 2 -- code/modules/overmap/ships/controlled_ship_datum.dm | 7 +++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/code/modules/overmap/_overmap_datum.dm b/code/modules/overmap/_overmap_datum.dm index 46b0dee70ec6..278a8786ca1a 100644 --- a/code/modules/overmap/_overmap_datum.dm +++ b/code/modules/overmap/_overmap_datum.dm @@ -69,6 +69,7 @@ SSovermap.overmap_container[x][y] -= src token.parent = null QDEL_NULL(token) + QDEL_LIST(contents) return ..() /** diff --git a/code/modules/overmap/overmap_token.dm b/code/modules/overmap/overmap_token.dm index 525b1b131512..45f50f9e41c1 100644 --- a/code/modules/overmap/overmap_token.dm +++ b/code/modules/overmap/overmap_token.dm @@ -44,8 +44,6 @@ QDEL_NULL(cam_screen) QDEL_NULL(cam_plane_master) QDEL_NULL(cam_background) - for(var/obj/overmap/content as anything in contents) - qdel(content.parent) return ..() /obj/overmap/attack_ghost(mob/user) diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index dee7e462ac67..760cd84ce21d 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -107,12 +107,19 @@ /datum/overmap/ship/controlled/Destroy() SSovermap.controlled_ships -= src + helms.Cut() + LAZYCLEARLIST(owner_candidates) if(!QDELETED(shuttle_port)) shuttle_port.current_ship = null qdel(shuttle_port, TRUE) shuttle_port = null if(!QDELETED(ship_account)) QDEL_NULL(ship_account) + if(!QDELETED(shipkey)) + QDEL_NULL(shipkey) + QDEL_LIST(manifest) + QDEL_LIST(job_slots) + QDEL_NULL(owner_act) for(var/a_key in applications) // it handles removal itself qdel(applications[a_key]) From f5be1736e70315f3aade67ddac94043d619fc523 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 00:38:12 -0500 Subject: [PATCH 044/147] curses --- code/_debugger.dm | 13 +++++++++++++ code/controllers/master.dm | 5 +++++ code/game/world.dm | 2 -- code/modules/holodeck/computer.dm | 2 +- code/modules/hydroponics/seeds.dm | 15 ++++++++------- shiptest.dme | 1 + 6 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 code/_debugger.dm diff --git a/code/_debugger.dm b/code/_debugger.dm new file mode 100644 index 000000000000..dafc759ec563 --- /dev/null +++ b/code/_debugger.dm @@ -0,0 +1,13 @@ +//Datum used to init Auxtools debugging as early as possible +//Datum gets created in master.dm because for whatever reason global code in there gets runs first +//In case we ever figure out how to manipulate global init order please move the datum creation into this file +/datum/debugger + +/datum/debugger/New() + enable_debugger() + +/datum/debugger/proc/enable_debugger() + var/dll = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL") + if (dll) + call(dll, "auxtools_init")() + enable_debugging() diff --git a/code/controllers/master.dm b/code/controllers/master.dm index f72f706c5bca..50d6fd96bbeb 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -7,6 +7,11 @@ * **/ +//Init the debugger datum first so we can debug Master +//You might wonder why not just create the debugger datum global in its own file, since its loaded way earlier than this DM file +//Well for whatever reason then the Master gets created first and then the debugger when doing that +//So thats why this code lives here now, until someone finds out how Byond inits globals +GLOBAL_REAL(Debugger, /datum/debugger) = new //This is the ABSOLUTE ONLY THING that should init globally like this //2019 update: the failsafe,config and Global controllers also do it GLOBAL_REAL(Master, /datum/controller/master) = new diff --git a/code/game/world.dm b/code/game/world.dm index b8ee40566c59..f49335fa0eb4 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -32,8 +32,6 @@ GLOBAL_VAR(restart_counter) //Keep the auxtools stuff at the top AUXTOOLS_CHECK(AUXMOS) - enable_debugger() - log_world("World loaded at [time_stamp()]!") SSmetrics.world_init_time = REALTIMEOFDAY // Important diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index b36fcf443bc3..ea07e2f70b27 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -98,7 +98,7 @@ and clear when youre done! if you dont i will use :newspaper2: on you // the following is necessary for power reasons if(!linked) - log_world("No matching holodeck area found") + log_mapping("No matching holodeck area found") qdel(src) return else if (!offline_program) diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index 1d83af3e63fd..008009a35765 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -8,7 +8,7 @@ w_class = WEIGHT_CLASS_TINY resistance_flags = FLAMMABLE var/plantname = "Plants" // Name of plant when planted. - var/obj/item/product // A type path. The thing that is created when the plant is harvested. + var/obj/item/product // A type path. The thing that is created when the plant is harvested. var/productdesc var/species = "" // Used to update icons. Should match the name in the sprites unless all icon_* are overridden. @@ -24,7 +24,7 @@ var/yield = 3 // Amount of growns created per harvest. If is -1, the plant/shroom/weed is never meant to be harvested. var/potency = 10 // The 'power' of a plant. Generally effects the amount of reagent in a plant, also used in other ways. var/growthstages = 6 // Amount of growth sprites the plant has. - var/instability = 5 //Chance that a plant will mutate in each stage of it's life. + var/instability = 5 // Chance that a plant will mutate in each stage of it's life. var/rarity = 0 // How rare the plant is. Used for giving points to cargo when shipping off to CentCom. var/list/mutatelist = list() // The type of plants that this plant can mutate into. var/list/genes = list() // Plant genes are stored here, see plant_genes.dm for more info. @@ -35,10 +35,10 @@ // Stronger reagents must always come first to avoid being displaced by weaker ones. // Total amount of any reagent in plant is calculated by formula: 1 + round(potency * multiplier) - var/weed_rate = 1 //If the chance below passes, then this many weeds sprout during growth - var/weed_chance = 5 //Percentage chance per tray update to grow weeds - var/research = 0 //defines "discovery value", which will give a one-time point payout if a seed is given to an R&D console. Seed discovery is determined on a ship-by-ship basis. - var/seed_flags = MUTATE_EARLY //Determines if a plant is allowed to mutate early at 30+ instability + var/weed_rate = 1 // If the chance below passes, then this many weeds sprout during growth + var/weed_chance = 5 // Percentage chance per tray update to grow weeds + var/research = 0 // Defines "discovery value", which will give a one-time point payout if a seed is given to an R&D console. Seed discovery is determined on a ship-by-ship basis. + var/seed_flags = MUTATE_EARLY // Determines if a plant is allowed to mutate early at 30+ instability /obj/item/seeds/Initialize(mapload, nogenes = 0) . = ..() @@ -76,7 +76,8 @@ reagents_from_genes() //quality coding /obj/item/seeds/Destroy() - QDEL_LIST(genes) + if(flags_1 & INITIALIZED_1) + QDEL_LIST(genes) return ..() /obj/item/seeds/examine(mob/user) diff --git a/shiptest.dme b/shiptest.dme index 732f3e8a936e..1fde92e931d9 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -16,6 +16,7 @@ #include "_maps\_basemap.dm" #include "code\__byond_version_compat.dm" #include "code\_compile_options.dm" +#include "code\_debugger.dm" #include "code\world.dm" #include "code\__DEFINES\_click.dm" #include "code\__DEFINES\_globals.dm" From 2c31a13f21dd67f6af9b39a3afb92b5e8402646d Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 01:02:58 -0500 Subject: [PATCH 045/147] this SHOULD be it --- check_regex.yaml | 2 +- code/datums/components/connect_containers.dm | 6 +++--- code/datums/components/connect_range.dm | 6 +++--- code/datums/components/crafting/recipes.dm | 6 +++--- code/datums/shuttles.dm | 1 - code/game/objects/items/devices/scanners.dm | 8 ++++---- code/game/objects/structures/beds_chairs/bed.dm | 9 +++++++++ .../mob/living/carbon/alien/special/facehugger.dm | 4 ++++ code/modules/mob/living/carbon/hologram/hologram.dm | 2 +- code/modules/overmap/ships/controlled_ship_datum.dm | 4 ++-- code/modules/paperwork/paper.dm | 8 ++++---- code/modules/unit_tests/create_and_destroy.dm | 4 +++- 12 files changed, 37 insertions(+), 23 deletions(-) diff --git a/check_regex.yaml b/check_regex.yaml index 86faec7e1091..d37107494882 100644 --- a/check_regex.yaml +++ b/check_regex.yaml @@ -44,7 +44,7 @@ standards: ] - exactly: [0, "incorrect indentations", '^(?: +)(?!\*)'] - exactly: [0, "superflous whitespace", '[ \t]+$'] - - exactly: [12, "mixed indentation", '^( +\t+|\t+ +)'] + - exactly: [0, "mixed indentation", '^( +\t+|\t+ +)'] - exactly: [21, 'padding inside parentheses', '\(([\t ]+([^)"\n\\]*)|([^("\n]+)[\t ]+)\)'] - no_more: diff --git a/code/datums/components/connect_containers.dm b/code/datums/components/connect_containers.dm index c386a096410b..d8a3ac8fbd3e 100644 --- a/code/datums/components/connect_containers.dm +++ b/code/datums/components/connect_containers.dm @@ -5,9 +5,9 @@ /// An assoc list of signal -> procpath to register to the loc this object is on. var/list/connections /** - * The atom the component is tracking. The component will delete itself if the tracked is deleted. - * Signals will also be updated whenever it moves. - */ + * The atom the component is tracking. The component will delete itself if the tracked is deleted. + * Signals will also be updated whenever it moves. + */ var/atom/movable/tracked /datum/component/connect_containers/Initialize(atom/movable/tracked, list/connections) diff --git a/code/datums/components/connect_range.dm b/code/datums/components/connect_range.dm index b40643c57494..5642b2ed4e2d 100644 --- a/code/datums/components/connect_range.dm +++ b/code/datums/components/connect_range.dm @@ -9,9 +9,9 @@ /// An assoc list of signal -> procpath to register to the loc this object is on. var/list/connections /** - * The atom the component is tracking. The component will delete itself if the tracked is deleted. - * Signals will also be updated whenever it moves (if it's a movable). - */ + * The atom the component is tracking. The component will delete itself if the tracked is deleted. + * Signals will also be updated whenever it moves (if it's a movable). + */ var/atom/tracked /// The component will hook into signals only on turfs not farther from tracked than this. diff --git a/code/datums/components/crafting/recipes.dm b/code/datums/components/crafting/recipes.dm index 5daa79d0ff7e..96a013df406a 100644 --- a/code/datums/components/crafting/recipes.dm +++ b/code/datums/components/crafting/recipes.dm @@ -871,9 +871,9 @@ /datum/crafting_recipe/ipickaxe name = "Improvised Pickaxe" reqs = list( - /obj/item/crowbar = 1, - /obj/item/kitchen/knife = 1, - /obj/item/stack/tape = 1) + /obj/item/crowbar = 1, + /obj/item/kitchen/knife = 1, + /obj/item/stack/tape = 1) result = /obj/item/pickaxe/improvised category = CAT_MISC diff --git a/code/datums/shuttles.dm b/code/datums/shuttles.dm index e4255541911d..1723676a0207 100644 --- a/code/datums/shuttles.dm +++ b/code/datums/shuttles.dm @@ -308,7 +308,6 @@ category = "shiptest" /datum/map_template/shuttle/custom - job_slots = list(new /datum/job/assistant = 5) // There will already be a captain, probably! file_name = "custom_shuttle" // Dummy /// Syndicate Infiltrator variants diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 2564fe961336..133c913118e5 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -671,19 +671,19 @@ GENE SCANNER if (T.slime_mutation[3] == T.slime_mutation[4]) if (T.slime_mutation[2] == T.slime_mutation[1]) to_render += "\nPossible mutation: [T.slime_mutation[3]]\ - \nGenetic destability: [T.mutation_chance/2] % chance of mutation on splitting" + \nGenetic destability: [T.mutation_chance/2] % chance of mutation on splitting" else to_render += "\nPossible mutations: [T.slime_mutation[1]], [T.slime_mutation[2]], [T.slime_mutation[3]] (x2)\ - \nGenetic destability: [T.mutation_chance] % chance of mutation on splitting" + \nGenetic destability: [T.mutation_chance] % chance of mutation on splitting" else to_render += "\nPossible mutations: [T.slime_mutation[1]], [T.slime_mutation[2]], [T.slime_mutation[3]], [T.slime_mutation[4]]\ - \nGenetic destability: [T.mutation_chance] % chance of mutation on splitting" + \nGenetic destability: [T.mutation_chance] % chance of mutation on splitting" if (T.cores > 1) to_render += "\nMultiple cores detected" to_render += "\nGrowth progress: [T.amount_grown]/[SLIME_EVOLUTION_THRESHOLD]" if(T.effectmod) to_render += "\nCore mutation in progress: [T.effectmod]\ - \nProgress in core mutation: [T.applied] / [(SLIME_EXTRACT_CROSSING_REQUIRED * T.crossbreed_modifier)]" + \nProgress in core mutation: [T.applied] / [(SLIME_EXTRACT_CROSSING_REQUIRED * T.crossbreed_modifier)]" to_chat(user, examine_block(to_render)) diff --git a/code/game/objects/structures/beds_chairs/bed.dm b/code/game/objects/structures/beds_chairs/bed.dm index 0cda61d847ef..3c7d1ac0f01c 100644 --- a/code/game/objects/structures/beds_chairs/bed.dm +++ b/code/game/objects/structures/beds_chairs/bed.dm @@ -193,10 +193,19 @@ anchored = TRUE /obj/structure/bed/dogbed/proc/update_owner(mob/living/M) + if(owner) + UnregisterSignal(owner, COMSIG_PARENT_QDELETING) owner = M + RegisterSignal(owner, COMSIG_PARENT_QDELETING, PROC_REF(owner_deleted)) name = "[M]'s bed" desc = "[M]'s bed! Looks comfy." +/obj/structure/bed/dogbed/proc/owner_deleted() + UnregisterSignal(owner, COMSIG_PARENT_QDELETING) + owner = null + name = initial(name) + desc = initial(desc) + /obj/structure/bed/dogbed/buckle_mob(mob/living/M, force, check_loc) . = ..() update_owner(M) diff --git a/code/modules/mob/living/carbon/alien/special/facehugger.dm b/code/modules/mob/living/carbon/alien/special/facehugger.dm index ee011b69715c..39958b84fc0d 100644 --- a/code/modules/mob/living/carbon/alien/special/facehugger.dm +++ b/code/modules/mob/living/carbon/alien/special/facehugger.dm @@ -71,6 +71,10 @@ var/obj/item/clothing/mask/facehugger_item/hugger_item = BecomeItem() user.put_in_hands(hugger_item) +/mob/living/simple_animal/hostile/facehugger/Destroy() + mask_facehugger?.facehugger_mob = null + return ..() + /** * Attempts to have the facehugger couple with the given target. Checks all possibilities and plays them out accordingly. * diff --git a/code/modules/mob/living/carbon/hologram/hologram.dm b/code/modules/mob/living/carbon/hologram/hologram.dm index e1582bec3b54..9a4e1f084374 100644 --- a/code/modules/mob/living/carbon/hologram/hologram.dm +++ b/code/modules/mob/living/carbon/hologram/hologram.dm @@ -225,7 +225,7 @@ var/formatted_laws = "Hologram law:\n" formatted_laws += flavortext ? "[flavortext]" : "No laws set!" //If flavortext set, show it, else show "No laws set!" formatted_laws += "\nEmergency holograms are ghost spawns that can majorly affect the round due to their versatility. Act with common sense.\n"+\ - "Using the role to grief or metagame against your set laws will be met with a silicon ban.\n" + "Using the role to grief or metagame against your set laws will be met with a silicon ban.\n" var/policy = get_policy(ROLE_POSIBRAIN) //if we need something different than the use of posibrains for policy and bans, ping mark and he'll add a new define for it if(policy) diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index 760cd84ce21d..1efa382c84a9 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -59,7 +59,7 @@ /// Short memo of the ship shown to new joins var/memo = null ///Assoc list of remaining open job slots (job = remaining slots) - var/list/job_slots = list(new /datum/job/captain() = 1, new /datum/job/assistant() = 5) + var/list/job_slots ///Time that next job slot change can occur COOLDOWN_DECLARE(job_slot_adjustment_cooldown) @@ -118,7 +118,7 @@ if(!QDELETED(shipkey)) QDEL_NULL(shipkey) QDEL_LIST(manifest) - QDEL_LIST(job_slots) + job_slots.Cut() QDEL_NULL(owner_act) for(var/a_key in applications) // it handles removal itself diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index 9bce0763c2c5..1af0e7f0012c 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -37,10 +37,10 @@ /// What's actually written on the paper. var/info = "" /** - * What's been written on the paper by things other than players. - * Will be sanitized by the UI, and finally - * added to info when the user edits the paper text. - */ + * What's been written on the paper by things other than players. + * Will be sanitized by the UI, and finally + * added to info when the user edits the paper text. + */ var/list/add_info /// The font color, face and the signature of the above. var/list/add_info_style diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index d8b307795f1e..0c27e3d9302b 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -48,7 +48,9 @@ /obj/item/bodypart/head, /obj/item/bodypart/l_arm, /obj/item/bodypart/r_arm, - /obj/item/bodypart/leg + /obj/item/bodypart/leg, + //fucking explodes when created + /obj/item/grown/bananapeel/bombanana, ) //This turf existing is an error in and of itself ignore += typesof(/turf/baseturf_skipover) From d7d4b74a789fdb586eec6597cc71ed716ae84882 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 16:39:40 -0500 Subject: [PATCH 046/147] this was way too zealous --- code/modules/admin/view_variables/reference_tracking.dm | 7 ------- 1 file changed, 7 deletions(-) diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index ce1673473c2a..69d3a5d1541b 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -67,10 +67,6 @@ SSgarbage.next_fire = world.time + world.tick_lag /datum/proc/DoSearchVar(potential_container, container_name, recursive_limit = 64, search_time = world.time) - #ifndef FIND_REF_NO_CHECK_TICK - CHECK_TICK - #endif - #ifdef REFERENCE_TRACKING_DEBUG if(SSgarbage.should_save_refs && !found_refs) found_refs = list() @@ -102,9 +98,6 @@ #endif if (varname == "vars" || varname == "vis_locs") //Fun fact, vis_locs don't count for references continue - #ifndef FIND_REF_NO_CHECK_TICK - CHECK_TICK - #endif var/variable = vars_list[varname] if(variable == src) From 644b431fb6d59f8dafb08dadc027ae13fd7a7dc7 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 18:31:27 -0500 Subject: [PATCH 047/147] fuck --- code/modules/overmap/_overmap_datum.dm | 8 ++++++-- code/modules/overmap/ships/ship_datum.dm | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/code/modules/overmap/_overmap_datum.dm b/code/modules/overmap/_overmap_datum.dm index 278a8786ca1a..46eb2eded0cf 100644 --- a/code/modules/overmap/_overmap_datum.dm +++ b/code/modules/overmap/_overmap_datum.dm @@ -65,8 +65,10 @@ /datum/overmap/Destroy(force, ...) SSovermap.overmap_objects -= src if(docked_to) - Undock(TRUE) - SSovermap.overmap_container[x][y] -= src + docked_to.post_undocked() + docked_to.contents -= src + if(isnum(x) && isnum(y)) + SSovermap.overmap_container[x][y] -= src token.parent = null QDEL_NULL(token) QDEL_LIST(contents) @@ -339,6 +341,8 @@ * * dock_requester - The overmap datum trying to undock from this one. Cannot be null. */ /datum/overmap/proc/post_undocked(datum/overmap/ship/controlled/dock_requester) + SHOULD_CALL_PARENT(TRUE) + contents -= dock_requester return /** diff --git a/code/modules/overmap/ships/ship_datum.dm b/code/modules/overmap/ships/ship_datum.dm index 0d2ef4370b35..d4080098712e 100644 --- a/code/modules/overmap/ships/ship_datum.dm +++ b/code/modules/overmap/ships/ship_datum.dm @@ -33,9 +33,9 @@ RegisterSignal(docked_to, COMSIG_OVERMAP_MOVED, .proc/on_docked_to_moved) /datum/overmap/ship/Destroy() - . = ..() if(movement_callback_id) deltimer(movement_callback_id, SSovermap_movement) + return ..() /datum/overmap/ship/complete_dock(datum/overmap/dock_target, datum/docking_ticket/ticket) . = ..() From 4b4fb0122bec781afddf390b806fea65cde75123 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 18:47:28 -0500 Subject: [PATCH 048/147] goowah --- code/modules/overmap/ships/controlled_ship_datum.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index 1efa382c84a9..86093d01e252 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -119,8 +119,9 @@ QDEL_NULL(shipkey) QDEL_LIST(manifest) job_slots.Cut() - QDEL_NULL(owner_act) for(var/a_key in applications) + if(isnull(applications[a_key])) + continue // it handles removal itself qdel(applications[a_key]) LAZYCLEARLIST(applications) From c4514cc573b2337ed94ece554e9eab5f901c87f1 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 18:49:17 -0500 Subject: [PATCH 049/147] EEE --- code/modules/overmap/overmap_token.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/overmap/overmap_token.dm b/code/modules/overmap/overmap_token.dm index 45f50f9e41c1..80475938240f 100644 --- a/code/modules/overmap/overmap_token.dm +++ b/code/modules/overmap/overmap_token.dm @@ -37,7 +37,7 @@ update_icon() /obj/overmap/Destroy(force) - if(parent) + if(!QDELETED(parent)) stack_trace("attempted to qdel a token that still has a parent") return QDEL_HINT_LETMELIVE if(render_map) From 7d78bfa60c308154acfa9cb196b6fe3ab43aa959 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 18:55:03 -0500 Subject: [PATCH 050/147] GUH --- code/modules/overmap/_overmap_datum.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/modules/overmap/_overmap_datum.dm b/code/modules/overmap/_overmap_datum.dm index 46eb2eded0cf..539c618fc517 100644 --- a/code/modules/overmap/_overmap_datum.dm +++ b/code/modules/overmap/_overmap_datum.dm @@ -341,8 +341,6 @@ * * dock_requester - The overmap datum trying to undock from this one. Cannot be null. */ /datum/overmap/proc/post_undocked(datum/overmap/ship/controlled/dock_requester) - SHOULD_CALL_PARENT(TRUE) - contents -= dock_requester return /** From 0c404f617c2f4263222d072fa313d5d5678d3905 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 20:27:44 -0500 Subject: [PATCH 051/147] fixes supply pods --- code/game/objects/structures/crates_lockers/closets.dm | 2 ++ code/modules/cargo/supplypod.dm | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 7d8199e5ae50..12fd3d1b1242 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -151,6 +151,8 @@ return TRUE /obj/structure/closet/dump_contents() + if(!isturf(loc)) + return var/atom/L = drop_location() for(var/atom/movable/AM as anything in src) AM.forceMove(L) diff --git a/code/modules/cargo/supplypod.dm b/code/modules/cargo/supplypod.dm index d02b04961cf0..d79eead9444f 100644 --- a/code/modules/cargo/supplypod.dm +++ b/code/modules/cargo/supplypod.dm @@ -40,7 +40,7 @@ var/openingSound //Admin sound to play when the pod opens var/leavingSound //Admin sound to play when the pod leaves var/soundVolume = 80 //Volume to play sounds at. Ignores the cap - var/bay //Used specifically for the centcom_podlauncher datum. Holds the current bay the user is launching objects from. Bays are specific rooms on the centcom map. + var/area/bay //Used specifically for the centcom_podlauncher datum. Holds the current bay the user is launching objects from. Bays are specific rooms on the centcom map. var/list/explosionSize = list(0,0,2,3) var/stay_after_drop = FALSE var/specialised = TRUE // It's not a general use pod for cargo/admin use @@ -129,7 +129,7 @@ risingPod.pixel_z = 0 //The initial value of risingPod's pixel_z is 200 because it normally comes down from a high spot animate(risingPod, pixel_z = 200, time = 10, easing = LINEAR_EASING) //Animate our rising pod if (returntobay) - holder.forceMove(bay) //Move the pod back to centcom, where it belongs + holder.forceMove(pick(bay.contents)) //Move the pod back to centcom, where it belongs QDEL_IN(risingPod, 10) reversing = FALSE //Now that we're done reversing, we set this to false (otherwise we would get stuck in an infinite loop of calling the close proc at the bottom of open() ) bluespace = TRUE //Make it so that the pod doesn't stay in centcom forever From fe8f3334e80f69b5f314371021a2758202f509cb Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 20:49:28 -0500 Subject: [PATCH 052/147] just a few more --- _maps/RandomRuins/SpaceRuins/hellfactory.dmm | 2 +- code/game/objects/items/wayfinding.dm | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/_maps/RandomRuins/SpaceRuins/hellfactory.dmm b/_maps/RandomRuins/SpaceRuins/hellfactory.dmm index 7ac9ff16fff2..7a4eab14d2dd 100644 --- a/_maps/RandomRuins/SpaceRuins/hellfactory.dmm +++ b/_maps/RandomRuins/SpaceRuins/hellfactory.dmm @@ -70,7 +70,7 @@ "ak" = ( /obj/machinery/atmospherics/components/unary/tank/oxygen{ dir = 8; - gas_type = /datum/gas/water_vapor; + gas_type = "water_vapor"; initialize_directions = 8 }, /turf/open/floor/plasteel/grimy, diff --git a/code/game/objects/items/wayfinding.dm b/code/game/objects/items/wayfinding.dm index b1e6523ee926..0fc80de2759d 100644 --- a/code/game/objects/items/wayfinding.dm +++ b/code/game/objects/items/wayfinding.dm @@ -126,7 +126,6 @@ icon_state = "pinpointer_way" resistance_flags = NONE var/owner = null - var/list/beacons = list() var/roundstart = FALSE /obj/item/pinpointer/wayfinding/attack_self(mob/living/user) @@ -138,8 +137,7 @@ if (!owner) owner = user.real_name - if(beacons.len) - beacons.Cut() + var/list/beacons = list() for(var/obj/machinery/navbeacon/B in GLOB.wayfindingbeacons) beacons[B.codes["wayfinding"]] = B From 941e2f846fc9a523f1b152baf61fcbdb62e7d8b4 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 21 Jul 2023 21:23:09 -0500 Subject: [PATCH 053/147] let's try this --- code/modules/unit_tests/create_and_destroy.dm | 56 +++++++++++++------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 0c27e3d9302b..6e2e1e1131d4 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -105,16 +105,20 @@ ignore += typesof(/mob/living/simple_animal/hologram) var/list/cached_contents = spawn_at.contents.Copy() - var/baseturf_count = length(spawn_at.baseturfs) + var/original_turf_type = spawn_at.type + var/original_baseturfs = islist(spawn_at.baseturfs) ? spawn_at.baseturfs.Copy() : spawn_at.baseturfs + var/original_baseturf_count = length(original_baseturfs) for(var/type_path in typesof(/atom/movable, /turf) - ignore) //No areas please if(ispath(type_path, /turf)) - spawn_at.ChangeTurf(type_path, /turf/baseturf_skipover) - //We change it back to prevent pain, please don't ask - spawn_at.ChangeTurf(/turf/open/floor/wood, /turf/baseturf_skipover) - if(baseturf_count != length(spawn_at.baseturfs)) - Fail("[type_path] changed the amount of baseturfs we have [baseturf_count] -> [length(spawn_at.baseturfs)]") - baseturf_count = length(spawn_at.baseturfs) + spawn_at.ChangeTurf(type_path) + //We change it back to prevent baseturfs stacking and hitting the limit + spawn_at.ChangeTurf(original_turf_type, original_baseturfs) + if(original_baseturf_count != length(spawn_at.baseturfs)) + Fail("[type_path] changed the amount of baseturfs from [original_baseturf_count] to [length(spawn_at.baseturfs)]; [english_list(original_baseturfs)] to [islist(spawn_at.baseturfs) ? english_list(spawn_at.baseturfs) : spawn_at.baseturfs]") + //Warn if it changes again + original_baseturfs = islist(spawn_at.baseturfs) ? spawn_at.baseturfs.Copy() : spawn_at.baseturfs + original_baseturf_count = length(original_baseturfs) else var/atom/creation = new type_path(spawn_at) if(QDELETED(creation)) @@ -133,29 +137,44 @@ //Hell code, we're bound to have ended the round somehow so let's stop if from ending while we work SSticker.delay_end = TRUE + + // Drastically lower the amount of time it takes to GC, since we don't have clients that can hold it up. + SSgarbage.collection_timeout[GC_QUEUE_CHECK] = 10 SECONDS //Prevent the garbage subsystem from harddeling anything, if only to save time SSgarbage.collection_timeout[GC_QUEUE_HARDDELETE] = 10000 HOURS //Clear it, just in case cached_contents.Cut() + var/list/queues_we_care_about = list() + // All up to harddel + for(var/i in 1 to GC_QUEUE_HARDDELETE - 1) + queues_we_care_about += i + //Now that we've qdel'd everything, let's sleep until the gc has processed all the shit we care about - var/time_needed = SSgarbage.collection_timeout[GC_QUEUE_CHECK] + // + 2 seconds to ensure that everything gets in the queue. + var/time_needed = 2 SECONDS + for(var/index in queues_we_care_about) + time_needed += SSgarbage.collection_timeout[index] + var/start_time = world.time var/garbage_queue_processed = FALSE sleep(time_needed) while(!garbage_queue_processed) - var/list/queue_to_check = SSgarbage.queues[GC_QUEUE_CHECK] - //How the hell did you manage to empty this? Good job! - if(!length(queue_to_check)) - garbage_queue_processed = TRUE - break + var/oldest_packet_creation = INFINITY + for(var/index in queues_we_care_about) + var/list/queue_to_check = SSgarbage.queues[index] + if(!length(queue_to_check)) + continue + + var/list/oldest_packet = queue_to_check[1] + //Pull out the time we inserted at + var/qdeld_at = oldest_packet[GC_QUEUE_ITEM_GCD_DESTROYED] + + oldest_packet_creation = min(qdeld_at, oldest_packet_creation) - var/list/oldest_packet = queue_to_check[1] - //Pull out the time we deld at - var/qdeld_at = oldest_packet[1] //If we've found a packet that got del'd later then we finished, then all our shit has been processed - if(qdeld_at > start_time) + if(oldest_packet_creation > start_time) garbage_queue_processed = TRUE break @@ -191,4 +210,5 @@ SSticker.delay_end = FALSE //This shouldn't be needed, but let's be polite - SSgarbage.collection_timeout[GC_QUEUE_HARDDELETE] = 10 SECONDS + SSgarbage.collection_timeout[GC_QUEUE_CHECK] = GC_CHECK_QUEUE + SSgarbage.collection_timeout[GC_QUEUE_HARDDELETE] = GC_DEL_QUEUE From e364c00724f446c2de99dd11ae65d6833198267e Mon Sep 17 00:00:00 2001 From: Tastyfish Date: Tue, 3 May 2022 21:19:01 -0400 Subject: [PATCH 054/147] Makes integration test results be in color and have annotations (#66649) About The Pull Request Separated compiling the integration tests and running them as separate steps for organization purposes. Added a TEST_ASSERT_NULL(value, reason) and TEST_ASSERT_NOTNULL(value, reason) because those are conceptually simple tests. Makes the PASS and FAIL prefixes in the integration test log be green and red for better readability. Failure reasons now display the file and line number. In order to achieve this, direct calls to Fail() are now wrapped in a macro, TEST_FAIL(), as Fail() itself needs preprocessor stuff passed to it. In the midst of updating it, I noticed multiple cases of tests directly calling Fail() and returning when they should have used a better macro, so those were updated. There was at least one case where it appeared that the code assumed that the test ended at Fail(), but made no attempt to do so, such as with the RCD test. Feel free to double check all of the changed unit tests in case I made a functional behavior change, but they currently pass. To take advantage of the previous change, failures are now marked as annotations. Note that outside of github, this creates an ugly-looking line but the primary environment is as a github action. Examples with intentionally botched unit test: image image image Why It's Good For The Game Makes inspecting failed unit tests significantly easier. Changelog N/A --- code/modules/surgery/bodyparts/helpers.dm | 1 + code/modules/unit_tests/README.md | 76 +++++++++++ code/modules/unit_tests/_unit_tests.dm | 49 ++++++- code/modules/unit_tests/anchored_mobs.dm | 4 +- code/modules/unit_tests/bespoke_id.dm | 2 +- code/modules/unit_tests/component_tests.dm | 4 +- code/modules/unit_tests/create_and_destroy.dm | 16 +-- code/modules/unit_tests/keybinding_init.dm | 2 +- code/modules/unit_tests/merge_type.dm | 14 ++ code/modules/unit_tests/outfit_sanity.dm | 7 +- code/modules/unit_tests/plantgrowth_tests.dm | 6 +- code/modules/unit_tests/projectiles.dm | 24 +++- code/modules/unit_tests/rcd.dm | 3 +- code/modules/unit_tests/reagent_id_typos.dm | 2 +- code/modules/unit_tests/reagent_names.dm | 15 +++ .../unit_tests/reagent_recipe_collisions.dm | 2 +- code/modules/unit_tests/say.dm | 4 +- code/modules/unit_tests/species_unique_id.dm | 14 ++ code/modules/unit_tests/species_whitelists.dm | 2 +- .../modules/unit_tests/stack_singular_name.dm | 18 +++ code/modules/unit_tests/subsystem_init.dm | 2 +- code/modules/unit_tests/surgeries.dm | 120 ++++++++++++++++++ code/modules/unit_tests/timer_sanity.dm | 4 +- code/modules/unit_tests/unit_test.dm | 25 +++- 24 files changed, 372 insertions(+), 44 deletions(-) create mode 100644 code/modules/unit_tests/README.md create mode 100644 code/modules/unit_tests/merge_type.dm create mode 100644 code/modules/unit_tests/reagent_names.dm create mode 100644 code/modules/unit_tests/species_unique_id.dm create mode 100644 code/modules/unit_tests/stack_singular_name.dm create mode 100644 code/modules/unit_tests/surgeries.dm diff --git a/code/modules/surgery/bodyparts/helpers.dm b/code/modules/surgery/bodyparts/helpers.dm index 73ecf0e52444..ce2ed5e98d40 100644 --- a/code/modules/surgery/bodyparts/helpers.dm +++ b/code/modules/surgery/bodyparts/helpers.dm @@ -62,6 +62,7 @@ /mob/living/proc/get_missing_limbs() + RETURN_TYPE(/list) return list() /mob/living/carbon/get_missing_limbs() diff --git a/code/modules/unit_tests/README.md b/code/modules/unit_tests/README.md new file mode 100644 index 000000000000..5f9a62e124eb --- /dev/null +++ b/code/modules/unit_tests/README.md @@ -0,0 +1,76 @@ +# Unit Tests + +## What is unit testing? + +Unit tests are automated code to verify that parts of the game work exactly as they should. For example, [a test to make sure that the amputation surgery actually amputates the limb](https://github.com/tgstation/tgstation/blob/e416283f162b86345a8623125ab866839b1ac40d/code/modules/unit_tests/surgeries.dm#L1-L13). These are ran every time a PR is made, and thus are very helpful for preventing bugs from cropping up in your code that would've otherwise gone unnoticed. For example, would you have thought to check [that beach boys would still work the same after editing pizza](https://github.com/tgstation/tgstation/pull/53641#issuecomment-691384934)? If you value your time, probably not. + +On their most basic level, when `UNIT_TESTS` is defined, all subtypes of `/datum/unit_test` will have their `Run` proc executed. From here, if `Fail` is called at any point, then the tests will report as failed. + +## How do I write one? +1. Find a relevant file. + +All unit test related code is in `code/modules/unit_tests`. If you are adding a new test for a surgery, for example, then you'd open `surgeries.dm`. If a relevant file does not exist, simply create one in this folder, then `#include` it in `_unit_tests.dm`. + +2. Create the unit test. + +To make a new unit test, you simply need to define a `/datum/unit_test`. + +For example, let's suppose that we are creating a test to make sure a proc `square` correctly raises inputs to the power of two. We'd start with first: + +``` +/datum/unit_test/square/Run() +``` + +This defines our new unit test, `/datum/unit_test/square`. Inside this function, we're then going to run through whatever we want to check. Tests provide a few assertion functions to make this easy. For now, we're going to use `TEST_ASSERT_EQUAL`. + +``` +/datum/unit_test/square/Run() + TEST_ASSERT_EQUAL(square(3), 9, "square(3) did not return 9") + TEST_ASSERT_EQUAL(square(4), 16, "square(4) did not return 16") +``` + +As you can hopefully tell, we're simply checking if the output of `square` matches the output we are expecting. If the test fails, it'll report the error message given as well as whatever the actual output was. + +3. Run the unit test + +Open `code/_compile_options.dm` and uncomment the following line. + +``` +//#define UNIT_TESTS //If this is uncommented, we do a single run though of the game setup and tear down process with unit tests in between +``` + +Then, run tgstation.dmb in Dream Daemon. Don't bother trying to connect, you won't need to. You'll be able to see the outputs of all the tests. You'll get to see which tests failed and for what reason. If they all pass, you're set! + +## How to think about tests + +Unit tests exist to prevent bugs that would happen in a real game. Thus, they should attempt to emulate the game world wherever possible. For example, the [quick swap sanity test](https://github.com/tgstation/tgstation/blob/e416283f162b86345a8623125ab866839b1ac40d/code/modules/unit_tests/quick_swap_sanity.dm) emulates a *real* scenario of the bug it fixed occurring by creating a character and giving it real items. The unrecommended alternative would be to create special test-only items. This isn't a hard rule, the [reagent method exposure tests](https://github.com/tgstation/tgstation/blob/e416283f162b86345a8623125ab866839b1ac40d/code/modules/unit_tests/reagent_mod_expose.dm) create a test-only reagent for example, but do keep it in mind. + +Unit tests should also be just that--testing *units* of code. For example, instead of having one massive test for reagents, there are instead several smaller tests for testing exposure, metabolization, etc. + +## The unit testing API + +You can find more information about all of these from their respective doc comments, but for a brief overview: + +`/datum/unit_test` - The base for all tests to be ran. Subtypes must override `Run()`. `New()` and `Destroy()` can be used for setup and teardown. To fail, use `TEST_FAIL(reason)`. + +`/datum/unit_test/proc/allocate(type, ...)` - Allocates an instance of the provided type with the given arguments. Is automatically destroyed when the test is over. Commonly seen in the form of `var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human)`. + +`TEST_FAIL(reason)` - Marks a failure at this location, but does not stop the test. + +`TEST_ASSERT(assertion, reason)` - Stops the unit test and fails if the assertion is not met. For example: `TEST_ASSERT(powered(), "Machine is not powered")`. + +`TEST_ASSERT_NOTNULL(a, message)` - Same as `TEST_ASSERT`, but checks if `!isnull(a)`. For example: `TEST_ASSERT_NOTNULL(myatom, "My atom was never set!")`. + +`TEST_ASSERT_NULL(a, message)` - Same as `TEST_ASSERT`, but checks if `isnull(a)`. If not, gives a helpful message showing what `a` was. For example: `TEST_ASSERT_NULL(delme, "Delme was never cleaned up!")`. + +`TEST_ASSERT_EQUAL(a, b, message)` - Same as `TEST_ASSERT`, but checks if `a == b`. If not, gives a helpful message showing what both `a` and `b` were. For example: `TEST_ASSERT_EQUAL(2 + 2, 4, "The universe is falling apart before our eyes!")`. + +`TEST_ASSERT_NOTEQUAL(a, b, message)` - Same as `TEST_ASSERT_EQUAL`, but reversed. + +`TEST_FOCUS(test_path)` - *Only* run the test provided within the parameters. Useful for reducing noise. For example, if we only want to run our example square test, we can add `TEST_FOCUS(/datum/unit_test/square)`. Should *never* be pushed in a pull request--you will be laughed at. + +## Final Notes + +- Writing tests before you attempt to fix the bug can actually speed up development a lot! It means you don't have to go in game and folllow the same exact steps manually every time. This process is known as "TDD" (test driven development). Write the test first, make sure it fails, *then* start work on the fix/feature, and you'll know you're done when your tests pass. If you do try this, do make sure to confirm in a non-testing environment just to double check. +- Make sure that your tests don't accidentally call RNG functions like `prob`. Since RNG is seeded during tests, you may not realize you have until someone else makes a PR and the tests fail! +- Do your best not to change the behavior of non-testing code during tests. While it may sometimes be necessary in the case of situations such as the above, it is still a slippery slope that can lead to the code you're testing being too different from the production environment to be useful. diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 54dd0695520e..19adab750a48 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -3,17 +3,38 @@ #ifdef UNIT_TESTS +/// For advanced cases, fail unconditionally but don't return (so a test can return multiple results) +#define TEST_FAIL(reason) (Fail(reason || "No reason", __FILE__, __LINE__)) + /// Asserts that a condition is true /// If the condition is not true, fails the test -#define TEST_ASSERT(assertion, reason) if (!(assertion)) { return Fail("Assertion failed: [reason || "No reason"]") } +#define TEST_ASSERT(assertion, reason) if (!(assertion)) { return Fail("Assertion failed: [reason || "No reason"]", __FILE__, __LINE__) } + +/// Asserts that a parameter is not null +#define TEST_ASSERT_NOTNULL(a, reason) if (isnull(a)) { return Fail("Expected non-null value: [reason || "No reason"]", __FILE__, __LINE__) } + +/// Asserts that a parameter is null +#define TEST_ASSERT_NULL(a, reason) if (!isnull(a)) { return Fail("Expected null value but received [a]: [reason || "No reason"]", __FILE__, __LINE__) } /// Asserts that the two parameters passed are equal, fails otherwise /// Optionally allows an additional message in the case of a failure -#define TEST_ASSERT_EQUAL(a, b, message) if ((a) != (b)) { return Fail("Expected [isnull(a) ? "null" : a] to be equal to [isnull(b) ? "null" : b].[message ? " [message]" : ""]") } +#define TEST_ASSERT_EQUAL(a, b, message) do { \ + var/lhs = ##a; \ + var/rhs = ##b; \ + if (lhs != rhs) { \ + return Fail("Expected [isnull(lhs) ? "null" : lhs] to be equal to [isnull(rhs) ? "null" : rhs].[message ? " [message]" : ""]", __FILE__, __LINE__); \ + } \ +} while (FALSE) /// Asserts that the two parameters passed are not equal, fails otherwise /// Optionally allows an additional message in the case of a failure -#define TEST_ASSERT_NOTEQUAL(a, b, message) if ((a) == (b)) { return Fail("Expected [isnull(a) ? "null" : a] to not be equal to [isnull(b) ? "null" : b].[message ? " [message]" : ""]") } +#define TEST_ASSERT_NOTEQUAL(a, b, message) do { \ + var/lhs = ##a; \ + var/rhs = ##b; \ + if (lhs == rhs) { \ + return Fail("Expected [isnull(lhs) ? "null" : lhs] to not be equal to [isnull(rhs) ? "null" : rhs].[message ? " [message]" : ""]", __FILE__, __LINE__); \ + } \ +} while (FALSE) /// *Only* run the test provided within the parentheses /// This is useful for debugging when you want to reduce noise, but should never be pushed @@ -28,6 +49,19 @@ #define TEST_DEFAULT 1 #define TEST_DEL_WORLD INFINITY +/// Change color to red on ANSI terminal output, if enabled with -DANSICOLORS. +#ifdef ANSICOLORS +#define TEST_OUTPUT_RED(text) "\x1B\x5B1;31m[text]\x1B\x5B0m" +#else +#define TEST_OUTPUT_RED(text) (text) +#endif +/// Change color to green on ANSI terminal output, if enabled with -DANSICOLORS. +#ifdef ANSICOLORS +#define TEST_OUTPUT_GREEN(text) "\x1B\x5B1;32m[text]\x1B\x5B0m" +#else +#define TEST_OUTPUT_GREEN(text) (text) +#endif + #include "anchored_mobs.dm" #include "autowiki.dm" #include "bespoke_id.dm" @@ -35,10 +69,11 @@ #include "combat.dm" #include "component_tests.dm" #include "connect_loc.dm" -#include "emoting.dm" #include "create_and_destroy.dm" +#include "emoting.dm" #include "keybinding_init.dm" #include "machine_disassembly.dm" +#include "merge_type.dm" #include "outfit_sanity.dm" #include "open_air.dm" #include "overmap.dm" @@ -51,17 +86,21 @@ #include "reagent_id_typos.dm" #include "reagent_mod_expose.dm" #include "reagent_mod_procs.dm" +#include "reagent_names.dm" #include "reagent_recipe_collisions.dm" #include "resist.dm" #include "say.dm" #include "serving_tray.dm" #include "ship_placement.dm" #include "spawn_humans.dm" +#include "species_unique_id.dm" #include "species_whitelists.dm" +#include "stack_singular_name.dm" #include "subsystem_init.dm" +#include "subsystem_metric_sanity.dm" #include "supply_pack.dm" +#include "surgeries.dm" #include "teleporters.dm" -#include "subsystem_metric_sanity.dm" #include "timer_sanity.dm" #include "unit_test.dm" diff --git a/code/modules/unit_tests/anchored_mobs.dm b/code/modules/unit_tests/anchored_mobs.dm index 103b97e7a993..88487ea2b8d7 100644 --- a/code/modules/unit_tests/anchored_mobs.dm +++ b/code/modules/unit_tests/anchored_mobs.dm @@ -4,6 +4,4 @@ var/mob/M = i if(initial(M.anchored)) L += "[i]" - if(!L.len) - return //passed! - Fail("The following mobs are defined as anchored. This is incompatible with the new move force/resist system and needs to be revised.: [L.Join(" ")]") + TEST_ASSERT(!L.len, "The following mobs are defined as anchored. This is incompatible with the new move force/resist system and needs to be revised.: [L.Join(" ")]") diff --git a/code/modules/unit_tests/bespoke_id.dm b/code/modules/unit_tests/bespoke_id.dm index 06676c626c7e..e1356650ded2 100644 --- a/code/modules/unit_tests/bespoke_id.dm +++ b/code/modules/unit_tests/bespoke_id.dm @@ -5,4 +5,4 @@ for(var/i in subtypesof(/datum/element)) var/datum/element/faketype = i if((initial(faketype.element_flags) & ELEMENT_BESPOKE) && initial(faketype.id_arg_index) == base_index) - Fail("A bespoke element was not configured with a proper id_arg_index: [faketype]") + TEST_FAIL("A bespoke element was not configured with a proper id_arg_index: [faketype]") diff --git a/code/modules/unit_tests/component_tests.dm b/code/modules/unit_tests/component_tests.dm index 0099d7508c5d..f609e73c4b72 100644 --- a/code/modules/unit_tests/component_tests.dm +++ b/code/modules/unit_tests/component_tests.dm @@ -8,5 +8,5 @@ var/dupe_type = initial(comp.dupe_type) if(dupe_type && !ispath(dupe_type)) bad_dts += t - if(length(bad_dms) || length(bad_dts)) - Fail("Components with invalid dupe modes: ([bad_dms.Join(",")]) ||| Components with invalid dupe types: ([bad_dts.Join(",")])") + TEST_ASSERT(!length(bad_dms) && !length(bad_dts), + "Components with invalid dupe modes: ([bad_dms.Join(",")]) ||| Components with invalid dupe types: ([bad_dts.Join(",")])") diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 6e2e1e1131d4..107f2aa3caef 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -115,7 +115,7 @@ //We change it back to prevent baseturfs stacking and hitting the limit spawn_at.ChangeTurf(original_turf_type, original_baseturfs) if(original_baseturf_count != length(spawn_at.baseturfs)) - Fail("[type_path] changed the amount of baseturfs from [original_baseturf_count] to [length(spawn_at.baseturfs)]; [english_list(original_baseturfs)] to [islist(spawn_at.baseturfs) ? english_list(spawn_at.baseturfs) : spawn_at.baseturfs]") + TEST_FAIL("[type_path] changed the amount of baseturfs from [original_baseturf_count] to [length(spawn_at.baseturfs)]; [english_list(original_baseturfs)] to [islist(spawn_at.baseturfs) ? english_list(spawn_at.baseturfs) : spawn_at.baseturfs]") //Warn if it changes again original_baseturfs = islist(spawn_at.baseturfs) ? spawn_at.baseturfs.Copy() : spawn_at.baseturfs original_baseturf_count = length(original_baseturfs) @@ -179,7 +179,7 @@ break if(world.time > start_time + time_needed + 30 MINUTES) //If this gets us gitbanned I'm going to laugh so hard - Fail("Something has gone horribly wrong, the garbage queue has been processing for well over 30 minutes. What the hell did you do") + TEST_FAIL("Something has gone horribly wrong, the garbage queue has been processing for well over 30 minutes. What the hell did you do") break //Immediately fire the gc right after @@ -192,21 +192,21 @@ for(var/path in cache_for_sonic_speed) var/datum/qdel_item/item = cache_for_sonic_speed[path] if(item.failures) - Fail("[item.name] hard deleted [item.failures] times out of a total del count of [item.qdels]") + TEST_FAIL("[item.name] hard deleted [item.failures] times out of a total del count of [item.qdels]") if(item.no_respect_force) - Fail("[item.name] failed to respect force deletion [item.no_respect_force] times out of a total del count of [item.qdels]") + TEST_FAIL("[item.name] failed to respect force deletion [item.no_respect_force] times out of a total del count of [item.qdels]") if(item.no_hint) - Fail("[item.name] failed to return a qdel hint [item.no_hint] times out of a total del count of [item.qdels]") + TEST_FAIL("[item.name] failed to return a qdel hint [item.no_hint] times out of a total del count of [item.qdels]") cache_for_sonic_speed = SSatoms.BadInitializeCalls for(var/path in cache_for_sonic_speed) var/fails = cache_for_sonic_speed[path] if(fails & BAD_INIT_NO_HINT) - Fail("[path] didn't return an Initialize hint") + TEST_FAIL("[path] didn't return an Initialize hint") if(fails & BAD_INIT_QDEL_BEFORE) - Fail("[path] qdel'd in New()") + TEST_FAIL("[path] qdel'd in New()") if(fails & BAD_INIT_SLEPT) - Fail("[path] slept during Initialize()") + TEST_FAIL("[path] slept during Initialize()") SSticker.delay_end = FALSE //This shouldn't be needed, but let's be polite diff --git a/code/modules/unit_tests/keybinding_init.dm b/code/modules/unit_tests/keybinding_init.dm index 2bd2fdee1e2e..c9d17f688afd 100644 --- a/code/modules/unit_tests/keybinding_init.dm +++ b/code/modules/unit_tests/keybinding_init.dm @@ -3,4 +3,4 @@ var/datum/keybinding/KB = i if(initial(KB.keybind_signal) || !initial(KB.name)) continue - Fail("[KB.name] does not have a keybind signal defined.") + TEST_FAIL("[KB.name] does not have a keybind signal defined.") diff --git a/code/modules/unit_tests/merge_type.dm b/code/modules/unit_tests/merge_type.dm new file mode 100644 index 000000000000..5b5a81bba285 --- /dev/null +++ b/code/modules/unit_tests/merge_type.dm @@ -0,0 +1,14 @@ +/datum/unit_test/merge_type/Run() + var/list/blacklist = list(/obj/item/stack/sheet, + /obj/item/stack/sheet/mineral, + /obj/item/stack/ore, + /obj/item/stack/license_plates, + /obj/item/stack/tile/mineral, + /obj/item/stack/tile) + + var/list/paths = subtypesof(/obj/item/stack) - blacklist + + for(var/stackpath in paths) + var/obj/item/stack/stack = stackpath + if(!initial(stack.merge_type)) + TEST_FAIL("([stack]) lacks set merge_type variable!") diff --git a/code/modules/unit_tests/outfit_sanity.dm b/code/modules/unit_tests/outfit_sanity.dm index ef41539c9019..fee653cd626f 100644 --- a/code/modules/unit_tests/outfit_sanity.dm +++ b/code/modules/unit_tests/outfit_sanity.dm @@ -1,8 +1,9 @@ #define CHECK_OUTFIT_SLOT(outfit_key, slot_name) if (outfit.##outfit_key) { \ H.equip_to_slot_or_del(new outfit.##outfit_key(H), ##slot_name, TRUE); \ /* We don't check the result of equip_to_slot_or_del because it returns false for random jumpsuits, as they delete themselves on init */ \ - if (!H.get_item_by_slot(##slot_name)) { \ - Fail("[outfit.name]'s [#outfit_key] is invalid!"); \ + var/obj/item/outfit_item = H.get_item_by_slot(##slot_name); \ + if (!outfit_item) { \ + TEST_FAIL("[outfit.name]'s [#outfit_key] is invalid! Could not equip a [outfit.##outfit_key] into that slot."); \ } \ } @@ -56,6 +57,6 @@ var/number = backpack_contents[path] || 1 for (var/_ in 1 to number) if (!H.equip_to_slot_or_del(new path(H), ITEM_SLOT_BACKPACK, TRUE)) - Fail("[outfit.name]'s backpack_contents are invalid! Couldn't add [path] to backpack.") + TEST_FAIL("[outfit.name]'s backpack_contents are invalid! Couldn't add [path] to backpack.") #undef CHECK_OUTFIT_SLOT diff --git a/code/modules/unit_tests/plantgrowth_tests.dm b/code/modules/unit_tests/plantgrowth_tests.dm index 15c56a12ec1d..daff6cccb8c2 100644 --- a/code/modules/unit_tests/plantgrowth_tests.dm +++ b/code/modules/unit_tests/plantgrowth_tests.dm @@ -16,11 +16,11 @@ for(var/i in 1 to seed.growthstages) if("[seed.icon_grow][i]" in states) continue - Fail("[seed.name] ([seed.type]) lacks the [seed.icon_grow][i] icon!") + TEST_FAIL("[seed.name] ([seed.type]) lacks the [seed.icon_grow][i] icon!") if(!(seed.icon_dead in states)) - Fail("[seed.name] ([seed.type]) lacks the [seed.icon_dead] icon!") + TEST_FAIL("[seed.name] ([seed.type]) lacks the [seed.icon_dead] icon!") if(seed.icon_harvest) // mushrooms have no grown sprites, same for items with no product if(!(seed.icon_harvest in states)) - Fail("[seed.name] ([seed.type]) lacks the [seed.icon_harvest] icon!") + TEST_FAIL("[seed.name] ([seed.type]) lacks the [seed.icon_harvest] icon!") diff --git a/code/modules/unit_tests/projectiles.dm b/code/modules/unit_tests/projectiles.dm index 06a8fb0780a9..4950be10c1a6 100644 --- a/code/modules/unit_tests/projectiles.dm +++ b/code/modules/unit_tests/projectiles.dm @@ -2,4 +2,26 @@ for(var/path in typesof(/obj/projectile)) var/obj/projectile/projectile = path if(initial(projectile.movement_type) & PHASING) - Fail("[path] has default movement type PHASING. Piercing projectiles should be done using the projectile piercing system, not movement_types!") + TEST_FAIL("[path] has default movement type PHASING. Piercing projectiles should be done using the projectile piercing system, not movement_types!") + +/datum/unit_test/gun_go_bang/Run() + // test is for a ballistic gun that starts loaded + chambered + var/obj/item/gun/test_gun = allocate(/obj/item/gun/ballistic/automatic/pistol) + var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human) + var/mob/living/carbon/human/gunner = allocate(/mob/living/carbon/human) + ADD_TRAIT(victim, TRAIT_PIERCEIMMUNE, INNATE_TRAIT) // So the human isn't randomly affected by shrapnel + + var/obj/item/ammo_casing/loaded_casing = test_gun.chambered + TEST_ASSERT(loaded_casing, "Gun started without round chambered, should be loaded") + var/obj/projectile/loaded_bullet = loaded_casing.BB + TEST_ASSERT(loaded_bullet, "Ammo casing has no loaded bullet") + + gunner.put_in_hands(test_gun, forced=TRUE) + var/expected_damage = loaded_bullet.damage + loaded_bullet.def_zone = BODY_ZONE_CHEST + var/did_we_shoot = test_gun.afterattack(victim, gunner) + TEST_ASSERT(did_we_shoot, "Gun does not appeared to have successfully fired.") + TEST_ASSERT_EQUAL(victim.getBruteLoss(), expected_damage, "Victim took incorrect amount of damage, expected [expected_damage], got [victim.getBruteLoss()].") + + var/obj/item/bodypart/expected_part = victim.get_bodypart(BODY_ZONE_CHEST) + TEST_ASSERT_EQUAL(expected_part.brute_dam, expected_damage, "Intended bodypart took incorrect amount of damage, either it hit another bodypart or armor was incorrectly applied. Expected [expected_damage], got [expected_part.brute_dam].") diff --git a/code/modules/unit_tests/rcd.dm b/code/modules/unit_tests/rcd.dm index 989ac8c3b9c5..b65d02312a78 100644 --- a/code/modules/unit_tests/rcd.dm +++ b/code/modules/unit_tests/rcd.dm @@ -19,8 +19,7 @@ var/list/adjacent_turfs = get_adjacent_open_turfs(engineer) - if(!length(adjacent_turfs)) - Fail("RCD Test failed - Lack of adjacent open turfs. This may be an issue with the unit test.") + TEST_ASSERT(length(adjacent_turfs), "RCD Test failed - Lack of adjacent open turfs. This may be an issue with the unit test.") var/turf/adjacent_turf = adjacent_turfs[1] diff --git a/code/modules/unit_tests/reagent_id_typos.dm b/code/modules/unit_tests/reagent_id_typos.dm index d6548852fa52..f85834999962 100644 --- a/code/modules/unit_tests/reagent_id_typos.dm +++ b/code/modules/unit_tests/reagent_id_typos.dm @@ -11,4 +11,4 @@ var/datum/chemical_reaction/R = V for(var/id in (R.required_reagents + R.required_catalysts)) if(!GLOB.chemical_reagents_list[id]) - Fail("Unknown chemical id \"[id]\" in recipe [R.type]") + TEST_FAIL("Unknown chemical id \"[id]\" in recipe [R.type]") diff --git a/code/modules/unit_tests/reagent_names.dm b/code/modules/unit_tests/reagent_names.dm new file mode 100644 index 000000000000..b7a690e93485 --- /dev/null +++ b/code/modules/unit_tests/reagent_names.dm @@ -0,0 +1,15 @@ +/// Test that all reagent names are different in order to prevent #65231 +/datum/unit_test/reagent_names + +/datum/unit_test/reagent_names/Run() + var/used_names = list() + + for (var/datum/reagent/reagent as anything in subtypesof(/datum/reagent)) + var/name = initial(reagent.name) + if (!name) + continue + + if (name in used_names) + TEST_FAIL("[used_names[name]] shares a name with [reagent] ([name])") + else + used_names[name] = reagent diff --git a/code/modules/unit_tests/reagent_recipe_collisions.dm b/code/modules/unit_tests/reagent_recipe_collisions.dm index 20e875422f29..b75a17a7e73c 100644 --- a/code/modules/unit_tests/reagent_recipe_collisions.dm +++ b/code/modules/unit_tests/reagent_recipe_collisions.dm @@ -12,4 +12,4 @@ var/datum/chemical_reaction/r1 = reactions[i] var/datum/chemical_reaction/r2 = reactions[i2] if(chem_recipes_do_conflict(r1, r2)) - Fail("Chemical recipe conflict between [r1.type] and [r2.type]") + TEST_FAIL("Chemical recipe conflict between [r1.type] and [r2.type]") diff --git a/code/modules/unit_tests/say.dm b/code/modules/unit_tests/say.dm index db686aa7db8f..d3fa6e6cdfc7 100644 --- a/code/modules/unit_tests/say.dm +++ b/code/modules/unit_tests/say.dm @@ -19,5 +19,5 @@ TEST_ASSERT_EQUAL(mods[mod_key], expected_mods[mod_key], "The value for [mod_key] was not what we expected. Message: [message]") expected_mods -= mod_key - if (expected_mods.len) - Fail("Some message mods were expected, but were not returned by get_message_mods: [json_encode(expected_mods)]. Message: [message]") + TEST_ASSERT(!expected_mods.len, + "Some message mods were expected, but were not returned by get_message_mods: [json_encode(expected_mods)]. Message: [message]") diff --git a/code/modules/unit_tests/species_unique_id.dm b/code/modules/unit_tests/species_unique_id.dm new file mode 100644 index 000000000000..d9fc2f288c91 --- /dev/null +++ b/code/modules/unit_tests/species_unique_id.dm @@ -0,0 +1,14 @@ +/** + * Every species should use a species ID unique to it and it alone. This test runs through every subtype of /datum/species, and checks for a species ID. + * Every ID is written to a list, gathered_species_ids, and if a previously written ID is written again, this test will fail. + */ +/datum/unit_test/species_unique_id + +/datum/unit_test/species_unique_id/Run() + var/list/gathered_species_ids = list() + for(var/datum/species/species as anything in subtypesof(/datum/species)) + var/species_id = initial(species.id) + if(gathered_species_ids[species_id]) + TEST_FAIL("Duplicate species ID! [species_id] is not unique to a single species.") + else + gathered_species_ids[species_id] = TRUE diff --git a/code/modules/unit_tests/species_whitelists.dm b/code/modules/unit_tests/species_whitelists.dm index 145f3a259fc2..ec05d0cf9f8f 100644 --- a/code/modules/unit_tests/species_whitelists.dm +++ b/code/modules/unit_tests/species_whitelists.dm @@ -2,4 +2,4 @@ for(var/typepath in subtypesof(/datum/species)) var/datum/species/S = typepath if(initial(S.changesource_flags) == NONE) - Fail("A species type was detected with no changesource flags: [S]") + TEST_FAIL("A species type was detected with no changesource flags: [S]") diff --git a/code/modules/unit_tests/stack_singular_name.dm b/code/modules/unit_tests/stack_singular_name.dm new file mode 100644 index 000000000000..739efb54d6a4 --- /dev/null +++ b/code/modules/unit_tests/stack_singular_name.dm @@ -0,0 +1,18 @@ +/** + * Goes through every subtype of /obj/item/stack to check for a singular name, var/singular_name. + * Everything within the blacklist does not need to be tested because it exists to be overriden. + * This test will fail if a subtype of /obj/item/stack is missing a singular name. + */ +/datum/unit_test/stack_singular_name + +/datum/unit_test/stack_singular_name/Run() + var/list/blacklist = list( // all of these are generally parents that exist to be overriden; ex. /obj/item/stack/license_plates exists to branch into /filled and /empty + /obj/item/stack/sheet, + /obj/item/stack/sheet/mineral, + /obj/item/stack/license_plates, + /obj/item/stack/sheet/animalhide, + ) + + for(var/obj/item/stack/stack_check as anything in subtypesof(/obj/item/stack) - blacklist) + if(!initial(stack_check.singular_name)) + TEST_FAIL("[stack_check] is missing a singular name!") diff --git a/code/modules/unit_tests/subsystem_init.dm b/code/modules/unit_tests/subsystem_init.dm index 7d5473bc1bb7..c377302ba6a1 100644 --- a/code/modules/unit_tests/subsystem_init.dm +++ b/code/modules/unit_tests/subsystem_init.dm @@ -4,4 +4,4 @@ if(ss.flags & SS_NO_INIT) continue if(!ss.initialized) - Fail("[ss]([ss.type]) is a subsystem meant to initialize but doesn't get set as initialized.") + TEST_FAIL("[ss]([ss.type]) is a subsystem meant to initialize but doesn't get set as initialized.") diff --git a/code/modules/unit_tests/surgeries.dm b/code/modules/unit_tests/surgeries.dm new file mode 100644 index 000000000000..f4f96a3b9f28 --- /dev/null +++ b/code/modules/unit_tests/surgeries.dm @@ -0,0 +1,120 @@ +/datum/unit_test/amputation/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human) + var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) + + TEST_ASSERT_EQUAL(patient.get_missing_limbs().len, 0, "Patient is somehow missing limbs before surgery") + + var/datum/surgery/amputation/surgery = new(patient, BODY_ZONE_R_ARM, patient.get_bodypart(BODY_ZONE_R_ARM)) + + var/datum/surgery_step/sever_limb/sever_limb = new + sever_limb.success(user, patient, BODY_ZONE_R_ARM, null, surgery) + + TEST_ASSERT_EQUAL(patient.get_missing_limbs().len, 1, "Patient did not lose any limbs") + TEST_ASSERT_EQUAL(patient.get_missing_limbs()[1], BODY_ZONE_R_ARM, "Patient is missing a limb that isn't the one we operated on") + +/datum/unit_test/brain_surgery/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human) + patient.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_SURGERY) + patient.setOrganLoss(ORGAN_SLOT_BRAIN, 20) + + TEST_ASSERT(patient.has_trauma_type(), "Patient does not have any traumas, despite being given one") + + var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) + + var/datum/surgery_step/fix_brain/fix_brain = new + fix_brain.success(user, patient) + + TEST_ASSERT(!patient.has_trauma_type(), "Patient kept their brain trauma after brain surgery") + TEST_ASSERT(patient.getOrganLoss(ORGAN_SLOT_BRAIN) < 20, "Patient did not heal their brain damage after brain surgery") + +/datum/unit_test/head_transplant/Run() + var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) + var/mob/living/carbon/human/alice = allocate(/mob/living/carbon/human) + var/mob/living/carbon/human/bob = allocate(/mob/living/carbon/human) + + alice.fully_replace_character_name(null, "Alice") + bob.fully_replace_character_name(null, "Bob") + + var/obj/item/bodypart/head/alices_head = alice.get_bodypart(BODY_ZONE_HEAD) + alices_head.drop_limb() + + var/obj/item/bodypart/head/bobs_head = bob.get_bodypart(BODY_ZONE_HEAD) + bobs_head.drop_limb() + + TEST_ASSERT_EQUAL(alice.get_bodypart(BODY_ZONE_HEAD), null, "Alice still has a head after dismemberment") + TEST_ASSERT_EQUAL(alice.get_visible_name(), "Unknown", "Alice's head was dismembered, but they are not Unknown") + + TEST_ASSERT_EQUAL(bobs_head.real_name, "Bob", "Bob's head does not remember that it is from Bob") + + // Put Bob's head onto Alice's body + var/datum/surgery_step/add_prosthetic/add_prosthetic = new + user.put_in_active_hand(bobs_head) + add_prosthetic.success(user, alice, BODY_ZONE_HEAD, bobs_head) + + TEST_ASSERT(!isnull(alice.get_bodypart(BODY_ZONE_HEAD)), "Alice has no head after prosthetic replacement") + TEST_ASSERT_EQUAL(alice.get_visible_name(), "Bob", "Bob's head was transplanted onto Alice's body, but their name is not Bob") + +/datum/unit_test/multiple_surgeries/Run() + var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) + var/mob/living/carbon/human/patient_zero = allocate(/mob/living/carbon/human) + var/mob/living/carbon/human/patient_one = allocate(/mob/living/carbon/human) + + var/obj/item/scalpel/scalpel = allocate(/obj/item/scalpel) + + var/datum/surgery_step/incise/surgery_step = new + var/datum/surgery/organ_manipulation/surgery_for_zero = new + + INVOKE_ASYNC(surgery_step, /datum/surgery_step/proc/initiate, user, patient_zero, BODY_ZONE_CHEST, scalpel, surgery_for_zero) + TEST_ASSERT(surgery_for_zero.step_in_progress, "Surgery on patient zero was not initiated") + + var/datum/surgery/organ_manipulation/surgery_for_one = new + + // Without waiting for the incision to complete, try to start a new surgery + TEST_ASSERT(!surgery_step.initiate(user, patient_one, BODY_ZONE_CHEST, scalpel, surgery_for_one), "Was allowed to start a second surgery without the rod of asclepius") + TEST_ASSERT(!surgery_for_one.step_in_progress, "Surgery for patient one is somehow in progress, despite not initiating") + + user.apply_status_effect(STATUS_EFFECT_HIPPOCRATIC_OATH) + INVOKE_ASYNC(surgery_step, /datum/surgery_step/proc/initiate, user, patient_one, BODY_ZONE_CHEST, scalpel, surgery_for_one) + TEST_ASSERT(surgery_for_one.step_in_progress, "Surgery on patient one was not initiated, despite having rod of asclepius") + +/// Ensures that the tend wounds surgery can be started +/datum/unit_test/start_tend_wounds + +/datum/unit_test/start_tend_wounds/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human) + var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) + + var/datum/surgery/surgery = new /datum/surgery/healing/brute/basic + + if (!surgery.can_start(user, patient)) + TEST_FAIL("Can't start basic tend wounds!") + + qdel(surgery) + +/datum/unit_test/tend_wounds/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human) + patient.take_overall_damage(100, 100) + + var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) + + // Test that tending wounds actually lowers damage + var/datum/surgery_step/heal/brute/basic/basic_brute_heal = new + basic_brute_heal.success(user, patient, BODY_ZONE_CHEST) + TEST_ASSERT(patient.getBruteLoss() < 100, "Tending brute wounds didn't lower brute damage ([patient.getBruteLoss()])") + + var/datum/surgery_step/heal/burn/basic/basic_burn_heal = new + basic_burn_heal.success(user, patient, BODY_ZONE_CHEST) + TEST_ASSERT(patient.getFireLoss() < 100, "Tending burn wounds didn't lower burn damage ([patient.getFireLoss()])") + + // Test that wearing clothing lowers heal amount + var/mob/living/carbon/human/naked_patient = allocate(/mob/living/carbon/human) + naked_patient.take_overall_damage(100) + + var/mob/living/carbon/human/clothed_patient = allocate(/mob/living/carbon/human) + clothed_patient.equipOutfit(/datum/outfit/job/doctor, TRUE) + clothed_patient.take_overall_damage(100) + + basic_brute_heal.success(user, naked_patient, BODY_ZONE_CHEST) + basic_brute_heal.success(user, clothed_patient, BODY_ZONE_CHEST) + + TEST_ASSERT(naked_patient.getBruteLoss() < clothed_patient.getBruteLoss(), "Naked patient did not heal more from wounds tending than a clothed patient") diff --git a/code/modules/unit_tests/timer_sanity.dm b/code/modules/unit_tests/timer_sanity.dm index d92323a5253f..dbdf3f6d8e8d 100644 --- a/code/modules/unit_tests/timer_sanity.dm +++ b/code/modules/unit_tests/timer_sanity.dm @@ -1,3 +1,3 @@ /datum/unit_test/timer_sanity/Run() - if(SStimer.bucket_count < 0) - Fail("SStimer is going into negative bucket count from something") + TEST_ASSERT(SStimer.bucket_count >= 0, + "SStimer is going into negative bucket count from something") diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm index b8ca1ea6f146..5104acb1d19d 100644 --- a/code/modules/unit_tests/unit_test.dm +++ b/code/modules/unit_tests/unit_test.dm @@ -3,7 +3,7 @@ Usage: Override /Run() to run your test code -Call Fail() to fail the test (You should specify a reason) +Call TEST_FAIL() to fail the test (You should specify a reason) You may use /New() and /Destroy() for setup/teardown respectively @@ -63,15 +63,15 @@ GLOBAL_VAR(test_log) return ..() /datum/unit_test/proc/Run() - Fail("Run() called parent or not implemented") + TEST_FAIL("Run() called parent or not implemented") -/datum/unit_test/proc/Fail(reason = "No reason") +/datum/unit_test/proc/Fail(reason = "No reason", file = "OUTDATED_TEST", line = 1) succeeded = FALSE if(!istext(reason)) reason = "FORMATTED: [reason != null ? reason : "NULL"]" - LAZYADD(fail_reasons, reason) + LAZYADD(fail_reasons, list(list(reason, file, line))) /// Allocates an instance of the provided type, and places it somewhere in an available loc /// Instances allocated through this proc will be destroyed when the test is over @@ -97,11 +97,22 @@ GLOBAL_VAR(test_log) GLOB.current_test = null GLOB.failed_any_test |= !test.succeeded - var/list/log_entry = list("[test.succeeded ? "PASS" : "FAIL"]: [test_path] [duration / 10]s") + var/list/log_entry = list( + "[test.succeeded ? TEST_OUTPUT_GREEN("PASS") : TEST_OUTPUT_RED("FAIL")]: [test_path] [duration / 10]s", + ) var/list/fail_reasons = test.fail_reasons - for(var/J in 1 to LAZYLEN(fail_reasons)) - log_entry += "\tREASON #[J]: [fail_reasons[J]]" + for(var/reasonID in 1 to LAZYLEN(fail_reasons)) + var/text = fail_reasons[reasonID][1] + var/file = fail_reasons[reasonID][2] + var/line = fail_reasons[reasonID][3] + + /// Github action annotation. + log_world("::error file=[file],line=[line],title=[test_path]::[text]") + + // Normal log message + log_entry += "\tREASON #[reasonID]: [text] at [file]:[line]" + var/message = log_entry.Join("\n") log_test(message) From 7c6af65573f70cca74c369c572d7a313551c28f2 Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Mon, 2 Jan 2023 13:07:22 -0800 Subject: [PATCH 055/147] Keeps gc_destroyed from getting updated on every step thru the gc queue. (#72401) Keeps gc_destroyed from getting updated on every step thru the gc queue. Fixes logic that assumed gc_destroyed is the time the object first qdel'ed. it used to get updated on each stage of the garbage controller and there are 3 stages. Added list index defines for the inner gc item list. --- code/__DEFINES/qdel.dm | 7 +++++++ code/controllers/subsystem/garbage.dm | 17 ++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/code/__DEFINES/qdel.dm b/code/__DEFINES/qdel.dm index d6a08b3174f8..86c3ad465250 100644 --- a/code/__DEFINES/qdel.dm +++ b/code/__DEFINES/qdel.dm @@ -30,6 +30,13 @@ #define GC_QUEUE_HARDDELETE 3 //! short queue for things that hard delete instead of going thru the gc subsystem, this is purely so if they *can* softdelete, they will soft delete rather then wasting time with a hard delete. #define GC_QUEUE_COUNT 3 //! Number of queues, used for allocating the nested lists. Don't forget to increase this if you add a new queue stage + +// Defines for the ssgarbage queue items +#define GC_QUEUE_ITEM_QUEUE_TIME 1 //! Time this item entered the queue +#define GC_QUEUE_ITEM_REF 2 //! Ref to the item +#define GC_QUEUE_ITEM_GCD_DESTROYED 3 //! Item's gc_destroyed var value. Used to detect ref reuse. +#define GC_QUEUE_ITEM_INDEX_COUNT 3 //! Number of item indexes, used for allocating the nested lists. Don't forget to increase this if you add a new queue item index + // Defines for the time an item has to get its reference cleaned before it fails the queue and moves to the next. #define GC_FILTER_QUEUE 1 SECONDS #define GC_CHECK_QUEUE 5 MINUTES diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index 02434e72d72b..895a8c1685fc 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -171,18 +171,19 @@ SUBSYSTEM_DEF(garbage) //Normally this isn't expensive, but the gc queue can grow to 40k items, and that gets costly/causes overrun. for (var/i in 1 to length(queue)) var/list/L = queue[i] - if (length(L) < 2) + if (length(L) < GC_QUEUE_ITEM_INDEX_COUNT) count++ if (MC_TICK_CHECK) return continue - var/GCd_at_time = L[1] - if(GCd_at_time > cut_off_time) + var/queued_at_time = L[GC_QUEUE_ITEM_QUEUE_TIME] + var/GCd_at_time = L[GC_QUEUE_ITEM_GCD_DESTROYED] + if(queued_at_time > cut_off_time) break // Everything else is newer, skip them count++ - var/refID = L[2] + var/refID = L[GC_QUEUE_ITEM_REF] var/datum/D D = locate(refID) @@ -255,13 +256,15 @@ SUBSYSTEM_DEF(garbage) if (level > GC_QUEUE_COUNT) HardDelete(D, TRUE) return - var/gctime = world.time + var/queue_time = world.time + var/refid = "\ref[D]" + if (D.gc_destroyed <= 0) + D.gc_destroyed = queue_time - D.gc_destroyed = gctime var/list/queue = queues[level] - queue[++queue.len] = list(gctime, refid) // not += for byond reasons + queue[++queue.len] = list(queue_time, refid, D.gc_destroyed) // not += for byond reasons //this is mainly to separate things profile wise. /datum/controller/subsystem/garbage/proc/HardDelete(datum/D, force) From 7d6c6825457772640f20eacd90165e6e59b7868b Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 22 Jul 2023 12:38:45 -0500 Subject: [PATCH 056/147] fixes new tests and more harddel fixes --- code/_compile_options.dm | 2 +- code/datums/status_effects/buffs.dm | 2 +- code/game/atoms.dm | 2 +- .../game/objects/items/devices/polycircuit.dm | 1 + .../objects/items/stacks/license_plates.dm | 9 +- .../items/stacks/sheets/sheet_types.dm | 6 +- code/game/objects/items/stacks/wrap.dm | 3 +- .../blob/blobstrains/energized_jelly.dm | 2 +- code/modules/cargo/bounties/reagent.dm | 4 - code/modules/mining/ores_coins.dm | 2 +- .../carbon/human/species_types/golems.dm | 1 + .../file_system/programs/alarm.dm | 20 +-- .../reagents/cat2_medicine_reagents.dm | 105 +++++++-------- .../chemistry/reagents/other_reagents.dm | 8 +- .../chemistry/reagents/toxin_reagents.dm | 2 +- .../chemistry/recipes/cat2_medicines.dm | 24 ++-- .../reagents/chemistry/recipes/medicine.dm | 4 +- .../chemistry/recipes/pyrotechnics.dm | 4 +- .../reagents/reagent_containers/jug.dm | 2 +- .../reagents/reagent_containers/pill.dm | 4 +- .../reagents/reagent_containers/spray.dm | 2 +- code/modules/unit_tests/_unit_tests.dm | 2 - code/modules/unit_tests/merge_type.dm | 14 -- code/modules/unit_tests/open_air.dm | 6 +- code/modules/unit_tests/reactions.dm | 2 +- code/modules/unit_tests/ship_placement.dm | 4 +- .../unit_tests/subsystem_metric_sanity.dm | 12 +- code/modules/unit_tests/supply_pack.dm | 2 +- code/modules/unit_tests/surgeries.dm | 120 ------------------ 29 files changed, 123 insertions(+), 248 deletions(-) delete mode 100644 code/modules/unit_tests/merge_type.dm delete mode 100644 code/modules/unit_tests/surgeries.dm diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 224367aaa9cf..8d743b0674b9 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -41,7 +41,7 @@ #define GC_FAILURE_HARD_LOOKUP #endif // REFERENCE_DOING_IT_LIVE -//#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER +#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER #ifndef PRELOAD_RSC //set to: #define PRELOAD_RSC 2 // 0 to allow using external resources or on-demand behaviour; diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 568196c1460b..2f605eb226d2 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -449,7 +449,7 @@ /datum/status_effect/hippocraticOath/proc/consume_owner() owner.visible_message("[owner]'s soul is absorbed into the rod, relieving the previous snake of its duty.") var/mob/living/simple_animal/hostile/retaliate/poison/snake/healSnake = new(owner.loc) - var/list/chems = list(/datum/reagent/medicine/sal_acid, /datum/reagent/medicine/C2/convermol, /datum/reagent/medicine/oxandrolone) + var/list/chems = list(/datum/reagent/medicine/sal_acid, /datum/reagent/medicine/c2/convermol, /datum/reagent/medicine/oxandrolone) healSnake.poison_type = pick(chems) healSnake.name = "Asclepius's Snake" healSnake.real_name = "Asclepius's Snake" diff --git a/code/game/atoms.dm b/code/game/atoms.dm index a11a2845a820..89922c3ce592 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1550,7 +1550,7 @@ else // See if there's a gravity generator on our map zone var/datum/map_zone/mapzone = T.get_map_zone() - if(mapzone.gravity_generators.len) + if(mapzone?.gravity_generators.len) var/max_grav = 0 for(var/obj/machinery/gravity_generator/main/G as anything in mapzone.gravity_generators) max_grav = max(G.setting,max_grav) diff --git a/code/game/objects/items/devices/polycircuit.dm b/code/game/objects/items/devices/polycircuit.dm index 60027e378a88..be41de2c8411 100644 --- a/code/game/objects/items/devices/polycircuit.dm +++ b/code/game/objects/items/devices/polycircuit.dm @@ -1,5 +1,6 @@ /obj/item/stack/circuit_stack name = "polycircuit aggregate" + singular_name = "polycircuit" desc = "A dense, overdesigned cluster of electronics which attempted to function as a multipurpose circuit electronic. Circuits can be removed from it... if you don't bleed out in the process." icon_state = "circuit_mess" item_state = "rods" diff --git a/code/game/objects/items/stacks/license_plates.dm b/code/game/objects/items/stacks/license_plates.dm index 06dc86ee6152..b0ae1bea526b 100644 --- a/code/game/objects/items/stacks/license_plates.dm +++ b/code/game/objects/items/stacks/license_plates.dm @@ -1,5 +1,6 @@ /obj/item/stack/license_plates - name = "invalid plate" + name = "invalid plates" + singular_name = "invalid plate" desc = "someone fucked up" icon = 'icons/obj/machines/prison.dmi' icon_state = "empty_plate" @@ -7,14 +8,16 @@ max_amount = 50 /obj/item/stack/license_plates/empty - name = "empty license plate" + name = "empty license plates" + singular_name = "empty licence plate" desc = "Instead of a license plate number, this could contain a quote like \"Live laugh love\"." /obj/item/stack/license_plates/empty/fifty amount = 50 /obj/item/stack/license_plates/filled - name = "license plate" + name = "license plates" + singular_name = "license plate" desc = "Prison labor paying off." icon_state = "filled_plate_1_1" diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 4e0994174b25..087b3613ab3b 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -756,13 +756,15 @@ new /datum/stack_recipe("paper frame door", /obj/structure/mineral_door/paperfra amount = 50 /obj/item/stack/sheet/capitalisium - name = "capitalisium sheet" + name = "capitalisium sheets" + singular_name = "capitalisium sheet" desc = "A source of raw capitalism, capable of bringing forth the prophesized Capitalist Golem." icon_state = "sheet-capitalisium" merge_type = /obj/item/stack/sheet/capitalisium /obj/item/stack/sheet/stalinium - name = "stalinium sheet" + name = "stalinium sheets" + singular_name = "stalinium sheet" desc = "A source of raw socialism, capable of bringing forth the prophesized Soviet Golem." icon_state = "sheet-stalinium" merge_type = /obj/item/stack/sheet/stalinium diff --git a/code/game/objects/items/stacks/wrap.dm b/code/game/objects/items/stacks/wrap.dm index 8196294405f4..b7d90a06158d 100644 --- a/code/game/objects/items/stacks/wrap.dm +++ b/code/game/objects/items/stacks/wrap.dm @@ -5,7 +5,8 @@ */ /obj/item/stack/wrapping_paper - name = "wrapping paper" + name = "wrapping paper roll" + singular_name = "wrapping sheet" desc = "Wrap packages with this festive paper to make gifts." icon = 'icons/obj/stack_objects.dmi' icon_state = "wrap_paper" diff --git a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm index dfd761ed0527..56a4aca744eb 100644 --- a/code/modules/antagonists/blob/blobstrains/energized_jelly.dm +++ b/code/modules/antagonists/blob/blobstrains/energized_jelly.dm @@ -22,7 +22,7 @@ B.take_damage(damage, BURN, "energy") /datum/reagent/blob/energized_jelly - name = "Energized Jelly" + name = "Blob Energized Jelly" taste_description = "gelatin" color = "#EFD65A" diff --git a/code/modules/cargo/bounties/reagent.dm b/code/modules/cargo/bounties/reagent.dm index 69ce2b4a4075..a3ece1cce8c6 100644 --- a/code/modules/cargo/bounties/reagent.dm +++ b/code/modules/cargo/bounties/reagent.dm @@ -238,10 +238,6 @@ /datum/reagent/medicine/atropine,\ /datum/reagent/medicine/cryoxadone,\ /datum/reagent/medicine/salbutamol,\ - /*WS Begin - No Cobby - /datum/reagent/medicine/C2/hercuri,\ - /datum/reagent/medicine/C2/probital,\ - WS End */ /datum/reagent/drug/methamphetamine,\ /datum/reagent/drug/crank,\ /datum/reagent/nitrous_oxide,\ diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index 7ad1e76a1356..739901da0ad3 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -129,7 +129,7 @@ icon_state = "wasteplanet_sand" item_state = "wasteplanet_sand" singular_name = "rocky dust" - grind_results = list(/datum/reagent/silicon = 10, /datum/reagent/lithium = 2, /datum/reagent/radium = 1, /datum/reagent/chlorine = 1, /datum/reagent/aluminium = 1)//may be unsafe for human consumption + grind_results = list(/datum/reagent/silicon = 10, /datum/reagent/lithium = 2, /datum/reagent/uranium/radium = 1, /datum/reagent/chlorine = 1, /datum/reagent/aluminium = 1)//may be unsafe for human consumption /obj/item/stack/ore/glass/beach name = "beige sand pile" diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index 76be509875d2..5c5f6872184c 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -54,6 +54,7 @@ /datum/species/golem/random name = "Random Golem" + id = "random golem" changesource_flags = MIRROR_BADMIN | WABBAJACK | MIRROR_PRIDE | MIRROR_MAGIC | RACE_SWAP | ERT_SPAWN var/static/list/random_golem_types diff --git a/code/modules/modular_computers/file_system/programs/alarm.dm b/code/modules/modular_computers/file_system/programs/alarm.dm index 34fd2d25a034..bc65f94ad440 100644 --- a/code/modules/modular_computers/file_system/programs/alarm.dm +++ b/code/modules/modular_computers/file_system/programs/alarm.dm @@ -43,7 +43,7 @@ var/list/alarm = our_sort[areaname] var/list/sources = alarm[3] if (!(source in sources)) - sources += source + sources += WEAKREF(source) return TRUE var/obj/machinery/camera/cam = null @@ -54,7 +54,7 @@ cam = our_cams[1] else if(cameras && istype(cameras, /obj/machinery/camera)) cam = cameras - our_sort[home.name] = list(home, (cam ? cam : cameras), list(source)) + our_sort[home.name] = list(home, (cam ? cam : cameras), list(WEAKREF(source))) update_alarm_display() return TRUE @@ -76,7 +76,7 @@ /datum/computer_file/program/alarm_monitor/proc/cancelAlarm(class, area/A, obj/origin) var/list/L = alarms[class] - var/cleared = 0 + var/cleared = FALSE var/arealevelalarm = FALSE // set to TRUE for alarms that set/clear whole areas if (class=="Fire") arealevelalarm = TRUE @@ -85,14 +85,18 @@ if (!arealevelalarm) // the traditional behaviour var/list/alarm = L[I] var/list/srcs = alarm[3] - if (origin in srcs) - srcs -= origin - if (srcs.len == 0) - cleared = 1 + if (WEAKREF(origin) in srcs) + srcs -= WEAKREF(origin) + for(var/datum/weakref/ref as anything in srcs) + if(ref.resolve()) + continue + srcs -= ref + if (!length(srcs)) + cleared = TRUE L -= I else L -= I // wipe the instances entirely - cleared = 1 + cleared = TRUE update_alarm_display() diff --git a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm index 3ddadea35b04..4fc71a1eba0d 100644 --- a/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/cat2_medicine_reagents.dm @@ -1,12 +1,13 @@ // Category 2 medicines are medicines that have an ill effect regardless of volume/OD to dissuade doping. Mostly used as emergency chemicals OR to convert damage (and heal a bit in the process). The type is used to prompt borgs that the medicine is harmful. -/datum/reagent/medicine/C2 +/datum/reagent/medicine/c2 + name = "Category two reagent" harmful = TRUE metabolization_rate = 0.2 /******BRUTE******/ /*Suffix: -bital*/ -/datum/reagent/medicine/C2/helbital //kinda a C2 only if you're not in hardcrit. +/datum/reagent/medicine/c2/helbital //kinda a C2 only if you're not in hardcrit. name = "Helbital" description = "Named after the norse goddess Hel, this medicine heals the patient's bruises the closer they are to death. Patients will find the medicine 'aids' their healing if not near death by causing asphyxiation." color = "#9400D3" @@ -16,7 +17,7 @@ var/helbent = FALSE var/reaping = FALSE -/datum/reagent/medicine/C2/helbital/on_mob_life(mob/living/carbon/M) +/datum/reagent/medicine/c2/helbital/on_mob_life(mob/living/carbon/M) . = TRUE var/death_is_coming = (M.getToxLoss() + M.getOxyLoss() + M.getFireLoss() + M.getBruteLoss()) var/thou_shall_heal = 0 @@ -66,26 +67,26 @@ ..() return -/datum/reagent/medicine/C2/helbital/overdose_process(mob/living/carbon/M) +/datum/reagent/medicine/c2/helbital/overdose_process(mob/living/carbon/M) if(!helbent) M.apply_necropolis_curse(CURSE_WASTING | CURSE_BLINDING) helbent = TRUE ..() return TRUE -/datum/reagent/medicine/C2/helbital/on_mob_delete(mob/living/L) +/datum/reagent/medicine/c2/helbital/on_mob_delete(mob/living/L) if(helbent) L.remove_status_effect(STATUS_EFFECT_NECROPOLIS_CURSE) ..() -/datum/reagent/medicine/C2/libital //messes with your liber +/datum/reagent/medicine/c2/libital //messes with your liber name = "Libital" description = "A bruise reliever. Does minor liver damage." color = "#ECEC8D" // rgb: 236 236 141 taste_description = "bitter with a hint of alcohol" reagent_state = SOLID -/datum/reagent/medicine/C2/libital/on_mob_life(mob/living/carbon/M) +/datum/reagent/medicine/c2/libital/on_mob_life(mob/living/carbon/M) M.adjustOrganLoss(ORGAN_SLOT_LIVER, 0.3*REM) M.adjustBruteLoss(-3*REM) ..() @@ -93,14 +94,14 @@ /*WS Begin - Medicine Fixes -/datum/reagent/medicine/C2/probital +/datum/reagent/medicine/c2/probital name = "Probital" description = "Originally developed as a prototype-gym supliment for those looking for quick workout turnover, this oral medication quickly repairs broken muscle tissue but causes lactic acid buildup, tiring the patient. Overdosing can cause extreme drowsiness. An Influx of nutrients promotes the muscle repair even further." reagent_state = SOLID color = "#FFFF6B" overdose_threshold = 20 -/datum/reagent/medicine/C2/probital/on_mob_life(mob/living/carbon/M) +/datum/reagent/medicine/c2/probital/on_mob_life(mob/living/carbon/M) M.adjustBruteLoss(-2.25*REM, FALSE) var/ooo_youaregettingsleepy = 3.5 switch(round(M.getStaminaLoss())) @@ -114,7 +115,7 @@ ..() . = TRUE -/datum/reagent/medicine/C2/probital/overdose_process(mob/living/M) +/datum/reagent/medicine/c2/probital/overdose_process(mob/living/M) M.adjustStaminaLoss(3*REM, 0) if(M.getStaminaLoss() >= 80) M.drowsyness++ @@ -125,11 +126,11 @@ ..() . = TRUE -/datum/reagent/medicine/C2/probital/on_transfer(atom/A, method=INGEST, trans_volume) +/datum/reagent/medicine/c2/probital/on_transfer(atom/A, method=INGEST, trans_volume) if(method != INGEST || !iscarbon(A)) return - A.reagents.remove_reagent(/datum/reagent/medicine/C2/probital, trans_volume * 0.05) + A.reagents.remove_reagent(/datum/reagent/medicine/c2/probital, trans_volume * 0.05) A.reagents.add_reagent(/datum/reagent/medicine/metafactor, trans_volume * 0.25) ..() @@ -138,7 +139,7 @@ WS End */ /******BURN******/ /*Suffix: -uri*/ -/datum/reagent/medicine/C2/lenturi +/datum/reagent/medicine/c2/lenturi name = "Lenturi" description = "Used to treat burns. Makes you move slower while it is in your system. Applies stomach damage when it leaves your system." reagent_state = LIQUID @@ -146,21 +147,21 @@ WS End */ var/resetting_probability = 0 var/spammer = 0 -/datum/reagent/medicine/C2/lenturi/on_mob_life(mob/living/carbon/M) +/datum/reagent/medicine/c2/lenturi/on_mob_life(mob/living/carbon/M) M.adjustFireLoss(-3 * REM) M.adjustOrganLoss(ORGAN_SLOT_STOMACH, 0.4 * REM) ..() return TRUE -/datum/reagent/medicine/C2/lenturi/on_mob_metabolize(mob/living/carbon/M) +/datum/reagent/medicine/c2/lenturi/on_mob_metabolize(mob/living/carbon/M) M.add_movespeed_modifier(/datum/movespeed_modifier/reagent/lenturi) return ..() -/datum/reagent/medicine/C2/lenturi/on_mob_end_metabolize(mob/living/carbon/M) +/datum/reagent/medicine/c2/lenturi/on_mob_end_metabolize(mob/living/carbon/M) M.remove_movespeed_modifier(/datum/movespeed_modifier/reagent/lenturi) return ..() -/datum/reagent/medicine/C2/aiuri +/datum/reagent/medicine/c2/aiuri name = "Aiuri" description = "Used to treat burns. Does minor eye damage." reagent_state = LIQUID @@ -168,7 +169,7 @@ WS End */ var/resetting_probability = 0 var/message_cd = 0 -/datum/reagent/medicine/C2/aiuri/on_mob_life(mob/living/carbon/M) +/datum/reagent/medicine/c2/aiuri/on_mob_life(mob/living/carbon/M) M.adjustFireLoss(-2*REM) M.adjustOrganLoss(ORGAN_SLOT_EYES,0.25*REM) ..() @@ -176,7 +177,7 @@ WS End */ /*WS Begin - Fixes Medicines -/datum/reagent/medicine/C2/hercuri +/datum/reagent/medicine/c2/hercuri name = "Hercuri" description = "Not to be confused with element Mercury, this medicine excels in reverting effects of dangerous high-temperature environments. Prolonged exposure can cause hypothermia." reagent_state = LIQUID @@ -184,7 +185,7 @@ WS End */ overdose_threshold = 25 reagent_weight = 0.6 -/datum/reagent/medicine/C2/hercuri/on_mob_life(mob/living/carbon/M) +/datum/reagent/medicine/c2/hercuri/on_mob_life(mob/living/carbon/M) if(M.getFireLoss() > 50) M.adjustFireLoss(-2*REM, FALSE) else @@ -206,7 +207,7 @@ WS End */ ..() -/datum/reagent/medicine/C2/hercuri/overdose_process(mob/living/carbon/M) +/datum/reagent/medicine/c2/hercuri/overdose_process(mob/living/carbon/M) M.adjust_bodytemperature(-10*TEMPERATURE_DAMAGE_COEFFICIENT*REM,50) //chilly chilly ..() @@ -216,14 +217,14 @@ WS End*/ /*Suffix: -mol*/ #define CONVERMOL_RATIO 5 //# Oxygen damage to result in 1 tox -/datum/reagent/medicine/C2/convermol +/datum/reagent/medicine/c2/convermol name = "Convermol" description = "Restores oxygen deprivation while producing a lesser amount of toxic byproducts. Both scale with exposure to the drug and current amount of oxygen deprivation. Overdose causes toxic byproducts regardless of oxygen deprivation." reagent_state = LIQUID color = "#FF6464" overdose_threshold = 35 // at least 2 full syringes +some, this stuff is nasty if left in for long -/datum/reagent/medicine/C2/convermol/on_mob_life(mob/living/carbon/human/M) +/datum/reagent/medicine/c2/convermol/on_mob_life(mob/living/carbon/human/M) var/oxycalc = 2.5*REM*current_cycle if(!overdosed) oxycalc = min(oxycalc,M.getOxyLoss()+0.5) //if NOT overdosing, we lower our toxdamage to only the damage we actually healed with a minimum of 0.1*current_cycle. IE if we only heal 10 oxygen damage but we COULD have healed 20, we will only take toxdamage for the 10. We would take the toxdamage for the extra 10 if we were overdosing. @@ -234,20 +235,20 @@ WS End*/ ..() return TRUE -/datum/reagent/medicine/C2/convermol/overdose_process(mob/living/carbon/human/M) +/datum/reagent/medicine/c2/convermol/overdose_process(mob/living/carbon/human/M) metabolization_rate += 1 ..() return TRUE #undef CONVERMOL_RATIO -/datum/reagent/medicine/C2/tirimol +/datum/reagent/medicine/c2/tirimol name = "Tirimol" description = "An oxygen deprivation medication that causes fatigue. Prolonged exposure causes the patient to fall asleep once the medicine metabolizes." color = "#FF6464" var/drowsycd = 0 -/datum/reagent/medicine/C2/tirimol/on_mob_life(mob/living/carbon/human/M) +/datum/reagent/medicine/c2/tirimol/on_mob_life(mob/living/carbon/human/M) M.adjustOxyLoss(-3) M.adjustStaminaLoss(2) if(drowsycd && (world.time > drowsycd)) @@ -258,7 +259,7 @@ WS End*/ ..() return TRUE -/datum/reagent/medicine/C2/tirimol/on_mob_end_metabolize(mob/living/L) +/datum/reagent/medicine/c2/tirimol/on_mob_end_metabolize(mob/living/L) if(current_cycle > 20) L.Sleeping(10 SECONDS) ..() @@ -266,16 +267,16 @@ WS End*/ /******TOXIN******/ /*Suffix: -iver*/ -/datum/reagent/medicine/C2/seiver //a bit of a gray joke +/datum/reagent/medicine/c2/seiver //a bit of a gray joke name = "Seiver" description = "A medicine that shifts functionality based on temperature. Colder temperatures incurs radiation removal while hotter temperatures promote antitoxicity. Damages the heart." //CHEM HOLDER TEMPS, NOT AIR TEMPS var/radbonustemp = (T0C - 100) //being below this number gives you 10% off rads. -/datum/reagent/medicine/C2/seiver/on_mob_metabolize(mob/living/carbon/human/M) +/datum/reagent/medicine/c2/seiver/on_mob_metabolize(mob/living/carbon/human/M) . = ..() radbonustemp = rand(radbonustemp - 50, radbonustemp + 50) // Basically this means 50K and below will always give the percent heal, and upto 150K could. Calculated once. -/datum/reagent/medicine/C2/seiver/on_mob_life(mob/living/carbon/human/M) +/datum/reagent/medicine/c2/seiver/on_mob_life(mob/living/carbon/human/M) var/chemtemp = min(M.reagents?.chem_temp, 1000) chemtemp = chemtemp ? chemtemp : 273 //why do you have null sweaty var/healypoints = 0 //5 healypoints = 1 heart damage; 5 rads = 1 tox damage healed for the purpose of healypoints @@ -304,11 +305,11 @@ WS End*/ ..() return TRUE -/datum/reagent/medicine/C2/multiver //enhanced with MULTIple medicines +/datum/reagent/medicine/c2/multiver //enhanced with MULTIple medicines name = "Multiver" description = "A chem-purger that becomes more effective the more unique medicines present. Slightly heals toxicity but causes lung damage (mitigatable by unique medicines)." -/datum/reagent/medicine/C2/multiver/on_mob_life(mob/living/carbon/human/M) +/datum/reagent/medicine/c2/multiver/on_mob_life(mob/living/carbon/human/M) var/medibonus = 0 //it will always have itself which makes it REALLY start @ 1 for(var/r in M.reagents.reagent_list) var/datum/reagent/the_reagent = r @@ -327,11 +328,11 @@ WS End*/ ..() return TRUE -#define issyrinormusc(A) (istype(A,/datum/reagent/medicine/C2/syriniver) || istype(A,/datum/reagent/medicine/C2/musiver)) //musc is metab of syrin so let's make sure we're not purging either +#define issyrinormusc(A) (istype(A,/datum/reagent/medicine/c2/syriniver) || istype(A,/datum/reagent/medicine/c2/musiver)) //musc is metab of syrin so let's make sure we're not purging either /*WS Begin - Medicine Fixes -/datum/reagent/medicine/C2/syriniver //Inject >> SYRINge +/datum/reagent/medicine/c2/syriniver //Inject >> SYRINge name = "Syriniver" description = "A potent antidote for intravenous use with a narrow therapeutic index, it is considered an active prodrug of musiver." reagent_state = LIQUID @@ -340,7 +341,7 @@ WS End*/ overdose_threshold = 6 var/conversion_amount -/datum/reagent/medicine/C2/syriniver/on_transfer(atom/A, method=INJECT, trans_volume) +/datum/reagent/medicine/c2/syriniver/on_transfer(atom/A, method=INJECT, trans_volume) if(method != INJECT || !iscarbon(A)) return var/mob/living/carbon/C = A @@ -350,11 +351,11 @@ WS End*/ if((L.organ_flags & ORGAN_FAILING) || !L) return conversion_amount = trans_volume * (min(100 -C.getOrganLoss(ORGAN_SLOT_LIVER), 80) / 100) //the more damaged the liver the worse we metabolize. - C.reagents.remove_reagent(/datum/reagent/medicine/C2/syriniver, conversion_amount) - C.reagents.add_reagent(/datum/reagent/medicine/C2/musiver, conversion_amount) + C.reagents.remove_reagent(/datum/reagent/medicine/c2/syriniver, conversion_amount) + C.reagents.add_reagent(/datum/reagent/medicine/c2/musiver, conversion_amount) ..() -/datum/reagent/medicine/C2/syriniver/on_mob_life(mob/living/carbon/M) +/datum/reagent/medicine/c2/syriniver/on_mob_life(mob/living/carbon/M) M.adjustOrganLoss(ORGAN_SLOT_LIVER, 0.8) M.adjustToxLoss(-1*REM, 0) for(var/datum/reagent/R in M.reagents.reagent_list) @@ -365,14 +366,14 @@ WS End*/ ..() . = 1 -/datum/reagent/medicine/C2/syriniver/overdose_process(mob/living/carbon/M) +/datum/reagent/medicine/c2/syriniver/overdose_process(mob/living/carbon/M) M.adjustOrganLoss(ORGAN_SLOT_LIVER, 1.5) M.adjust_disgust(3) - M.reagents.add_reagent(/datum/reagent/medicine/C2/musiver, 0.225 * REM) + M.reagents.add_reagent(/datum/reagent/medicine/c2/musiver, 0.225 * REM) ..() . = 1 -/datum/reagent/medicine/C2/musiver //MUScles +/datum/reagent/medicine/c2/musiver //MUScles name = "Musiver" description = "The active metabolite of syriniver. Causes muscle weakness on overdose" reagent_state = LIQUID @@ -381,7 +382,7 @@ WS End*/ overdose_threshold = 25 var/datum/brain_trauma/mild/muscle_weakness/U -/datum/reagent/medicine/C2/musiver/on_mob_life(mob/living/carbon/M) +/datum/reagent/medicine/c2/musiver/on_mob_life(mob/living/carbon/M) M.adjustOrganLoss(ORGAN_SLOT_LIVER, 0.1) M.adjustToxLoss(-1*REM, 0) for(var/datum/reagent/R in M.reagents.reagent_list) @@ -391,17 +392,17 @@ WS End*/ ..() . = 1 -/datum/reagent/medicine/C2/musiver/overdose_start(mob/living/carbon/M) +/datum/reagent/medicine/c2/musiver/overdose_start(mob/living/carbon/M) U = new() M.gain_trauma(U, TRAUMA_RESILIENCE_ABSOLUTE) ..() -/datum/reagent/medicine/C2/musiver/on_mob_delete(mob/living/carbon/M) +/datum/reagent/medicine/c2/musiver/on_mob_delete(mob/living/carbon/M) if(U) QDEL_NULL(U) return ..() -/datum/reagent/medicine/C2/musiver/overdose_process(mob/living/carbon/M) +/datum/reagent/medicine/c2/musiver/overdose_process(mob/living/carbon/M) M.adjustOrganLoss(ORGAN_SLOT_LIVER, 1.5) M.adjust_disgust(3) ..() @@ -413,7 +414,7 @@ WS End*/ /******COMBOS******/ /*Suffix: Combo of healing, prob gonna get wack REAL fast*/ -/datum/reagent/medicine/C2/instabitaluri +/datum/reagent/medicine/c2/instabitaluri name = "Synthflesh (Instabitaluri)" description = "Heals brute and burn damage at the cost of toxicity (66% of damage healed). Touch application only." reagent_state = LIQUID @@ -431,7 +432,7 @@ WS End*/ if(show_message) to_chat(carbies, "You feel your burns and bruises healing! It stings like hell!") SEND_SIGNAL(carbies, COMSIG_ADD_MOOD_EVENT, "painful_medicine", /datum/mood_event/painful_medicine) - if(HAS_TRAIT_FROM(M, TRAIT_HUSK, "burn") && carbies.getFireLoss() < THRESHOLD_UNHUSK && (carbies.reagents.get_reagent_amount(/datum/reagent/medicine/C2/instabitaluri) + reac_volume >= 100)) + if(HAS_TRAIT_FROM(M, TRAIT_HUSK, "burn") && carbies.getFireLoss() < THRESHOLD_UNHUSK && (carbies.reagents.get_reagent_amount(/datum/reagent/medicine/c2/instabitaluri) + reac_volume >= 100)) carbies.cure_husk("burn") carbies.visible_message("A rubbery liquid coats [carbies]'s burns. [carbies] looks a lot healthier!") //we're avoiding using the phrases "burnt flesh" and "burnt skin" here because carbies could be a skeleton or a golem or something ..() @@ -449,13 +450,13 @@ WS End*/ *causing you to loose your soft crit, hard crit and heart stabilization effects. *Overdosing on penthrite also causes a heart failure. */ -/datum/reagent/medicine/C2/penthrite +/datum/reagent/medicine/c2/penthrite name = "Penthrite" description = "An expensive medicine that aids with pumping blood around the body even without a heart, and prevents the heart from slowing down. It reacts violently with other emergency medication." color = "#F5F5F5" overdose_threshold = 50 -/datum/reagent/medicine/C2/penthrite/on_mob_add(mob/living/M) +/datum/reagent/medicine/c2/penthrite/on_mob_add(mob/living/M) . = ..() to_chat(M,"Your heart begins to beat with great force!") ADD_TRAIT(M, TRAIT_STABLEHEART, type) @@ -464,7 +465,7 @@ WS End*/ M.crit_threshold = M.crit_threshold + HEALTH_THRESHOLD_FULLCRIT*2 //your heart is still pumping! -/datum/reagent/medicine/C2/penthrite/on_mob_life(mob/living/carbon/human/H) +/datum/reagent/medicine/c2/penthrite/on_mob_life(mob/living/carbon/human/H) H.adjustOrganLoss(ORGAN_SLOT_STOMACH,0.25) if(H.health <= HEALTH_THRESHOLD_CRIT && H.health > H.crit_threshold) //we cannot save someone above our raised crit threshold. @@ -492,14 +493,14 @@ WS End*/ volume = 0 . = ..() -/datum/reagent/medicine/C2/penthrite/on_mob_end_metabolize(mob/living/M) +/datum/reagent/medicine/c2/penthrite/on_mob_end_metabolize(mob/living/M) M.crit_threshold = M.crit_threshold - HEALTH_THRESHOLD_FULLCRIT*2 //your heart is still pumping! REMOVE_TRAIT(M, TRAIT_STABLEHEART, type) REMOVE_TRAIT(M, TRAIT_NOHARDCRIT,type) REMOVE_TRAIT(M, TRAIT_NOSOFTCRIT,type) . = ..() -/datum/reagent/medicine/C2/penthrite/overdose_process(mob/living/carbon/human/H) +/datum/reagent/medicine/c2/penthrite/overdose_process(mob/living/carbon/human/H) REMOVE_TRAIT(H, TRAIT_STABLEHEART, type) H.adjustStaminaLoss(10) H.adjustOrganLoss(ORGAN_SLOT_HEART,10) diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index a63fa14e868e..6a6f3928e103 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -118,6 +118,7 @@ src.data |= data.Copy() /datum/reagent/vaccine/fungal_tb + name = "Fungal TB Vaccine" /datum/reagent/vaccine/fungal_tb/New(data) . = ..() @@ -692,7 +693,7 @@ taste_description = "brai...nothing in particular" /datum/reagent/mutationtoxin/goofzombie - name = "Zombie Mutation Toxin" + name = "Krokodil Zombie Mutation Toxin" description = "An undead toxin... kinda..." color = "#5EFF3B" //RGB: 94, 255, 59 race = /datum/species/human/krokodil_addict //Not the infectious kind. The days of xenobio zombie outbreaks are long past. @@ -1097,7 +1098,7 @@ /datum/reagent/uranium/radium/dip_object(obj/item/I, mob/user, obj/item/reagent_containers/H) return FALSE -/datum/reagent/radium/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) +/datum/reagent/uranium/radium/on_hydroponics_apply(obj/item/seeds/myseed, datum/reagents/chems, obj/machinery/hydroponics/mytray, mob/user) . = ..() if(chems.has_reagent(type, 1)) mytray.adjustHealth(-round(chems.get_reagent_amount(type) * 2.5)) @@ -2242,11 +2243,12 @@ return ..() /datum/reagent/pax/peaceborg - name = "synthpax" + name = "Synthpax" description = "A colorless liquid that suppresses violence in its subjects. Cheaper to synthesize than normal Pax, but wears off faster." metabolization_rate = 1.5 * REAGENTS_METABOLISM /datum/reagent/peaceborg + name = "Abstract Peaceborg Reagent" can_synth = FALSE /datum/reagent/peaceborg/confuse diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 210f980eb041..9cde25afcac0 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -377,7 +377,7 @@ ..() /datum/reagent/toxin/fakebeer //disguised as normal beer for use by emagged brobots - name = "Beer" + name = "Beer?" description = "A specially-engineered sedative disguised as beer. It induces instant sleep in its target." color = "#664300" // rgb: 102, 67, 0 metabolization_rate = 1.5 * REAGENTS_METABOLISM diff --git a/code/modules/reagents/chemistry/recipes/cat2_medicines.dm b/code/modules/reagents/chemistry/recipes/cat2_medicines.dm index dbe3398e3f0c..c68438fa73ce 100644 --- a/code/modules/reagents/chemistry/recipes/cat2_medicines.dm +++ b/code/modules/reagents/chemistry/recipes/cat2_medicines.dm @@ -3,19 +3,19 @@ /*****BRUTE*****/ /datum/chemical_reaction/helbital - results = list(/datum/reagent/medicine/C2/helbital = 3) + results = list(/datum/reagent/medicine/c2/helbital = 3) required_reagents = list(/datum/reagent/consumable/sugar = 1, /datum/reagent/fluorine = 1, /datum/reagent/carbon = 1) mix_message = "The mixture turns into a thick, yellow powder." /datum/chemical_reaction/libital - results = list(/datum/reagent/medicine/C2/libital = 3) + results = list(/datum/reagent/medicine/c2/libital = 3) required_reagents = list(/datum/reagent/phenol = 1, /datum/reagent/oxygen = 1, /datum/reagent/nitrogen = 1) /*WS Begin - Fixes medicines /datum/chemical_reaction/probital - results = list(/datum/reagent/medicine/C2/probital = 4) + results = list(/datum/reagent/medicine/c2/probital = 4) required_reagents = list(/datum/reagent/copper = 1, /datum/reagent/acetone = 2, /datum/reagent/phosphorus = 1) WS End */ @@ -25,19 +25,19 @@ WS End */ /*WS Begin - No CobbyChems /datum/chemical_reaction/lenturi - results = list(/datum/reagent/medicine/C2/lenturi = 5) + results = list(/datum/reagent/medicine/c2/lenturi = 5) required_reagents = list(/datum/reagent/ammonia = 1, /datum/reagent/silver = 1, /datum/reagent/sulfur = 1, /datum/reagent/oxygen = 1, /datum/reagent/chlorine = 1) */ /datum/chemical_reaction/aiuri - results = list(/datum/reagent/medicine/C2/aiuri = 4) + results = list(/datum/reagent/medicine/c2/aiuri = 4) required_reagents = list(/datum/reagent/ammonia = 1, /datum/reagent/toxin/acid = 1, /datum/reagent/hydrogen = 2) /*WS Begin - Fixes medicines /datum/chemical_reaction/hercuri - results = list(/datum/reagent/medicine/C2/hercuri = 5) + results = list(/datum/reagent/medicine/c2/hercuri = 5) required_reagents = list(/datum/reagent/cryostylane = 3, /datum/reagent/bromine = 1, /datum/reagent/lye = 1) required_temp = 47 is_cold_recipe = TRUE @@ -49,7 +49,7 @@ WS End */ /*WS Begin - No CobbyChems /datum/chemical_reaction/convermol - results = list(/datum/reagent/medicine/C2/convermol = 3) + results = list(/datum/reagent/medicine/c2/convermol = 3) required_reagents = list(/datum/reagent/hydrogen = 1, /datum/reagent/fluorine = 1, /datum/reagent/fuel/oil = 1) required_temp = 370 mix_message = "The mixture rapidly turns into a dense pink liquid." @@ -57,30 +57,30 @@ WS End */ */ /datum/chemical_reaction/tirimol - results = list(/datum/reagent/medicine/C2/tirimol = 5) + results = list(/datum/reagent/medicine/c2/tirimol = 5) required_reagents = list(/datum/reagent/nitrogen = 3, /datum/reagent/acetone = 2) required_catalysts = list(/datum/reagent/toxin/acid = 1) /*****TOX*****/ /datum/chemical_reaction/seiver - results = list(/datum/reagent/medicine/C2/seiver = 3) + results = list(/datum/reagent/medicine/c2/seiver = 3) required_reagents = list(/datum/reagent/nitrogen = 1, /datum/reagent/potassium = 1, /datum/reagent/aluminium = 1) /*WS Begin - No CobbyChems /datum/chemical_reaction/multiver - results = list(/datum/reagent/medicine/C2/multiver = 2) + results = list(/datum/reagent/medicine/c2/multiver = 2) required_reagents = list(/datum/reagent/ash = 1, /datum/reagent/consumable/sodiumchloride = 1) mix_message = "The mixture yields a fine black powder." required_temp = 380 /datum/chemical_reaction/syriniver - results = list(/datum/reagent/medicine/C2/syriniver = 5) + results = list(/datum/reagent/medicine/c2/syriniver = 5) required_reagents = list(/datum/reagent/sulfur = 1, /datum/reagent/fluorine = 1, /datum/reagent/toxin = 1, /datum/reagent/nitrous_oxide = 2) */ /datum/chemical_reaction/penthrite - results = list(/datum/reagent/medicine/C2/penthrite = 3) + results = list(/datum/reagent/medicine/c2/penthrite = 3) required_reagents = list(/datum/reagent/pentaerythritol = 1, /datum/reagent/acetone = 1, /datum/reagent/toxin/acid/nitracid = 1 , /datum/reagent/wittel = 1) diff --git a/code/modules/reagents/chemistry/recipes/medicine.dm b/code/modules/reagents/chemistry/recipes/medicine.dm index 5e689add2433..b2e275bc0631 100644 --- a/code/modules/reagents/chemistry/recipes/medicine.dm +++ b/code/modules/reagents/chemistry/recipes/medicine.dm @@ -126,8 +126,8 @@ /*WS Begin - No Cobbychmes /datum/chemical_reaction/instabitaluri - results = list(/datum/reagent/medicine/C2/instabitaluri = 3) - required_reagents = list(/datum/reagent/blood = 1, /datum/reagent/carbon = 1, /datum/reagent/medicine/C2/libital = 1) + results = list(/datum/reagent/medicine/c2/instabitaluri = 3) + required_reagents = list(/datum/reagent/blood = 1, /datum/reagent/carbon = 1, /datum/reagent/medicine/c2/libital = 1) WS End */ diff --git a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm index 5b64f57e1a37..82be8a075cc1 100644 --- a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm +++ b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm @@ -122,11 +122,11 @@ /datum/chemical_reaction/reagent_explosion/penthrite_explosion_epinephrine - required_reagents = list(/datum/reagent/medicine/C2/penthrite = 1, /datum/reagent/medicine/epinephrine = 1) + required_reagents = list(/datum/reagent/medicine/c2/penthrite = 1, /datum/reagent/medicine/epinephrine = 1) strengthdiv = 5 /datum/chemical_reaction/reagent_explosion/penthrite_explosion_atropine - required_reagents = list(/datum/reagent/medicine/C2/penthrite = 1, /datum/reagent/medicine/atropine = 1) + required_reagents = list(/datum/reagent/medicine/c2/penthrite = 1, /datum/reagent/medicine/atropine = 1) strengthdiv = 5 modifier = 5 diff --git a/code/modules/reagents/reagent_containers/jug.dm b/code/modules/reagents/reagent_containers/jug.dm index 4c524dff9c44..2c8364cf0d92 100644 --- a/code/modules/reagents/reagent_containers/jug.dm +++ b/code/modules/reagents/reagent_containers/jug.dm @@ -103,7 +103,7 @@ /obj/item/reagent_containers/glass/chem_jug/radium name = "chemical jug (radium)" icon_state = "chem_jug_radium" - list_reagents = list(/datum/reagent/radium = 150) + list_reagents = list(/datum/reagent/uranium/radium = 150) /obj/item/reagent_containers/glass/chem_jug/aluminium name = "chemical jug (aluminium)" diff --git a/code/modules/reagents/reagent_containers/pill.dm b/code/modules/reagents/reagent_containers/pill.dm index ba365d435952..50436b8ee9e6 100644 --- a/code/modules/reagents/reagent_containers/pill.dm +++ b/code/modules/reagents/reagent_containers/pill.dm @@ -270,11 +270,11 @@ /*WS Begin - No Cobbychem -/obj/item/reagent_containers/pill/C2/probital +/obj/item/reagent_containers/pill/c2/probital name = "Probital pill" desc = "Used to treat brute damage of minor and moderate severity.The carving in the pill says 'Eat before ingesting'. Causes fatigue and diluted with granibitaluri." icon_state = "pill12" - list_reagents = list(/datum/reagent/medicine/C2/probital = 5, /datum/reagent/medicine/granibitaluri = 10) + list_reagents = list(/datum/reagent/medicine/c2/probital = 5, /datum/reagent/medicine/granibitaluri = 10) rename_with_volume = TRUE WS End */ diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 11b36fb7b969..d1a0f98b7755 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -413,6 +413,6 @@ name = "medical spray (hercuri)" desc = "A medical spray bottle.This one contains hercuri, a medicine used to negate the effects of dangerous high-temperature environments. Careful not to freeze the patient!" icon_state = "sprayer_large" - list_reagents = list(/datum/reagent/medicine/C2/hercuri = 100) + list_reagents = list(/datum/reagent/medicine/c2/hercuri = 100) WS End */ diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 19adab750a48..95e7b42316a5 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -73,7 +73,6 @@ #include "emoting.dm" #include "keybinding_init.dm" #include "machine_disassembly.dm" -#include "merge_type.dm" #include "outfit_sanity.dm" #include "open_air.dm" #include "overmap.dm" @@ -99,7 +98,6 @@ #include "subsystem_init.dm" #include "subsystem_metric_sanity.dm" #include "supply_pack.dm" -#include "surgeries.dm" #include "teleporters.dm" #include "timer_sanity.dm" #include "unit_test.dm" diff --git a/code/modules/unit_tests/merge_type.dm b/code/modules/unit_tests/merge_type.dm deleted file mode 100644 index 5b5a81bba285..000000000000 --- a/code/modules/unit_tests/merge_type.dm +++ /dev/null @@ -1,14 +0,0 @@ -/datum/unit_test/merge_type/Run() - var/list/blacklist = list(/obj/item/stack/sheet, - /obj/item/stack/sheet/mineral, - /obj/item/stack/ore, - /obj/item/stack/license_plates, - /obj/item/stack/tile/mineral, - /obj/item/stack/tile) - - var/list/paths = subtypesof(/obj/item/stack) - blacklist - - for(var/stackpath in paths) - var/obj/item/stack/stack = stackpath - if(!initial(stack.merge_type)) - TEST_FAIL("([stack]) lacks set merge_type variable!") diff --git a/code/modules/unit_tests/open_air.dm b/code/modules/unit_tests/open_air.dm index 97a6f4132f36..969e1f7561cc 100644 --- a/code/modules/unit_tests/open_air.dm +++ b/code/modules/unit_tests/open_air.dm @@ -9,16 +9,16 @@ SSair.fire() sleep(1) if(center_turf.air.get_moles(GAS_PLASMA) > 28) - Fail("Gas isn't moving at all, or isn't moving enough (somehow) (plasma started at 32, is now [center_turf.air.get_moles(GAS_PLASMA)]") + TEST_FAIL("Gas isn't moving at all, or isn't moving enough (somehow) (plasma started at 32, is now [center_turf.air.get_moles(GAS_PLASMA)]") center_turf.air.set_moles(GAS_PLASMA, 100) center_turf.air.set_moles(GAS_O2, 100/1.4) center_turf.air.set_temperature(5000) center_turf.air.vv_react(center_turf) if(center_turf.air.get_moles(GAS_PLASMA) >= 100) - Fail("Gas isn't reacting properly (plasma: [center_turf.air.get_moles(GAS_PLASMA)], temp: [center_turf.air.return_temperature()]") + TEST_FAIL("Gas isn't reacting properly (plasma: [center_turf.air.get_moles(GAS_PLASMA)], temp: [center_turf.air.return_temperature()]") var/obj/effect/hotspot = locate(/obj/effect/hotspot) in center_turf if(!istype(hotspot)) - Fail("Hotspots aren't showing up on reaction") + TEST_FAIL("Hotspots aren't showing up on reaction") /datum/unit_test/open_air/Destroy() var/datum/virtual_level/vlevel = mapzone.virtual_levels[1] diff --git a/code/modules/unit_tests/reactions.dm b/code/modules/unit_tests/reactions.dm index 66d9b490991c..7a48aeb6dd7a 100644 --- a/code/modules/unit_tests/reactions.dm +++ b/code/modules/unit_tests/reactions.dm @@ -3,4 +3,4 @@ var/test_info = G.test() if(!test_info["success"]) var/message = test_info["message"] - Fail("Gas reaction [G.name] is failing its unit test with the following message: [message]") + TEST_FAIL("Gas reaction [G.name] is failing its unit test with the following message: [message]") diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index 7261fa5efd47..301ec4d6078e 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -5,11 +5,11 @@ try new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) catch(var/exception/e) - Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") + TEST_FAIL("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE var/list/errors = atmosscan(TRUE) errors += powerdebug(TRUE) for(var/error in errors) - Fail("[error]") + TEST_FAIL("[error]") diff --git a/code/modules/unit_tests/subsystem_metric_sanity.dm b/code/modules/unit_tests/subsystem_metric_sanity.dm index 44e375b7535b..c062e60ae4ab 100644 --- a/code/modules/unit_tests/subsystem_metric_sanity.dm +++ b/code/modules/unit_tests/subsystem_metric_sanity.dm @@ -2,21 +2,21 @@ /datum/unit_test/subsystem_metric_sanity/Run() for(var/datum/controller/subsystem/SS in Master.subsystems) if(SS.ss_id == initial(SS.ss_id)) // initial() works here because ss_id is set at runtime during /New() - Fail("[SS.type] has no SS ID, somehow!") + TEST_FAIL("[SS.type] has no SS ID, somehow!") continue var/list/data = SS.get_metrics() if(length(data) != 3) - Fail("SS[SS.ss_id] has invalid metrics data!") + TEST_FAIL("SS[SS.ss_id] has invalid metrics data!") continue if(isnull(data["cost"])) - Fail("SS[SS.ss_id] has invalid metrics data! No 'cost' found in [json_encode(data)]") + TEST_FAIL("SS[SS.ss_id] has invalid metrics data! No 'cost' found in [json_encode(data)]") continue if(isnull(data["tick_usage"])) - Fail("SS[SS.ss_id] has invalid metrics data! No 'tick_usage' found in [json_encode(data)]") + TEST_FAIL("SS[SS.ss_id] has invalid metrics data! No 'tick_usage' found in [json_encode(data)]") continue if(isnull(data["custom"])) - Fail("SS[SS.ss_id] has invalid metrics data! No 'custom' found in [json_encode(data)]") + TEST_FAIL("SS[SS.ss_id] has invalid metrics data! No 'custom' found in [json_encode(data)]") continue if(!islist(data["custom"])) - Fail("SS[SS.ss_id] has invalid metrics data! 'custom' is not a list in [json_encode(data)]") + TEST_FAIL("SS[SS.ss_id] has invalid metrics data! 'custom' is not a list in [json_encode(data)]") continue diff --git a/code/modules/unit_tests/supply_pack.dm b/code/modules/unit_tests/supply_pack.dm index 37ba56b7865b..ca4c1154ca6a 100644 --- a/code/modules/unit_tests/supply_pack.dm +++ b/code/modules/unit_tests/supply_pack.dm @@ -9,4 +9,4 @@ value += rep.total_value[thing] if(value >= pack.cost) - Fail("[pack] ([pack_type]) was resold for [value], [value - pack.cost] greater than the buy price of [pack.cost]!") + TEST_FAIL("[pack] ([pack_type]) was resold for [value], [value - pack.cost] greater than the buy price of [pack.cost]!") diff --git a/code/modules/unit_tests/surgeries.dm b/code/modules/unit_tests/surgeries.dm deleted file mode 100644 index f4f96a3b9f28..000000000000 --- a/code/modules/unit_tests/surgeries.dm +++ /dev/null @@ -1,120 +0,0 @@ -/datum/unit_test/amputation/Run() - var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human) - var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) - - TEST_ASSERT_EQUAL(patient.get_missing_limbs().len, 0, "Patient is somehow missing limbs before surgery") - - var/datum/surgery/amputation/surgery = new(patient, BODY_ZONE_R_ARM, patient.get_bodypart(BODY_ZONE_R_ARM)) - - var/datum/surgery_step/sever_limb/sever_limb = new - sever_limb.success(user, patient, BODY_ZONE_R_ARM, null, surgery) - - TEST_ASSERT_EQUAL(patient.get_missing_limbs().len, 1, "Patient did not lose any limbs") - TEST_ASSERT_EQUAL(patient.get_missing_limbs()[1], BODY_ZONE_R_ARM, "Patient is missing a limb that isn't the one we operated on") - -/datum/unit_test/brain_surgery/Run() - var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human) - patient.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_SURGERY) - patient.setOrganLoss(ORGAN_SLOT_BRAIN, 20) - - TEST_ASSERT(patient.has_trauma_type(), "Patient does not have any traumas, despite being given one") - - var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) - - var/datum/surgery_step/fix_brain/fix_brain = new - fix_brain.success(user, patient) - - TEST_ASSERT(!patient.has_trauma_type(), "Patient kept their brain trauma after brain surgery") - TEST_ASSERT(patient.getOrganLoss(ORGAN_SLOT_BRAIN) < 20, "Patient did not heal their brain damage after brain surgery") - -/datum/unit_test/head_transplant/Run() - var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) - var/mob/living/carbon/human/alice = allocate(/mob/living/carbon/human) - var/mob/living/carbon/human/bob = allocate(/mob/living/carbon/human) - - alice.fully_replace_character_name(null, "Alice") - bob.fully_replace_character_name(null, "Bob") - - var/obj/item/bodypart/head/alices_head = alice.get_bodypart(BODY_ZONE_HEAD) - alices_head.drop_limb() - - var/obj/item/bodypart/head/bobs_head = bob.get_bodypart(BODY_ZONE_HEAD) - bobs_head.drop_limb() - - TEST_ASSERT_EQUAL(alice.get_bodypart(BODY_ZONE_HEAD), null, "Alice still has a head after dismemberment") - TEST_ASSERT_EQUAL(alice.get_visible_name(), "Unknown", "Alice's head was dismembered, but they are not Unknown") - - TEST_ASSERT_EQUAL(bobs_head.real_name, "Bob", "Bob's head does not remember that it is from Bob") - - // Put Bob's head onto Alice's body - var/datum/surgery_step/add_prosthetic/add_prosthetic = new - user.put_in_active_hand(bobs_head) - add_prosthetic.success(user, alice, BODY_ZONE_HEAD, bobs_head) - - TEST_ASSERT(!isnull(alice.get_bodypart(BODY_ZONE_HEAD)), "Alice has no head after prosthetic replacement") - TEST_ASSERT_EQUAL(alice.get_visible_name(), "Bob", "Bob's head was transplanted onto Alice's body, but their name is not Bob") - -/datum/unit_test/multiple_surgeries/Run() - var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) - var/mob/living/carbon/human/patient_zero = allocate(/mob/living/carbon/human) - var/mob/living/carbon/human/patient_one = allocate(/mob/living/carbon/human) - - var/obj/item/scalpel/scalpel = allocate(/obj/item/scalpel) - - var/datum/surgery_step/incise/surgery_step = new - var/datum/surgery/organ_manipulation/surgery_for_zero = new - - INVOKE_ASYNC(surgery_step, /datum/surgery_step/proc/initiate, user, patient_zero, BODY_ZONE_CHEST, scalpel, surgery_for_zero) - TEST_ASSERT(surgery_for_zero.step_in_progress, "Surgery on patient zero was not initiated") - - var/datum/surgery/organ_manipulation/surgery_for_one = new - - // Without waiting for the incision to complete, try to start a new surgery - TEST_ASSERT(!surgery_step.initiate(user, patient_one, BODY_ZONE_CHEST, scalpel, surgery_for_one), "Was allowed to start a second surgery without the rod of asclepius") - TEST_ASSERT(!surgery_for_one.step_in_progress, "Surgery for patient one is somehow in progress, despite not initiating") - - user.apply_status_effect(STATUS_EFFECT_HIPPOCRATIC_OATH) - INVOKE_ASYNC(surgery_step, /datum/surgery_step/proc/initiate, user, patient_one, BODY_ZONE_CHEST, scalpel, surgery_for_one) - TEST_ASSERT(surgery_for_one.step_in_progress, "Surgery on patient one was not initiated, despite having rod of asclepius") - -/// Ensures that the tend wounds surgery can be started -/datum/unit_test/start_tend_wounds - -/datum/unit_test/start_tend_wounds/Run() - var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human) - var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) - - var/datum/surgery/surgery = new /datum/surgery/healing/brute/basic - - if (!surgery.can_start(user, patient)) - TEST_FAIL("Can't start basic tend wounds!") - - qdel(surgery) - -/datum/unit_test/tend_wounds/Run() - var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human) - patient.take_overall_damage(100, 100) - - var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human) - - // Test that tending wounds actually lowers damage - var/datum/surgery_step/heal/brute/basic/basic_brute_heal = new - basic_brute_heal.success(user, patient, BODY_ZONE_CHEST) - TEST_ASSERT(patient.getBruteLoss() < 100, "Tending brute wounds didn't lower brute damage ([patient.getBruteLoss()])") - - var/datum/surgery_step/heal/burn/basic/basic_burn_heal = new - basic_burn_heal.success(user, patient, BODY_ZONE_CHEST) - TEST_ASSERT(patient.getFireLoss() < 100, "Tending burn wounds didn't lower burn damage ([patient.getFireLoss()])") - - // Test that wearing clothing lowers heal amount - var/mob/living/carbon/human/naked_patient = allocate(/mob/living/carbon/human) - naked_patient.take_overall_damage(100) - - var/mob/living/carbon/human/clothed_patient = allocate(/mob/living/carbon/human) - clothed_patient.equipOutfit(/datum/outfit/job/doctor, TRUE) - clothed_patient.take_overall_damage(100) - - basic_brute_heal.success(user, naked_patient, BODY_ZONE_CHEST) - basic_brute_heal.success(user, clothed_patient, BODY_ZONE_CHEST) - - TEST_ASSERT(naked_patient.getBruteLoss() < clothed_patient.getBruteLoss(), "Naked patient did not heal more from wounds tending than a clothed patient") From 2be3fadecb1b7578e009752a504aac3bc80f38e0 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 22 Jul 2023 12:45:41 -0500 Subject: [PATCH 057/147] sheesh --- code/datums/quixotejump.dm | 10 ++++++++-- code/modules/clothing/spacesuits/hardsuit.dm | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/code/datums/quixotejump.dm b/code/datums/quixotejump.dm index 8ed02f286cb5..98827a2a2df6 100644 --- a/code/datums/quixotejump.dm +++ b/code/datums/quixotejump.dm @@ -6,13 +6,13 @@ var/charges = 3 var/max_charges = 3 var/charge_rate = 60 //3 seconds - var/mob/living/carbon/human/holder + var/datum/weakref/holder_ref var/dash_sound = 'sound/magic/blink.ogg' var/beam_effect = "blur" /datum/action/innate/quixotejump/Grant(mob/user) . = ..() - holder = user + holder_ref = WEAKREF(user) /datum/action/innate/quixotejump/IsAvailable() if(charges > 0) @@ -21,11 +21,17 @@ return FALSE /datum/action/innate/quixotejump/proc/charge() + var/mob/living/carbon/human/holder = holder_ref.resolve() + if(isnull(holder)) + return charges = clamp(charges + 1, 0, max_charges) holder.update_action_buttons_icon() to_chat(holder, "Quixote dash mechanisms now have [charges]/[max_charges] charges.") /datum/action/innate/quixotejump/Activate() + var/mob/living/carbon/human/holder = holder_ref.resolve() + if(isnull(holder)) + return if(!charges) to_chat(holder, "Quixote dash mechanisms are still recharging. Please standby.") return diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index bde5ba13e3eb..6a4235c7ee10 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -1240,6 +1240,10 @@ . = ..() jump = new(src) +/obj/item/clothing/suit/space/hardsuit/quixote/Destroy() + QDEL_NULL(jump) + return ..() + /obj/item/clothing/suit/space/hardsuit/quixote/equipped(mob/user, slot) . = ..() if(slot == ITEM_SLOT_OCLOTHING) From 96ef1f1d814c0af135e75e564ddf47879d2608bf Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 22 Jul 2023 12:46:58 -0500 Subject: [PATCH 058/147] REEE --- code/modules/unit_tests/ship_placement.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/unit_tests/ship_placement.dm b/code/modules/unit_tests/ship_placement.dm index 301ec4d6078e..7261fa5efd47 100644 --- a/code/modules/unit_tests/ship_placement.dm +++ b/code/modules/unit_tests/ship_placement.dm @@ -5,11 +5,11 @@ try new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) catch(var/exception/e) - TEST_FAIL("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") + Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE var/list/errors = atmosscan(TRUE) errors += powerdebug(TRUE) for(var/error in errors) - TEST_FAIL("[error]") + Fail("[error]") From 4b0842db936abc4ba4006ad4cec99ef3c7228f29 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 22 Jul 2023 12:47:45 -0500 Subject: [PATCH 059/147] OH FUCK AAAA --- code/_compile_options.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 8d743b0674b9..224367aaa9cf 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -41,7 +41,7 @@ #define GC_FAILURE_HARD_LOOKUP #endif // REFERENCE_DOING_IT_LIVE -#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER +//#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER #ifndef PRELOAD_RSC //set to: #define PRELOAD_RSC 2 // 0 to allow using external resources or on-demand behaviour; From d23b3e43fc61516f2718239b45366bbeeb46b9a0 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 22 Jul 2023 23:50:26 -0500 Subject: [PATCH 060/147] gwuhh...... --- code/modules/overmap/ships/controlled_ship_datum.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index 86093d01e252..84fe5e27cc78 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -106,6 +106,8 @@ SSovermap.controlled_ships += src /datum/overmap/ship/controlled/Destroy() + //SHOULD be called first + . = ..() SSovermap.controlled_ships -= src helms.Cut() LAZYCLEARLIST(owner_candidates) @@ -127,7 +129,6 @@ LAZYCLEARLIST(applications) // set ourselves to ownerless to unregister signals set_owner_mob(null) - return ..() /datum/overmap/ship/controlled/get_jump_to_turf() return get_turf(shuttle_port) From 07edd2098f105342c2e60e88160327299df8df0a Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 25 Jul 2023 00:13:44 -0500 Subject: [PATCH 061/147] more harddel fixes --- code/datums/ai_laws.dm | 6 ++++++ code/game/machinery/fat_sucker.dm | 4 ++++ code/game/objects/items/devices/transfer_valve.dm | 9 ++++++--- code/modules/error_handler/error_handler.dm | 2 +- code/modules/mob/living/silicon/ai/ai.dm | 14 +++++++++++--- .../modules/mob/living/silicon/ai/robot_control.dm | 6 ++++++ .../simple_animal/hostile/venus_human_trap.dm | 8 +++++++- 7 files changed, 41 insertions(+), 8 deletions(-) diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index 8066c548896f..d2b499de92ed 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -18,6 +18,12 @@ var/list/devillaws = list() var/id = DEFAULT_AI_LAWID +/datum/ai_laws/Destroy(force, ...) + if(!QDELETED(owner)) + CRASH("AI lawset destroyed even though owner AI is not being destroyed.") + owner = null + return ..() + /datum/ai_laws/proc/lawid_to_type(lawid) var/all_ai_laws = subtypesof(/datum/ai_laws) for(var/al in all_ai_laws) diff --git a/code/game/machinery/fat_sucker.dm b/code/game/machinery/fat_sucker.dm index 995d8a4fb85d..0bc2fecce830 100644 --- a/code/game/machinery/fat_sucker.dm +++ b/code/game/machinery/fat_sucker.dm @@ -32,6 +32,10 @@ soundloop = new(list(src), FALSE) update_icon() +/obj/machinery/fat_sucker/Destroy() + QDEL_NULL(soundloop) + return ..() + /obj/machinery/fat_sucker/RefreshParts() ..() var/rating = 0 diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 5d8d9d290271..74bfafd0d41e 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -11,12 +11,14 @@ var/obj/item/tank/tank_one var/obj/item/tank/tank_two var/obj/item/assembly/attached_device - var/mob/attacher = null + var/datum/weakref/attacher_ref = null var/valve_open = FALSE var/toggle = TRUE /obj/item/transfer_valve/Destroy() - attached_device = null + QDEL_NULL(tank_one) + QDEL_NULL(tank_two) + QDEL_NULL(attached_device) return ..() /obj/item/transfer_valve/IsAssemblyHolder() @@ -57,7 +59,7 @@ A.holder = src A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb). log_bomber(user, "attached a [item.name] to a ttv -", src, null, FALSE) - attacher = user + attacher_ref = WEAKREF(user) return //These keep attached devices synced up, for example a TTV with a mouse trap being found in a bag so it's triggered, or moving the TTV with an infrared beam sensor to update the beam's direction. @@ -157,6 +159,7 @@ var/admin_attachment_message var/attachment_message if(attachment) + var/mob/attacher = attacher_ref.resolve() admin_attachment_message = " with [attachment] attached by [attacher ? ADMIN_LOOKUPFLW(attacher) : "Unknown"]" attachment_message = " with [attachment] attached by [attacher ? key_name_admin(attacher) : "Unknown"]" diff --git a/code/modules/error_handler/error_handler.dm b/code/modules/error_handler/error_handler.dm index 7d9454aa6cf7..668aaf6195a6 100644 --- a/code/modules/error_handler/error_handler.dm +++ b/code/modules/error_handler/error_handler.dm @@ -129,7 +129,7 @@ GLOBAL_VAR_INIT(total_runtimes_skipped, 0) #ifdef UNIT_TESTS if(GLOB.current_test) //good day, sir - GLOB.current_test.Fail("[main_line]\n[desclines.Join("\n")]") + GLOB.current_test.Fail("[main_line]\n[desclines.Join("\n")]", file = E.file, line = E.line) #endif diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 733596a19cb9..be7b26800146 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -38,14 +38,14 @@ var/can_be_carded = TRUE var/alarms = list("Motion"=list(), "Fire"=list(), "Atmosphere"=list(), "Power"=list(), "Camera"=list(), "Burglar"=list()) var/viewalerts = 0 - var/icon/holo_icon//Default is assigned when AI is created. + var/icon/holo_icon //Default is assigned when AI is created. var/obj/mecha/controlled_mech //For controlled_mech a mech, to determine whether to relaymove or use the AI eye. var/radio_enabled = TRUE //Determins if a carded AI can speak with its built in radio or not. radiomod = ";" //AIs will, by default, state their laws on the internal radio. var/obj/item/multitool/aiMulti var/mob/living/simple_animal/bot/Bot var/tracking = FALSE //this is 1 if the AI is currently tracking somebody, but the track has not yet been completed. - var/datum/effect_system/spark_spread/spark_system//So they can initialize sparks whenever/N + var/datum/effect_system/spark_spread/spark_system //So they can initialize sparks whenever/N //MALFUNCTION var/datum/module_picker/malf_picker @@ -193,7 +193,15 @@ /mob/living/silicon/ai/Destroy() GLOB.ai_list -= src - qdel(eyeobj) // No AI, no Eye + QDEL_NULL(eyeobj) // No AI, no Eye + QDEL_NULL(aiMulti) + QDEL_NULL(aiPDA) + QDEL_NULL(aicamera) + QDEL_NULL(builtInCamera) + QDEL_NULL(spark_system) + QDEL_NULL(laws) + if(robot_control) + QDEL_NULL(robot_control) malfhack = null . = ..() diff --git a/code/modules/mob/living/silicon/ai/robot_control.dm b/code/modules/mob/living/silicon/ai/robot_control.dm index e84a62694d3c..b70ae816b790 100644 --- a/code/modules/mob/living/silicon/ai/robot_control.dm +++ b/code/modules/mob/living/silicon/ai/robot_control.dm @@ -1,6 +1,12 @@ /datum/robot_control var/mob/living/silicon/ai/owner +/datum/robot_control/Destroy(force, ...) + if(!QDELETED(owner)) + CRASH("Robot Control panel destroyed even though owner AI is not being destroyed.") + owner = null + return ..() + /datum/robot_control/New(mob/living/silicon/ai/new_owner) if(!istype(new_owner)) qdel(src) diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index 020b160bbed9..fcffbd2bd9f4 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -19,6 +19,8 @@ smoothing_flags = NONE /// The amount of time it takes to create a venus human trap. var/growth_time = 120 SECONDS + /// The current vines + var/list/vines = list() /obj/structure/alien/resin/flower_bud_enemy/Initialize() . = ..() @@ -29,9 +31,13 @@ anchors += locate(x+2,y-2,z) for(var/turf/T in anchors) - Beam(T, "vine", maxdistance=5, beam_type=/obj/effect/ebeam/vine) + vines += Beam(T, "vine", maxdistance=5, beam_type=/obj/effect/ebeam/vine) addtimer(CALLBACK(src, .proc/bear_fruit), growth_time) +/obj/structure/alien/resin/flower_bud_enemy/Destroy() + QDEL_LIST(vines) + return ..() + /** * Spawns a venus human trap, then qdels itself. * From 3d25ba06b7b862ec1f64d4549f18e936b4a8917a Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 25 Jul 2023 00:46:53 -0500 Subject: [PATCH 062/147] fixes projectile runtime --- code/modules/projectiles/projectile.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index f926cf013306..751f897846b2 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -758,8 +758,6 @@ process_homing() var/forcemoved = FALSE for(var/i in 1 to SSprojectiles.global_iterations_per_move) - if(QDELETED(src)) - return trajectory.increment(trajectory_multiplier) var/turf/T = trajectory.return_turf() if(!istype(T)) @@ -780,6 +778,8 @@ else if(T != loc) step_towards(src, T) hitscan_last = loc + if(QDELETED(src)) + return if(!hitscanning && !forcemoved) pixel_x = trajectory.return_px() - trajectory.mpx * trajectory_multiplier * SSprojectiles.global_iterations_per_move pixel_y = trajectory.return_py() - trajectory.mpy * trajectory_multiplier * SSprojectiles.global_iterations_per_move From 0cbd4c914c244cb555fba2169341acbbf1e884aa Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 25 Jul 2023 16:07:34 -0500 Subject: [PATCH 063/147] more more more --- code/datums/beam.dm | 4 +++- code/game/objects/structures/ai_core.dm | 7 +++---- code/modules/mob/living/silicon/ai/ai.dm | 4 ---- code/modules/mob/living/silicon/pai/pai.dm | 1 + code/modules/mob/living/silicon/robot/robot.dm | 1 + code/modules/mob/living/silicon/silicon.dm | 1 + .../hostile/mining_mobs/elites/elite.dm | 13 ++++++------- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/code/datums/beam.dm b/code/datums/beam.dm index 8ff67bfb54fb..a8f07477c6df 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -90,7 +90,8 @@ /datum/beam/Destroy() QDEL_LIST(elements) - QDEL_NULL(visuals) + if(visuals) + QDEL_NULL(visuals) UnregisterSignal(origin, COMSIG_MOVABLE_MOVED) UnregisterSignal(target, COMSIG_MOVABLE_MOVED) target = null @@ -179,6 +180,7 @@ . += emissive_overlay /obj/effect/ebeam/Destroy() + owner?.visuals = null owner = null return ..() diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index d684ebef34a2..fc6ac6355c0c 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -30,11 +30,10 @@ /obj/structure/AIcore/Destroy() if(circuit) - qdel(circuit) - circuit = null + QDEL_NULL(circuit) if(brain) - qdel(brain) - brain = null + QDEL_NULL(brain) + QDEL_NULL(laws) return ..() /obj/structure/AIcore/latejoin_inactive diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index be7b26800146..df6360c2a947 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -195,11 +195,7 @@ GLOB.ai_list -= src QDEL_NULL(eyeobj) // No AI, no Eye QDEL_NULL(aiMulti) - QDEL_NULL(aiPDA) - QDEL_NULL(aicamera) - QDEL_NULL(builtInCamera) QDEL_NULL(spark_system) - QDEL_NULL(laws) if(robot_control) QDEL_NULL(robot_control) malfhack = null diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 7ec7f6b83459..cc646cfcc98c 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -90,6 +90,7 @@ /mob/living/silicon/pai/Destroy() QDEL_NULL(internal_instrument) + QDEL_NULL(laws) if(cable) QDEL_NULL(cable) if (loc != card) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 84ac57c12ef3..04a964e66f01 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -207,6 +207,7 @@ QDEL_NULL(inv2) QDEL_NULL(inv3) QDEL_NULL(spark_system) + QDEL_LIST(upgrades) cell = null return ..() diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 6ef4c9a67f27..1923df3b50eb 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -71,6 +71,7 @@ QDEL_NULL(aicamera) QDEL_NULL(builtInCamera) QDEL_NULL(aiPDA) + QDEL_NULL(laws) GLOB.silicon_mobs -= src return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm index 35599ecdfe43..33bd3e6ba0f0 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm @@ -68,19 +68,18 @@ While using this makes the system rely on OnFire, it still gives options for tim icon_icon = 'icons/mob/actions/actions_elites.dmi' button_icon_state = "" background_icon_state = "bg_default" - var/mob/living/simple_animal/hostile/asteroid/elite/M var/chosen_message var/chosen_attack_num = 0 /datum/action/innate/elite_attack/Grant(mob/living/L) - if(istype(L, /mob/living/simple_animal/hostile/asteroid/elite)) - M = L - return ..() - return FALSE + if(!istype(L, /mob/living/simple_animal/hostile/asteroid/elite)) + return FALSE + return ..() /datum/action/innate/elite_attack/Activate() - M.chosen_attack = chosen_attack_num - to_chat(M, chosen_message) + var/mob/living/simple_animal/hostile/asteroid/elite/elite_owner = owner + elite_owner.chosen_attack = chosen_attack_num + to_chat(elite_owner, chosen_message) //The Pulsing Tumor, the actual "spawn-point" of elites, handles the spawning, arena, and procs for dealing with basic scenarios. From bfacb463b5a8435edc7f8cdd5462232a8ed12e8a Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 25 Jul 2023 16:36:30 -0500 Subject: [PATCH 064/147] trying this I guess --- .../mob/living/simple_animal/hostile/venus_human_trap.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index fcffbd2bd9f4..52b134672075 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -197,5 +197,8 @@ * Arguments: * * datum/beam/vine - The vine to be removed from the list. */ -/mob/living/simple_animal/hostile/venus_human_trap/proc/remove_vine(datum/beam/vine, force) +/mob/living/simple_animal/hostile/venus_human_trap/proc/remove_vine(datum/beam/vine) + SIGNAL_HANDLER + + UnregisterSignal(vine, COMSIG_PARENT_QDELETING) vines -= vine From 7cd042781a5b3820b37256d16b8aa219b61f9ac3 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 25 Jul 2023 16:49:29 -0500 Subject: [PATCH 065/147] idfk --- .../mob/living/simple_animal/hostile/venus_human_trap.dm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index 52b134672075..e518955d91af 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -53,10 +53,10 @@ mouse_opacity = MOUSE_OPACITY_ICON desc = "A thick vine, painful to the touch." -/obj/effect/ebeam/vine/Initialize() +/obj/effect/ebeam/vine/Initialize(mapload) . = ..() var/static/list/loc_connections = list( - COMSIG_ATOM_ENTERED = .proc/on_entered, + COMSIG_ATOM_ENTERED = PROC_REF(on_entered), ) AddElement(/datum/element/connect_loc, loc_connections) @@ -66,7 +66,7 @@ var/mob/living/L = AM if(!isvineimmune(L)) L.adjustBruteLoss(5) - to_chat(L, "You cut yourself on the thorny vines.") + to_chat(L, span_alert("You cut yourself on the thorny vines.")) /** * Venus Human Trap @@ -151,6 +151,7 @@ /mob/living/simple_animal/hostile/venus_human_trap/Destroy() for(var/datum/beam/vine as anything in vines) qdel(vine) // reference is automatically deleted by remove_vine + vines.Cut() return ..() /** From e9add73bd5de1e9407d845f2c5ca04c8442cb525 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 25 Jul 2023 17:18:06 -0500 Subject: [PATCH 066/147] PLeASE --- code/datums/beam.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/datums/beam.dm b/code/datums/beam.dm index a8f07477c6df..4cac802d5911 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -163,6 +163,8 @@ segment.pixel_x = origin_px + Pixel_x segment.pixel_y = origin_py + Pixel_y + //This var might hold onto references, and we might be qdeleted during the check_tick... so yeah. + segment = null CHECK_TICK /obj/effect/ebeam From c641aac9b33180051a541faa67c60e744fc29441 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 25 Jul 2023 22:42:54 -0500 Subject: [PATCH 067/147] more things --- code/datums/beam.dm | 4 +--- code/game/objects/effects/spawners/structure.dm | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code/datums/beam.dm b/code/datums/beam.dm index 4cac802d5911..f29d687e02a4 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -163,8 +163,6 @@ segment.pixel_x = origin_px + Pixel_x segment.pixel_y = origin_py + Pixel_y - //This var might hold onto references, and we might be qdeleted during the check_tick... so yeah. - segment = null CHECK_TICK /obj/effect/ebeam @@ -182,7 +180,7 @@ . += emissive_overlay /obj/effect/ebeam/Destroy() - owner?.visuals = null + owner?.elements -= src owner = null return ..() diff --git a/code/game/objects/effects/spawners/structure.dm b/code/game/objects/effects/spawners/structure.dm index cd2a3d7cc134..be5293925c19 100644 --- a/code/game/objects/effects/spawners/structure.dm +++ b/code/game/objects/effects/spawners/structure.dm @@ -4,6 +4,9 @@ Because mapping is already tedious enough this spawner let you spawn generic again. */ +//These NEED to spawn immediately, because windows are important for keeping the space out +INITIALIZE_IMMEDIATE(/obj/effect/spawner/structure) + /obj/effect/spawner/structure name = "map structure spawner" var/list/spawn_list From ac5084759fba7ebbcc45b609833c7cabbc27aeb8 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 00:17:41 -0500 Subject: [PATCH 068/147] Almost there --- code/__DEFINES/traits.dm | 2 ++ code/datums/beam.dm | 2 ++ code/datums/elements/forced_gravity.dm | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 6b0695fe7d4c..b8bcbca1f079 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -216,6 +216,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_NOMOBSWAP "no-mob-swap" #define TRAIT_XRAY_VISION "xray_vision" #define TRAIT_THERMAL_VISION "thermal_vision" +/// We have some form of forced gravity acting on us +#define TRAIT_FORCED_GRAVITY "forced_gravity" #define TRAIT_ABDUCTOR_TRAINING "abductor-training" #define TRAIT_ABDUCTOR_SCIENTIST_TRAINING "abductor-scientist-training" #define TRAIT_SURGEON "surgeon" diff --git a/code/datums/beam.dm b/code/datums/beam.dm index f29d687e02a4..bfb395d528a0 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -163,6 +163,8 @@ segment.pixel_x = origin_px + Pixel_x segment.pixel_y = origin_py + Pixel_y + //This var might hold onto references, and we might be qdeleted during the check_tick... so yeah. + segment = null CHECK_TICK /obj/effect/ebeam diff --git a/code/datums/elements/forced_gravity.dm b/code/datums/elements/forced_gravity.dm index b184aa989cb0..c567ff7b0961 100644 --- a/code/datums/elements/forced_gravity.dm +++ b/code/datums/elements/forced_gravity.dm @@ -9,6 +9,10 @@ if(!isatom(target)) return ELEMENT_INCOMPATIBLE + var/our_ref = REF(src) + if(HAS_TRAIT_FROM(target, TRAIT_FORCED_GRAVITY, our_ref)) + return + src.gravity = gravity src.ignore_space = ignore_space @@ -16,10 +20,13 @@ if(isturf(target)) RegisterSignal(target, COMSIG_TURF_HAS_GRAVITY, .proc/turf_gravity_check) + ADD_TRAIT(target, TRAIT_FORCED_GRAVITY, our_ref) + /datum/element/forced_gravity/Detach(datum/source, force) . = ..() var/static/list/signals_b_gone = list(COMSIG_ATOM_HAS_GRAVITY, COMSIG_TURF_HAS_GRAVITY) UnregisterSignal(source, signals_b_gone) + REMOVE_TRAIT(source, TRAIT_FORCED_GRAVITY, REF(src)) /datum/element/forced_gravity/proc/gravity_check(datum/source, turf/location, list/gravs) SIGNAL_HANDLER From 4da1ca231d37075315e19818f8bbb32865e566a0 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 00:26:43 -0500 Subject: [PATCH 069/147] guh --- code/game/objects/effects/effect_system/effects_explosion.dm | 2 ++ code/game/objects/structures/traps.dm | 3 +++ 2 files changed, 5 insertions(+) diff --git a/code/game/objects/effects/effect_system/effects_explosion.dm b/code/game/objects/effects/effect_system/effects_explosion.dm index 98ac62f095a5..f12ee1e2df72 100644 --- a/code/game/objects/effects/effect_system/effects_explosion.dm +++ b/code/game/objects/effects/effect_system/effects_explosion.dm @@ -13,6 +13,8 @@ var/steps_amt = pick(1;25,2;50,3,4;200) for(var/j in 1 to steps_amt) step(src, direct) + if(QDELETED(src)) + return sleep(1) qdel(src) diff --git a/code/game/objects/structures/traps.dm b/code/game/objects/structures/traps.dm index aa7e94dffe8a..fefcc0e47b95 100644 --- a/code/game/objects/structures/traps.dm +++ b/code/game/objects/structures/traps.dm @@ -133,6 +133,9 @@ var/turf/our_turf = get_turf(src) if(!our_turf) return + if(!stored_item) + qdel(src) + return stored_item.forceMove(get_turf(src)) forceMove(stored_item) if(caught) From 6a333a8d96ad44a15c7f8f139630556fa5e0015b Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 00:56:33 -0500 Subject: [PATCH 070/147] well, guess it doesn't matter --- code/datums/beam.dm | 2 +- code/modules/unit_tests/create_and_destroy.dm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/datums/beam.dm b/code/datums/beam.dm index bfb395d528a0..6e3ce4bb48ae 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -164,6 +164,7 @@ segment.pixel_x = origin_px + Pixel_x segment.pixel_y = origin_py + Pixel_y //This var might hold onto references, and we might be qdeleted during the check_tick... so yeah. + //It doesn't really matter, because this whole proc counts as a ref for src, but still. segment = null CHECK_TICK @@ -182,7 +183,6 @@ . += emissive_overlay /obj/effect/ebeam/Destroy() - owner?.elements -= src owner = null return ..() diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 107f2aa3caef..bb8ae321aa0a 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -97,6 +97,8 @@ ignore += typesof(/obj/effect/ctf) //Our system doesn't support it without warning spam from unregister calls on things that never registered ignore += typesof(/obj/docking_port) + //This spawns beams as a part of init, which can sleep past an async proc. This hangs a ref, and fucks us. It's only a problem here because the beam sleeps with CHECK_TICK + ignore += typesof(/obj/structure/alien/resin/flower_bud) //Expects a mob to holderize, we have nothing to give ignore += typesof(/obj/item/clothing/head/mob_holder) //Needs ships From aab0117136eef4f810f2c6e612a12574c62efdf1 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 15:33:11 -0500 Subject: [PATCH 071/147] whoops --- code/modules/unit_tests/create_and_destroy.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index bb8ae321aa0a..95b79bd0267f 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -98,7 +98,7 @@ //Our system doesn't support it without warning spam from unregister calls on things that never registered ignore += typesof(/obj/docking_port) //This spawns beams as a part of init, which can sleep past an async proc. This hangs a ref, and fucks us. It's only a problem here because the beam sleeps with CHECK_TICK - ignore += typesof(/obj/structure/alien/resin/flower_bud) + ignore += typesof(/obj/structure/alien/resin/flower_bud_enemy) //Expects a mob to holderize, we have nothing to give ignore += typesof(/obj/item/clothing/head/mob_holder) //Needs ships From f17edb9ad4198fc5ebc400f4ca1b9fde05f99d5d Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 16:52:41 -0500 Subject: [PATCH 072/147] soon --- code/game/objects/effects/anomalies/anomalies_flux.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/game/objects/effects/anomalies/anomalies_flux.dm b/code/game/objects/effects/anomalies/anomalies_flux.dm index 56e6f2c4c15e..b1318953f4a6 100644 --- a/code/game/objects/effects/anomalies/anomalies_flux.dm +++ b/code/game/objects/effects/anomalies/anomalies_flux.dm @@ -35,6 +35,9 @@ /obj/effect/anomaly/flux/proc/on_entered(datum/source, atom/movable/AM) SIGNAL_HANDLER + //the countdown effect, lmao + if(iseffect(AM)) + return mobShock(AM) tesla_zap(src, zap_range, zap_power, zap_flags) new /obj/effect/particle_effect/sparks(loc) From 156eacaceaa6aa41ba0aa08c5d5c6d501705d09f Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 17:14:02 -0500 Subject: [PATCH 073/147] I Hate This --- code/game/objects/effects/spawners/structure.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/game/objects/effects/spawners/structure.dm b/code/game/objects/effects/spawners/structure.dm index be5293925c19..158c542308fc 100644 --- a/code/game/objects/effects/spawners/structure.dm +++ b/code/game/objects/effects/spawners/structure.dm @@ -9,6 +9,8 @@ INITIALIZE_IMMEDIATE(/obj/effect/spawner/structure) /obj/effect/spawner/structure name = "map structure spawner" + //Just so stuff doesn't leak out while it's initializing + CanAtmosPass = FALSE var/list/spawn_list /obj/effect/spawner/structure/Initialize() From b5c3ef3ab55155884fa082be19d4d852c87015ae Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 18:06:31 -0500 Subject: [PATCH 074/147] bump From 13fb67bf63a14b6157dd5f65dac6d924f961503a Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 18:08:15 -0500 Subject: [PATCH 075/147] oops --- code/game/objects/effects/spawners/structure.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/effects/spawners/structure.dm b/code/game/objects/effects/spawners/structure.dm index 158c542308fc..9ce3411cc93a 100644 --- a/code/game/objects/effects/spawners/structure.dm +++ b/code/game/objects/effects/spawners/structure.dm @@ -10,7 +10,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/spawner/structure) /obj/effect/spawner/structure name = "map structure spawner" //Just so stuff doesn't leak out while it's initializing - CanAtmosPass = FALSE + CanAtmosPass = ATMOS_PASS_NO var/list/spawn_list /obj/effect/spawner/structure/Initialize() From 0fb8abf34bf2cf26b24ebbd229a5fb4d0efb5900 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 19:19:49 -0500 Subject: [PATCH 076/147] there --- code/game/objects/effects/effects.dm | 2 +- code/game/objects/effects/misc.dm | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/game/objects/effects/effects.dm b/code/game/objects/effects/effects.dm index f3ce881ba4c7..fea67e7341b4 100644 --- a/code/game/objects/effects/effects.dm +++ b/code/game/objects/effects/effects.dm @@ -3,7 +3,7 @@ //Effects are mostly temporary visual effects like sparks, smoke, as well as decals, etc... /obj/effect icon = 'icons/effects/effects.dmi' - resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | LANDING_PROOF | HYPERSPACE_PROOF + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | HYPERSPACE_PROOF move_resist = INFINITY obj_flags = 0 vis_flags = VIS_INHERIT_PLANE diff --git a/code/game/objects/effects/misc.dm b/code/game/objects/effects/misc.dm index f9f7d19d161f..3fd2889caa1b 100644 --- a/code/game/objects/effects/misc.dm +++ b/code/game/objects/effects/misc.dm @@ -100,5 +100,6 @@ return INITIALIZE_HINT_QDEL /obj/effect/abstract/directional_lighting + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF | LANDING_PROOF | HYPERSPACE_PROOF mouse_opacity = MOUSE_OPACITY_TRANSPARENT vis_flags = VIS_HIDE From 6527792e9b10064c5aa795607a68cc94f7af2f00 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 22:14:07 -0500 Subject: [PATCH 077/147] whoopsie --- code/game/objects/structures/tables_racks.dm | 4 ++-- code/modules/unit_tests/unit_test.dm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 5a48d6a1f440..0621a8ff17bd 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -587,7 +587,7 @@ smoothing_flags = NONE smoothing_groups = null canSmoothWith = null - can_buckle = 1 + can_buckle = TRUE buckle_lying = 90 //I don't see why you wouldn't be lying down while buckled to it buckle_requires_restraints = FALSE can_flip = FALSE @@ -616,7 +616,7 @@ /obj/structure/table/optable/proc/get_patient() var/mob/living/carbon/M = locate(/mob/living/carbon) in loc if(M) - if(M.resting) + if(M.resting || M.buckled == src) set_patient(M) else set_patient(null) diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm index 5104acb1d19d..64e6022fd62e 100644 --- a/code/modules/unit_tests/unit_test.dm +++ b/code/modules/unit_tests/unit_test.dm @@ -140,4 +140,4 @@ GLOBAL_VAR(test_log) SSticker.force_ending = TRUE //We have to call this manually because del_text can preceed us, and SSticker doesn't fire in the post game - SSticker.standard_reboot() + SSticker.declare_completion() From e4e4eb579560f713d1fa0c66f670125f08b1e5f3 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 22:19:51 -0500 Subject: [PATCH 078/147] oh, need this too --- tgui/packages/tgui/interfaces/OperatingComputer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tgui/packages/tgui/interfaces/OperatingComputer.js b/tgui/packages/tgui/interfaces/OperatingComputer.js index 87d1979aa813..a2291676c2e5 100644 --- a/tgui/packages/tgui/interfaces/OperatingComputer.js +++ b/tgui/packages/tgui/interfaces/OperatingComputer.js @@ -55,6 +55,9 @@ const PatientStateView = (props, context) => { if (!table) { return No Table Detected; } + if (!patient) { + return No Patient Detected; + } return ( <>
From 65bb60306093cf532a496519ffb13ad59b0a003a Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 26 Jul 2023 22:30:04 -0500 Subject: [PATCH 079/147] gwuhhh. --- code/modules/shuttle/on_move.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index e32a8bf76982..d656600af90a 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -140,6 +140,9 @@ All ShuttleMove procs go here // Called on atoms after everything has been moved /atom/movable/proc/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation) SHOULD_CALL_PARENT(TRUE) + if(QDELETED(src)) + CRASH("Movable qdeleted on shuttle move!") + var/turf/newT = get_turf(src) if (newT.z != oldT.z) onTransitZ(oldT.z, newT.z) From 11dfef2730835a2684768477b9d11f53081e9d47 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 27 Jul 2023 20:44:35 -0500 Subject: [PATCH 080/147] more things yay --- code/modules/admin/verbs/SDQL2/SDQL_2.dm | 4 ++++ code/modules/mob/living/simple_animal/hostile/regalrat.dm | 7 +++++++ code/modules/unit_tests/ship_outpost_placement.dm | 3 +++ 3 files changed, 14 insertions(+) diff --git a/code/modules/admin/verbs/SDQL2/SDQL_2.dm b/code/modules/admin/verbs/SDQL2/SDQL_2.dm index e9fee95ab5ed..0295a1f95cb6 100644 --- a/code/modules/admin/verbs/SDQL2/SDQL_2.dm +++ b/code/modules/admin/verbs/SDQL2/SDQL_2.dm @@ -355,6 +355,10 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/SDQL2_VV_all, new(null qdel_on_finish = finished_qdel /datum/SDQL2_query/Destroy() + if(delete_click) + QDEL_NULL(delete_click) + if(action_click) + QDEL_NULL(action_click) state = SDQL2_STATE_HALTING query_tree = null obj_count_all = null diff --git a/code/modules/mob/living/simple_animal/hostile/regalrat.dm b/code/modules/mob/living/simple_animal/hostile/regalrat.dm index 3d85af5dc84c..8c1e47926935 100644 --- a/code/modules/mob/living/simple_animal/hostile/regalrat.dm +++ b/code/modules/mob/living/simple_animal/hostile/regalrat.dm @@ -39,6 +39,13 @@ riot.Grant(src) INVOKE_ASYNC(src, .proc/get_player) +/mob/living/simple_animal/hostile/regalrat/Destroy() + coffer.Remove(src) + riot.Remove(src) + QDEL_NULL(coffer) + QDEL_NULL(riot) + return ..() + /mob/living/simple_animal/hostile/regalrat/proc/get_player() var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you want to play as the Royal Rat, cheesey be his crown?", ROLE_SENTIENCE, null, FALSE, 100, POLL_IGNORE_SENTIENCE_POTION) if(LAZYLEN(candidates) && !mind) diff --git a/code/modules/unit_tests/ship_outpost_placement.dm b/code/modules/unit_tests/ship_outpost_placement.dm index 6042f42d5fd6..d9e1b3d73541 100644 --- a/code/modules/unit_tests/ship_outpost_placement.dm +++ b/code/modules/unit_tests/ship_outpost_placement.dm @@ -33,3 +33,6 @@ // keeps ships ready for the next test, and stops us from loading 50 duplicate hangars if(cur_ship.docked_to) cur_ship.Undock(TRUE) + + for(var/datum/overmap/ship/controlled/deleting_ship as anything in SSovermap.controlled_ships) + qdel(deleting_ship) From 99cf0c73f3c76ebc4d60f472148ea7778c083080 Mon Sep 17 00:00:00 2001 From: Couls Date: Thu, 24 Sep 2020 05:00:41 -0400 Subject: [PATCH 081/147] improve performance of vis_overlays by handling dir by using vis_flags (#53816) vis dir changes are now handled by vis_flags --- code/controllers/subsystem/vis_overlays.dm | 24 ---------------------- code/game/objects/effects/overlays.dm | 8 +++++--- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/code/controllers/subsystem/vis_overlays.dm b/code/controllers/subsystem/vis_overlays.dm index 39feb5629428..a4b0fccae437 100644 --- a/code/controllers/subsystem/vis_overlays.dm +++ b/code/controllers/subsystem/vis_overlays.dm @@ -5,12 +5,10 @@ SUBSYSTEM_DEF(vis_overlays) init_order = INIT_ORDER_VIS var/list/vis_overlay_cache - var/list/unique_vis_overlays var/list/currentrun /datum/controller/subsystem/vis_overlays/Initialize() vis_overlay_cache = list() - unique_vis_overlays = list() return ..() /datum/controller/subsystem/vis_overlays/fire(resumed = FALSE) @@ -45,7 +43,6 @@ SUBSYSTEM_DEF(vis_overlays) overlay = _create_new_vis_overlay(icon, iconstate, layer, plane, dir, alpha, add_appearance_flags) overlay.cache_expiration = -1 var/cache_id = "\ref[overlay]@{[world.time]}" - unique_vis_overlays += overlay vis_overlay_cache[cache_id] = overlay . = overlay if(overlay == null) @@ -58,7 +55,6 @@ SUBSYSTEM_DEF(vis_overlays) if(!thing.managed_vis_overlays) thing.managed_vis_overlays = list(overlay) - RegisterSignal(thing, COMSIG_ATOM_DIR_CHANGE, .proc/rotate_vis_overlay) else thing.managed_vis_overlays += overlay @@ -81,23 +77,3 @@ SUBSYSTEM_DEF(vis_overlays) thing.managed_vis_overlays -= overlays if(!length(thing.managed_vis_overlays)) thing.managed_vis_overlays = null - UnregisterSignal(thing, COMSIG_ATOM_DIR_CHANGE) - -/datum/controller/subsystem/vis_overlays/proc/rotate_vis_overlay(atom/thing, old_dir, new_dir) - SIGNAL_HANDLER - - if(old_dir == new_dir) - return - var/rotation = dir2angle(old_dir) - dir2angle(new_dir) - var/list/overlays_to_remove = list() - for(var/i in thing.managed_vis_overlays - unique_vis_overlays) - var/obj/effect/overlay/vis/overlay = i - if(overlay == null) - message_debug("Somehow someway we are processing a null vis_overlay! ([thing.type])") - else - add_vis_overlay(thing, overlay.icon, overlay.icon_state, overlay.layer, overlay.plane, turn(overlay.dir, rotation), overlay.alpha, overlay.appearance_flags) - overlays_to_remove += overlay - for(var/i in thing.managed_vis_overlays & unique_vis_overlays) - var/obj/effect/overlay/vis/overlay = i - overlay.dir = turn(overlay.dir, rotation) - remove_vis_overlay(thing, overlays_to_remove) diff --git a/code/game/objects/effects/overlays.dm b/code/game/objects/effects/overlays.dm index 5331e0b466db..f5f28c60c80f 100644 --- a/code/game/objects/effects/overlays.dm +++ b/code/game/objects/effects/overlays.dm @@ -49,9 +49,11 @@ /obj/effect/overlay/vis mouse_opacity = MOUSE_OPACITY_TRANSPARENT anchored = TRUE - vis_flags = NONE - var/unused = 0 //When detected to be unused it gets set to world.time, after a while it gets removed - var/cache_expiration = 2 MINUTES // overlays which go unused for 2 minutes get cleaned up + vis_flags = VIS_INHERIT_DIR + ///When detected to be unused it gets set to world.time, after a while it gets removed + var/unused = 0 + ///overlays which go unused for this amount of time get cleaned up + var/cache_expiration = 2 MINUTES /obj/effect/overlay/light_visible name = "" From a4b7881e01b7dad341c33a499352757f78214998 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 27 Jul 2023 21:33:56 -0500 Subject: [PATCH 082/147] fixes fucking navbeacons --- code/game/machinery/navbeacon.dm | 13 ++++--------- code/modules/shuttle/on_move.dm | 16 ---------------- .../modules/unit_tests/ship_outpost_placement.dm | 6 +++--- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index be5d2d31e1a7..8855ea373f90 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -45,10 +45,8 @@ return ..() /obj/machinery/navbeacon/onTransitZ(old_z, new_z) - if (GLOB.navbeacons["[old_z]"]) - GLOB.navbeacons["[old_z]"] -= src - if (GLOB.navbeacons["[new_z]"]) - GLOB.navbeacons["[new_z]"] += src + LAZYREMOVE(GLOB.navbeacons["[old_z]"], src) + LAZYADD(GLOB.navbeacons["[new_z]"], src) ..() // set the transponder codes assoc list from codes_txt @@ -70,8 +68,7 @@ codes[e] = "1" /obj/machinery/navbeacon/proc/glob_lists_deregister() - if (GLOB.navbeacons["[z]"]) - GLOB.navbeacons["[z]"] -= src //Remove from beacon list, if in one. + LAZYREMOVE(GLOB.navbeacons["[z]"], src) GLOB.deliverybeacons -= src GLOB.deliverybeacontags -= location GLOB.wayfindingbeacons -= src @@ -82,9 +79,7 @@ if(!codes) return if(codes["patrol"]) - if(!GLOB.navbeacons["[z]"]) - GLOB.navbeacons["[z]"] = list() - GLOB.navbeacons["[z]"] += src //Register with the patrol list! + LAZYADD(GLOB.navbeacons["[z]"], src) if(codes["delivery"]) GLOB.deliverybeacons += src GLOB.deliverybeacontags += location diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index d656600af90a..1d03fb816110 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -291,22 +291,6 @@ All ShuttleMove procs go here // atmosinit() calls update_icon(), so we don't need to call it update_icon() -/obj/machinery/navbeacon/beforeShuttleMove(turf/newT, rotation, move_mode, obj/docking_port/mobile/moving_dock) - . = ..() - GLOB.navbeacons["[z]"] -= src - GLOB.deliverybeacons -= src - -/obj/machinery/navbeacon/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation) - . = ..() - - if(codes["patrol"]) - if(!GLOB.navbeacons["[z]"]) - GLOB.navbeacons["[z]"] = list() - GLOB.navbeacons["[z]"] += src //Register with the patrol list! - if(codes["delivery"]) - GLOB.deliverybeacons += src - GLOB.deliverybeacontags += location - /************************************Item move procs************************************/ /obj/item/storage/pod/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation) diff --git a/code/modules/unit_tests/ship_outpost_placement.dm b/code/modules/unit_tests/ship_outpost_placement.dm index d9e1b3d73541..08c13b9d28ae 100644 --- a/code/modules/unit_tests/ship_outpost_placement.dm +++ b/code/modules/unit_tests/ship_outpost_placement.dm @@ -6,14 +6,14 @@ // they'll spawn in empty space, and won't be docked new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) catch(var/exception/e) - Fail("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") + TEST_FAIL("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE var/list/errors = atmosscan(TRUE) errors += powerdebug(TRUE) for(var/error in errors) - Fail("[error]") + TEST_FAIL("[error]") for(var/outpost_type in subtypesof(/datum/overmap/outpost)) var/datum/overmap/outpost/test_outpost = new outpost_type() @@ -28,7 +28,7 @@ found_dock = TRUE break if(!found_dock) - Fail("[cur_ship.source_template.name] was unable to dock with [test_outpost.type]!") + TEST_FAIL("[cur_ship.source_template.name] was unable to dock with [test_outpost.type]!") // keeps ships ready for the next test, and stops us from loading 50 duplicate hangars if(cur_ship.docked_to) From ec702610b3e05c5044c09e4dabb99f8d552f9638 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 27 Jul 2023 21:41:12 -0500 Subject: [PATCH 083/147] fixes elevator runtimes in create_and_destroy --- code/modules/unit_tests/create_and_destroy.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 95b79bd0267f..4d7eff3aee5e 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -105,6 +105,9 @@ ignore += typesof(/obj/overmap) //Needs a holopad ignore += typesof(/mob/living/simple_animal/hologram) + //Needs an elevator + ignore += typesof(/obj/machinery/status_display/elevator) + ignore += typesof(/obj/machinery/elevator_floor_button) var/list/cached_contents = spawn_at.contents.Copy() var/original_turf_type = spawn_at.type From e413500cf619d94d9d4b812df781739265188565 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 27 Jul 2023 22:14:22 -0500 Subject: [PATCH 084/147] fixes one runtime --- code/modules/shuttle/on_move.dm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index 1d03fb816110..b1dc9619a598 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -79,11 +79,19 @@ All ShuttleMove procs go here //Dealing with the turf we left behind oldT.TransferComponents(src) SEND_SIGNAL(oldT, COMSIG_TURF_AFTER_SHUTTLE_MOVE, src) //Mostly for decals + + if(rotation) + shuttleRotate(rotation) //see shuttle_rotate.dm + //find the boundary between the shuttle that left and what remains - var/area/ship/A = loc - var/obj/docking_port/mobile/top_shuttle = A?.mobile_port - var/shuttle_layers = -1*A.get_missing_shuttles(src) - for(var/index in 1 to all_towed_shuttles.len) + var/area/ship/ship_area = loc + if(!istype(ship_area)) + return TRUE + + //Only run this code if it's a ship area + var/obj/docking_port/mobile/top_shuttle = ship_area.mobile_port + var/shuttle_layers = -1 * ship_area.get_missing_shuttles(src) + for(var/index in 1 to length(all_towed_shuttles)) var/obj/docking_port/mobile/M = all_towed_shuttles[index] if(!M.underlying_turf_area[src]) continue @@ -103,9 +111,6 @@ All ShuttleMove procs go here if(BT_index != length(baseturfs)) oldT.ScrapeAway(baseturfs.len - BT_index, CHANGETURF_FORCEOP) - if(rotation) - shuttleRotate(rotation) //see shuttle_rotate.dm - return TRUE /turf/proc/lateShuttleMove(turf/oldT) @@ -140,9 +145,6 @@ All ShuttleMove procs go here // Called on atoms after everything has been moved /atom/movable/proc/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation) SHOULD_CALL_PARENT(TRUE) - if(QDELETED(src)) - CRASH("Movable qdeleted on shuttle move!") - var/turf/newT = get_turf(src) if (newT.z != oldT.z) onTransitZ(oldT.z, newT.z) From 6ff4578b43d5ba75c0c4f535445da96cdd5f45ec Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 00:19:29 -0500 Subject: [PATCH 085/147] Space/Changeturf fixes and optimizations (#73261) We've got a few space related things that are busted, and shuttle movement is slow. I'd like to try to improve these things, if just a bit. Long list of only tenuously related topics. Sorry for the shotgun blast space](https://github.com/tgstation/tgstation/commit/d4de176a63f87d0f820e0cb610cd192750c897d6) We need to handle area transferring in maploading code under niche cases, and we also need to actually init reservation spaces we create. It's also redundant and potentially dupe creating to do area lighting handling in changeturf, because it gets touched in turf init anyway. Old me is stupid. ssmappping/transit](https://github.com/tgstation/tgstation/commit/269717145d70a4a73198791ca50253c708ee3ac1) We had a reserved space for just shuttles to use, except it wasn't for just shuttles. So in theory if the space got clogged with other shit, the shuttles could have nowhere to actually use. It's better to just have the two groups share real estate. More sane individual turf you check for activity)](https://github.com/tgstation/tgstation/commit/7312a314bef281c1b85a377cf2dcb647a2045050) context)](https://github.com/tgstation/tgstation/commit/be94c422ed76aa3f07b43cad4d1dc6b6148f135f) Starlight was causing each space turf to cause itself and its neighbor to constantly recheck if they had starlight off changeturf. The exact same effect can be had by taking advantage of some pre-existing information, namely if the space turf is gaining or losing a source of starlight. Essentially, instead of telling a turf to check all adjacent turfs to see if it's got starlight, we tell the turf if WE are a source of starlight, or if we might be taking something away from it. There's a bit of wasted cpu here but not much, if it's worth doing a register signal pattern for clearing depends on the case we're working with. Being intelligent about this makes things much faster, something in the neighborhood of 4 to 3 fold. I've also made openspace's starlight work better, cause the old pattern was a bit silly. bit](https://github.com/tgstation/tgstation/commit/386b3ab7fc2a820a9ffe3d2e39d78f96dc562d64) Don't do work if the thing you're working on doesn't exist, don't check every adjacent turf for firelocks on turf change (just have thefirelocks manage that), don't check all atoms on the turf for decals on turf change, similar. Also moves visibility changes from camera code into changeturf, to avoid unneeded work. Needs some extra work to optimize the guts for this path but I can do that! changes](https://github.com/tgstation/tgstation/commit/ebab69e9ea4adffd8787671f309f4ba27756c82e) We should only update vis when our opacity changes. In addition, we don't need all the camera handling fluff if we only want to update our turf's static groups. Also micros a camera net helper to be less crap for non multiz maps in opacity handling](https://github.com/tgstation/tgstation/commit/72ae07ba1db1fb1c4434a4cdaecc78ea6a2864fc) objects](https://github.com/tgstation/tgstation/commit/a99ff2265a4d1b157849fb7485adee17a3250df5) S dumb, and leads to space turfs having two sources of lighting, which looks wrong. This was invisible when their lighting was fullbright, but it sucks now. collisions](https://github.com/tgstation/tgstation/commit/40fb8f21e20d5bd9ef2f989eb166e03b30d66b3d) stupid](https://github.com/tgstation/tgstation/commit/bf4ee6710026e6ca9922d0f1fa49020ebde8cd6f) WHY ARE YOU USING THE RANGED TURF HELPER IF YOU GO ONE TILE wrong](https://github.com/tgstation/tgstation/commit/c85c2cfc86f3b2dd224cae6b12e2fc428846c30b) I'm sorry @Time-Green shuttles](https://github.com/tgstation/tgstation/commit/35e85334c4f815da0cadd8172e9908267a01d334) Adds a max reserved transit size to the shuttle subsystem, to keep things in bounds. In addition, adds a soft cap under which existing transit space will get hold onto, to make repeated non escape/arrive shuttle movements faster Hopefully this makes common shuttle moves less bad. Speed --- code/__HELPERS/game.dm | 21 +++++-- code/datums/components/overlay_lighting.dm | 11 ++-- code/datums/datum.dm | 14 ++--- code/game/atoms.dm | 10 ---- code/game/objects/effects/decals/decal.dm | 13 ++++- code/game/turfs/change_turf.dm | 25 +++++--- code/game/turfs/turf.dm | 3 - code/modules/lighting/lighting_atom.dm | 4 +- code/modules/lighting/lighting_setup.dm | 2 +- .../living/silicon/ai/freelook/cameranet.dm | 57 ++++++++++--------- 10 files changed, 88 insertions(+), 72 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 438bbdfda28f..ed429102e694 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -40,12 +40,23 @@ block( \ if(istype(T)) return T +///Returns a list with all the adjacent open turfs. /proc/get_adjacent_open_turfs(atom/center) - . = list(get_open_turf_in_dir(center, NORTH), - get_open_turf_in_dir(center, SOUTH), - get_open_turf_in_dir(center, EAST), - get_open_turf_in_dir(center, WEST)) - listclearnulls(.) + var/list/hand_back = list() + // Inlined get_open_turf_in_dir, just to be fast + var/turf/open/new_turf = get_step(center, NORTH) + if(istype(new_turf)) + hand_back += new_turf + new_turf = get_step(center, SOUTH) + if(istype(new_turf)) + hand_back += new_turf + new_turf = get_step(center, EAST) + if(istype(new_turf)) + hand_back += new_turf + new_turf = get_step(center, WEST) + if(istype(new_turf)) + hand_back += new_turf + return hand_back /proc/get_adjacent_open_areas(atom/center) . = list() diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 623b24fb2c42..4e36391d3914 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -156,8 +156,7 @@ ///Clears the affected_turfs lazylist, removing from its contents the effects of being near the light. /datum/component/overlay_lighting/proc/clean_old_turfs() - for(var/t in affected_turfs) - var/turf/lit_turf = t + for(var/turf/lit_turf as anything in affected_turfs) lit_turf.dynamic_lumcount -= lum_power affected_turfs = null @@ -167,9 +166,12 @@ if(!current_holder) return var/atom/movable/light_source = GET_LIGHT_SOURCE + . = list() for(var/turf/lit_turf in view(lumcount_range, get_turf(light_source))) lit_turf.dynamic_lumcount += lum_power - LAZYADD(affected_turfs, lit_turf) + . += lit_turf + if(length(.)) + affected_turfs = . ///Clears the old affected turfs and populates the new ones. @@ -407,8 +409,7 @@ . = lum_power lum_power = new_lum_power var/difference = . - lum_power - for(var/t in affected_turfs) - var/turf/lit_turf = t + for(var/turf/lit_turf as anything in affected_turfs) lit_turf.dynamic_lumcount -= difference ///Here we append the behavior associated to changing lum_power. diff --git a/code/datums/datum.dm b/code/datums/datum.dm index ff29802f10d1..e2f478ba7834 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -87,13 +87,13 @@ datum_flags &= ~DF_USE_TAG //In case something tries to REF us weak_reference = null //ensure prompt GCing of weakref. - var/list/timers = active_timers - active_timers = null - for(var/thing as anything in timers) - var/datum/timedevent/timer = thing - if (timer.spent && !(timer.flags & TIMER_DELETE_ME)) - continue - qdel(timer) + if(active_timers) + var/list/timers = active_timers + active_timers = null + for(var/datum/timedevent/timer as anything in timers) + if (timer.spent && !(timer.flags & TIMER_DELETE_ME)) + continue + qdel(timer) #ifdef REFERENCE_TRACKING #ifdef REFERENCE_TRACKING_DEBUG diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 89922c3ce592..da205b72749e 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -962,16 +962,6 @@ /atom/proc/handle_atom_del(atom/A) SEND_SIGNAL(src, COMSIG_ATOM_CONTENTS_DEL, A) -/** - * called when the turf the atom resides on is ChangeTurfed - * - * Default behaviour is to loop through atom contents and call their HandleTurfChange() proc - */ -/atom/proc/HandleTurfChange(turf/T) - for(var/atom in src) - var/atom/A = atom - A.HandleTurfChange(T) - /** * the vision impairment to give to the mob whose perspective is set to that atom * diff --git a/code/game/objects/effects/decals/decal.dm b/code/game/objects/effects/decals/decal.dm index 7aea2fcb4c7d..504c49d4a582 100644 --- a/code/game/objects/effects/decals/decal.dm +++ b/code/game/objects/effects/decals/decal.dm @@ -9,6 +9,10 @@ . = ..() if(turf_loc_check && (!isturf(loc) || NeverShouldHaveComeHere(loc))) return INITIALIZE_HINT_QDEL + var/static/list/loc_connections = list( + COMSIG_TURF_CHANGED = PROC_REF(handle_turf_change), + ) + AddElement(/datum/element/connect_loc, loc_connections) /obj/effect/decal/blob_act(obj/structure/blob/B) if(B && B.loc == loc) @@ -24,9 +28,12 @@ if(!(resistance_flags & FIRE_PROOF)) //non fire proof decal or being burned by lava qdel(src) -/obj/effect/decal/HandleTurfChange(turf/T) - ..() - if(T == loc && NeverShouldHaveComeHere(T)) +/obj/effect/decal/proc/handle_turf_change(turf/source, path, list/new_baseturfs, flags, list/post_change_callbacks) + SIGNAL_HANDLER + post_change_callbacks += CALLBACK(src, PROC_REF(sanity_check_self)) + +/obj/effect/decal/proc/sanity_check_self(turf/changed) + if(changed == loc && NeverShouldHaveComeHere(changed)) qdel(src) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm index 885128f2caf0..a8567072f56b 100644 --- a/code/game/turfs/change_turf.dm +++ b/code/game/turfs/change_turf.dm @@ -84,6 +84,8 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( var/old_lighting_corner_SW = lighting_corner_SW var/old_lighting_corner_NW = lighting_corner_NW var/old_directional_opacity = directional_opacity + var/old_dynamic_lumcount = dynamic_lumcount + var/old_opacity = opacity var/old_exl = explosion_level var/old_exi = explosion_id @@ -134,6 +136,8 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( lighting_corner_SW = old_lighting_corner_SW lighting_corner_NW = old_lighting_corner_NW + dynamic_lumcount = old_dynamic_lumcount + if(SSlighting.initialized) lighting_object = old_lighting_object @@ -151,8 +155,11 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( for(var/turf/open/space/S in RANGE_TURFS(1, W)) //RANGE_TURFS is in code\__HELPERS\game.dm S.check_starlight(W) - // Smoothing is deferred if CHANGETURF_DEFER_BATCH is set. - if(!(flags & CHANGETURF_DEFER_BATCH)) + if(old_opacity != opacity && SSticker) + GLOB.cameranet.bareMajorChunkChange(src) + + // Smoothing is deferred if CHANGETURF_DEFER_BATCH is set, or we're uninitialized + if(!(flags & CHANGETURF_DEFER_BATCH) && (flags_1 & INITIALIZED_1)) QUEUE_SMOOTH_NEIGHBORS(W) QUEUE_SMOOTH(W) @@ -170,7 +177,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( var/turf_fire_ref if(turf_fire) if(isgroundlessturf(newTurf)) - qdel(turf_fire) + QDEL_NULL(turf_fire) else turf_fire_ref = turf_fire newTurf.turf_fire = turf_fire_ref @@ -179,14 +186,15 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( QDEL_NULL(stashed_air) else if(turf_fire) - qdel(turf_fire) - if(ispath(path,/turf/closed)) - update_air_ref(-1) - . = ..() - else + QDEL_NULL(turf_fire) + if(ispath(path, /turf/open)) . = ..() if(!istype(air,/datum/gas_mixture)) Initalize_Atmos(0) + else + update_air_ref(-1) + . = ..() + // Take off the top layer turf and replace it with the next baseturf down /turf/proc/ScrapeAway(amount=1, flags) @@ -318,7 +326,6 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( for(var/obj/machinery/door/firedoor/FD in T) FD.CalculateAffectingAreas() - HandleTurfChange(src) /turf/open/AfterChange(flags) ..() diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 606c74f07056..e2fb89b9cb3b 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -118,8 +118,6 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists) if (smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) QUEUE_SMOOTH(src) - visibilityChanged() - for(var/atom/movable/content as anything in src) Entered(content, null) @@ -190,7 +188,6 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists) for(var/A in B.contents) qdel(A) return - visibilityChanged() QDEL_LIST(blueprint_data) flags_1 &= ~INITIALIZED_1 requires_activation = FALSE diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index e2879ea34b4c..fbdf2bccf634 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -26,9 +26,7 @@ // Will update the light (duh). // Creates or destroys it if needed, makes it update values, makes sure it's got the correct source turf... /atom/proc/update_light() - set waitfor = FALSE - if (QDELETED(src)) - return + SHOULD_NOT_SLEEP(TRUE) if(light_system != STATIC_LIGHT) CRASH("update_light() for [src] with following light_system value: [light_system]") diff --git a/code/modules/lighting/lighting_setup.dm b/code/modules/lighting/lighting_setup.dm index baf98d801337..fd26e1215f7c 100644 --- a/code/modules/lighting/lighting_setup.dm +++ b/code/modules/lighting/lighting_setup.dm @@ -2,7 +2,7 @@ for(var/turf/T in world) var/area/A = T.loc if(IS_DYNAMIC_LIGHTING(T) && IS_DYNAMIC_LIGHTING(A)) - new/atom/movable/lighting_object(T) + new /atom/movable/lighting_object(T) // Initial starlight updates used to be done in lighting_object initialize, // but doing them here means ChangeTurf doesn't occasionally update starlight twice. diff --git a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm b/code/modules/mob/living/silicon/ai/freelook/cameranet.dm index a3ffd460dd67..27136c4bbc94 100644 --- a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm +++ b/code/modules/mob/living/silicon/ai/freelook/cameranet.dm @@ -9,20 +9,20 @@ GLOBAL_DATUM_INIT(cameranet, /datum/cameranet, new) /datum/cameranet var/name = "Camera Net" // Name to show for VV and stat() - // The cameras on the map, no matter if they work or not. Updated in obj/machinery/camera.dm by New() and Del(). + /// The cameras on the map, no matter if they work or not. Updated in obj/machinery/camera.dm by New() and Del(). var/list/cameras = list() - // The chunks of the map, mapping the areas that the cameras can see. + /// The chunks of the map, mapping the areas that the cameras can see. var/list/chunks = list() var/ready = 0 - // The object used for the clickable stat() button. + /// The object used for the clickable stat() button. var/obj/effect/statclick/statclick - // The objects used in vis_contents of obscured turfs + /// The objects used in vis_contents of obscured turfs var/list/vis_contents_objects var/obj/effect/overlay/camera_static/vis_contents_opaque var/obj/effect/overlay/camera_static/vis_contents_transparent - // The image given to the effect in vis_contents on AI clients + /// The image given to the effect in vis_contents on AI clients var/image/obscured var/image/obscured_transparent @@ -37,14 +37,14 @@ GLOBAL_DATUM_INIT(cameranet, /datum/cameranet, new) obscured_transparent = new('icons/effects/cameravis.dmi', vis_contents_transparent, null, CAMERA_STATIC_LAYER) obscured_transparent.plane = CAMERA_STATIC_PLANE -// Checks if a chunk has been Generated in x, y, z. +/// Checks if a chunk has been Generated in x, y, z. /datum/cameranet/proc/chunkGenerated(x, y, z) x &= ~(CHUNK_SIZE - 1) y &= ~(CHUNK_SIZE - 1) return chunks["[x],[y],[z]"] -// Returns the chunk in the x, y, z. -// If there is no chunk, it creates a new chunk and returns that. +/// Returns the chunk in the x, y, z. +/// If there is no chunk, it creates a new chunk and returns that. /datum/cameranet/proc/getCameraChunk(x, y, z) x &= ~(CHUNK_SIZE - 1) y &= ~(CHUNK_SIZE - 1) @@ -53,8 +53,7 @@ GLOBAL_DATUM_INIT(cameranet, /datum/cameranet, new) if(!.) chunks[key] = . = new /datum/camerachunk(x, y, z) -// Updates what the aiEye can see. It is recommended you use this when the aiEye moves or it's location is set. - +/// Updates what the aiEye can see. It is recommended you use this when the aiEye moves or it's location is set. /datum/cameranet/proc/visibility(list/moved_eyes, client/C, list/other_eyes, use_static = USE_STATIC_OPAQUE) if(!islist(moved_eyes)) moved_eyes = moved_eyes ? list(moved_eyes) : list() @@ -106,8 +105,7 @@ GLOBAL_DATUM_INIT(cameranet, /datum/cameranet, new) if(USE_STATIC_OPAQUE) client.images -= GLOB.cameranet.obscured -// Updates the chunks that the turf is located in. Use this when obstacles are destroyed or when doors open. - +/// Updates the chunks that the turf is located in. Use this when obstacles are destroyed or when doors open. /datum/cameranet/proc/updateVisibility(atom/A, opacity_check = 1) if(!SSticker || (opacity_check && !A.opacity)) return @@ -119,29 +117,25 @@ GLOBAL_DATUM_INIT(cameranet, /datum/cameranet, new) return chunk.hasChanged() -// Removes a camera from a chunk. - +/// Removes a camera from a chunk. /datum/cameranet/proc/removeCamera(obj/machinery/camera/c) majorChunkChange(c, 0) -// Add a camera to a chunk. - +/// Add a camera to a chunk. /datum/cameranet/proc/addCamera(obj/machinery/camera/c) if(c.can_use()) majorChunkChange(c, 1) -// Used for Cyborg cameras. Since portable cameras can be in ANY chunk. - +/// Used for Cyborg cameras. Since portable cameras can be in ANY chunk. /datum/cameranet/proc/updatePortableCamera(obj/machinery/camera/c) if(c.can_use()) majorChunkChange(c, 1) -// Never access this proc directly!!!! -// This will update the chunk and all the surrounding chunks. -// It will also add the atom to the cameras list if you set the choice to 1. -// Setting the choice to 0 will remove the camera from the chunks. -// If you want to update the chunks around an object, without adding/removing a camera, use choice 2. - +/// Never access this proc directly!!!! +/// This will update the chunk and all the surrounding chunks. +/// It will also add the atom to the cameras list if you set the choice to 1. +/// Setting the choice to 0 will remove the camera from the chunks. +/// If you want to update the chunks around an object, without adding/removing a camera, use choice 2. /datum/cameranet/proc/majorChunkChange(atom/c, choice) if(!c) return @@ -164,8 +158,19 @@ GLOBAL_DATUM_INIT(cameranet, /datum/cameranet, new) chunk.cameras |= c chunk.hasChanged() -// Will check if a mob is on a viewable turf. Returns 1 if it is, otherwise returns 0. - +/// A faster, turf only version of [/datum/cameranet/proc/majorChunkChange] +/// For use in sensitive code, be careful with it +/datum/cameranet/proc/bareMajorChunkChange(turf/changed) + var/x1 = max(1, changed.x - (CHUNK_SIZE / 2)) + var/y1 = max(1, changed.y - (CHUNK_SIZE / 2)) + var/x2 = min(world.maxx, changed.x + (CHUNK_SIZE / 2)) + var/y2 = min(world.maxy, changed.y + (CHUNK_SIZE / 2)) + for(var/x = x1; x <= x2; x += CHUNK_SIZE) + for(var/y = y1; y <= y2; y += CHUNK_SIZE) + var/datum/camerachunk/chunk = chunkGenerated(x, y, changed.z) + chunk?.hasChanged() + +/// Will check if a mob is on a viewable turf. Returns 1 if it is, otherwise returns 0. /datum/cameranet/proc/checkCameraVis(mob/living/target) var/turf/position = get_turf(target) return checkTurfVis(position) From cc643c58cffde04840b7853671db7582d2c8e7c0 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 00:25:52 -0500 Subject: [PATCH 086/147] this probably won't help --- code/game/objects/effects/decals/cleanable.dm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index b44719ba904e..778547091ddb 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -28,11 +28,10 @@ var/static/list/loc_connections = list( COMSIG_ATOM_ENTERED = .proc/on_entered, - COMSIG_ATOM_EXITED = .proc/on_uncrossed, ) AddElement(/datum/element/connect_loc, loc_connections) - addtimer(CALLBACK(src, /datum.proc/_AddComponent, list(/datum/component/beauty, beauty)), 0) + AddElement(/datum/element/beauty, beauty) SSblackbox.record_feedback("tally", "station_mess_created", 1, name) @@ -80,10 +79,6 @@ reagents.expose_temperature(exposed_temperature) ..() -/obj/effect/decal/cleanable/proc/on_uncrossed(datum/source, atom/movable/O) - SIGNAL_HANDLER - return - //Add "bloodiness" of this blood's type, to the human's shoes //This is on /cleanable because fuck this ancient mess /obj/effect/decal/cleanable/proc/on_entered(datum/source, atom/movable/AM) From 3d7c6e56ad49e60273aa08159f7aabf585e57dc5 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 00:35:42 -0500 Subject: [PATCH 087/147] why the fuck are you like this --- code/game/objects/effects/decals/cleanable.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 778547091ddb..48e0eabe06e9 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -31,7 +31,7 @@ ) AddElement(/datum/element/connect_loc, loc_connections) - AddElement(/datum/element/beauty, beauty) + addtimer(CALLBACK(src, /datum.proc/_AddComponent, list(/datum/component/beauty, beauty)), 0) SSblackbox.record_feedback("tally", "station_mess_created", 1, name) From 2f2a116ccde5d662eb18c6732d586cc2e10b3bff Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 13:54:45 -0500 Subject: [PATCH 088/147] temporary debugging thingy --- code/datums/datum.dm | 1 + code/game/objects/objs.dm | 2 ++ code/modules/admin/view_variables/reference_tracking.dm | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index e2f478ba7834..4ab0c5ac46e4 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -51,6 +51,7 @@ var/list/found_refs #endif #endif + var/locname //TODO: KILL #ifdef DATUMVAR_DEBUGGING_MODE var/list/cached_vars diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index d2d1325e435b..2b8d260a8c93 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -79,6 +79,8 @@ T.add_blueprints(src) /obj/Destroy(force=FALSE) + var/area/current_area = get_area(src) + locname = "[current_area?.name] (est location: [check_shuttle_offset()])" if(!ismachinery(src)) STOP_PROCESSING(SSobj, src) // TODO: Have a processing bitflag to reduce on unnecessary loops through the processing lists SStgui.close_uis(src) diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 69d3a5d1541b..70c20dce4ae8 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -24,7 +24,7 @@ if(usr?.client) usr.client.running_find_references = type - log_reftracker("Beginning search for references to a [type].") + log_reftracker("Beginning search for references to a [type] (in [locname]).") var/starting_time = world.time From 70fa6f86ffccb39e7103825996676bbaffbeae97 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 14:29:26 -0500 Subject: [PATCH 089/147] Revert "temporary debugging thingy" This reverts commit 2f2a116ccde5d662eb18c6732d586cc2e10b3bff. --- code/datums/datum.dm | 1 - code/game/objects/objs.dm | 2 -- code/modules/admin/view_variables/reference_tracking.dm | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 4ab0c5ac46e4..e2f478ba7834 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -51,7 +51,6 @@ var/list/found_refs #endif #endif - var/locname //TODO: KILL #ifdef DATUMVAR_DEBUGGING_MODE var/list/cached_vars diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 2b8d260a8c93..d2d1325e435b 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -79,8 +79,6 @@ T.add_blueprints(src) /obj/Destroy(force=FALSE) - var/area/current_area = get_area(src) - locname = "[current_area?.name] (est location: [check_shuttle_offset()])" if(!ismachinery(src)) STOP_PROCESSING(SSobj, src) // TODO: Have a processing bitflag to reduce on unnecessary loops through the processing lists SStgui.close_uis(src) diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 70c20dce4ae8..69d3a5d1541b 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -24,7 +24,7 @@ if(usr?.client) usr.client.running_find_references = type - log_reftracker("Beginning search for references to a [type] (in [locname]).") + log_reftracker("Beginning search for references to a [type].") var/starting_time = world.time From dcb421dc4d3d5a60ab2949187b632f63a8378d4e Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 14:34:20 -0500 Subject: [PATCH 090/147] Revert "Revert "temporary debugging thingy"" This reverts commit 70fa6f86ffccb39e7103825996676bbaffbeae97. --- code/datums/datum.dm | 1 + code/game/objects/objs.dm | 2 ++ code/modules/admin/view_variables/reference_tracking.dm | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index e2f478ba7834..4ab0c5ac46e4 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -51,6 +51,7 @@ var/list/found_refs #endif #endif + var/locname //TODO: KILL #ifdef DATUMVAR_DEBUGGING_MODE var/list/cached_vars diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index d2d1325e435b..2b8d260a8c93 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -79,6 +79,8 @@ T.add_blueprints(src) /obj/Destroy(force=FALSE) + var/area/current_area = get_area(src) + locname = "[current_area?.name] (est location: [check_shuttle_offset()])" if(!ismachinery(src)) STOP_PROCESSING(SSobj, src) // TODO: Have a processing bitflag to reduce on unnecessary loops through the processing lists SStgui.close_uis(src) diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 69d3a5d1541b..70c20dce4ae8 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -24,7 +24,7 @@ if(usr?.client) usr.client.running_find_references = type - log_reftracker("Beginning search for references to a [type].") + log_reftracker("Beginning search for references to a [type] (in [locname]).") var/starting_time = world.time From 13b02c2c0b6832a320bc92010829fa01c7b8e076 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 14:38:08 -0500 Subject: [PATCH 091/147] temporary debugging thingy REVENGANCE --- code/game/objects/effects/decals/cleanable/robots.dm | 5 +++++ code/game/objects/objs.dm | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/game/objects/effects/decals/cleanable/robots.dm b/code/game/objects/effects/decals/cleanable/robots.dm index 79059b51f351..c165c0ac4ee4 100644 --- a/code/game/objects/effects/decals/cleanable/robots.dm +++ b/code/game/objects/effects/decals/cleanable/robots.dm @@ -51,6 +51,11 @@ blood_state = BLOOD_STATE_OIL bloodiness = BLOOD_AMOUNT_PER_DECAL beauty = -100 + var/shuttle_name + +/obj/effect/decal/cleanable/oil/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) + . = ..() + locname = "[port.current_ship.name] (est location: [check_shuttle_offset()])" /obj/effect/decal/cleanable/oil/Initialize() . = ..() diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 2b8d260a8c93..d2d1325e435b 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -79,8 +79,6 @@ T.add_blueprints(src) /obj/Destroy(force=FALSE) - var/area/current_area = get_area(src) - locname = "[current_area?.name] (est location: [check_shuttle_offset()])" if(!ismachinery(src)) STOP_PROCESSING(SSobj, src) // TODO: Have a processing bitflag to reduce on unnecessary loops through the processing lists SStgui.close_uis(src) From 47cfce6d01a28a3a0b939c16eab176857c96f284 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 15:03:01 -0500 Subject: [PATCH 092/147] temporary debugging thingy REVENGANCEERER --- code/game/objects/effects/decals/cleanable/robots.dm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/code/game/objects/effects/decals/cleanable/robots.dm b/code/game/objects/effects/decals/cleanable/robots.dm index c165c0ac4ee4..348496ffa504 100644 --- a/code/game/objects/effects/decals/cleanable/robots.dm +++ b/code/game/objects/effects/decals/cleanable/robots.dm @@ -51,15 +51,10 @@ blood_state = BLOOD_STATE_OIL bloodiness = BLOOD_AMOUNT_PER_DECAL beauty = -100 - var/shuttle_name - -/obj/effect/decal/cleanable/oil/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) - . = ..() - locname = "[port.current_ship.name] (est location: [check_shuttle_offset()])" /obj/effect/decal/cleanable/oil/Initialize() . = ..() - reagents.add_reagent(/datum/reagent/fuel/oil, 30) + locname = "[loc] [loc.loc] [json_encode(loc.contents)]" /obj/effect/decal/cleanable/oil/attackby(obj/item/I, mob/living/user) var/attacked_by_hot_thing = I.get_temperature() From 568c753ca7cee1b8508031976cc23454c7eff374 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 15:40:26 -0500 Subject: [PATCH 093/147] I HATE YOU --- code/datums/datum.dm | 1 - code/game/machinery/telecomms/machines/message_server.dm | 9 +++++++-- code/game/objects/effects/decals/cleanable/robots.dm | 4 ---- code/modules/admin/view_variables/reference_tracking.dm | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 4ab0c5ac46e4..e2f478ba7834 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -51,7 +51,6 @@ var/list/found_refs #endif #endif - var/locname //TODO: KILL #ifdef DATUMVAR_DEBUGGING_MODE var/list/cached_vars diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm index 8f37befee68e..51de169eb162 100644 --- a/code/game/machinery/telecomms/machines/message_server.dm +++ b/code/game/machinery/telecomms/machines/message_server.dm @@ -46,12 +46,17 @@ return return ..() -/obj/machinery/blackbox_recorder/Destroy() +/obj/machinery/blackbox_recorder/deconstruct(disassembled) if(stored) - stored.forceMove(loc) + stored.forceMove(drop_location()) new /obj/effect/decal/cleanable/oil(loc) return ..() +/obj/machinery/blackbox_recorder/Destroy() + if(stored) + QDEL_NULL(stored) + return ..() + /obj/machinery/blackbox_recorder/update_icon() . = ..() if(!stored) diff --git a/code/game/objects/effects/decals/cleanable/robots.dm b/code/game/objects/effects/decals/cleanable/robots.dm index 348496ffa504..f283de309cc8 100644 --- a/code/game/objects/effects/decals/cleanable/robots.dm +++ b/code/game/objects/effects/decals/cleanable/robots.dm @@ -52,10 +52,6 @@ bloodiness = BLOOD_AMOUNT_PER_DECAL beauty = -100 -/obj/effect/decal/cleanable/oil/Initialize() - . = ..() - locname = "[loc] [loc.loc] [json_encode(loc.contents)]" - /obj/effect/decal/cleanable/oil/attackby(obj/item/I, mob/living/user) var/attacked_by_hot_thing = I.get_temperature() if(attacked_by_hot_thing) diff --git a/code/modules/admin/view_variables/reference_tracking.dm b/code/modules/admin/view_variables/reference_tracking.dm index 70c20dce4ae8..69d3a5d1541b 100644 --- a/code/modules/admin/view_variables/reference_tracking.dm +++ b/code/modules/admin/view_variables/reference_tracking.dm @@ -24,7 +24,7 @@ if(usr?.client) usr.client.running_find_references = type - log_reftracker("Beginning search for references to a [type] (in [locname]).") + log_reftracker("Beginning search for references to a [type].") var/starting_time = world.time From 3f789ff87b5c9cb8e07365bd3a2a995ea764f735 Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Thu, 10 Jun 2021 14:42:11 -0700 Subject: [PATCH 094/147] shrug --- code/modules/lighting/lighting_object.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/lighting/lighting_object.dm b/code/modules/lighting/lighting_object.dm index 35b98fa145f3..476ce6d9b7bd 100644 --- a/code/modules/lighting/lighting_object.dm +++ b/code/modules/lighting/lighting_object.dm @@ -34,7 +34,7 @@ /atom/movable/lighting_object/Destroy(force) if (force) SSlighting.objects_queue -= src - if (loc != myturf) + if (loc != myturf && loc) var/turf/oldturf = get_turf(myturf) var/turf/newturf = get_turf(loc) stack_trace("A lighting object was qdeleted with a different loc then it is suppose to have ([COORD(oldturf)] -> [COORD(newturf)])") From 65c0ff1467afef48acc3a02b00795df6c5b20731 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 17:20:07 -0500 Subject: [PATCH 095/147] empty commit for tests From b397ed55d6a0bdd06fd74893cd9c850fb35d6bf7 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 17:20:12 -0500 Subject: [PATCH 096/147] empty commit for tests From 28c6be6bc735b5574fdee388e2fff2b3ed0faddd Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 17:20:14 -0500 Subject: [PATCH 097/147] empty commit for tests From 3e48d7688bfd2779fae19abd8f8cd1d4359206a7 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 18:09:47 -0500 Subject: [PATCH 098/147] polly & bookworm GC --- .../living/simple_animal/friendly/snake.dm | 4 ++ .../mob/living/simple_animal/parrot.dm | 67 ++++++++++++------- 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/code/modules/mob/living/simple_animal/friendly/snake.dm b/code/modules/mob/living/simple_animal/friendly/snake.dm index c9695c6e1a61..c24271d9b09e 100644 --- a/code/modules/mob/living/simple_animal/friendly/snake.dm +++ b/code/modules/mob/living/simple_animal/friendly/snake.dm @@ -41,6 +41,10 @@ var/glasses_overlay_file = 'icons/mob/pets.dmi' var/obj/item/clothing/glasses/glasses = null //snek glasses +/mob/living/simple_animal/hostile/retaliate/poison/snake/Destroy() + if(glasses) + QDEL_NULL(glasses) + return ..() /mob/living/simple_animal/hostile/retaliate/poison/snake/ListTargets(atom/the_target) . = oview(vision_range, targets_from) //get list of things in vision range diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index d506eee8ad4b..4eeda89cce89 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -70,7 +70,6 @@ var/parrot_state = PARROT_WANDER //Hunt for a perch when created var/parrot_sleep_max = 25 //The time the parrot sits while perched before looking around. Mosly a way to avoid the parrot's AI in life() being run every single tick. var/parrot_sleep_dur = 25 //Same as above, this is the var that physically counts down - var/parrot_dam_zone = list(BODY_ZONE_CHEST, BODY_ZONE_HEAD, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_ARM, BODY_ZONE_R_LEG) //For humans, select a bodypart to attack var/parrot_speed = 5 //"Delay in world ticks between movement." according to byond. Yeah, that's BS but it does directly affect movement. Higher number = slower. var/parrot_lastmove = null //Updates/Stores position of the parrot while it's moving @@ -276,18 +275,18 @@ * Attack responces */ //Humans, monkeys, aliens -/mob/living/simple_animal/parrot/attack_hand(mob/living/carbon/M) +/mob/living/simple_animal/parrot/attack_hand(mob/living/carbon/attacker) ..() if(client) return - if(!stat && M.a_intent == INTENT_HARM) + if(!stat && attacker.a_intent == INTENT_HARM) icon_state = icon_living //It is going to be flying regardless of whether it flees or attacks if(parrot_state == PARROT_PERCH) parrot_sleep_dur = parrot_sleep_max //Reset it's sleep timer if it was perched - parrot_interest = M + set_interest(attacker) parrot_state = PARROT_SWOOP //The parrot just got hit, it WILL move, now to pick a direction.. if(health > 30) //Let's get in there and squawk it up! @@ -295,18 +294,18 @@ else parrot_state |= PARROT_FLEE //Otherwise, fly like a bat out of hell! drop_held_item(0) - if(stat != DEAD && M.a_intent == INTENT_HELP) + if(stat != DEAD && attacker.a_intent == INTENT_HELP) handle_automated_speech(1) //assured speak/emote return -/mob/living/simple_animal/parrot/attack_paw(mob/living/carbon/monkey/M) - return attack_hand(M) +/mob/living/simple_animal/parrot/attack_paw(mob/living/carbon/monkey/attacker) + return attack_hand(attacker) -/mob/living/simple_animal/parrot/attack_alien(mob/living/carbon/alien/M) - return attack_hand(M) +/mob/living/simple_animal/parrot/attack_alien(mob/living/carbon/alien/attacker) + return attack_hand(attacker) //Simple animals -/mob/living/simple_animal/parrot/attack_animal(mob/living/simple_animal/M) +/mob/living/simple_animal/parrot/attack_animal(mob/living/simple_animal/attacker) . = ..() //goodbye immortal parrots if(client) @@ -315,8 +314,8 @@ if(parrot_state == PARROT_PERCH) parrot_sleep_dur = parrot_sleep_max //Reset it's sleep timer if it was perched - if(M.melee_damage_upper > 0 && !stat) - parrot_interest = M + if(attacker.melee_damage_upper > 0 && !stat) + set_interest(attacker) parrot_state = PARROT_SWOOP | PARROT_ATTACK //Attack other animals regardless icon_state = icon_living @@ -352,7 +351,7 @@ if(parrot_state == PARROT_PERCH) parrot_sleep_dur = parrot_sleep_max //Reset it's sleep timer if it was perched - parrot_interest = null + set_interest(null) parrot_state = PARROT_WANDER | PARROT_FLEE //Been shot and survived! RUN LIKE HELL! //parrot_been_shot += 5 icon_state = icon_living @@ -444,7 +443,7 @@ speak = newspeak //Search for item to steal - parrot_interest = search_for_item() + set_interest(search_for_item()) if(parrot_interest) manual_emote("looks in [parrot_interest]'s direction and takes flight.") parrot_state = PARROT_SWOOP | PARROT_STEAL @@ -455,7 +454,7 @@ else if(parrot_state == PARROT_WANDER) //Stop movement, we'll set it later walk(src, 0) - parrot_interest = null + set_interest(null) //Wander around aimlessly. This will help keep the loops from searches down //and possibly move the mob into a new are in view of something they can use @@ -464,15 +463,15 @@ return if(!held_item && !parrot_perch) //If we've got nothing to do.. look for something to do. - var/atom/movable/AM = search_for_perch_and_item() //This handles checking through lists so we know it's either a perch or stealable item - if(AM) - if(istype(AM, /obj/item) || isliving(AM)) //If stealable item - parrot_interest = AM + var/atom/movable/potential_perch = search_for_perch_and_item() //This handles checking through lists so we know it's either a perch or stealable item + if(potential_perch) + if(istype(potential_perch, /obj/item) || isliving(potential_perch)) //If stealable item + set_interest(potential_perch) manual_emote("turns and flies towards [parrot_interest].") parrot_state = PARROT_SWOOP | PARROT_STEAL return else //Else it's a perch - parrot_perch = AM + set_perch(potential_perch) parrot_state = PARROT_SWOOP | PARROT_RETURN return return @@ -512,7 +511,7 @@ parrot_interest.forceMove(src) visible_message("[src] grabs [held_item]!", "You grab [held_item]!", "You hear the sounds of wings flapping furiously.") - parrot_interest = null + set_interest(null) parrot_state = PARROT_SWOOP | PARROT_RETURN return @@ -526,7 +525,7 @@ else if(parrot_state == (PARROT_SWOOP | PARROT_RETURN)) walk(src, 0) if(!parrot_perch || !isturf(parrot_perch.loc)) //Make sure the perch exists and somehow isnt inside of something else. - parrot_perch = null + set_perch(null) parrot_state = PARROT_WANDER return @@ -560,7 +559,7 @@ //If we're attacking a nothing, an object, a turf or a ghost for some stupid reason, switch to wander if(!parrot_interest || !isliving(parrot_interest)) - parrot_interest = null + set_interest(null) parrot_state = PARROT_WANDER return @@ -574,7 +573,7 @@ //If the mob we've been chasing/attacking dies or falls into crit, check for loot! if(L.stat) - parrot_interest = null + set_interest(null) if(!held_item) held_item = steal_from_ground() if(!held_item) @@ -598,8 +597,8 @@ //-----STATE MISHAP else //This should not happen. If it does lets reset everything and try again walk(src,0) - parrot_interest = null - parrot_perch = null + set_interest(null) + set_perch(null) drop_held_item() parrot_state = PARROT_WANDER return @@ -872,6 +871,22 @@ to_chat(src, "You will now [a_intent] others.") return +/mob/living/simple_animal/parrot/proc/set_interest(atom/movable/new_interest) + if(parrot_interest) + UnregisterSignal(parrot_interest, COMSIG_PARENT_QDELETING) + parrot_interest = null + if(new_interest) + parrot_interest = new_interest + RegisterSignal(parrot_interest, COMSIG_PARENT_QDELETING, PROC_REF(set_interest)) + +/mob/living/simple_animal/parrot/proc/set_perch(obj/new_perch) + if(parrot_perch) + UnregisterSignal(parrot_perch, COMSIG_PARENT_QDELETING) + parrot_perch = null + if(new_perch) + parrot_perch = new_perch + RegisterSignal(parrot_perch, COMSIG_PARENT_QDELETING, PROC_REF(set_perch)) + /* * Sub-types */ From f1695a6462734f489e6020bb0368b2c66dcc7028 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 18:19:37 -0500 Subject: [PATCH 099/147] 1984s poly into polly --- code/controllers/subsystem/persistence.dm | 6 +-- code/datums/diseases/parrotpossession.dm | 2 +- code/modules/admin/topic.dm | 2 +- .../modules/awaymissions/super_secret_room.dm | 6 +-- code/modules/events/holiday/halloween.dm | 6 +-- .../mob/living/carbon/human/human_say.dm | 2 +- .../mob/living/simple_animal/parrot.dm | 46 +++++++++---------- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index 914bf781bd16..f8d371755dfd 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -12,7 +12,7 @@ SUBSYSTEM_DEF(persistence) var/list/paintings = list() /datum/controller/subsystem/persistence/Initialize() - LoadPoly() + LoadPolly() LoadTrophies() LoadRecentModes() LoadPhotoPersistence() @@ -22,8 +22,8 @@ SUBSYSTEM_DEF(persistence) LoadPanicBunker() return ..() -/datum/controller/subsystem/persistence/proc/LoadPoly() - for(var/mob/living/simple_animal/parrot/Poly/P in GLOB.alive_mob_list) +/datum/controller/subsystem/persistence/proc/LoadPolly() + for(var/mob/living/simple_animal/parrot/Polly/P in GLOB.alive_mob_list) twitterize(P.speech_buffer, "polytalk") break //Who's been duping the bird?! diff --git a/code/datums/diseases/parrotpossession.dm b/code/datums/diseases/parrotpossession.dm index 1a3346d5658d..2fb3a3645906 100644 --- a/code/datums/diseases/parrotpossession.dm +++ b/code/datums/diseases/parrotpossession.dm @@ -13,7 +13,7 @@ severity = DISEASE_SEVERITY_MEDIUM infectable_biotypes = MOB_ORGANIC|MOB_UNDEAD|MOB_ROBOTIC|MOB_MINERAL bypasses_immunity = TRUE //2spook - var/mob/living/simple_animal/parrot/Poly/ghost/parrot + var/mob/living/simple_animal/parrot/Polly/ghost/parrot /datum/disease/parrot_possession/stage_act() ..() diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 012be5da1e51..707b6f93e53a 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -363,7 +363,7 @@ if("parrot") M.change_mob_type(/mob/living/simple_animal/parrot , null, null, delmob) if("polyparrot") - M.change_mob_type(/mob/living/simple_animal/parrot/Poly , null, null, delmob) + M.change_mob_type(/mob/living/simple_animal/parrot/Polly , null, null, delmob) if("constructjuggernaut") M.change_mob_type(/mob/living/simple_animal/hostile/construct/juggernaut , null, null, delmob) if("constructartificer") diff --git a/code/modules/awaymissions/super_secret_room.dm b/code/modules/awaymissions/super_secret_room.dm index a1ec18d25653..fcefdef265fe 100644 --- a/code/modules/awaymissions/super_secret_room.dm +++ b/code/modules/awaymissions/super_secret_room.dm @@ -12,7 +12,7 @@ /obj/structure/speaking_tile/Initialize() . = ..() - var/json_file = file("data/npc_saves/Poly.json") + var/json_file = file("data/npc_saves/Polly.json") if(!fexists(json_file)) return var/list/json = json_decode(file2text(json_file)) @@ -45,7 +45,7 @@ if(9) SpeakPeace(list("Alright maybe that's too boring.", "I can't keep manually typing these lines out though.", "It's hard to explain but the code structure I'm using is kind of terrible.")) if(10) - SpeakPeace(list("Oh I have an idea!", "Lets outsource this endless banter to Poly!", "Then you'll be able to keep listening to this without getting bored!")) + SpeakPeace(list("Oh I have an idea!", "Lets outsource this endless banter to Polly!", "Then you'll be able to keep listening to this without getting bored!")) if(isnull(shenanigans) || !shenanigans.len) shenanigans = list("Except the poly file is missing...") if(11 to 14, 16 to 50, 52 to 99, 103 to 107, 109 to 203, 205 to 249, 252 to 665, 667 to 999, 1001 to 5642) @@ -55,7 +55,7 @@ if(15) SpeakPeace(list("See? Isn't this fun?","Now you can mash this for hours without getting bored.","Anyway I'll leave you it.")) if(51) - SpeakPeace(list("The fun never ends around here.", "The Poly text files stores up to 500 statements.", "But you've probably heard a few repeats by now.")) + SpeakPeace(list("The fun never ends around here.", "The Polly text files stores up to 500 statements.", "But you've probably heard a few repeats by now.")) if(100) SpeakPeace(list("And that's a solid hundred.", "Good hustle I guess.", "You've probably heard a lot of repeats by now.")) if(101) diff --git a/code/modules/events/holiday/halloween.dm b/code/modules/events/holiday/halloween.dm index 3a7090a65319..ff02f77edaa4 100644 --- a/code/modules/events/holiday/halloween.dm +++ b/code/modules/events/holiday/halloween.dm @@ -16,9 +16,9 @@ for(var/mob/living/simple_animal/pet/dog/corgi/Ian/Ian in GLOB.mob_living_list) Ian.place_on_head(new /obj/item/bedsheet(Ian)) - for(var/mob/living/simple_animal/parrot/Poly/Poly in GLOB.mob_living_list) - new /mob/living/simple_animal/parrot/Poly/ghost(Poly.loc) - qdel(Poly) + for(var/mob/living/simple_animal/parrot/Polly/Polly in GLOB.mob_living_list) + new /mob/living/simple_animal/parrot/Polly/ghost(Polly.loc) + qdel(Polly) /datum/round_event/spooky/announce(fake) priority_announce(pick("RATTLE ME BONES!","THE RIDE NEVER ENDS!", "A SKELETON POPS OUT!", "SPOOKY SCARY SKELETONS!", "CREWMEMBERS BEWARE, YOU'RE IN FOR A SCARE!") , "THE CALL IS COMING FROM INSIDE THE HOUSE") diff --git a/code/modules/mob/living/carbon/human/human_say.dm b/code/modules/mob/living/carbon/human/human_say.dm index c54c453dc15f..551e60501940 100644 --- a/code/modules/mob/living/carbon/human/human_say.dm +++ b/code/modules/mob/living/carbon/human/human_say.dm @@ -60,7 +60,7 @@ if(dongle.translate_binary) return TRUE -/mob/living/carbon/human/radio(message, list/message_mods = list(), list/spans, language) //Poly has a copy of this, lazy bastard +/mob/living/carbon/human/radio(message, list/message_mods = list(), list/spans, language) //Polly has a copy of this, lazy bastard . = ..() if(. != FALSE) return . diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index 4eeda89cce89..e12876388d54 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -80,7 +80,7 @@ var/speech_shuffle_rate = 20 var/list/available_channels = list() - //Headset for Poly to yell at engineers :) + //Headset for Polly to yell at engineers :) var/obj/item/radio/headset/ears = null //The thing the parrot is currently interested in. This gets used for items the parrot wants to pick up, mobs it wants to steal from, @@ -334,7 +334,7 @@ parrot_state |= PARROT_FLEE icon_state = icon_living drop_held_item(0) - else if(istype(O, /obj/item/reagent_containers/food/snacks/cracker)) //Poly wants a cracker. + else if(istype(O, /obj/item/reagent_containers/food/snacks/cracker)) //Polly wants a cracker. qdel(O) if(health < maxHealth) adjustBruteLoss(-10) @@ -890,10 +890,10 @@ /* * Sub-types */ -/mob/living/simple_animal/parrot/Poly - name = "Poly" - desc = "Poly the Parrot. An expert on quantum cracker theory." - speak = list("Poly wanna cracker!", ":e Check the crystal, you chucklefucks!",":e Wire the solars, you lazy bums!",":e WHO TOOK THE DAMN HARDSUITS?",":e OH GOD ITS ABOUT TO DELAMINATE CALL THE SHUTTLE") +/mob/living/simple_animal/parrot/Polly + name = "Polly" + desc = "Polly the Parrot. An expert on quantum cracker theory." + speak = list("Polly wanna cracker!", ":e Check the crystal, you chucklefucks!",":e Wire the solars, you lazy bums!",":e WHO TOOK THE DAMN HARDSUITS?",":e OH GOD ITS ABOUT TO DELAMINATE CALL THE SHUTTLE") gold_core_spawnable = NO_SPAWN speak_chance = 3 var/memory_saved = FALSE @@ -901,7 +901,7 @@ var/longest_survival = 0 var/longest_deathstreak = 0 -/mob/living/simple_animal/parrot/Poly/Initialize() +/mob/living/simple_animal/parrot/Polly/Initialize() ears = new /obj/item/radio/headset/headset_eng(src) available_channels = list(":e") Read_Memory() @@ -922,33 +922,33 @@ . = ..() -/mob/living/simple_animal/parrot/Poly/Life() +/mob/living/simple_animal/parrot/Polly/Life() if(!stat && SSticker.current_state == GAME_STATE_FINISHED && !memory_saved) Write_Memory(FALSE) memory_saved = TRUE ..() -/mob/living/simple_animal/parrot/Poly/death(gibbed) +/mob/living/simple_animal/parrot/Polly/death(gibbed) if(!memory_saved) Write_Memory(TRUE) if(rounds_survived == longest_survival || rounds_survived == longest_deathstreak || prob(0.666)) - var/mob/living/simple_animal/parrot/Poly/ghost/G = new(loc) + var/mob/living/simple_animal/parrot/Polly/ghost/G = new(loc) if(mind) mind.transfer_to(G) else G.key = key ..(gibbed) -/mob/living/simple_animal/parrot/Poly/proc/Read_Memory() - if(fexists("data/npc_saves/Poly.sav")) //legacy compatability to convert old format to new - var/savefile/S = new /savefile("data/npc_saves/Poly.sav") +/mob/living/simple_animal/parrot/Polly/proc/Read_Memory() + if(fexists("data/npc_saves/Polly.sav")) //legacy compatability to convert old format to new + var/savefile/S = new /savefile("data/npc_saves/Polly.sav") S["phrases"] >> speech_buffer S["roundssurvived"] >> rounds_survived S["longestsurvival"] >> longest_survival S["longestdeathstreak"] >> longest_deathstreak - fdel("data/npc_saves/Poly.sav") + fdel("data/npc_saves/Polly.sav") else - var/json_file = file("data/npc_saves/Poly.json") + var/json_file = file("data/npc_saves/Polly.json") if(!fexists(json_file)) return var/list/json = json_decode(file2text(json_file)) @@ -959,8 +959,8 @@ if(!islist(speech_buffer)) speech_buffer = list() -/mob/living/simple_animal/parrot/Poly/proc/Write_Memory(dead) - var/json_file = file("data/npc_saves/Poly.json") +/mob/living/simple_animal/parrot/Polly/proc/Write_Memory(dead) + var/json_file = file("data/npc_saves/Polly.json") var/list/file_data = list() if(islist(speech_buffer)) file_data["phrases"] = speech_buffer @@ -981,8 +981,8 @@ fdel(json_file) WRITE_FILE(json_file, json_encode(file_data)) -/mob/living/simple_animal/parrot/Poly/ghost - name = "The Ghost of Poly" +/mob/living/simple_animal/parrot/Polly/ghost + name = "The Ghost of Polly" desc = "Doomed to squawk the Earth." color = "#FFFFFF77" speak_chance = 20 @@ -990,16 +990,16 @@ incorporeal_move = INCORPOREAL_MOVE_BASIC butcher_results = list(/obj/item/ectoplasm = 1) -/mob/living/simple_animal/parrot/Poly/ghost/Initialize() +/mob/living/simple_animal/parrot/Polly/ghost/Initialize() memory_saved = TRUE //At this point nothing is saved . = ..() -/mob/living/simple_animal/parrot/Poly/ghost/handle_automated_speech() +/mob/living/simple_animal/parrot/Polly/ghost/handle_automated_speech() if(ismob(loc)) return ..() -/mob/living/simple_animal/parrot/Poly/ghost/handle_automated_movement() +/mob/living/simple_animal/parrot/Polly/ghost/handle_automated_movement() if(isliving(parrot_interest)) if(!ishuman(parrot_interest)) parrot_interest = null @@ -1008,7 +1008,7 @@ Possess(parrot_interest) ..() -/mob/living/simple_animal/parrot/Poly/ghost/proc/Possess(mob/living/carbon/human/H) +/mob/living/simple_animal/parrot/Polly/ghost/proc/Possess(mob/living/carbon/human/H) if(!ishuman(H)) return var/datum/disease/parrot_possession/P = new From 91e8984e1f1b2af572dc94012a7b81e2b5a802da Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 18:34:40 -0500 Subject: [PATCH 100/147] gwah gwah --- _maps/shuttles/shiptest/independent_tranquility.dmm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_maps/shuttles/shiptest/independent_tranquility.dmm b/_maps/shuttles/shiptest/independent_tranquility.dmm index cd5272d0ce9e..5d86854b39c4 100644 --- a/_maps/shuttles/shiptest/independent_tranquility.dmm +++ b/_maps/shuttles/shiptest/independent_tranquility.dmm @@ -3914,8 +3914,8 @@ /obj/structure/chair/comfy/black{ dir = 8 }, -/mob/living/simple_animal/parrot/Poly{ - name = "Polyphema" +/mob/living/simple_animal/parrot/Polly{ + name = "Pollyphema" }, /turf/open/floor/plasteel/tech, /area/ship/crew/crewfour) From 6311d6ea9451dfc2d1daa17717947d594fb4c7d9 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 18:38:51 -0500 Subject: [PATCH 101/147] fuuuuck me --- code/game/turfs/open/space/transit.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/game/turfs/open/space/transit.dm b/code/game/turfs/open/space/transit.dm index 5e85d3ec2b38..6f3146215815 100644 --- a/code/game/turfs/open/space/transit.dm +++ b/code/game/turfs/open/space/transit.dm @@ -32,6 +32,8 @@ AM.throw_atom_into_space() /atom/proc/throw_atom_into_space() + if(flags_1 & INITIALIZED_1) + return qdel(src) /obj/throw_atom_into_space() From 47a85fee1b82997948d665ecf387d088019a36f8 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 28 Jul 2023 20:23:26 -0500 Subject: [PATCH 102/147] eeee --- code/modules/shuttle/on_move.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index b1dc9619a598..8424dad2c4cd 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -146,7 +146,7 @@ All ShuttleMove procs go here /atom/movable/proc/afterShuttleMove(turf/oldT, list/movement_force, shuttle_dir, shuttle_preferred_direction, move_dir, rotation) SHOULD_CALL_PARENT(TRUE) var/turf/newT = get_turf(src) - if (newT.z != oldT.z) + if (newT?.z != oldT.z) onTransitZ(oldT.z, newT.z) if(light) From 1fe9480ff3453659405b4c1bcf151e6578c59a2b Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 29 Jul 2023 00:06:26 -0500 Subject: [PATCH 103/147] guh! --- _maps/_basemap.dm | 10 +++---- code/modules/unit_tests/_unit_tests.dm | 1 + code/modules/unit_tests/ruin_placement.dm | 33 +++++++++++++++++++++++ tools/build/build.js | 5 ++-- 4 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 code/modules/unit_tests/ruin_placement.dm diff --git a/_maps/_basemap.dm b/_maps/_basemap.dm index fa90eedff88a..11542625c870 100644 --- a/_maps/_basemap.dm +++ b/_maps/_basemap.dm @@ -1,5 +1,5 @@ /// VERY IMPORTANT FOR RUNNING FAST IN PRODUCTION! -/// If you define this flag, more things will init during initializations rather than when they're needed, such as planetoids. +/// If you define this flag, centcom will load. It's also supposed to preload planetoids, but that is disabled. //#define FULL_INIT #ifdef FULL_INIT @@ -8,10 +8,8 @@ #include "map_files\generic\blank.dmm" #endif -#ifndef LOWMEMORYMODE - #ifdef ALL_MAPS - #ifdef CIBUILDING - #include "templates.dm" - #endif +#ifdef ALL_MAPS + #ifdef CIBUILDING + #include "templates.dm" #endif #endif diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 051d5e76041e..6a6e880f8076 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -88,6 +88,7 @@ #include "reagent_names.dm" #include "reagent_recipe_collisions.dm" #include "resist.dm" +#include "ruin_placement.dm" #include "say.dm" #include "serving_tray.dm" #include "ship_outpost_placement.dm" diff --git a/code/modules/unit_tests/ruin_placement.dm b/code/modules/unit_tests/ruin_placement.dm new file mode 100644 index 000000000000..a99d5e95ef51 --- /dev/null +++ b/code/modules/unit_tests/ruin_placement.dm @@ -0,0 +1,33 @@ +/datum/unit_test/ruin_placement + focus = TRUE + +/datum/unit_test/ruin_placement/Run() + SSair.is_test_loading = TRUE + var/datum/map_zone/mapzone = SSmapping.create_map_zone("Ruin Testing Zone") + for(var/planet_name as anything in SSmapping.planet_types) + var/datum/planet_type/planet_type = SSmapping.planet_types[planet_name] + for(var/ruin_name as anything in SSmapping.ruin_types_list[planet_type.ruin_type]) + var/datum/map_template/ruin/ruin = SSmapping.ruin_types_list[planet_type.ruin_type][ruin_name] + var/datum/virtual_level/vlevel = SSmapping.create_virtual_level( + ruin.name, + list(ZTRAIT_MINING = TRUE, ZTRAIT_BASETURF = planet_type.default_baseturf), + mapzone, + ruin.width, + ruin.height + ) + vlevel.fill_in(planet_type.default_baseturf) + + try + ruin.load(vlevel.get_unreserved_bottom_left_turf()) + catch(var/exception/e) + TEST_FAIL("Runtime error loading ruin type ([ruin.name]): [e] on [e.file]:[e.line]\n[e.desc]") + + SSair.is_test_loading = FALSE + + var/list/errors = atmosscan(TRUE) + errors += powerdebug(TRUE) + + for(var/error in errors) + TEST_FAIL("[error]") + + qdel(mapzone) diff --git a/tools/build/build.js b/tools/build/build.js index f63411918e31..01491d4964e1 100755 --- a/tools/build/build.js +++ b/tools/build/build.js @@ -55,9 +55,8 @@ export const NoWarningParameter = new Juke.Parameter({ export const DmMapsIncludeTarget = new Juke.Target({ executes: async () => { const folders = [ - ...Juke.glob("_maps/map_files/**/modular_pieces/*.dmm"), + ...Juke.glob("_maps/outpost/**/*.dmm"), ...Juke.glob("_maps/RandomRuins/**/*.dmm"), - ...Juke.glob("_maps/RandomZLevels/**/*.dmm"), ...Juke.glob("_maps/shuttles/**/*.dmm"), ...Juke.glob("_maps/templates/**/*.dmm"), ]; @@ -81,7 +80,7 @@ export const DmTarget = new Juke.Target({ get(DefineParameter).includes("ALL_MAPS") && DmMapsIncludeTarget, ], inputs: [ - "_maps/map_files/generic/**", + "_maps/map_files/**", "code/**", "html/**", "icons/**", From 5e3b152c91e06a690451eea5ad49a38f4c12dced Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 29 Jul 2023 15:52:44 -0500 Subject: [PATCH 104/147] makes the test actually decent --- code/__HELPERS/virtual_z_level.dm | 5 +++++ code/datums/components/tackle.dm | 16 +++++++++----- code/modules/admin/verbs/atmosdebug.dm | 2 +- .../atmospherics/machinery/datum_pipeline.dm | 7 +----- code/modules/hydroponics/grown/cotton.dm | 14 +++++++++--- .../living/simple_animal/hostile/hostile.dm | 3 +++ code/modules/unit_tests/_unit_tests.dm | 2 +- code/modules/unit_tests/ruin_placement.dm | 22 ++++++++----------- 8 files changed, 42 insertions(+), 29 deletions(-) diff --git a/code/__HELPERS/virtual_z_level.dm b/code/__HELPERS/virtual_z_level.dm index a218539de4b0..251b0323601a 100644 --- a/code/__HELPERS/virtual_z_level.dm +++ b/code/__HELPERS/virtual_z_level.dm @@ -24,6 +24,7 @@ return my_turf.virtual_z /atom/proc/get_virtual_level() + RETURN_TYPE(/datum/virtual_level) return /atom/movable/get_virtual_level() @@ -45,3 +46,7 @@ var/datum/virtual_level/vlevel = get_virtual_level() if(vlevel) return vlevel.parent_map_zone + +/atom/proc/get_relative_location() + var/datum/virtual_level/vlevel = get_virtual_level() + return vlevel.get_relative_coords(src) diff --git a/code/datums/components/tackle.dm b/code/datums/components/tackle.dm index 249d6df24c57..9edf16e0b634 100644 --- a/code/datums/components/tackle.dm +++ b/code/datums/components/tackle.dm @@ -30,7 +30,7 @@ ///Some gloves, generally ones that increase mobility, may have a minimum distance to fly. Rocket gloves are especially dangerous with this, be sure you'll hit your target or have a clear background if you miss, or else! var/min_distance ///The throwdatum we're currently dealing with, if we need it - var/datum/thrownthing/tackle + var/datum/weakref/tackle_ref /datum/component/tackler/Initialize(stamina_cost = 25, base_knockdown = 1 SECONDS, range = 4, speed = 1, skill_mod = 0, min_distance = min_distance) if(!iscarbon(parent)) @@ -62,10 +62,11 @@ UnregisterSignal(parent, list(COMSIG_MOB_CLICKON, COMSIG_MOVABLE_IMPACT, COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_POST_THROW)) ///Store the thrownthing datum for later use -/datum/component/tackler/proc/registerTackle(mob/living/carbon/user, datum/thrownthing/TT) +/datum/component/tackler/proc/registerTackle(mob/living/carbon/user, datum/thrownthing/tackle) SIGNAL_HANDLER - tackle = TT + tackle_ref = WEAKREF(tackle) + tackle.thrower = user ///See if we can tackle or not. If we can, leap! /datum/component/tackler/proc/checkTackle(mob/living/carbon/user, atom/A, params) @@ -145,7 +146,9 @@ /datum/component/tackler/proc/sack(mob/living/carbon/user, atom/hit) SIGNAL_HANDLER + var/datum/thrownthing/tackle = tackle_ref?.resolve() if(!tackling || !tackle) + tackle = null return if(!iscarbon(hit)) @@ -422,7 +425,7 @@ /datum/component/tackler/proc/resetTackle() tackling = FALSE - QDEL_NULL(tackle) + QDEL_NULL(tackle_ref) UnregisterSignal(parent, COMSIG_MOVABLE_MOVED) ///A special case for splatting for handling windows @@ -508,8 +511,11 @@ I.throw_at(get_ranged_target_turf(I, pick(GLOB.alldirs), range = dist), range = dist, speed = sp) I.visible_message("[I] goes flying[sp > 3 ? " dangerously fast" : ""]!") // standard embed speed + var/datum/thrownthing/tackle = tackle_ref?.resolve() + playsound(owner, 'sound/weapons/smash.ogg', 70, TRUE) - tackle.finalize(hit=TRUE) + if(tackle) + tackle.finalize(hit=TRUE) resetTackle() #undef MAX_TABLE_MESSES diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm index da8fe89cea48..c231b90d1277 100644 --- a/code/modules/admin/verbs/atmosdebug.dm +++ b/code/modules/admin/verbs/atmosdebug.dm @@ -1,4 +1,4 @@ -#define ANNOTATE_OBJECT(object) testing ? "[get_area(object)] (estimated location: [json_encode(object.check_shuttle_offset())])" : ADMIN_VERBOSEJMP(object) +#define ANNOTATE_OBJECT(object) testing ? "[get_area(object)] (estimated location: [json_encode(object.check_shuttle_offset() || object.get_relative_location())])" : ADMIN_VERBOSEJMP(object) /atom/proc/check_shuttle_offset() if(!SSshuttle.initialized) diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index 57299fe2bc71..e7e3ac49741b 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -82,12 +82,7 @@ if(!members.Find(item)) if(item.parent) - var/static/pipenetwarnings = 10 - if(pipenetwarnings > 0) - log_mapping("build_pipeline(): [item.type] added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf) around [AREACOORD(item)].") - pipenetwarnings-- - if(pipenetwarnings == 0) - log_mapping("build_pipeline(): further messages about pipenets will be suppressed") + stack_trace("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") members += item possible_expansions += item diff --git a/code/modules/hydroponics/grown/cotton.dm b/code/modules/hydroponics/grown/cotton.dm index b9d903ddf72a..ec6618df7fc9 100644 --- a/code/modules/hydroponics/grown/cotton.dm +++ b/code/modules/hydroponics/grown/cotton.dm @@ -38,9 +38,17 @@ seed_modifier = round(seed.potency / 25) var/obj/item/stack/cotton = new cotton_type(user.loc, 1 + seed_modifier) var/old_cotton_amount = cotton.amount - for(var/obj/item/stack/ST in user.loc) - if(ST != cotton && istype(ST, cotton_type) && ST.amount < ST.max_amount) - ST.attackby(cotton, user) + for(var/obj/item/stack/potential_stack in user.loc) + if(QDELETED(potential_stack)) + continue + if(potential_stack == cotton) + continue + if(!istype(potential_stack, cotton_type)) + continue + if(potential_stack.amount >= potential_stack.max_amount) + continue + potential_stack.attackby(cotton, user) + if(cotton.amount > old_cotton_amount) to_chat(user, "You add the newly-formed [cotton_name] to the stack. It now contains [cotton.amount] [cotton_name].") qdel(src) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index b83362bf8323..0e4f33b7bcb3 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -351,6 +351,9 @@ /mob/living/simple_animal/hostile/proc/AttackingTarget() SEND_SIGNAL(src, COMSIG_HOSTILE_ATTACKINGTARGET, target) + //Target can be removed by the signal's effects + if(QDELETED(target)) + return in_melee = TRUE return target.attack_animal(src) diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 6a6e880f8076..c45ee50378e4 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -103,7 +103,7 @@ #include "timer_sanity.dm" #include "unit_test.dm" -#ifdef REFERENCE_TRACKING //Don't try and parse this file if ref tracking isn't turned on. IE: don't parse ref tracking please mr linter +#ifdef REFERENCE_TRACKING_DEBUG //Don't try and parse this file if ref tracking isn't turned on. IE: don't parse ref tracking please mr linter #include "find_reference_sanity.dm" #endif diff --git a/code/modules/unit_tests/ruin_placement.dm b/code/modules/unit_tests/ruin_placement.dm index a99d5e95ef51..98b86f25ec6f 100644 --- a/code/modules/unit_tests/ruin_placement.dm +++ b/code/modules/unit_tests/ruin_placement.dm @@ -1,6 +1,3 @@ -/datum/unit_test/ruin_placement - focus = TRUE - /datum/unit_test/ruin_placement/Run() SSair.is_test_loading = TRUE var/datum/map_zone/mapzone = SSmapping.create_map_zone("Ruin Testing Zone") @@ -15,19 +12,18 @@ ruin.width, ruin.height ) - vlevel.fill_in(planet_type.default_baseturf) - try - ruin.load(vlevel.get_unreserved_bottom_left_turf()) - catch(var/exception/e) - TEST_FAIL("Runtime error loading ruin type ([ruin.name]): [e] on [e.file]:[e.line]\n[e.desc]") + ruin.load(vlevel.get_unreserved_bottom_left_turf()) - SSair.is_test_loading = FALSE + var/list/errors = atmosscan(TRUE) + errors += powerdebug(TRUE) - var/list/errors = atmosscan(TRUE) - errors += powerdebug(TRUE) + for(var/error in errors) + Fail("in [ruin_name]: [error]", ruin.mappath, 1) - for(var/error in errors) - TEST_FAIL("[error]") + vlevel.clear_reservation() + qdel(vlevel) + + SSair.is_test_loading = FALSE qdel(mapzone) From 6123a8bd9d56f24efb0860527df75dc494d45059 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 29 Jul 2023 22:08:44 -0500 Subject: [PATCH 105/147] WOOOOO --- .../whitesands_surface_medipen_plant.dmm | 83 ++++++----- .../whitesands_surface_youreinsane.dmm | 3 - _maps/RandomRuins/SpaceRuins/Fast_Food.dmm | 7 +- .../SpaceRuins/corporate_mining.dmm | 15 -- _maps/RandomRuins/SpaceRuins/hellfactory.dmm | 28 ++-- .../SpaceRuins/singularity_lab.dmm | 13 +- _maps/RandomRuins/SpaceRuins/spacemall.dmm | 133 +++--------------- .../wasteplanet_abandoned_mechbay.dmm | 4 +- .../Ruins}/lavaland_biodome_beach.dmm | 0 .../lavaland_surface_syndicate_base1.dmm | 0 _maps/deprecated/deprecated_datums.dm | 15 ++ code/controllers/subsystem/timer.dm | 2 +- code/datums/map_zones.dm | 6 +- code/datums/ruins/lavaland.dm | 15 -- code/game/area/areas/ruins/_ruins.dm | 2 +- code/game/machinery/doors/airlock.dm | 2 +- code/game/machinery/shuttle/shuttle_engine.dm | 2 + .../machinery/shuttle/shuttle_engine_types.dm | 6 - code/game/machinery/shuttle/shuttle_heater.dm | 13 +- code/game/objects/items/mop.dm | 5 +- code/game/turfs/open/floor/catwalk_plating.dm | 6 +- code/modules/admin/verbs/atmosdebug.dm | 44 ++---- .../atmospherics/machinery/datum_pipeline.dm | 4 +- code/modules/mining/machine_processing.dm | 7 +- code/modules/mob/living/damage_procs.dm | 2 +- .../simple_animal/hostile/giant_spider.dm | 24 ++-- code/modules/power/solar.dm | 5 + code/modules/unit_tests/ruin_placement.dm | 6 +- .../unit_tests/ship_outpost_placement.dm | 2 +- 29 files changed, 156 insertions(+), 298 deletions(-) rename _maps/{RandomRuins/LavaRuins => deprecated/Ruins}/lavaland_biodome_beach.dmm (100%) rename _maps/{RandomRuins/LavaRuins => deprecated/Ruins}/lavaland_surface_syndicate_base1.dmm (100%) diff --git a/_maps/RandomRuins/SandRuins/whitesands_surface_medipen_plant.dmm b/_maps/RandomRuins/SandRuins/whitesands_surface_medipen_plant.dmm index 5432885c9d4d..089efd809cff 100644 --- a/_maps/RandomRuins/SandRuins/whitesands_surface_medipen_plant.dmm +++ b/_maps/RandomRuins/SandRuins/whitesands_surface_medipen_plant.dmm @@ -216,12 +216,10 @@ icon_state = "small" }, /obj/item/shard, -/obj/machinery/atmospherics/pipe/manifold/supply/hidden{ - dir = 8 - }, /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{ dir = 8 }, +/obj/machinery/atmospherics/pipe/simple/supply/hidden, /turf/open/floor/plating, /area/whitesands/surface/outdoors) "fJ" = ( @@ -232,9 +230,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{ dir = 8 }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden{ - dir = 8 - }, /turf/open/floor/plasteel, /area/whitesands/surface/outdoors) "fO" = ( @@ -297,6 +292,7 @@ dir = 1 }, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden, /turf/open/floor/plasteel/dark, /area/whitesands/surface/outdoors) "hC" = ( @@ -517,6 +513,7 @@ /obj/effect/turf_decal/corner/transparent/neutral{ dir = 4 }, +/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden, /turf/open/floor/plasteel/dark, /area/whitesands/surface/outdoors) "nQ" = ( @@ -715,9 +712,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{ dir = 8 }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden{ - dir = 8 - }, /turf/open/floor/plating{ icon_state = "platingdmg1" }, @@ -742,7 +736,6 @@ /area/whitesands/surface/outdoors) "uc" = ( /obj/effect/decal/cleanable/dirt, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden, /turf/open/floor/plasteel/dark, /area/whitesands/surface/outdoors) "uu" = ( @@ -783,6 +776,12 @@ }, /turf/open/floor/plating, /area/whitesands/surface/outdoors) +"vq" = ( +/obj/machinery/atmospherics/pipe/simple/supply/hidden{ + dir = 9 + }, +/turf/open/floor/plasteel/white, +/area/whitesands/surface/outdoors) "vB" = ( /obj/structure/chair{ dir = 1 @@ -1060,6 +1059,7 @@ /obj/machinery/atmospherics/pipe/simple/supply/hidden{ dir = 8 }, +/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden, /turf/open/floor/plasteel/dark, /area/whitesands/surface/outdoors) "FO" = ( @@ -1134,6 +1134,14 @@ }, /turf/open/floor/plasteel/dark, /area/whitesands/surface/outdoors) +"Iz" = ( +/obj/effect/spawner/structure/window, +/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden, +/obj/machinery/atmospherics/pipe/simple/supply/hidden{ + dir = 8 + }, +/turf/open/floor/plating, +/area/whitesands/surface/outdoors) "IA" = ( /obj/effect/turf_decal/industrial/warning{ dir = 1 @@ -1279,16 +1287,16 @@ /turf/open/floor/plating/asteroid/whitesands, /area/whitesands/surface/outdoors) "Nd" = ( -/obj/structure/table, -/obj/effect/spawner/lootdrop/donkpockets, -/obj/effect/turf_decal/corner/transparent/neutral{ - dir = 1 - }, -/obj/effect/turf_decal/corner/transparent/neutral{ +/obj/effect/turf_decal/industrial/warning{ dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden, -/turf/open/floor/plasteel/dark, +/obj/structure/cable{ + icon_state = "1-2" + }, +/obj/machinery/atmospherics/pipe/simple/supply/hidden{ + dir = 8 + }, +/turf/open/floor/plasteel, /area/whitesands/surface/outdoors) "OB" = ( /obj/effect/decal/cleanable/dirt, @@ -1371,9 +1379,6 @@ /obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden{ dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden{ - dir = 8 - }, /turf/open/floor/plating, /area/whitesands/surface/outdoors) "Qc" = ( @@ -1404,9 +1409,7 @@ /obj/structure/cable{ icon_state = "4-8" }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{ - dir = 8 - }, +/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden, /turf/open/floor/plasteel/dark, /area/whitesands/surface/outdoors) "QP" = ( @@ -1480,8 +1483,10 @@ /obj/structure/cable{ icon_state = "4-8" }, -/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden, /obj/machinery/atmospherics/pipe/simple/supply/hidden, +/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{ + dir = 8 + }, /turf/open/floor/plasteel/dark, /area/whitesands/surface/outdoors) "Tb" = ( @@ -1492,7 +1497,7 @@ "Tc" = ( /obj/effect/decal/cleanable/dirt, /obj/machinery/atmospherics/pipe/simple/supply/hidden{ - dir = 8 + dir = 6 }, /turf/open/floor/plasteel/white, /area/whitesands/surface/outdoors) @@ -1523,7 +1528,6 @@ /obj/machinery/atmospherics/pipe/manifold/supply/hidden{ dir = 1 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden, /turf/open/floor/plasteel/dark, /area/whitesands/surface/outdoors) "UH" = ( @@ -1623,6 +1627,15 @@ /obj/machinery/atmospherics/pipe/simple/supply/hidden, /turf/open/floor/plasteel/dark, /area/whitesands/surface/outdoors) +"Xn" = ( +/obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/supply/hidden{ + dir = 8 + }, +/turf/open/floor/plating{ + icon_state = "platingdmg3" + }, +/area/whitesands/surface/outdoors) "XG" = ( /obj/effect/decal/cleanable/dirt, /obj/structure/cable{ @@ -2063,7 +2076,7 @@ ku Jb kF sE -sE +gS nF hq FM @@ -2073,7 +2086,7 @@ hY kk Qq fG -xd +Qq mh Hp AO @@ -2094,8 +2107,8 @@ Nb dZ bu sE -gS -Nd +sE +KU uc Ud SL @@ -2104,7 +2117,7 @@ qs Wa Qk fJ -eI +Xn zk rN iP @@ -2135,7 +2148,7 @@ sz Rs Lj sT -SE +Nd kS SE SE @@ -2166,7 +2179,7 @@ hY en Bn Qa -rf +Iz yc rf rf @@ -2197,7 +2210,7 @@ hn ir ad Tc -ad +vq zk ad oH diff --git a/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm b/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm index f1ab9b3979c3..0e84d74be5ad 100644 --- a/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm +++ b/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm @@ -139,9 +139,6 @@ dir = 1 }, /obj/structure/frame/machine, -/obj/machinery/atmospherics/pipe/simple/general/visible{ - dir = 9 - }, /obj/machinery/atmospherics/pipe/simple/general/visible{ dir = 9 }, diff --git a/_maps/RandomRuins/SpaceRuins/Fast_Food.dmm b/_maps/RandomRuins/SpaceRuins/Fast_Food.dmm index 7371069c7a17..3c98825f7924 100644 --- a/_maps/RandomRuins/SpaceRuins/Fast_Food.dmm +++ b/_maps/RandomRuins/SpaceRuins/Fast_Food.dmm @@ -1645,11 +1645,6 @@ /obj/item/reagent_containers/food/snacks/burger/brain, /turf/open/floor/carpet, /area/ruin/space/has_grav/powered/macspace) -"Fk" = ( -/obj/machinery/atmospherics/components/unary/tank/oxygen, -/obj/machinery/atmospherics/components/unary/tank/oxygen, -/turf/open/floor/mineral/titanium, -/area/ruin/space/has_grav/powered/macspace) "Im" = ( /obj/machinery/door/airlock/silver, /obj/effect/mapping_helpers/airlock/cyclelink_helper, @@ -2226,7 +2221,7 @@ aM ae dk dk -Fk +dk ae VM VM diff --git a/_maps/RandomRuins/SpaceRuins/corporate_mining.dmm b/_maps/RandomRuins/SpaceRuins/corporate_mining.dmm index ee1685c11dd8..06535a3341d9 100644 --- a/_maps/RandomRuins/SpaceRuins/corporate_mining.dmm +++ b/_maps/RandomRuins/SpaceRuins/corporate_mining.dmm @@ -129,9 +129,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers{ dir = 9 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ - dir = 1 - }, /obj/structure/cable{ icon_state = "2-8" }, @@ -542,9 +539,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ dir = 6 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ - dir = 6 - }, /turf/open/floor/plasteel/grimy, /area/ruin/space/has_grav/corporatemine/crewquarters) "my" = ( @@ -856,12 +850,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ dir = 1 }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2{ - dir = 1 - }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ - dir = 1 - }, /obj/effect/mapping_helpers/airlock/abandoned, /obj/effect/turf_decal/trimline/opaque/bar/filled/warning{ dir = 1 @@ -1819,9 +1807,6 @@ /area/ruin/space) "NV" = ( /obj/machinery/vending/cigarette, -/obj/machinery/atmospherics/components/unary/vent_pump/on/layer2{ - dir = 1 - }, /obj/machinery/atmospherics/components/unary/vent_pump/on/layer2{ dir = 1 }, diff --git a/_maps/RandomRuins/SpaceRuins/hellfactory.dmm b/_maps/RandomRuins/SpaceRuins/hellfactory.dmm index 7a4eab14d2dd..0104b112aeda 100644 --- a/_maps/RandomRuins/SpaceRuins/hellfactory.dmm +++ b/_maps/RandomRuins/SpaceRuins/hellfactory.dmm @@ -25,10 +25,10 @@ /obj/machinery/atmospherics/pipe/heat_exchanging/junction{ dir = 4 }, -/obj/machinery/atmospherics/pipe/heat_exchanging/junction{ +/obj/machinery/atmospherics/pipe/heat_exchanging/junction/layer1{ dir = 4 }, -/obj/machinery/atmospherics/pipe/heat_exchanging/junction/layer1{ +/obj/machinery/atmospherics/pipe/heat_exchanging/junction/layer4{ dir = 4 }, /turf/open/floor/plastic, @@ -40,7 +40,7 @@ /obj/machinery/atmospherics/pipe/heat_exchanging/manifold/layer1{ dir = 1 }, -/obj/machinery/atmospherics/pipe/heat_exchanging/manifold{ +/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/layer4{ dir = 1 }, /turf/open/floor/plastic, @@ -55,7 +55,7 @@ /obj/machinery/atmospherics/pipe/heat_exchanging/junction/layer1{ dir = 8 }, -/obj/machinery/atmospherics/pipe/heat_exchanging/junction{ +/obj/machinery/atmospherics/pipe/heat_exchanging/junction/layer4{ dir = 8 }, /turf/closed/indestructible/reinforced, @@ -122,15 +122,12 @@ /obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer1{ dir = 6 }, -/obj/machinery/atmospherics/pipe/heat_exchanging/simple{ +/obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer4{ dir = 6 }, /turf/open/floor/plastic, /area/ruin/space/has_grav/hellfactory) "av" = ( -/obj/machinery/atmospherics/pipe/heat_exchanging/simple{ - dir = 4 - }, /obj/machinery/atmospherics/pipe/heat_exchanging/simple{ dir = 4 }, @@ -138,6 +135,9 @@ dir = 4 }, /obj/structure/holobox, +/obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer4{ + dir = 4 + }, /turf/open/floor/plastic, /area/ruin/space/has_grav/hellfactory) "ax" = ( @@ -147,7 +147,7 @@ /obj/machinery/atmospherics/pipe/heat_exchanging/manifold/layer1{ dir = 4 }, -/obj/machinery/atmospherics/pipe/heat_exchanging/manifold{ +/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/layer4{ dir = 4 }, /turf/open/floor/plastic, @@ -166,7 +166,7 @@ "aC" = ( /obj/machinery/atmospherics/pipe/heat_exchanging/simple, /obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer1, -/obj/machinery/atmospherics/pipe/heat_exchanging/simple, +/obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer4, /turf/open/floor/plastic, /area/ruin/space/has_grav/hellfactory) "aD" = ( @@ -206,7 +206,7 @@ /obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer1{ dir = 5 }, -/obj/machinery/atmospherics/pipe/heat_exchanging/simple{ +/obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer4{ dir = 5 }, /turf/open/floor/plastic, @@ -218,7 +218,7 @@ /obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer1{ dir = 4 }, -/obj/machinery/atmospherics/pipe/heat_exchanging/simple{ +/obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer4{ dir = 4 }, /turf/open/floor/plastic, @@ -230,7 +230,7 @@ /obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer1{ dir = 9 }, -/obj/machinery/atmospherics/pipe/heat_exchanging/simple{ +/obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer4{ dir = 9 }, /turf/open/floor/plastic, @@ -1030,8 +1030,8 @@ "Nv" = ( /obj/machinery/atmospherics/pipe/heat_exchanging/simple, /obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer1, -/obj/machinery/atmospherics/pipe/heat_exchanging/simple, /obj/machinery/light/directional/east, +/obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer4, /turf/open/floor/plastic, /area/ruin/space/has_grav/hellfactory) "Nx" = ( diff --git a/_maps/RandomRuins/SpaceRuins/singularity_lab.dmm b/_maps/RandomRuins/SpaceRuins/singularity_lab.dmm index 20d903582dbe..dd2810f96734 100644 --- a/_maps/RandomRuins/SpaceRuins/singularity_lab.dmm +++ b/_maps/RandomRuins/SpaceRuins/singularity_lab.dmm @@ -6360,9 +6360,6 @@ /obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer2{ dir = 4 }, -/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer2{ - dir = 4 - }, /turf/open/floor/plasteel, /area/ruin/space/has_grav/singularitylab) "ym" = ( @@ -13283,14 +13280,6 @@ /obj/structure/spacevine, /turf/open/floor/plating, /area/ruin/space/has_grav/singularitylab) -"XN" = ( -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2, -/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer2{ - dir = 4 - }, -/turf/open/floor/plasteel, -/area/ruin/space/has_grav/singularitylab) "XR" = ( /obj/effect/turf_decal/siding/thinplating, /obj/effect/decal/cleanable/blood{ @@ -21344,7 +21333,7 @@ QB FL nu If -XN +If yk WB DE diff --git a/_maps/RandomRuins/SpaceRuins/spacemall.dmm b/_maps/RandomRuins/SpaceRuins/spacemall.dmm index 40a45f8de51a..9f233a4069fe 100644 --- a/_maps/RandomRuins/SpaceRuins/spacemall.dmm +++ b/_maps/RandomRuins/SpaceRuins/spacemall.dmm @@ -958,9 +958,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, /turf/open/floor/plating, /area/ruin/space/has_grav/spacemall/maint) "dK" = ( @@ -1877,16 +1874,6 @@ /obj/effect/decal/cleanable/cobweb, /turf/open/floor/wood, /area/ruin/space/has_grav/spacemall/maint) -"hh" = ( -/obj/machinery/door/airlock/maintenance_hatch, -/obj/structure/cable{ - icon_state = "1-2" - }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2, -/turf/open/floor/plating, -/area/ruin/space/has_grav/spacemall/maint) "hj" = ( /obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4{ dir = 6 @@ -2980,9 +2967,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, /turf/open/floor/plasteel, /area/ruin/space/has_grav/spacemall/shop) "ln" = ( @@ -4704,9 +4688,6 @@ /obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4{ dir = 9 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, /obj/structure/catwalk/over/plated_catwalk, /turf/open/floor/plating, /area/ruin/space/has_grav/spacemall/maint) @@ -5183,9 +5164,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, /turf/open/floor/plasteel, /area/ruin/space/has_grav/spacemall/shop) "td" = ( @@ -5930,24 +5908,6 @@ /obj/machinery/light/dim/directional/north, /turf/open/floor/plasteel/white, /area/ruin/space/has_grav/spacemall) -"vO" = ( -/obj/structure/cable{ - icon_state = "4-8" - }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4{ - dir = 4 - }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4{ - dir = 4 - }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, -/obj/structure/disposalpipe/segment{ - dir = 4 - }, -/turf/open/floor/plasteel, -/area/ruin/space/has_grav/spacemall/dorms) "vQ" = ( /mob/living/simple_animal/hostile/poison/giant_spider{ environment_smash = 0 @@ -6899,21 +6859,6 @@ /obj/effect/decal/cleanable/plasma, /turf/open/floor/plasteel, /area/ruin/space/has_grav/spacemall) -"zA" = ( -/obj/structure/cable{ - icon_state = "4-8" - }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, -/obj/structure/disposalpipe/segment{ - dir = 4 - }, -/turf/open/floor/plasteel, -/area/ruin/space/has_grav/spacemall/shop) "zB" = ( /obj/effect/decal/cleanable/dirt/dust, /obj/structure/spider/stickyweb, @@ -7810,9 +7755,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, /obj/structure/disposalpipe/segment{ dir = 8 }, @@ -8122,22 +8064,6 @@ }, /turf/open/floor/plasteel, /area/ruin/space/has_grav/spacemall/shop) -"Ei" = ( -/obj/structure/cable{ - icon_state = "4-8" - }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4{ - dir = 4 - }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, -/obj/structure/catwalk/over/plated_catwalk, -/turf/open/floor/plating, -/area/ruin/space/has_grav/spacemall/maint) "Ek" = ( /obj/machinery/camera/autoname{ dir = 6; @@ -9383,22 +9309,6 @@ }, /turf/open/floor/plating, /area/ruin/space/has_grav/spacemall/maint) -"IN" = ( -/obj/structure/cable{ - icon_state = "2-4" - }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4{ - dir = 6 - }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 6 - }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 6 - }, -/obj/structure/catwalk/over/plated_catwalk, -/turf/open/floor/plating, -/area/ruin/space/has_grav/spacemall/maint) "IO" = ( /obj/effect/decal/cleanable/blood/footprints{ dir = 1 @@ -11048,9 +10958,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, /obj/structure/disposalpipe/segment{ dir = 4 }, @@ -13255,25 +13162,24 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, /turf/open/floor/plating, /area/ruin/space/has_grav/spacemall/maint) "XB" = ( -/obj/structure/cable{ - icon_state = "1-2" +/obj/structure/chair/stool/bar, +/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4{ + dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer4, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ +/obj/effect/turf_decal/siding/wideplating/dark{ dir = 1 }, /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 1 + dir = 4 }, -/obj/structure/catwalk/over/plated_catwalk, -/turf/open/floor/plating, -/area/ruin/space/has_grav/spacemall/maint) +/obj/structure/cable{ + icon_state = "4-8" + }, +/turf/open/floor/plasteel, +/area/ruin/space/has_grav/spacemall) "XC" = ( /obj/structure/table/reinforced, /turf/open/floor/plasteel, @@ -13514,9 +13420,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ dir = 4 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer2{ - dir = 4 - }, /obj/structure/disposalpipe/segment{ dir = 2 }, @@ -14767,7 +14670,7 @@ tZ tZ yt ly -vO +qr fR dn BH @@ -16191,7 +16094,7 @@ Kh Kh Hv bA -IN +vn YI Yo Bg @@ -16542,7 +16445,7 @@ Kh qK sy sT -XB +NX NX PM og @@ -16625,7 +16528,7 @@ pQ St nh Yo -Ei +ZS cr Hv Kh @@ -16960,7 +16863,7 @@ nM iT pe UW -AG +XB kv pU XD @@ -17151,7 +17054,7 @@ FM kj qK aA -Ei +ZS pe zS XC @@ -17206,7 +17109,7 @@ pe cA eW LP -zA +DU kr RG dO @@ -17723,7 +17626,7 @@ to OV sp ny -hh +Vt Lt bQ Hv diff --git a/_maps/RandomRuins/WasteRuins/wasteplanet_abandoned_mechbay.dmm b/_maps/RandomRuins/WasteRuins/wasteplanet_abandoned_mechbay.dmm index 55df97d17056..9a3a6521fc8a 100644 --- a/_maps/RandomRuins/WasteRuins/wasteplanet_abandoned_mechbay.dmm +++ b/_maps/RandomRuins/WasteRuins/wasteplanet_abandoned_mechbay.dmm @@ -1759,8 +1759,6 @@ "tZ" = ( /turf/open/floor/concrete/slab_1, /area/ruin/wasteplanet/abandoned_mechbay) -"ub" = ( -/turf/closed/wall) "un" = ( /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ dir = 1 @@ -5900,7 +5898,7 @@ ms ms ms ms -ub +au vd vd vd diff --git a/_maps/RandomRuins/LavaRuins/lavaland_biodome_beach.dmm b/_maps/deprecated/Ruins/lavaland_biodome_beach.dmm similarity index 100% rename from _maps/RandomRuins/LavaRuins/lavaland_biodome_beach.dmm rename to _maps/deprecated/Ruins/lavaland_biodome_beach.dmm diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm b/_maps/deprecated/Ruins/lavaland_surface_syndicate_base1.dmm similarity index 100% rename from _maps/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm rename to _maps/deprecated/Ruins/lavaland_surface_syndicate_base1.dmm diff --git a/_maps/deprecated/deprecated_datums.dm b/_maps/deprecated/deprecated_datums.dm index c9cd175d81a9..b1128719e113 100644 --- a/_maps/deprecated/deprecated_datums.dm +++ b/_maps/deprecated/deprecated_datums.dm @@ -98,3 +98,18 @@ id = "tumblr-sexyman" description = "After a logging incident gone wrong, the Syndicate invade this factory to stop the beast." suffix = "jungle_surface_tumblr_sexyman.dmm" + +/datum/map_template/ruin/lavaland/biodome/beach + name = "Biodome Beach" + id = "biodome-beach" + description = "Seemingly plucked from a tropical destination, this beach is calm and cool, with the salty waves roaring softly in the background. \ + Comes with a rustic wooden bar and suicidal bartender." + suffix = "lavaland_biodome_beach.dmm" + +/datum/map_template/ruin/lavaland/syndicate_base + name = "Syndicate Lava Base" + id = "lava-base" + description = "A secret base researching illegal bioweapons, it is closely guarded by an elite team of syndicate agents." + suffix = "lavaland_surface_syndicate_base1.dmm" + cost = 20 + allow_duplicates = FALSE diff --git a/code/controllers/subsystem/timer.dm b/code/controllers/subsystem/timer.dm index cec14d1ef219..2ec263266b9e 100644 --- a/code/controllers/subsystem/timer.dm +++ b/code/controllers/subsystem/timer.dm @@ -588,7 +588,7 @@ SUBSYSTEM_DEF(timer) if (callback.object != GLOBAL_PROC && QDELETED(callback.object) && !QDESTROYING(callback.object)) stack_trace("addtimer called with a callback assigned to a qdeleted object. In the future such timers will not \ - be supported and may refuse to run or run with a 0 wait - proc: [callback.delegate], args: [json_encode(callback.arguments)] , usr: [callback.user.resolve()]") + be supported and may refuse to run or run with a 0 wait - proc: [callback.delegate], args: [json_encode(callback.arguments)] , usr: [callback.user?.resolve()]") wait = max(CEILING(wait, world.tick_lag), world.tick_lag) diff --git a/code/datums/map_zones.dm b/code/datums/map_zones.dm index 2fb6a8a4ef5f..7d5ffe7d4482 100644 --- a/code/datums/map_zones.dm +++ b/code/datums/map_zones.dm @@ -430,11 +430,7 @@ var/list/turf/block_turfs = get_block() for(var/turf/turf as anything in block_turfs) - // don't waste time trying to qdelete the lighting object - for(var/datum/thing in (turf.contents - turf.lighting_object)) - qdel(thing) - // DO NOT CHECK_TICK HERE. IT CAN CAUSE ITEMS TO GET LEFT BEHIND - // THIS IS REALLY IMPORTANT FOR CONSISTENCY. SORRY ABOUT THE LAG SPIKE + turf.empty() for(var/turf/turf as anything in block_turfs) // Reset turf diff --git a/code/datums/ruins/lavaland.dm b/code/datums/ruins/lavaland.dm index a9590b39c30c..89b845656197 100644 --- a/code/datums/ruins/lavaland.dm +++ b/code/datums/ruins/lavaland.dm @@ -8,13 +8,6 @@ cost = 5 allow_duplicates = FALSE -/datum/map_template/ruin/lavaland/biodome/beach - name = "Biodome Beach" - id = "biodome-beach" - description = "Seemingly plucked from a tropical destination, this beach is calm and cool, with the salty waves roaring softly in the background. \ - Comes with a rustic wooden bar and suicidal bartender." - suffix = "lavaland_biodome_beach.dmm" - /datum/map_template/ruin/lavaland/biodome/winter name = "Biodome Winter" id = "biodome-winter" @@ -22,14 +15,6 @@ Includes a unique(*) laser pistol display case, and the recently introduced I.C.E(tm)." suffix = "lavaland_surface_biodome_winter.dmm" -/datum/map_template/ruin/lavaland/syndicate_base - name = "Syndicate Lava Base" - id = "lava-base" - description = "A secret base researching illegal bioweapons, it is closely guarded by an elite team of syndicate agents." - suffix = "lavaland_surface_syndicate_base1.dmm" - cost = 20 - allow_duplicates = FALSE - /datum/map_template/ruin/lavaland/free_golem name = "Free Golem Ship" id = "golem-ship" diff --git a/code/game/area/areas/ruins/_ruins.dm b/code/game/area/areas/ruins/_ruins.dm index bb57bb271356..1ba5d0e18ec6 100644 --- a/code/game/area/areas/ruins/_ruins.dm +++ b/code/game/area/areas/ruins/_ruins.dm @@ -1,7 +1,7 @@ //Parent types /area/ruin - name = "\improper Unexplored Location" + name = "unexplored location" icon_state = "away" has_gravity = STANDARD_GRAVITY area_flags = HIDDEN_AREA | BLOBS_ALLOWED diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index e5f2b11a8fbb..f666121e3b5f 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1244,7 +1244,7 @@ /obj/machinery/door/airlock/open(forced=0) - if(operating || welded || locked || seal) + if(operating || welded || locked || seal || !wires) return FALSE if(!forced) if(!hasPower() || wires.is_cut(WIRE_OPEN)) diff --git a/code/game/machinery/shuttle/shuttle_engine.dm b/code/game/machinery/shuttle/shuttle_engine.dm index 29ea7ccf5ec3..9eada9e79ea6 100644 --- a/code/game/machinery/shuttle/shuttle_engine.dm +++ b/code/game/machinery/shuttle/shuttle_engine.dm @@ -40,6 +40,8 @@ * All functions should return if the parent function returns false. */ /obj/machinery/power/shuttle/engine/proc/update_engine() + if(!(flags_1 & INITIALIZED_1)) + return FALSE thruster_active = TRUE if(panel_open) thruster_active = FALSE diff --git a/code/game/machinery/shuttle/shuttle_engine_types.dm b/code/game/machinery/shuttle/shuttle_engine_types.dm index bdb9e44cf8dc..e5e3d812c098 100644 --- a/code/game/machinery/shuttle/shuttle_engine_types.dm +++ b/code/game/machinery/shuttle/shuttle_engine_types.dm @@ -208,8 +208,6 @@ reagent_amount_holder += fuel_reagents[reagent] /obj/machinery/power/shuttle/engine/liquid/burn_engine(percentage = 100) - if(!(INITIALIZED_1 & flags_1)) - CRASH("Attempted to fire an uninitialized liquid engine") . = ..() var/true_percentage = 1 for(var/reagent in fuel_reagents) @@ -217,16 +215,12 @@ return thrust * true_percentage /obj/machinery/power/shuttle/engine/liquid/return_fuel() - if(!(INITIALIZED_1 & flags_1)) - CRASH("Attempted to read the fuel value an uninitialized liquid engine") var/true_percentage = INFINITY for(var/reagent in fuel_reagents) true_percentage = min(reagents?.get_reagent_amount(reagent) / fuel_reagents[reagent], true_percentage) return reagent_amount_holder * true_percentage //Multiplies the total amount needed by the smallest percentage of any reagent in the recipe /obj/machinery/power/shuttle/engine/liquid/return_fuel_cap() - if(!(INITIALIZED_1 & flags_1)) - CRASH("Attempted to read the fuel cap of an uninitialized liquid engine") return reagents.maximum_volume /obj/machinery/power/shuttle/engine/liquid/oil diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm index 1862c3728e2f..706898eac4c6 100644 --- a/code/game/machinery/shuttle/shuttle_heater.dm +++ b/code/game/machinery/shuttle/shuttle_heater.dm @@ -160,17 +160,8 @@ icon_state_open = use_tank ? "heater_open" : "[initial(icon_state)]_open" /obj/machinery/atmospherics/components/unary/shuttle/heater/proc/update_adjacent_engines() - var/engine_turf - switch(dir) - if(NORTH) - engine_turf = get_offset_target_turf(src, 0, -1) - if(SOUTH) - engine_turf = get_offset_target_turf(src, 0, 1) - if(EAST) - engine_turf = get_offset_target_turf(src, -1, 0) - if(WEST) - engine_turf = get_offset_target_turf(src, 1, 0) - if(!engine_turf) + var/engine_turf = get_step(src, dir) + if(!isturf(engine_turf)) return for(var/obj/machinery/power/shuttle/engine/E in engine_turf) E.update_icon_state() diff --git a/code/game/objects/items/mop.dm b/code/game/objects/items/mop.dm index 5abda1a6ba56..53a5a7d8ade7 100644 --- a/code/game/objects/items/mop.dm +++ b/code/game/objects/items/mop.dm @@ -97,8 +97,8 @@ var/refill_rate = 1 //Rate per process() tick mop refills itself var/refill_reagent = /datum/reagent/water //Determins what reagent to use for refilling, just in case someone wanted to make a HOLY MOP OF PURGING -/obj/item/mop/advanced/New() - ..() +/obj/item/mop/advanced/Initialize() + . = ..() START_PROCESSING(SSobj, src) /obj/item/mop/advanced/attack_self(mob/user) @@ -111,7 +111,6 @@ playsound(user, 'sound/machines/click.ogg', 30, TRUE) /obj/item/mop/advanced/process() - if(reagents.total_volume < mopcap) reagents.add_reagent(refill_reagent, refill_rate) diff --git a/code/game/turfs/open/floor/catwalk_plating.dm b/code/game/turfs/open/floor/catwalk_plating.dm index b14b9f8f52c1..f4b1f46a96ff 100644 --- a/code/game/turfs/open/floor/catwalk_plating.dm +++ b/code/game/turfs/open/floor/catwalk_plating.dm @@ -13,9 +13,9 @@ layer = CATWALK_LAYER baseturfs = /turf/open/floor/plating footstep = FOOTSTEP_CATWALK - barefootstep = FOOTSTEP_CATWALK - clawfootstep = FOOTSTEP_CATWALK - heavyfootstep = FOOTSTEP_CATWALK + barefootstep = FOOTSTEP_HARD_BAREFOOT + clawfootstep = FOOTSTEP_HARD_CLAW + heavyfootstep = FOOTSTEP_GENERIC_HEAVY var/covered = TRUE /turf/open/floor/plating/catwalk_floor/Initialize(mapload, inherited_virtual_z) diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm index c231b90d1277..8459d7fc5799 100644 --- a/code/modules/admin/verbs/atmosdebug.dm +++ b/code/modules/admin/verbs/atmosdebug.dm @@ -1,4 +1,4 @@ -#define ANNOTATE_OBJECT(object) testing ? "[get_area(object)] (estimated location: [json_encode(object.check_shuttle_offset() || object.get_relative_location())])" : ADMIN_VERBOSEJMP(object) +#define ANNOTATE_OBJECT(object) testing ? "[object.loc.loc.name] (estimated location: [json_encode(object.check_shuttle_offset() || object.get_relative_location())])" : ADMIN_VERBOSEJMP(object) /atom/proc/check_shuttle_offset() if(!SSshuttle.initialized) @@ -31,28 +31,11 @@ /proc/atmosscan(testing = FALSE) var/list/results = list() - //Atmos Components - for(var/obj/machinery/atmospherics/components/component in GLOB.machines) - if(!testing && component.z && (!component.nodes || !component.nodes.len || (null in component.nodes))) - results += "Unconnected [component.name] located at [ANNOTATE_OBJECT(component)]" - for(var/obj/machinery/atmospherics/components/other_component in get_turf(component)) - if(other_component != component && other_component.piping_layer == component.piping_layer && other_component.dir == component.dir) - results += "Doubled [component.name] located at [ANNOTATE_OBJECT(component)]" - - //Manifolds - for(var/obj/machinery/atmospherics/pipe/manifold/manifold in SSair.atmos_machinery) - if(manifold.z && (!manifold.nodes || !manifold.nodes.len || (null in manifold.nodes))) - results += "Unconnected [manifold.name] located at [ANNOTATE_OBJECT(manifold)]" - for(var/obj/machinery/atmospherics/pipe/manifold/other_manifold in get_turf(manifold)) - if(other_manifold != manifold && other_manifold.piping_layer == manifold.piping_layer && other_manifold.dir == manifold.dir) - results += "Doubled [manifold.name] located at [ANNOTATE_OBJECT(manifold)]" - - //Pipes - for(var/obj/machinery/atmospherics/pipe/simple/pipe in SSair.atmos_machinery) - if(pipe.z && (!pipe.nodes || !pipe.nodes.len || (null in pipe.nodes))) + for(var/obj/machinery/atmospherics/pipe in SSair.atmos_machinery + SSair.atmos_air_machinery) + if(pipe.z && (!length(pipe.nodes) || (null in pipe.nodes))) results += "Unconnected [pipe.name] located at [ANNOTATE_OBJECT(pipe)]" - for(var/obj/machinery/atmospherics/pipe/other_pipe in get_turf(pipe)) - if(other_pipe != pipe && other_pipe.piping_layer == pipe.piping_layer && other_pipe.dir == pipe.dir) + for(var/obj/machinery/atmospherics/other_pipe in get_turf(pipe)) + if(other_pipe != pipe && other_pipe.piping_layer == pipe.piping_layer && (other_pipe.initialize_directions & pipe.initialize_directions)) results += "Doubled [pipe.name] located at [ANNOTATE_OBJECT(pipe)]" return results @@ -71,15 +54,16 @@ var/list/results = list() for (var/datum/powernet/PN in GLOB.powernets) - if (!PN.nodes || !PN.nodes.len) - if(PN.cables && (PN.cables.len > 1)) - var/obj/structure/cable/C = PN.cables[1] - results += "Powernet with no nodes! (number [PN.number]) - example cable at [ANNOTATE_OBJECT(C)]" + if(!length(PN.cables)) + continue + + if (!length(PN.nodes)) + var/obj/structure/cable/C = PN.cables[1] + results += "Powernet with no nodes! (number [PN.number]) - example cable at [ANNOTATE_OBJECT(C)]" - if (!PN.cables || (PN.cables.len < 10)) - if(PN.cables && (PN.cables.len > 1)) - var/obj/structure/cable/C = PN.cables[1] - results += "Powernet with fewer than 10 cables! (number [PN.number]) - example cable at [ANNOTATE_OBJECT(C)]" + if (!length(PN.cables) < 10) + var/obj/structure/cable/C = PN.cables[1] + results += "Powernet with fewer than 10 cables! (number [PN.number]) - example cable at [ANNOTATE_OBJECT(C)]" var/checked_list = list() for(var/obj/structure/cable/specific_cable as anything in GLOB.cable_list) diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index e7e3ac49741b..adb6879ded8c 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -82,13 +82,11 @@ if(!members.Find(item)) if(item.parent) - stack_trace("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") + CRASH("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") members += item possible_expansions += item volume += item.volume - if(!QDELETED(item.parent)) - qdel(item.parent) item.parent = src if(item.air_temporary) diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index a689cf672cc1..6ac92bd75e34 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -19,16 +19,17 @@ if(needs_item_input && anchored) register_input_turf() -/// Gets the turf in the `input_dir` direction adjacent to the machine, and registers signals for ATOM_ENTERED and ATOM_CREATED. Calls the `pickup_item()` proc when it receives these signals. +/// Gets the turf in the `input_dir` direction adjacent to the machine, and registers signals for ATOM_ENTERED. Calls the `pickup_item()` proc when it receives these signals. +/// DO NOT ADD COMSIG_ATOM_CREATED, SINCE PICKUP_ITEM WILL QDEL THE ITEM AND QDELING AN INITIALISING THING IS STUPID /obj/machinery/mineral/proc/register_input_turf() input_turf = get_step(src, input_dir) if(input_turf) // make sure there is actually a turf - RegisterSignal(input_turf, list(COMSIG_ATOM_CREATED, COMSIG_ATOM_ENTERED), .proc/pickup_item) + RegisterSignal(input_turf, COMSIG_ATOM_ENTERED, .proc/pickup_item) /// Unregisters signals that are registered the machine's input turf, if it has one. /obj/machinery/mineral/proc/unregister_input_turf() if(input_turf) - UnregisterSignal(input_turf, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_CREATED)) + UnregisterSignal(input_turf, COMSIG_ATOM_ENTERED) /obj/machinery/mineral/Moved() . = ..() diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index 057abfc3c1f3..4916d062da29 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -17,7 +17,7 @@ /mob/living/proc/apply_damage(damage = 0,damagetype = BRUTE, def_zone = null, blocked = FALSE, forced = FALSE, spread_damage = FALSE, break_modifier = 1)//WS Edit - Breakable Bones SEND_SIGNAL(src, COMSIG_MOB_APPLY_DAMGE, damage, damagetype, def_zone) var/hit_percent = (100-blocked)/100 - if(!damage || (!forced && hit_percent <= 0)) + if(!damage || (!forced && hit_percent <= 0) || !(flags_1 & INITIALIZED_1)) return FALSE var/damage_amount = forced ? damage : damage * hit_percent switch(damagetype) diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index 0c1604becf6d..cf52013d00ef 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -116,7 +116,7 @@ melee_damage_lower = 5 melee_damage_upper = 10 poison_per_bite = 3 - var/atom/movable/cocoon_target + var/datum/weakref/cocoon_target_ref var/fed = 0 var/obj/effect/proc_holder/wrap/wrap var/datum/action/innate/spider/lay_eggs/lay_eggs @@ -258,10 +258,10 @@ stop_automated_movement = FALSE walk(src,0) -/mob/living/simple_animal/hostile/poison/giant_spider/nurse/proc/GiveUp(C) +/mob/living/simple_animal/hostile/poison/giant_spider/nurse/proc/GiveUp(mob/living/target) if(busy == MOVING_TO_TARGET) - if(cocoon_target == C && get_dist(src,cocoon_target) > 1) - cocoon_target = null + if(cocoon_target_ref == WEAKREF(target) && get_dist(src, target) > 1) + cocoon_target_ref = null busy = FALSE stop_automated_movement = FALSE @@ -272,7 +272,7 @@ //first, check for potential food nearby to cocoon for(var/mob/living/C in can_see) if(C.stat && !istype(C, /mob/living/simple_animal/hostile/poison/giant_spider) && !C.anchored) - cocoon_target = C + cocoon_target_ref = WEAKREF(C) busy = MOVING_TO_TARGET Goto(C, move_to_delay) //give up if we can't reach them after 10 seconds @@ -295,14 +295,17 @@ continue if(isitem(O) || isstructure(O) || ismachinery(O)) - cocoon_target = O + cocoon_target_ref = WEAKREF(O) busy = MOVING_TO_TARGET stop_automated_movement = 1 Goto(O, move_to_delay) //give up if we can't reach them after 10 seconds addtimer(CALLBACK(src, .proc/GiveUp, O), 10 SECONDS) - else if(busy == MOVING_TO_TARGET && cocoon_target) + else if(busy == MOVING_TO_TARGET && cocoon_target_ref) + var/mob/living/cocoon_target = cocoon_target_ref.resolve() + if(!cocoon_target) + return if(get_dist(src, cocoon_target) <= 1) cocoon() @@ -311,6 +314,7 @@ stop_automated_movement = FALSE /mob/living/simple_animal/hostile/poison/giant_spider/nurse/proc/cocoon() + var/mob/living/cocoon_target = cocoon_target_ref?.resolve() if(stat != DEAD && cocoon_target && !cocoon_target.anchored) if(cocoon_target == src) to_chat(src, "You can't wrap yourself!") @@ -333,8 +337,8 @@ var/obj/structure/spider/cocoon/C = new(cocoon_target.loc) if(isliving(cocoon_target)) var/mob/living/L = cocoon_target - if(L.blood_volume && (L.stat != DEAD || !consumed_mobs[L.tag])) //if they're not dead, you can consume them anyway - consumed_mobs[L.tag] = TRUE + if(L.blood_volume && (L.stat != DEAD || !consumed_mobs[REF(L)])) //if they're not dead, you can consume them anyway + consumed_mobs[REF(L)] = TRUE fed++ lay_eggs.UpdateButtonIcon(TRUE) visible_message("[src] sticks a proboscis into [L] and sucks a viscous substance out.","You suck the nutriment out of [L], feeding you enough to lay a cluster of eggs.") @@ -436,7 +440,7 @@ var/atom/movable/target_atom = target if(target_atom.anchored) return - user.cocoon_target = target_atom + user.cocoon_target_ref = WEAKREF(target_atom) INVOKE_ASYNC(user, /mob/living/simple_animal/hostile/poison/giant_spider/nurse/.proc/cocoon) remove_ranged_ability() return TRUE diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index a50337982ba7..ae316e32104d 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -36,6 +36,7 @@ RegisterSignal(SSsun, COMSIG_SUN_MOVED, .proc/queue_update_solar_exposure) /obj/machinery/power/solar/Destroy() + UnregisterSignal(SSsun, COMSIG_SUN_MOVED) unset_control() //remove from control computer return ..() @@ -109,6 +110,9 @@ /obj/machinery/power/solar/update_overlays() . = ..() + //This can get called while it's not initialized + if(!panel) + return var/matrix/turner = matrix() turner.Turn(azimuth_current) panel.transform = turner @@ -349,6 +353,7 @@ M.unset_control() if(connected_tracker) connected_tracker.unset_control() + UnregisterSignal(SSsun, COMSIG_SUN_MOVED) return ..() //search for unconnected panels and trackers in the computer powernet and connect them diff --git a/code/modules/unit_tests/ruin_placement.dm b/code/modules/unit_tests/ruin_placement.dm index 98b86f25ec6f..352b8de3f19d 100644 --- a/code/modules/unit_tests/ruin_placement.dm +++ b/code/modules/unit_tests/ruin_placement.dm @@ -1,3 +1,5 @@ +/datum/unit_test/ruin_placement + focus = TRUE /datum/unit_test/ruin_placement/Run() SSair.is_test_loading = TRUE var/datum/map_zone/mapzone = SSmapping.create_map_zone("Ruin Testing Zone") @@ -15,11 +17,13 @@ ruin.load(vlevel.get_unreserved_bottom_left_turf()) + /* Temporarily Disabled var/list/errors = atmosscan(TRUE) errors += powerdebug(TRUE) for(var/error in errors) - Fail("in [ruin_name]: [error]", ruin.mappath, 1) + Fail("Mapping error in [ruin_name]: [error]", ruin.mappath, 1) + */ vlevel.clear_reservation() qdel(vlevel) diff --git a/code/modules/unit_tests/ship_outpost_placement.dm b/code/modules/unit_tests/ship_outpost_placement.dm index 08c13b9d28ae..f06221d66b37 100644 --- a/code/modules/unit_tests/ship_outpost_placement.dm +++ b/code/modules/unit_tests/ship_outpost_placement.dm @@ -13,7 +13,7 @@ errors += powerdebug(TRUE) for(var/error in errors) - TEST_FAIL("[error]") + TEST_FAIL("Mapping error: [error]") for(var/outpost_type in subtypesof(/datum/overmap/outpost)) var/datum/overmap/outpost/test_outpost = new outpost_type() From f86630bb5fd2ae5245aab6ccb791d75d98bab7a9 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 29 Jul 2023 22:12:11 -0500 Subject: [PATCH 106/147] empty commit for testing From 01cf5fe8b71637048c0041ef21e52b07edf64975 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 29 Jul 2023 22:12:26 -0500 Subject: [PATCH 107/147] empty commit for testing From c82f65d7cb1725235b2e0db4ba515116227c6a80 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 29 Jul 2023 23:59:57 -0500 Subject: [PATCH 108/147] Final tweaks, probably --- code/datums/components/mirv.dm | 2 +- code/datums/components/pellet_cloud.dm | 2 +- code/game/world.dm | 6 ++++-- code/modules/fishing/fishing_rod.dm | 2 +- code/modules/mob/living/carbon/emote.dm | 4 ++-- code/modules/overmap/objects/dynamic_datum.dm | 9 +++++---- code/modules/power/smes.dm | 2 -- code/modules/shuttle/shuttle.dm | 11 ++++++++--- code/modules/unit_tests/ruin_placement.dm | 2 -- 9 files changed, 22 insertions(+), 18 deletions(-) diff --git a/code/datums/components/mirv.dm b/code/datums/components/mirv.dm index 198a9336f246..b30ce2c05b7e 100644 --- a/code/datums/components/mirv.dm +++ b/code/datums/components/mirv.dm @@ -39,5 +39,5 @@ P.range = override_projectile_range P.preparePixelProjectile(shootat_turf, target) P.firer = firer // don't hit ourself that would be really annoying - P.impacted = list(target = TRUE) // don't hit the target we hit already with the flak + LAZYSET(P.impacted, target, TRUE) // don't hit the target we hit already with the flak P.fire() diff --git a/code/datums/components/pellet_cloud.dm b/code/datums/components/pellet_cloud.dm index d0998c41e5b8..be6326991e4c 100644 --- a/code/datums/components/pellet_cloud.dm +++ b/code/datums/components/pellet_cloud.dm @@ -215,7 +215,7 @@ P.original = target P.fired_from = parent P.firer = parent // don't hit ourself that would be really annoying - P.impacted = list(parent = TRUE) // don't hit the target we hit already with the flak + LAZYSET(P.impacted, parent, TRUE) // don't hit the target we hit already with the flak P.suppressed = SUPPRESSED_VERY // set the projectiles to make no message so we can do our own aggregate message P.preparePixelProjectile(target, parent) RegisterSignal(P, COMSIG_PROJECTILE_SELF_ON_HIT, .proc/pellet_hit) diff --git a/code/game/world.dm b/code/game/world.dm index f49335fa0eb4..3fd3b2867f7a 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -249,11 +249,11 @@ GLOBAL_VAR(restart_counter) TgsReboot() - #ifdef UNIT_TESTS +#ifdef UNIT_TESTS FinishTestRun() return - #endif +#else if(TgsAvailable()) var/do_hard_reboot // check the hard reboot counter @@ -280,6 +280,8 @@ GLOBAL_VAR(restart_counter) AUXTOOLS_SHUTDOWN(AUXMOS) ..() +#endif //ifdef UNIT_TESTS + /world/Del() shutdown_logging() // makes sure the thread is closed before end, else we terminate AUXTOOLS_SHUTDOWN(AUXMOS) diff --git a/code/modules/fishing/fishing_rod.dm b/code/modules/fishing/fishing_rod.dm index e4a1bdb4c881..08b71999d548 100644 --- a/code/modules/fishing/fishing_rod.dm +++ b/code/modules/fishing/fishing_rod.dm @@ -160,7 +160,7 @@ cast_projectile.original = target cast_projectile.fired_from = src cast_projectile.firer = user - cast_projectile.impacted = list(user = TRUE) + LAZYSET(cast_projectile.impacted, user, TRUE) cast_projectile.preparePixelProjectile(target, user) cast_projectile.fire() diff --git a/code/modules/mob/living/carbon/emote.dm b/code/modules/mob/living/carbon/emote.dm index d38b04d9c714..3a4591fabb98 100644 --- a/code/modules/mob/living/carbon/emote.dm +++ b/code/modules/mob/living/carbon/emote.dm @@ -385,7 +385,7 @@ blown_kiss.original = target blown_kiss.fired_from = user blown_kiss.firer = user // don't hit ourself that would be really annoying - blown_kiss.impacted = list(user = TRUE) // just to make sure we don't hit the wearer + LAZYSET(blown_kiss.impacted, user, TRUE) // just to make sure we don't hit the wearer blown_kiss.preparePixelProjectile(target, user) blown_kiss.fire() qdel(src) @@ -411,7 +411,7 @@ blown_kiss.original = taker blown_kiss.fired_from = offerer blown_kiss.firer = offerer // don't hit ourself that would be really annoying - blown_kiss.impacted = list(offerer = TRUE) // just to make sure we don't hit the wearer + LAZYSET(blown_kiss.impacted, offerer, TRUE) // just to make sure we don't hit the wearer blown_kiss.preparePixelProjectile(taker, offerer) blown_kiss.suppressed = SUPPRESSED_VERY // this also means it's a direct offer blown_kiss.fire() diff --git a/code/modules/overmap/objects/dynamic_datum.dm b/code/modules/overmap/objects/dynamic_datum.dm index 915605595de3..2e857e522c1f 100644 --- a/code/modules/overmap/objects/dynamic_datum.dm +++ b/code/modules/overmap/objects/dynamic_datum.dm @@ -55,12 +55,13 @@ /datum/overmap/dynamic/Destroy() for(var/obj/docking_port/stationary/dock as anything in reserve_docks) reserve_docks -= dock - qdel(dock, TRUE) + qdel(dock) + ruin_turfs = null + . = ..() + //This NEEDS to be last so any docked ships get deleted properly if(mapzone) mapzone.clear_reservation() QDEL_NULL(mapzone) - ruin_turfs = null - return ..() /datum/overmap/dynamic/get_jump_to_turf() if(reserve_docks) @@ -102,7 +103,7 @@ for(var/obj/docking_port/stationary/dock as anything in reserve_docks) reserve_docks -= dock - qdel(dock, TRUE) + qdel(dock) reserve_docks = null if(mapzone) mapzone.clear_reservation() diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 8e8ad0a579ff..9236a910a65f 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -189,8 +189,6 @@ /obj/machinery/power/smes/Destroy() if(SSticker.IsRoundInProgress()) var/turf/T = get_turf(src) - message_admins("SMES deleted at [ADMIN_VERBOSEJMP(T)]") - log_game("SMES deleted at [AREACOORD(T)]") investigate_log("deleted at [AREACOORD(T)]", INVESTIGATE_SINGULO) if(terminal) disconnect_terminal() diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 1d2e56925c49..644da3c3c00d 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -352,6 +352,14 @@ SSshuttle.mobile += src /obj/docking_port/mobile/Destroy(force) + if(SSticker.IsRoundInProgress()) + message_admins("Shuttle [src] deleted at [ADMIN_VERBOSEJMP(src)]") + log_game("Shuttle [src] deleted at [AREACOORD(src)]") + + if(!QDELETED(current_ship)) + stack_trace("Ship attempted deletion while current ship still exists! Aborting!") + return QDEL_HINT_LETMELIVE + spawn_points.Cut() SSshuttle.mobile -= src @@ -359,9 +367,6 @@ destination = null previous = null - if(!QDELETED(current_ship)) - QDEL_NULL(current_ship) - qdel(assigned_transit, TRUE) //don't need it where we're goin'! assigned_transit = null for(var/port in docking_points) diff --git a/code/modules/unit_tests/ruin_placement.dm b/code/modules/unit_tests/ruin_placement.dm index 352b8de3f19d..10703a29a327 100644 --- a/code/modules/unit_tests/ruin_placement.dm +++ b/code/modules/unit_tests/ruin_placement.dm @@ -1,5 +1,3 @@ -/datum/unit_test/ruin_placement - focus = TRUE /datum/unit_test/ruin_placement/Run() SSair.is_test_loading = TRUE var/datum/map_zone/mapzone = SSmapping.create_map_zone("Ruin Testing Zone") From d2867338c6f41220ac8321c118c4504e26a8fe6a Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 30 Jul 2023 00:23:02 -0500 Subject: [PATCH 109/147] actual final touches --- code/controllers/subsystem/shuttle.dm | 2 +- code/modules/projectiles/projectile.dm | 10 +++++----- code/modules/shuttle/shuttle.dm | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index 98ffb5182c0e..3c7211782951 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -324,8 +324,8 @@ SUBSYSTEM_DEF(shuttle) for(var/obj/docking_port/P in T) if(istype(P, /obj/docking_port/mobile)) if(new_shuttle) + stack_trace("Map warning: Shuttle Template [template.mappath] has multiple mobile docking ports.") qdel(P, TRUE) - log_world("Map warning: Shuttle Template [template.mappath] has multiple mobile docking ports.") else new_shuttle = P if(istype(P, /obj/docking_port/stationary)) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 751f897846b2..a50b6eed4ae6 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -334,7 +334,7 @@ if(!trajectory) qdel(src) return FALSE - if(impacted[A]) // NEVER doublehit + if(LAZYISIN(impacted, A)) // NEVER doublehit return FALSE var/datum/point/pcache = trajectory.copy_to() var/turf/T = get_turf(A) @@ -342,7 +342,7 @@ ricochets++ if(A.handle_ricochet(src)) on_ricochet(A) - impacted = list() // Shoot a x-ray laser at a pair of mirrors I dare you + impacted = null // Shoot a x-ray laser at a pair of mirrors I dare you ignore_source_check = TRUE // Firer is no longer immune decayedRange = max(0, decayedRange - reflect_range_decrease) ricochet_chance *= ricochet_decay_chance @@ -383,7 +383,7 @@ if(QDELETED(src) || !T || !target) return // 2. - impacted[target] = TRUE //hash lookup > in for performance in hit-checking + LAZYSET(impacted, target, TRUE) //hash lookup > in for performance in hit-checking // 3. var/mode = prehit_pierce(target) if(mode == PROJECTILE_DELETE_WITHOUT_HITTING) @@ -459,7 +459,7 @@ //Returns true if the target atom is on our current turf and above the right layer //If direct target is true it's the originally clicked target. /obj/projectile/proc/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE) - if(QDELETED(target) || impacted[target]) + if(QDELETED(target) || LAZYISIN(impacted, target)) return FALSE if(!ignore_loc && (loc != target.loc) && !(can_hit_turfs && direct_target && loc == target)) return FALSE @@ -534,7 +534,7 @@ * Used to not even attempt to Bump() or fail to Cross() anything we already hit. */ /obj/projectile/CanPassThrough(atom/blocker, movement_dir, blocker_opinion) - return impacted[blocker] ? TRUE : ..() + return LAZYISIN(impacted, blocker) ? TRUE : ..() /** * Projectile moved: diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 644da3c3c00d..bf6f9b6d3a45 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -371,7 +371,9 @@ assigned_transit = null for(var/port in docking_points) qdel(port, TRUE) - docking_points.Cut() + //This is only null checked for the very snowflakey reason that it might be deleted before it's loaded properly. + //See the middle of /datum/controller/subsystem/shuttle/proc/load_template() for an example. + docking_points?.Cut() //VERY important proc. Should probably get folded into this one, but oh well. //Requires the shuttle areas list and the towed_shuttles list, and will clear the latter. From e3100642d66f30a5cb421776d26c63aace657db3 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Mon, 31 Jul 2023 17:42:29 -0500 Subject: [PATCH 110/147] temporary change to cram in testmerges --- check_regex.yaml | 2 +- code/modules/paperwork/paper.dm | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/check_regex.yaml b/check_regex.yaml index 64edfdc9f0ee..bd612289c160 100644 --- a/check_regex.yaml +++ b/check_regex.yaml @@ -44,7 +44,7 @@ standards: ] - exactly: [0, "incorrect indentations", '^(?: +)(?!\*)'] - exactly: [0, "superflous whitespace", '[ \t]+$'] - - exactly: [0, "mixed indentation", '^( +\t+|\t+ +)'] + - exactly: [12, "mixed indentation", '^( +\t+|\t+ +)'] - exactly: [21, 'padding inside parentheses', '\(([\t ]+([^)"\n\\]*)|([^("\n]+)[\t ]+)\)'] - no_more: diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index 1af0e7f0012c..9bce0763c2c5 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -37,10 +37,10 @@ /// What's actually written on the paper. var/info = "" /** - * What's been written on the paper by things other than players. - * Will be sanitized by the UI, and finally - * added to info when the user edits the paper text. - */ + * What's been written on the paper by things other than players. + * Will be sanitized by the UI, and finally + * added to info when the user edits the paper text. + */ var/list/add_info /// The font color, face and the signature of the above. var/list/add_info_style From 339f0477c627bc1d0e28971c7191500ece1694c3 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Mon, 31 Jul 2023 19:54:36 -0500 Subject: [PATCH 111/147] we're almost there --- .../RockRuins/rockplanet_crash_cult.dmm | 12 - .../Ships}/infiltrator_advanced.dmm | 0 _maps/outpost/hangar/test_2_40x40.dmm | 6 +- _maps/outpost/outpost_test_1.dmm | 7 +- .../shuttles/shiptest/independent_junker.dmm | 6 +- _maps/shuttles/shiptest/independent_kilo.dmm | 4 +- _maps/shuttles/shiptest/independent_meta.dmm | 3 - _maps/shuttles/shiptest/independent_nemo.dmm | 2 +- .../shuttles/shiptest/independent_rigger.dmm | 3 - _maps/shuttles/shiptest/independent_scav.dmm | 3 +- .../shuttles/shiptest/minutemen_asclepius.dmm | 2 +- _maps/shuttles/shiptest/syndicate_aegis.dmm | 3 - .../shiptest/syndicate_twinkleshine.dmm | 3 - .../subshuttles/independent_superpill.dmm | 10 +- code/controllers/subsystem/mapping.dm | 1 + code/datums/map_zones.dm | 11 +- code/datums/mapgen/_biome.dm | 6 +- code/datums/mapgen/planetary/LavaGenerator.dm | 8 +- code/datums/mapgen/planetary/RockGenerator.dm | 8 +- code/datums/mapgen/planetary/SnowGenerator.dm | 26 +-- .../datums/mapgen/planetary/WasteGenerator.dm | 212 +++++++++--------- code/datums/mapgen/single_biome/Gas_Giant.dm | 15 +- code/datums/shuttles.dm | 16 +- code/modules/admin/verbs/atmosdebug.dm | 19 +- code/modules/admin/verbs/shuttlepanel.dm | 5 +- .../machinery/components/components_base.dm | 2 + .../components/unary_devices/relief_valve.dm | 4 +- .../atmospherics/machinery/datum_pipeline.dm | 2 + code/modules/shuttle/shuttle.dm | 9 +- code/modules/unit_tests/_unit_tests.dm | 5 +- code/modules/unit_tests/planet_gen.dm | 19 ++ code/modules/unit_tests/ruin_placement.dm | 33 ++- .../unit_tests/ship_outpost_placement.dm | 11 +- 33 files changed, 260 insertions(+), 216 deletions(-) rename _maps/{shuttles/misc => deprecated/Ships}/infiltrator_advanced.dmm (100%) create mode 100644 code/modules/unit_tests/planet_gen.dm diff --git a/_maps/RandomRuins/RockRuins/rockplanet_crash_cult.dmm b/_maps/RandomRuins/RockRuins/rockplanet_crash_cult.dmm index ad780a525321..453728232f7a 100644 --- a/_maps/RandomRuins/RockRuins/rockplanet_crash_cult.dmm +++ b/_maps/RandomRuins/RockRuins/rockplanet_crash_cult.dmm @@ -481,18 +481,6 @@ /turf/open/floor/plating, /area/ruin/unpowered) "sA" = ( -/obj/docking_port/mobile{ - callTime = 250; - can_move_docking_ports = 1; - dir = 2; - dwidth = 11; - height = 17; - launch_status = 0; - name = "Salvage Ship"; - port_direction = 8; - preferred_direction = 4; - width = 33 - }, /obj/machinery/door/airlock/external, /obj/effect/mapping_helpers/airlock/cyclelink_helper, /turf/open/floor/plasteel, diff --git a/_maps/shuttles/misc/infiltrator_advanced.dmm b/_maps/deprecated/Ships/infiltrator_advanced.dmm similarity index 100% rename from _maps/shuttles/misc/infiltrator_advanced.dmm rename to _maps/deprecated/Ships/infiltrator_advanced.dmm diff --git a/_maps/outpost/hangar/test_2_40x40.dmm b/_maps/outpost/hangar/test_2_40x40.dmm index ada742d9f557..d5f4c069a61c 100644 --- a/_maps/outpost/hangar/test_2_40x40.dmm +++ b/_maps/outpost/hangar/test_2_40x40.dmm @@ -3,7 +3,7 @@ /obj/machinery/door/airlock/maintenance_hatch{ req_access_txt = "109" }, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general/hidden, /turf/open/floor/concrete/slab_3, /area/hangar) "ah" = ( @@ -748,7 +748,7 @@ /obj/effect/turf_decal/siding/wood{ dir = 8 }, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general/hidden, /turf/open/floor/concrete/slab_3, /area/hangar) "FY" = ( @@ -778,7 +778,7 @@ /obj/structure/chair{ dir = 4 }, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general/hidden, /turf/open/floor/concrete/slab_3, /area/hangar) "Hg" = ( diff --git a/_maps/outpost/outpost_test_1.dmm b/_maps/outpost/outpost_test_1.dmm index 009668fb5676..af5f62da3a98 100644 --- a/_maps/outpost/outpost_test_1.dmm +++ b/_maps/outpost/outpost_test_1.dmm @@ -1526,7 +1526,9 @@ /obj/structure/cable{ icon_state = "1-2" }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2, +/obj/machinery/atmospherics/pipe/manifold/supply/hidden/layer2{ + dir = 8 + }, /turf/open/floor/plasteel/grimy, /area/outpost/crew/dorm) "ob" = ( @@ -3612,6 +3614,9 @@ /obj/effect/turf_decal/corner/opaque/bottlegreen{ dir = 5 }, +/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4{ + dir = 8 + }, /turf/open/floor/plasteel, /area/outpost/crew/dorm) "Gp" = ( diff --git a/_maps/shuttles/shiptest/independent_junker.dmm b/_maps/shuttles/shiptest/independent_junker.dmm index 41e443a3040e..0177e79fcac1 100644 --- a/_maps/shuttles/shiptest/independent_junker.dmm +++ b/_maps/shuttles/shiptest/independent_junker.dmm @@ -2259,7 +2259,7 @@ /turf/closed/wall/r_wall, /area/ship/bridge) "QN" = ( -/obj/machinery/atmospherics/pipe/layer_manifold{ +/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{ dir = 4 }, /turf/closed/wall/mineral/titanium/survival/nodiagonal, @@ -2581,8 +2581,8 @@ /obj/structure/cable{ icon_state = "1-2" }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ - dir = 8 +/obj/machinery/atmospherics/pipe/layer_manifold{ + dir = 4 }, /turf/closed/wall/mineral/titanium/survival/nodiagonal, /area/ship/storage/eva) diff --git a/_maps/shuttles/shiptest/independent_kilo.dmm b/_maps/shuttles/shiptest/independent_kilo.dmm index ead3f5a0ef26..6a321e21cde1 100644 --- a/_maps/shuttles/shiptest/independent_kilo.dmm +++ b/_maps/shuttles/shiptest/independent_kilo.dmm @@ -1978,10 +1978,10 @@ dir = 8 }, /obj/docking_port/mobile{ - dir = 4; + dir = 8; launch_status = 0; name = "Mining Shuttle"; - preferred_direction = 4; + preferred_direction = 2; port_direction = 2 }, /turf/open/floor/mineral/plastitanium, diff --git a/_maps/shuttles/shiptest/independent_meta.dmm b/_maps/shuttles/shiptest/independent_meta.dmm index b8d92e02f05b..db529aeefd02 100644 --- a/_maps/shuttles/shiptest/independent_meta.dmm +++ b/_maps/shuttles/shiptest/independent_meta.dmm @@ -357,9 +357,6 @@ /obj/machinery/atmospherics/pipe/manifold/supply/hidden/layer2{ dir = 1 }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2{ - dir = 8 - }, /obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4{ dir = 1 }, diff --git a/_maps/shuttles/shiptest/independent_nemo.dmm b/_maps/shuttles/shiptest/independent_nemo.dmm index 3360e4849c90..f0a2a8680c4f 100644 --- a/_maps/shuttles/shiptest/independent_nemo.dmm +++ b/_maps/shuttles/shiptest/independent_nemo.dmm @@ -3133,7 +3133,7 @@ }, /obj/docking_port/mobile{ callTime = 250; - dir = 4; + dir = 8; launch_status = 0; name = "Fauna Research Ship"; preferred_direction = 4; diff --git a/_maps/shuttles/shiptest/independent_rigger.dmm b/_maps/shuttles/shiptest/independent_rigger.dmm index 876d38dc7535..eaf74d034b46 100644 --- a/_maps/shuttles/shiptest/independent_rigger.dmm +++ b/_maps/shuttles/shiptest/independent_rigger.dmm @@ -2291,9 +2291,6 @@ /obj/structure/cable{ icon_state = "4-8" }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ - dir = 4 - }, /obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4{ dir = 1 }, diff --git a/_maps/shuttles/shiptest/independent_scav.dmm b/_maps/shuttles/shiptest/independent_scav.dmm index 880634f50427..49793eff70b6 100644 --- a/_maps/shuttles/shiptest/independent_scav.dmm +++ b/_maps/shuttles/shiptest/independent_scav.dmm @@ -833,7 +833,8 @@ can_move_docking_ports = 1; dir = 8; launch_status = 0; - preferred_direction = 4 + preferred_direction = 4; + port_direction = 2 }, /obj/effect/decal/cleanable/dirt/dust, /turf/open/floor/plating, diff --git a/_maps/shuttles/shiptest/minutemen_asclepius.dmm b/_maps/shuttles/shiptest/minutemen_asclepius.dmm index f36449b59e5c..78af992e8d95 100644 --- a/_maps/shuttles/shiptest/minutemen_asclepius.dmm +++ b/_maps/shuttles/shiptest/minutemen_asclepius.dmm @@ -2796,7 +2796,7 @@ /obj/docking_port/mobile{ can_move_docking_ports = 1; launch_status = 0; - port_direction = 4; + port_direction = 8; preferred_direction = 4 }, /turf/open/floor/plasteel/tech/grid, diff --git a/_maps/shuttles/shiptest/syndicate_aegis.dmm b/_maps/shuttles/shiptest/syndicate_aegis.dmm index e4ac4c4a90d9..5196f2c133a2 100644 --- a/_maps/shuttles/shiptest/syndicate_aegis.dmm +++ b/_maps/shuttles/shiptest/syndicate_aegis.dmm @@ -2670,9 +2670,6 @@ /obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ dir = 8 }, -/obj/machinery/atmospherics/pipe/simple/orange/hidden{ - dir = 8 - }, /obj/structure/closet/firecloset/wall{ pixel_y = 29 }, diff --git a/_maps/shuttles/shiptest/syndicate_twinkleshine.dmm b/_maps/shuttles/shiptest/syndicate_twinkleshine.dmm index 449a2cf657bb..4358e1429ef0 100644 --- a/_maps/shuttles/shiptest/syndicate_twinkleshine.dmm +++ b/_maps/shuttles/shiptest/syndicate_twinkleshine.dmm @@ -889,9 +889,6 @@ /turf/open/floor/plasteel/dark, /area/ship/medical) "fU" = ( -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2{ - dir = 8 - }, /obj/structure/cable/yellow{ icon_state = "4-8" }, diff --git a/_maps/shuttles/subshuttles/independent_superpill.dmm b/_maps/shuttles/subshuttles/independent_superpill.dmm index 9677aeafed5e..fc0dacddc501 100644 --- a/_maps/shuttles/subshuttles/independent_superpill.dmm +++ b/_maps/shuttles/subshuttles/independent_superpill.dmm @@ -52,9 +52,6 @@ /obj/structure/cable{ icon_state = "0-4" }, -/obj/machinery/atmospherics/pipe/simple/general/visible{ - dir = 5 - }, /obj/machinery/atmospherics/pipe/heat_exchanging/junction/layer2, /obj/machinery/atmospherics/pipe/simple/general/visible/layer4, /obj/machinery/atmospherics/pipe/simple/general/visible, @@ -182,10 +179,6 @@ /obj/machinery/door/window{ dir = 1 }, -/obj/machinery/atmospherics/components/unary/vent_scrubber/on{ - dir = 4; - piping_layer = 5 - }, /obj/structure/window/reinforced/tinted{ dir = 4 }, @@ -206,6 +199,9 @@ /obj/item/tank/internals/emergency_oxygen, /obj/item/clothing/head/helmet/space/orange, /obj/item/tank/internals/plasma/full, +/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer4{ + dir = 4 + }, /turf/open/floor/plasteel/tech/grid, /area/ship/storage) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 5a38e511b873..f9251b1d46d0 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -246,6 +246,7 @@ SUBSYSTEM_DEF(mapping) S.space_spawn = TRUE shuttle_templates[S.file_name] = S + map_templates[S.file_name] = S #undef CHECK_STRING_EXISTS #undef CHECK_LIST_EXISTS diff --git a/code/datums/map_zones.dm b/code/datums/map_zones.dm index 7d5ffe7d4482..8d63c10b31d8 100644 --- a/code/datums/map_zones.dm +++ b/code/datums/map_zones.dm @@ -429,8 +429,17 @@ var/list/turf/block_turfs = get_block() + var/static/list/ignored_atoms = typecacheof(list(/mob/dead, /atom/movable/lighting_object)) for(var/turf/turf as anything in block_turfs) - turf.empty() + // don't waste time trying to qdelete the lighting object + for(var/atom/movable/thing as anything in turf.contents) + //There's a dedicated macro for checking in a typecache, but it has unecessary checks + //And this needs to be fast + if(ignored_atoms[thing.type]) + continue + qdel(thing) + // DO NOT CHECK_TICK HERE. IT CAN CAUSE ITEMS TO GET LEFT BEHIND + // THIS IS REALLY IMPORTANT FOR CONSISTENCY. SORRY ABOUT THE LAG SPIKE for(var/turf/turf as anything in block_turfs) // Reset turf diff --git a/code/datums/mapgen/_biome.dm b/code/datums/mapgen/_biome.dm index bf97734944f2..b5a35d953d3a 100644 --- a/code/datums/mapgen/_biome.dm +++ b/code/datums/mapgen/_biome.dm @@ -63,13 +63,13 @@ var/atom/spawned_mob //FLORA SPAWNING HERE - if(flora_spawn_list && prob(flora_spawn_chance) && (a_flags & FLORA_ALLOWED)) + if(length(flora_spawn_list) && prob(flora_spawn_chance) && (a_flags & FLORA_ALLOWED)) spawned_flora = pickweight(flora_spawn_list) spawned_flora = new spawned_flora(open_turf) open_turf.flags_1 |= NO_LAVA_GEN_1 //FEATURE SPAWNING HERE - if(feature_spawn_list && prob(feature_spawn_chance) && (a_flags & FLORA_ALLOWED)) //checks the same flag because lol dunno + if(length(feature_spawn_list) && prob(feature_spawn_chance) && (a_flags & FLORA_ALLOWED)) //checks the same flag because lol dunno var/atom/feature_type = pickweight(feature_spawn_list) var/can_spawn = TRUE @@ -85,7 +85,7 @@ open_turf.flags_1 |= NO_LAVA_GEN_1 //MOB SPAWNING HERE - if(mob_spawn_list && !spawned_flora && !spawned_feature && prob(mob_spawn_chance) && (a_flags & MOB_SPAWN_ALLOWED)) + if(length(mob_spawn_list) && !spawned_flora && !spawned_feature && prob(mob_spawn_chance) && (a_flags & MOB_SPAWN_ALLOWED)) var/atom/picked_mob = pickweight(mob_spawn_list) var/can_spawn = TRUE diff --git a/code/datums/mapgen/planetary/LavaGenerator.dm b/code/datums/mapgen/planetary/LavaGenerator.dm index d154063bdc17..6e6d4d898ac1 100644 --- a/code/datums/mapgen/planetary/LavaGenerator.dm +++ b/code/datums/mapgen/planetary/LavaGenerator.dm @@ -96,10 +96,10 @@ ) feature_spawn_chance = 0.3 feature_spawn_list = list( - /obj/structure/flora/rock/hell = 5, - /obj/structure/elite_tumor = 1, - /obj/structure/geyser/random = 1, - /obj/effect/spawner/lootdrop/anomaly/lava = 0.5 + /obj/structure/flora/rock/hell = 10, + /obj/structure/elite_tumor = 2, + /obj/structure/geyser/random = 2, + /obj/effect/spawner/lootdrop/anomaly/lava = 1, ) mob_spawn_chance = 4 diff --git a/code/datums/mapgen/planetary/RockGenerator.dm b/code/datums/mapgen/planetary/RockGenerator.dm index 5496984db43a..c82841b42482 100644 --- a/code/datums/mapgen/planetary/RockGenerator.dm +++ b/code/datums/mapgen/planetary/RockGenerator.dm @@ -85,10 +85,10 @@ feature_spawn_chance = 0.25 feature_spawn_list = list( - /obj/structure/geyser/random = 8, - /obj/structure/elite_tumor = 4, - /obj/effect/spawner/lootdrop/anomaly/rock = 1, - /obj/effect/spawner/lootdrop/anomaly/big = 0.1 //get out of here stalker + /obj/structure/geyser/random = 80, + /obj/structure/elite_tumor = 40, + /obj/effect/spawner/lootdrop/anomaly/rock = 10, + /obj/effect/spawner/lootdrop/anomaly/big = 1 //get out of here stalker ) flora_spawn_chance = 5 diff --git a/code/datums/mapgen/planetary/SnowGenerator.dm b/code/datums/mapgen/planetary/SnowGenerator.dm index c021ecfce9bf..05661009b52d 100644 --- a/code/datums/mapgen/planetary/SnowGenerator.dm +++ b/code/datums/mapgen/planetary/SnowGenerator.dm @@ -207,12 +207,12 @@ ) feature_spawn_chance = 0.3 feature_spawn_list = list( - /obj/effect/spawner/lootdrop/anomaly/ice = 1, - /obj/effect/spawner/lootdrop/anomaly/big = 0.01, - /obj/structure/spawner/ice_moon/demonic_portal/low_threat = 3, - /obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 5, - /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 0.5, - /obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 0.01 + /obj/effect/spawner/lootdrop/anomaly/ice = 100, + /obj/effect/spawner/lootdrop/anomaly/big = 1, + /obj/structure/spawner/ice_moon/demonic_portal/low_threat = 300, + /obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 500, + /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 50, + /obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 1 ) @@ -260,13 +260,13 @@ ) feature_spawn_chance = 0.2 feature_spawn_list = list( - /obj/structure/spawner/ice_moon/demonic_portal/low_threat = 3, - /obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 5, - /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 0.6, - /obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 0.2, - /obj/structure/spawner/ice_moon = 3, - /obj/structure/spawner/ice_moon/polarbear = 3, - /obj/effect/spawner/lootdrop/anomaly/ice/cave = 1 + /obj/structure/spawner/ice_moon/demonic_portal/low_threat = 30, + /obj/structure/spawner/ice_moon/demonic_portal/medium_threat = 50, + /obj/structure/spawner/ice_moon/demonic_portal/high_threat = 6, + /obj/structure/spawner/ice_moon/demonic_portal/extreme_threat = 2, + /obj/structure/spawner/ice_moon = 30, + /obj/structure/spawner/ice_moon/polarbear = 30, + /obj/effect/spawner/lootdrop/anomaly/ice/cave = 10 ) /datum/biome/cave/snow/thawed diff --git a/code/datums/mapgen/planetary/WasteGenerator.dm b/code/datums/mapgen/planetary/WasteGenerator.dm index a660e3d35321..fecafcf8dc00 100644 --- a/code/datums/mapgen/planetary/WasteGenerator.dm +++ b/code/datums/mapgen/planetary/WasteGenerator.dm @@ -158,12 +158,12 @@ ) flora_spawn_list = list( - /obj/effect/spawner/lootdrop/waste/trash = 90, - /obj/effect/spawner/lootdrop/waste/radiation = 8, - /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 1, - /obj/effect/spawner/lootdrop/waste/atmos_can = 18, - /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 0.5, - /obj/effect/spawner/lootdrop/waste/salvageable = 30, + /obj/effect/spawner/lootdrop/waste/trash = 180, + /obj/effect/spawner/lootdrop/waste/radiation = 16, + /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 2, + /obj/effect/spawner/lootdrop/waste/atmos_can = 36, + /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 1, + /obj/effect/spawner/lootdrop/waste/salvageable = 60, ) mob_spawn_chance = 1 @@ -183,26 +183,26 @@ /datum/biome/waste/clearing/mushroom flora_spawn_list = list( - /obj/effect/spawner/lootdrop/waste/mechwreck = 10, - /obj/effect/spawner/lootdrop/waste/trash = 90, - /obj/effect/spawner/lootdrop/waste/radiation = 30, - /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 12, - /obj/effect/spawner/lootdrop/waste/girder = 60, - /obj/structure/reagent_dispensers/fueltank = 10, - /obj/structure/reagent_dispensers/watertank = 20, - /obj/item/stack/cable_coil/cut = 50, - /obj/structure/closet/crate/secure/loot = 3, - /obj/effect/spawner/lootdrop/waste/atmos_can = 5, - /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 0.1, - /obj/effect/spawner/lootdrop/waste/salvageable = 30, - /obj/effect/spawner/lootdrop/waste/grille_or_trash = 20, - /obj/effect/spawner/lootdrop/maintenance = 20, - /obj/effect/spawner/lootdrop/maintenance/two = 10, - /obj/effect/spawner/lootdrop/maintenance/three = 5, - /obj/effect/spawner/lootdrop/maintenance/four = 2, - /obj/structure/flora/ash/garden/waste = 30, - /obj/structure/flora/ash/glowshroom = 180, - /obj/effect/mine/shrapnel/human_only = 1 + /obj/effect/spawner/lootdrop/waste/mechwreck = 100, + /obj/effect/spawner/lootdrop/waste/trash = 900, + /obj/effect/spawner/lootdrop/waste/radiation = 300, + /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 120, + /obj/effect/spawner/lootdrop/waste/girder = 600, + /obj/structure/reagent_dispensers/fueltank = 100, + /obj/structure/reagent_dispensers/watertank = 200, + /obj/item/stack/cable_coil/cut = 500, + /obj/structure/closet/crate/secure/loot = 30, + /obj/effect/spawner/lootdrop/waste/atmos_can = 50, + /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 1, + /obj/effect/spawner/lootdrop/waste/salvageable = 300, + /obj/effect/spawner/lootdrop/waste/grille_or_trash = 200, + /obj/effect/spawner/lootdrop/maintenance = 200, + /obj/effect/spawner/lootdrop/maintenance/two = 100, + /obj/effect/spawner/lootdrop/maintenance/three = 50, + /obj/effect/spawner/lootdrop/maintenance/four = 20, + /obj/structure/flora/ash/garden/waste = 300, + /obj/structure/flora/ash/glowshroom = 1800, + /obj/effect/mine/shrapnel/human_only = 10 ) /datum/biome/waste/tar_bed //tar colorings @@ -225,28 +225,28 @@ ) flora_spawn_list = list( //there are no plants here - /obj/effect/spawner/lootdrop/waste/mechwreck = 20, - /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 5, - /obj/effect/spawner/lootdrop/waste/trash = 90, - /obj/effect/spawner/lootdrop/waste/radiation = 8, - /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 2, - /obj/effect/spawner/lootdrop/waste/girder = 60, - /obj/structure/reagent_dispensers/fueltank = 10, - /obj/structure/reagent_dispensers/watertank = 20, - /obj/item/stack/cable_coil/cut = 50, - /obj/structure/closet/crate/secure/loot = 3, - /obj/effect/spawner/lootdrop/waste/atmos_can = 5, - /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 0.1, - /obj/effect/spawner/lootdrop/waste/salvageable = 30, - /obj/effect/spawner/lootdrop/waste/grille_or_trash = 20, - /obj/effect/spawner/lootdrop/maintenance = 20, - /obj/effect/spawner/lootdrop/maintenance/two = 10, - /obj/effect/spawner/lootdrop/maintenance/three = 5, - /obj/effect/spawner/lootdrop/maintenance/four = 2, - /obj/structure/closet/crate/secure/loot = 3, - /obj/effect/spawner/lootdrop/waste/atmos_can = 18, - /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 0.1, - /obj/effect/spawner/lootdrop/waste/salvageable = 30 + /obj/effect/spawner/lootdrop/waste/mechwreck = 200, + /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 50, + /obj/effect/spawner/lootdrop/waste/trash = 900, + /obj/effect/spawner/lootdrop/waste/radiation = 80, + /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 20, + /obj/effect/spawner/lootdrop/waste/girder = 600, + /obj/structure/reagent_dispensers/fueltank = 100, + /obj/structure/reagent_dispensers/watertank = 200, + /obj/item/stack/cable_coil/cut = 500, + /obj/structure/closet/crate/secure/loot = 30, + /obj/effect/spawner/lootdrop/waste/atmos_can = 50, + /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 1, + /obj/effect/spawner/lootdrop/waste/salvageable = 300, + /obj/effect/spawner/lootdrop/waste/grille_or_trash = 200, + /obj/effect/spawner/lootdrop/maintenance = 200, + /obj/effect/spawner/lootdrop/maintenance/two = 100, + /obj/effect/spawner/lootdrop/maintenance/three = 50, + /obj/effect/spawner/lootdrop/maintenance/four = 20, + /obj/structure/closet/crate/secure/loot = 30, + /obj/effect/spawner/lootdrop/waste/atmos_can = 180, + /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 1, + /obj/effect/spawner/lootdrop/waste/salvageable = 300 ) mob_spawn_list = list( //nor organics, more biased towards hivebots though /mob/living/simple_animal/hostile/hivebot/wasteplanet/strong = 80, @@ -287,28 +287,28 @@ ) flora_spawn_list = list( - /obj/effect/spawner/lootdrop/waste/mechwreck = 10, - /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 2, - /obj/effect/spawner/lootdrop/waste/trash = 180, - /obj/effect/spawner/lootdrop/waste/radiation = 8, - /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 1, - /obj/effect/spawner/lootdrop/waste/girder = 60, - /obj/structure/reagent_dispensers/fueltank = 10, - /obj/structure/reagent_dispensers/watertank = 20, - /obj/item/stack/cable_coil/cut = 50, - /obj/structure/closet/crate/secure/loot = 3, - /obj/effect/spawner/lootdrop/waste/atmos_can = 5, - /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 0.5, - /obj/effect/spawner/lootdrop/waste/salvageable = 30, - /obj/effect/spawner/lootdrop/waste/grille_or_trash = 20, - /obj/effect/spawner/lootdrop/maintenance = 2, - /obj/effect/spawner/lootdrop/maintenance/two = 5, - /obj/effect/spawner/lootdrop/maintenance/three = 10, - /obj/effect/spawner/lootdrop/maintenance/four = 20, - /obj/effect/spawner/lootdrop/waste/salvageable = 40, - /obj/structure/flora/ash/garden/waste = 7, - /obj/structure/flora/ash/glowshroom = 40, //more common in caves - /obj/effect/mine/shrapnel/human_only = 1 + /obj/effect/spawner/lootdrop/waste/mechwreck = 100, + /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 20, + /obj/effect/spawner/lootdrop/waste/trash = 1800, + /obj/effect/spawner/lootdrop/waste/radiation = 80, + /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 10, + /obj/effect/spawner/lootdrop/waste/girder = 600, + /obj/structure/reagent_dispensers/fueltank = 100, + /obj/structure/reagent_dispensers/watertank = 200, + /obj/item/stack/cable_coil/cut = 500, + /obj/structure/closet/crate/secure/loot = 30, + /obj/effect/spawner/lootdrop/waste/atmos_can = 50, + /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 5, + /obj/effect/spawner/lootdrop/waste/salvageable = 300, + /obj/effect/spawner/lootdrop/waste/grille_or_trash = 200, + /obj/effect/spawner/lootdrop/maintenance = 20, + /obj/effect/spawner/lootdrop/maintenance/two = 50, + /obj/effect/spawner/lootdrop/maintenance/three = 100, + /obj/effect/spawner/lootdrop/maintenance/four = 200, + /obj/effect/spawner/lootdrop/waste/salvageable = 400, + /obj/structure/flora/ash/garden/waste = 70, + /obj/structure/flora/ash/glowshroom = 400, //more common in caves + /obj/effect/mine/shrapnel/human_only = 10 ) feature_spawn_list = list( @@ -346,23 +346,23 @@ /datum/biome/cave/waste/rad flora_spawn_list = list( - /obj/effect/spawner/lootdrop/waste/trash = 90, - /obj/effect/spawner/lootdrop/waste/radiation = 25, - /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 7, - /obj/effect/spawner/lootdrop/waste/atmos_can = 5, - /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 0.5, - /obj/effect/spawner/lootdrop/waste/salvageable = 15, - /obj/effect/spawner/lootdrop/waste/girder = 20, - /obj/structure/reagent_dispensers/fueltank = 1, - /obj/structure/reagent_dispensers/watertank = 1, - /obj/item/stack/cable_coil/cut = 50, - /obj/structure/closet/crate/secure/loot = 3, - /obj/effect/spawner/lootdrop/waste/grille_or_trash = 20, - /obj/effect/spawner/lootdrop/maintenance = 2, - /obj/effect/spawner/lootdrop/maintenance/two = 5, - /obj/effect/spawner/lootdrop/maintenance/three = 10, - /obj/effect/spawner/lootdrop/maintenance/four = 20, - /obj/structure/flora/ash/glowshroom = 180 + /obj/effect/spawner/lootdrop/waste/trash = 900, + /obj/effect/spawner/lootdrop/waste/radiation = 250, + /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 70, + /obj/effect/spawner/lootdrop/waste/atmos_can = 50, + /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 5, + /obj/effect/spawner/lootdrop/waste/salvageable = 150, + /obj/effect/spawner/lootdrop/waste/girder = 200, + /obj/structure/reagent_dispensers/fueltank = 10, + /obj/structure/reagent_dispensers/watertank = 10, + /obj/item/stack/cable_coil/cut = 500, + /obj/structure/closet/crate/secure/loot = 30, + /obj/effect/spawner/lootdrop/waste/grille_or_trash = 200, + /obj/effect/spawner/lootdrop/maintenance = 20, + /obj/effect/spawner/lootdrop/maintenance/two = 50, + /obj/effect/spawner/lootdrop/maintenance/three = 100, + /obj/effect/spawner/lootdrop/maintenance/four = 200, + /obj/structure/flora/ash/glowshroom = 1800 ) feature_spawn_chance = 12 @@ -378,25 +378,25 @@ /turf/closed/wall/rust = 10 ) flora_spawn_list = list( - /obj/effect/spawner/lootdrop/waste/mechwreck = 20, - /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 5, - /obj/effect/spawner/lootdrop/waste/trash = 90, - /obj/effect/spawner/lootdrop/waste/radiation = 16, - /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 2, - /obj/effect/spawner/lootdrop/waste/girder = 60, - /obj/structure/reagent_dispensers/fueltank = 10, - /obj/structure/reagent_dispensers/watertank = 20, - /obj/item/stack/cable_coil/cut = 50, - /obj/structure/closet/crate/secure/loot = 3, - /obj/effect/spawner/lootdrop/waste/atmos_can = 5, - /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 0.5, - /obj/effect/spawner/lootdrop/waste/salvageable = 30, - /obj/effect/spawner/lootdrop/waste/grille_or_trash = 20, - /obj/effect/spawner/lootdrop/maintenance = 2, - /obj/effect/spawner/lootdrop/maintenance/two = 5, - /obj/effect/spawner/lootdrop/maintenance/three = 10, - /obj/effect/spawner/lootdrop/maintenance/four = 20, - /obj/effect/spawner/lootdrop/waste/salvageable = 40, + /obj/effect/spawner/lootdrop/waste/mechwreck = 40, + /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 10, + /obj/effect/spawner/lootdrop/waste/trash = 180, + /obj/effect/spawner/lootdrop/waste/radiation = 32, + /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 4, + /obj/effect/spawner/lootdrop/waste/girder = 120, + /obj/structure/reagent_dispensers/fueltank = 20, + /obj/structure/reagent_dispensers/watertank = 40, + /obj/item/stack/cable_coil/cut = 100, + /obj/structure/closet/crate/secure/loot = 6, + /obj/effect/spawner/lootdrop/waste/atmos_can = 10, + /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 1, + /obj/effect/spawner/lootdrop/waste/salvageable = 60, + /obj/effect/spawner/lootdrop/waste/grille_or_trash = 40, + /obj/effect/spawner/lootdrop/maintenance = 4, + /obj/effect/spawner/lootdrop/maintenance/two = 10, + /obj/effect/spawner/lootdrop/maintenance/three = 20, + /obj/effect/spawner/lootdrop/maintenance/four = 40, + /obj/effect/spawner/lootdrop/waste/salvageable = 80, ) mob_spawn_list = list( //nor organics, more biased towards hivebots though /mob/living/simple_animal/hostile/hivebot/wasteplanet/strong = 80, diff --git a/code/datums/mapgen/single_biome/Gas_Giant.dm b/code/datums/mapgen/single_biome/Gas_Giant.dm index ff904db06853..7a99a1d8ca76 100644 --- a/code/datums/mapgen/single_biome/Gas_Giant.dm +++ b/code/datums/mapgen/single_biome/Gas_Giant.dm @@ -5,13 +5,12 @@ area_type = /area/overmap_encounter/planetoid/gas_giant /datum/biome/gas_giant - open_turf_types = list(/turf/open/chasm/gas_giant) + open_turf_types = list(/turf/open/chasm/gas_giant = 1) - flora_spawn_list = list( - ) + flora_spawn_list = null feature_spawn_list = null mob_spawn_list = list( - /mob/living/simple_animal/hostile/asteroid/basilisk/watcher + /mob/living/simple_animal/hostile/asteroid/basilisk/watcher = 1 //in the future, I'd like to add something like. //The slylandro, or really any floating gas bag species, it'd be cool ) @@ -25,12 +24,10 @@ /datum/biome/plasma_giant - open_turf_types = list(/turf/open/chasm/gas_giant/plasma) + open_turf_types = list(/turf/open/chasm/gas_giant/plasma = 1) - flora_spawn_list = list( - ) + flora_spawn_list = null feature_spawn_list = null mob_spawn_list = list( - /mob/living/simple_animal/hostile/asteroid/basilisk/watcher - + /mob/living/simple_animal/hostile/asteroid/basilisk/watcher = 1 ) diff --git a/code/datums/shuttles.dm b/code/datums/shuttles.dm index b4621559fba1..c1b065d3b73e 100644 --- a/code/datums/shuttles.dm +++ b/code/datums/shuttles.dm @@ -108,6 +108,8 @@ continue for(var/obj/docking_port/mobile/port in place) + if(my_port) + CRASH("[src] loaded with multiple docking ports!") my_port = port if(register) port.register() @@ -135,6 +137,9 @@ port.dwidth = port_y_offset - 1 port.dheight = width - port_x_offset + if(!my_port) + CRASH("Shuttle template loaded without a mobile port!") + for(var/turf/shuttle_turf in turfs) //Set up underlying_turf_area and update relevent towed_shuttles var/area/ship/turf_loc = turfs[shuttle_turf] @@ -310,17 +315,6 @@ /datum/map_template/shuttle/shiptest category = "shiptest" -/datum/map_template/shuttle/custom - file_name = "custom_shuttle" // Dummy - -/// Syndicate Infiltrator variants -/datum/map_template/shuttle/infiltrator - category = "misc" - -/datum/map_template/shuttle/infiltrator/advanced - file_name = "infiltrator_advanced" - name = "advanced syndicate infiltrator" - /// Pirate ship templates /datum/map_template/shuttle/pirate category = "misc" diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm index 8459d7fc5799..6fc5f8a4c709 100644 --- a/code/modules/admin/verbs/atmosdebug.dm +++ b/code/modules/admin/verbs/atmosdebug.dm @@ -1,4 +1,4 @@ -#define ANNOTATE_OBJECT(object) testing ? "[object.loc.loc.name] (estimated location: [json_encode(object.check_shuttle_offset() || object.get_relative_location())])" : ADMIN_VERBOSEJMP(object) +#define ANNOTATE_OBJECT(object) testing ? "[object.loc.loc.name] (estimated location: [json_encode(object.get_relative_location())])" : ADMIN_VERBOSEJMP(object) /atom/proc/check_shuttle_offset() if(!SSshuttle.initialized) @@ -28,13 +28,26 @@ var/list/results = atmosscan() to_chat(src, "[results.Join("\n")]", confidential = TRUE) -/proc/atmosscan(testing = FALSE) +/proc/atmosscan(testing = FALSE, critical_only = FALSE) var/list/results = list() + var/static/list/blacklist = typecacheof(list(/obj/machinery/atmospherics/pipe/layer_manifold, /obj/machinery/atmospherics/pipe/heat_exchanging)) for(var/obj/machinery/atmospherics/pipe in SSair.atmos_machinery + SSair.atmos_air_machinery) - if(pipe.z && (!length(pipe.nodes) || (null in pipe.nodes))) + if(blacklist[pipe.type]) + continue + if(pipe.z && (!length(pipe.nodes) || (null in pipe.nodes)) && !critical_only) results += "Unconnected [pipe.name] located at [ANNOTATE_OBJECT(pipe)]" for(var/obj/machinery/atmospherics/other_pipe in get_turf(pipe)) + if(blacklist[other_pipe.type]) + continue + if(other_pipe != pipe && other_pipe.piping_layer == pipe.piping_layer && (other_pipe.initialize_directions & pipe.initialize_directions)) + results += "Doubled [pipe.name] located at [ANNOTATE_OBJECT(pipe)]" + + //HE pipes are tested separately + for(var/obj/machinery/atmospherics/pipe/heat_exchanging/pipe in SSair.atmos_air_machinery) + if(pipe.z && (!length(pipe.nodes) || (null in pipe.nodes)) && !critical_only) + results += "Unconnected [pipe.name] located at [ANNOTATE_OBJECT(pipe)]" + for(var/obj/machinery/atmospherics/pipe/heat_exchanging/other_pipe in get_turf(pipe)) if(other_pipe != pipe && other_pipe.piping_layer == pipe.piping_layer && (other_pipe.initialize_directions & pipe.initialize_directions)) results += "Doubled [pipe.name] located at [ANNOTATE_OBJECT(pipe)]" diff --git a/code/modules/admin/verbs/shuttlepanel.dm b/code/modules/admin/verbs/shuttlepanel.dm index 80502185d7f9..b4e374f41cb8 100644 --- a/code/modules/admin/verbs/shuttlepanel.dm +++ b/code/modules/admin/verbs/shuttlepanel.dm @@ -37,7 +37,10 @@ if("Delete Shuttle") if(alert(user, "Really delete [name]?", "Delete Shuttle", "Cancel", "Really!") != "Really!") return - qdel(src, TRUE) + if(QDELETED(current_ship)) + qdel(src) + else + qdel(current_ship) message_admins("\[SHUTTLE]: [key_name_admin(user)] has deleted [name].") else diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index e978ee2f56e7..c1b94eaf8d77 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -76,6 +76,8 @@ if(parents[i]) nullifyPipenet(parents[i]) airs[i] = null + if(!QDELETED(src)) + airs[i] = new /datum/gas_mixture(200) return ..() /obj/machinery/atmospherics/components/on_construction() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/relief_valve.dm b/code/modules/atmospherics/machinery/components/unary_devices/relief_valve.dm index 1bc4bf810d48..2c6bbe4ce939 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/relief_valve.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/relief_valve.dm @@ -48,9 +48,7 @@ var/pressure_delta = our_pressure - environment.return_pressure() var/transfer_moles = pressure_delta*200/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION) if(transfer_moles > 0) - var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - - loc.assume_air(removed) + loc.transfer_air(air_contents, transfer_moles) air_update_turf() update_parents() diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index adb6879ded8c..c825d3ac4c6f 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -82,6 +82,8 @@ if(!members.Find(item)) if(item.parent) + message_admins("Doubled atmosmachine found at [ADMIN_VERBOSEJMP(item)]! Report this to mappers if it's been loaded from a map file!") + log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") CRASH("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") members += item possible_expansions += item diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index bf6f9b6d3a45..696ba89ad854 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -352,14 +352,15 @@ SSshuttle.mobile += src /obj/docking_port/mobile/Destroy(force) - if(SSticker.IsRoundInProgress()) - message_admins("Shuttle [src] deleted at [ADMIN_VERBOSEJMP(src)]") - log_game("Shuttle [src] deleted at [AREACOORD(src)]") - if(!QDELETED(current_ship)) + message_admins("Shuttle [src] tried to delete at [ADMIN_VERBOSEJMP(src)], but failed!") stack_trace("Ship attempted deletion while current ship still exists! Aborting!") return QDEL_HINT_LETMELIVE + if(SSticker.IsRoundInProgress()) + message_admins("Shuttle [src] deleted at [ADMIN_VERBOSEJMP(src)]") + log_game("Shuttle [src] deleted at [AREACOORD(src)]") + spawn_points.Cut() SSshuttle.mobile -= src diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index c45ee50378e4..c901e486a1f6 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -73,14 +73,15 @@ #include "emoting.dm" #include "keybinding_init.dm" #include "machine_disassembly.dm" -#include "outfit_sanity.dm" #include "open_air.dm" +#include "outfit_sanity.dm" #include "overmap.dm" #include "pills.dm" +#include "planet_gen.dm" #include "plantgrowth_tests.dm" +#include "projectiles.dm" #include "quick_swap_sanity.dm" #include "rcd.dm" -#include "projectiles.dm" #include "reactions.dm" #include "reagent_id_typos.dm" #include "reagent_mod_expose.dm" diff --git a/code/modules/unit_tests/planet_gen.dm b/code/modules/unit_tests/planet_gen.dm new file mode 100644 index 000000000000..fdcfda1faeaa --- /dev/null +++ b/code/modules/unit_tests/planet_gen.dm @@ -0,0 +1,19 @@ +/datum/unit_test/planet_gen/Run() + var/datum/map_zone/mapzone = SSmapping.create_map_zone("Planet Generation Testing Zone") + for(var/planet_name as anything in SSmapping.planet_types) + var/datum/planet_type/planet_type = SSmapping.planet_types[planet_name] + var/datum/map_generator/mapgen = new planet_type.mapgen + var/datum/virtual_level/vlevel = SSmapping.create_virtual_level( + planet_name, + list(ZTRAIT_MINING = TRUE, ZTRAIT_BASETURF = planet_type.default_baseturf), + mapzone, + QUADRANT_MAP_SIZE, + QUADRANT_MAP_SIZE, + ALLOCATION_QUADRANT, + QUADRANT_MAP_SIZE + ) + mapgen.generate_turfs(vlevel.get_unreserved_block()) + mapgen.populate_turfs(vlevel.get_unreserved_block()) + vlevel.clear_reservation() + qdel(vlevel) + qdel(mapzone) diff --git a/code/modules/unit_tests/ruin_placement.dm b/code/modules/unit_tests/ruin_placement.dm index 10703a29a327..8688e8686245 100644 --- a/code/modules/unit_tests/ruin_placement.dm +++ b/code/modules/unit_tests/ruin_placement.dm @@ -15,13 +15,11 @@ ruin.load(vlevel.get_unreserved_bottom_left_turf()) - /* Temporarily Disabled - var/list/errors = atmosscan(TRUE) - errors += powerdebug(TRUE) + var/list/errors = atmosscan(TRUE, TRUE) + //errors += powerdebug(TRUE) for(var/error in errors) Fail("Mapping error in [ruin_name]: [error]", ruin.mappath, 1) - */ vlevel.clear_reservation() qdel(vlevel) @@ -29,3 +27,30 @@ SSair.is_test_loading = FALSE qdel(mapzone) + +/* Slow, and usually unecessary +/datum/unit_test/direct_tmpl_placement/Run() + SSair.is_test_loading = TRUE + var/datum/map_zone/mapzone = SSmapping.create_map_zone("Template Testing Zone") + for(var/ship_name as anything in SSmapping.map_templates) + var/datum/map_template/template = SSmapping.map_templates[ship_name] + var/datum/virtual_level/vlevel = SSmapping.create_virtual_level( + template.name, + list(), + mapzone, + template.width, + template.height + ) + + template.load(vlevel.get_unreserved_bottom_left_turf()) + + var/list/errors = atmosscan(TRUE) + //errors += powerdebug(TRUE) + + for(var/error in errors) + Fail("Mapping error in [ship_name]: [error]", template.mappath, 1) + + vlevel.clear_reservation() + qdel(vlevel) + SSair.is_test_loading = FALSE +*/ diff --git a/code/modules/unit_tests/ship_outpost_placement.dm b/code/modules/unit_tests/ship_outpost_placement.dm index f06221d66b37..9fb36d0fdc6d 100644 --- a/code/modules/unit_tests/ship_outpost_placement.dm +++ b/code/modules/unit_tests/ship_outpost_placement.dm @@ -9,11 +9,6 @@ TEST_FAIL("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") SSair.is_test_loading = FALSE - var/list/errors = atmosscan(TRUE) - errors += powerdebug(TRUE) - - for(var/error in errors) - TEST_FAIL("Mapping error: [error]") for(var/outpost_type in subtypesof(/datum/overmap/outpost)) var/datum/overmap/outpost/test_outpost = new outpost_type() @@ -34,5 +29,11 @@ if(cur_ship.docked_to) cur_ship.Undock(TRUE) + var/list/errors = atmosscan(TRUE) + errors += powerdebug(TRUE) + + for(var/error in errors) + TEST_FAIL("Mapping error: [error]") + for(var/datum/overmap/ship/controlled/deleting_ship as anything in SSovermap.controlled_ships) qdel(deleting_ship) From 9868a22114e62fd1c91f18f65beee597468e3fdc Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Wed, 1 Feb 2023 01:46:16 -0800 Subject: [PATCH 112/147] Fixes some runtime spam from lazyloading/map templates (#73037) Ensures we don't try and rebuild loading turfs midload Turf refs persist through destroy, so when we changeturf earlier to get our turf reservation, we insert our space turfs into the rebuild queue, and then end up here where we can be rebuilt randomly, midload, with uninit'd turfs Avoids starting atmos machine processing until init This avoids some runtimes with null gasmixtures There's still trouble with atmos and template loading, pipes start processing before their pipelines exist, so we just kinda get fucked. Need to look into this more deeply, it involves pulling this stuff off `on_construct` and `setup_template_machinery` and throwing it in maybe late init, which I don't really relish but will just have to do eventually. Reduces runtime spam --- code/modules/atmospherics/machinery/atmosmachinery.dm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index ea68ab89bd8e..5fd89405a6ca 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -44,6 +44,9 @@ ///Is the thing being rebuilt by SSair or not. Prevents list blaot var/rebuilding = FALSE + ///If we should init and immediately start processing + var/init_processing = FALSE + /obj/machinery/atmospherics/examine(mob/user) . = ..() if(is_type_in_list(src, GLOB.ventcrawl_machinery) && isliving(user)) @@ -59,11 +62,15 @@ nodes = new(device_type) if (!armor) armor = list("melee" = 25, "bullet" = 10, "laser" = 10, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 70) + init_processing = process ..() - if(process) - SSair.start_processing_machine(src) SetInitDirections() +/obj/machinery/atmospherics/Initialize(mapload) + if(init_processing) + SSair.start_processing_machine(src) + return ..() + /obj/machinery/atmospherics/Destroy() for(var/i in 1 to device_type) nullifyNode(i) From 1006fe94eedf0071f50916712c8500469fef3be4 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Mon, 31 Jul 2023 22:17:49 -0500 Subject: [PATCH 113/147] tweaks --- code/datums/components/chasm.dm | 49 +++++++++++-------- .../atmospherics/machinery/datum_pipeline.dm | 48 +++++++++--------- 2 files changed, 53 insertions(+), 44 deletions(-) diff --git a/code/datums/components/chasm.dm b/code/datums/components/chasm.dm index 9188e89ae734..dfb3bafbfb0e 100644 --- a/code/datums/components/chasm.dm +++ b/code/datums/components/chasm.dm @@ -4,7 +4,8 @@ var/fall_message = "GAH! Ah... where are you?" var/oblivion_message = "You stumble and stare into the abyss before you. It stares back, and you fall into the enveloping dark." - var/static/list/falling_atoms = list() // Atoms currently falling into chasms + /// List of refs to falling objects -> how many levels deep we've fallen + var/static/list/falling_atoms = list() var/static/list/forbidden_types = typecacheof(list( /obj/singularity, /obj/docking_port, @@ -20,7 +21,9 @@ /obj/effect/light_emitter/tendril, /obj/effect/collapse, /obj/effect/particle_effect/ion_trails, - /obj/effect/dummy/phased_mob + /obj/effect/dummy/phased_mob, + /obj/effect/mapping_helpers, + /obj/effect/wisp, )) /datum/component/chasm/Initialize(turf/target) @@ -28,11 +31,11 @@ target_turf = target START_PROCESSING(SSobj, src) // process on create, in case stuff is still there -/datum/component/chasm/proc/Entered(datum/source, atom/movable/AM, atom/old_loc, list/atom/old_locs) +/datum/component/chasm/proc/Entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs) SIGNAL_HANDLER START_PROCESSING(SSobj, src) - drop_stuff(AM) + drop_stuff(arrived) /datum/component/chasm/process() if (!drop_stuff()) @@ -50,7 +53,6 @@ return LAZYLEN(found_safeties) /datum/component/chasm/proc/drop_stuff(AM) - . = 0 if (is_safe()) return FALSE @@ -58,57 +60,58 @@ var/to_check = AM ? list(AM) : parent.contents for (var/thing in to_check) if (droppable(thing)) - . = 1 + . = TRUE INVOKE_ASYNC(src, .proc/drop, thing) /datum/component/chasm/proc/droppable(atom/movable/AM) + var/datum/weakref/falling_ref = WEAKREF(AM) // avoid an infinite loop, but allow falling a large distance - if(falling_atoms[AM] && falling_atoms[AM] > 30) + if(falling_atoms[falling_ref] && falling_atoms[falling_ref] > 30) return FALSE if(!isliving(AM) && !isobj(AM)) return FALSE - if(is_type_in_typecache(AM, forbidden_types) || AM.throwing || (AM.movement_type & FLOATING)) + if(is_type_in_typecache(AM, forbidden_types) || AM.throwing || (AM.movement_type & (FLOATING|FLYING))) return FALSE //Flies right over the chasm if(ismob(AM)) var/mob/M = AM - if(M.buckled) //middle statement to prevent infinite loops just in case! + if(M.buckled) //middle statement to prevent infinite loops just in case! var/mob/buckled_to = M.buckled if((!ismob(M.buckled) || (buckled_to.buckled != M)) && !droppable(M.buckled)) return FALSE - if(M.is_flying()) - return FALSE if(ishuman(AM)) var/mob/living/carbon/human/H = AM if(istype(H.belt, /obj/item/wormhole_jaunter)) var/obj/item/wormhole_jaunter/J = H.belt //To freak out any bystanders - H.visible_message("[H] falls into [parent]!") + H.visible_message(span_boldwarning("[H] falls into [parent]!")) J.chasm_react(H) return FALSE return TRUE /datum/component/chasm/proc/drop(atom/movable/AM) + var/datum/weakref/falling_ref = WEAKREF(AM) //Make sure the item is still there after our sleep - if(!AM || QDELETED(AM)) + if(!AM || !falling_ref?.resolve()) + falling_atoms -= falling_ref return - falling_atoms[AM] = (falling_atoms[AM] || 0) + 1 + falling_atoms[falling_ref] = (falling_atoms[falling_ref] || 0) + 1 var/turf/T = target_turf if(T) // send to the turf below - AM.visible_message("[AM] falls into [parent]!", "[fall_message]") - T.visible_message("[AM] falls from above!") + AM.visible_message(span_boldwarning("[AM] falls into [parent]!"), span_userdanger("[fall_message]")) + T.visible_message(span_boldwarning("[AM] falls from above!")) AM.forceMove(T) if(isliving(AM)) var/mob/living/L = AM L.Paralyze(100) L.adjustBruteLoss(30) - falling_atoms -= AM + falling_atoms -= falling_ref else // send to oblivion - AM.visible_message("[AM] falls into [parent]!", "[oblivion_message]") + AM.visible_message(span_boldwarning("[AM] falls into [parent]!"), span_userdanger("[oblivion_message]")) if (isliving(AM)) var/mob/living/L = AM L.notransform = TRUE @@ -132,12 +135,16 @@ if(iscyborg(AM)) var/mob/living/silicon/robot/S = AM qdel(S.mmi) + if(isliving(AM)) + var/mob/living/L = AM + if(L.stat != DEAD) + L.death(TRUE) - falling_atoms -= AM + falling_atoms -= falling_ref qdel(AM) - if(AM && !QDELETED(AM)) //It's indestructible + if(AM && !QDELETED(AM)) //It's indestructible var/atom/parent = src.parent - parent.visible_message("[parent] spits out [AM]!") + parent.visible_message(span_boldwarning("[parent] spits out [AM]!")) AM.alpha = oldalpha AM.color = oldcolor AM.transform = oldtransform diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index c825d3ac4c6f..2bda70631d1e 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -72,31 +72,33 @@ if(!air) air = new var/list/possible_expansions = list(base) - while(possible_expansions.len>0) + while(length(possible_expansions.len)) for(var/obj/machinery/atmospherics/borderline in possible_expansions) var/list/result = borderline.pipeline_expansion(src) - if(result?.len > 0) - for(var/obj/machinery/atmospherics/P in result) - if(istype(P, /obj/machinery/atmospherics/pipe)) - var/obj/machinery/atmospherics/pipe/item = P - if(!members.Find(item)) - - if(item.parent) - message_admins("Doubled atmosmachine found at [ADMIN_VERBOSEJMP(item)]! Report this to mappers if it's been loaded from a map file!") - log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") - CRASH("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") - members += item - possible_expansions += item - - volume += item.volume - item.parent = src - - if(item.air_temporary) - air.merge(item.air_temporary) - item.air_temporary = null - else - P.setPipenet(src, borderline) - addMachineryMember(P) + if(!result?.len) + continue + for(var/obj/machinery/atmospherics/P in result) + if(istype(P, /obj/machinery/atmospherics/pipe)) + var/obj/machinery/atmospherics/pipe/item = P + if(item in members) + continue + + if(item.parent) + message_admins("Doubled atmosmachine found at [ADMIN_VERBOSEJMP(item)]! Report this to mappers if it's been loaded from a map file!") + log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") + CRASH("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") + members += item + possible_expansions += item + + volume += item.volume + item.parent = src + + if(item.air_temporary) + air.merge(item.air_temporary) + item.air_temporary = null + else + P.setPipenet(src, borderline) + addMachineryMember(P) possible_expansions -= borderline From 8eea9134cd8c3c7f0b5847b6c7cf3c736c18de4c Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 1 Aug 2023 00:24:38 -0500 Subject: [PATCH 114/147] I will lose my mind if this doesn't fix it --- _maps/outpost/hangar/test_20x20.dmm | 2 +- _maps/outpost/hangar/test_2_20x20.dmm | 44 ++++++---- _maps/outpost/hangar/test_2_40x20.dmm | 86 +++++++++---------- _maps/outpost/hangar/test_40x20.dmm | 2 +- _maps/outpost/hangar/test_40x40.dmm | 2 +- _maps/outpost/hangar/test_56x20.dmm | 2 +- _maps/outpost/hangar/test_56x40.dmm | 2 +- .../shiptest/independent_shepherd.dmm | 5 +- .../shiptest/syndicate_luxembourg.dmm | 3 - code/__HELPERS/virtual_z_level.dm | 2 +- code/controllers/master.dm | 3 +- code/controllers/subsystem/air.dm | 46 +++++++--- code/game/machinery/airlock_cycle_control.dm | 2 +- code/game/machinery/computer/atmos_control.dm | 4 +- .../atmospherics/machinery/atmosmachinery.dm | 2 +- .../machinery/components/components_base.dm | 4 +- .../components/unary_devices/thermomachine.dm | 3 +- .../atmospherics/machinery/datum_pipeline.dm | 81 ++++++++--------- .../atmospherics/machinery/other/meter.dm | 2 +- .../portable/portable_atmospherics.dm | 4 +- code/modules/power/generator.dm | 2 +- code/modules/power/supermatter/supermatter.dm | 4 +- 22 files changed, 169 insertions(+), 138 deletions(-) diff --git a/_maps/outpost/hangar/test_20x20.dmm b/_maps/outpost/hangar/test_20x20.dmm index c4301d8bceea..118bb8afa821 100644 --- a/_maps/outpost/hangar/test_20x20.dmm +++ b/_maps/outpost/hangar/test_20x20.dmm @@ -51,7 +51,7 @@ /turf/open/floor/plasteel, /area/hangar) "r" = ( -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/closed/indestructible/reinforced, /area/hangar) "s" = ( diff --git a/_maps/outpost/hangar/test_2_20x20.dmm b/_maps/outpost/hangar/test_2_20x20.dmm index da747c09c0c4..727cff44270b 100644 --- a/_maps/outpost/hangar/test_2_20x20.dmm +++ b/_maps/outpost/hangar/test_2_20x20.dmm @@ -10,7 +10,7 @@ /obj/effect/turf_decal/industrial/warning/corner{ dir = 8 }, -/obj/item/pipe/binary{ +/obj/machinery/atmospherics/pipe/simple/general{ dir = 10 }, /turf/open/floor/plating{ @@ -59,9 +59,6 @@ /obj/effect/turf_decal/steeldecal/steel_decals_central2{ pixel_y = 2 }, -/obj/item/pipe/binary{ - dir = 9 - }, /turf/open/floor/plasteel/dark, /area/hangar) "dU" = ( @@ -180,7 +177,7 @@ }, /obj/structure/catwalk/over/plated_catwalk, /obj/effect/decal/cleanable/dirt, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating{ icon_state = "panelscorched" }, @@ -222,7 +219,7 @@ /area/hangar) "gX" = ( /obj/structure/catwalk/over/plated_catwalk, -/obj/item/pipe/binary{ +/obj/machinery/atmospherics/pipe/simple/general{ dir = 5 }, /turf/open/floor/plating{ @@ -259,7 +256,7 @@ /obj/machinery/door/airlock/maintenance_hatch{ req_access_txt = "109" }, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating, /area/hangar) "jc" = ( @@ -324,7 +321,7 @@ }, /obj/structure/catwalk/over/plated_catwalk, /obj/effect/decal/cleanable/blood/old, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating, /area/hangar) "kA" = ( @@ -445,9 +442,6 @@ /obj/effect/turf_decal/steeldecal/steel_decals_central2{ pixel_y = 2 }, -/obj/item/pipe/binary{ - dir = 4 - }, /turf/open/floor/plasteel/dark, /area/hangar) "pX" = ( @@ -678,7 +672,7 @@ /obj/effect/turf_decal/industrial/warning{ dir = 8 }, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating{ icon_state = "panelscorched" }, @@ -833,7 +827,7 @@ /obj/effect/turf_decal/industrial/warning{ dir = 10 }, -/obj/item/pipe/binary{ +/obj/machinery/atmospherics/pipe/simple/general{ dir = 4 }, /turf/open/floor/plating{ @@ -1202,6 +1196,9 @@ "NV" = ( /obj/structure/catwalk/over/plated_catwalk, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 + }, /turf/open/floor/plating{ icon_state = "panelscorched" }, @@ -1213,6 +1210,9 @@ /area/hangar) "Os" = ( /obj/structure/catwalk/over/plated_catwalk, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 6 + }, /turf/open/floor/plating{ icon_state = "platingdmg3" }, @@ -1268,13 +1268,18 @@ /obj/structure/catwalk/over/plated_catwalk, /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/glass, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 9 + }, /turf/open/floor/plating{ icon_state = "panelscorched" }, /area/hangar) "Qk" = ( /obj/structure/catwalk/over/plated_catwalk, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 + }, /turf/open/floor/plating{ icon_state = "platingdmg2" }, @@ -1469,6 +1474,13 @@ "Xg" = ( /turf/open/floor/plasteel/tech, /area/hangar) +"Xw" = ( +/obj/structure/catwalk/over/plated_catwalk, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 + }, +/turf/open/floor/plating, +/area/hangar) "XA" = ( /obj/effect/decal/fakelattice{ color = "#808080" @@ -1527,7 +1539,7 @@ pixel_y = 2 }, /obj/machinery/atmospherics/components/unary/passive_vent{ - dir = 4 + dir = 1 }, /turf/open/floor/plasteel/dark, /area/hangar) @@ -1882,7 +1894,7 @@ iZ GX Lb Ug -dU +Xw pB cF uq diff --git a/_maps/outpost/hangar/test_2_40x20.dmm b/_maps/outpost/hangar/test_2_40x20.dmm index 13bb1e35223d..f0b68a06dee3 100644 --- a/_maps/outpost/hangar/test_2_40x20.dmm +++ b/_maps/outpost/hangar/test_2_40x20.dmm @@ -47,9 +47,6 @@ /turf/open/floor/plasteel/patterned/cargo_one, /area/hangar) "cJ" = ( -/obj/item/pipe/binary{ - dir = 9 - }, /obj/structure/catwalk/over/plated_catwalk, /obj/effect/turf_decal/industrial/warning{ dir = 4 @@ -58,6 +55,9 @@ dir = 1 }, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 9 + }, /turf/open/floor/plating, /area/hangar) "cR" = ( @@ -77,7 +77,7 @@ /area/hangar) "dg" = ( /obj/structure/catwalk/over/plated_catwalk, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating{ icon_state = "panelscorched" }, @@ -198,8 +198,8 @@ /turf/open/floor/plasteel/dark, /area/hangar) "fm" = ( -/obj/item/pipe/binary{ - dir = 8 +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 }, /turf/open/floor/plasteel/stairs{ dir = 4 @@ -278,7 +278,7 @@ /obj/effect/turf_decal/industrial/warning{ dir = 1 }, -/obj/item/pipe/binary{ +/obj/machinery/atmospherics/pipe/simple/general{ dir = 5 }, /turf/open/floor/plasteel/dark, @@ -376,13 +376,13 @@ /turf/open/floor/plasteel/dark, /area/hangar) "jx" = ( -/obj/item/pipe/binary{ - dir = 8 - }, /obj/structure/catwalk/over/plated_catwalk, /obj/machinery/light/directional/north, /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 + }, /turf/open/floor/plating, /area/hangar) "jS" = ( @@ -444,16 +444,16 @@ dir = 1 }, /obj/effect/decal/cleanable/dirt, -/obj/item/pipe/binary{ - dir = 8 +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 }, /turf/open/floor/plasteel/dark, /area/hangar) "mh" = ( -/obj/item/pipe/binary, /obj/structure/catwalk/over/plated_catwalk, /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating, /area/hangar) "mu" = ( @@ -470,9 +470,6 @@ /turf/open/floor/plasteel/tech, /area/hangar) "mZ" = ( -/obj/item/pipe/binary{ - dir = 9 - }, /obj/item/kirbyplants{ icon_state = "plant-25"; pixel_x = 5 @@ -481,6 +478,9 @@ /obj/effect/decal/cleanable/robot_debris{ pixel_x = 8 }, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 9 + }, /turf/open/floor/plasteel/tech/techmaint, /area/hangar) "nq" = ( @@ -565,7 +565,7 @@ }, /obj/structure/catwalk/over/plated_catwalk, /obj/effect/turf_decal/spline/fancy/opaque/black, -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating{ icon_state = "platingdmg3" }, @@ -616,9 +616,9 @@ /turf/open/floor/plasteel/tech, /area/hangar) "ry" = ( -/obj/item/pipe/binary, /obj/structure/catwalk/over/plated_catwalk, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating, /area/hangar) "rK" = ( @@ -790,9 +790,9 @@ /obj/machinery/door/airlock/maintenance_hatch{ req_access_txt = "109" }, -/obj/item/pipe/binary, /obj/structure/catwalk/over/plated_catwalk, /obj/structure/barricade/wooden/crude, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating, /area/hangar) "vO" = ( @@ -1165,18 +1165,18 @@ /area/hangar) "Kn" = ( /obj/structure/catwalk/over/plated_catwalk, -/obj/item/pipe/binary, /obj/machinery/light/directional/east, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plating{ icon_state = "panelscorched" }, /area/hangar) "KM" = ( -/obj/item/pipe/binary{ - dir = 6 - }, /obj/structure/catwalk/over/plated_catwalk, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 6 + }, /turf/open/floor/plating, /area/hangar) "KV" = ( @@ -1220,8 +1220,8 @@ dir = 1 }, /obj/effect/decal/cleanable/dirt, -/obj/item/pipe/binary{ - dir = 8 +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 }, /turf/open/floor/plasteel/dark, /area/hangar) @@ -1235,7 +1235,6 @@ /turf/open/floor/plasteel/patterned/cargo_one, /area/hangar) "Ni" = ( -/obj/item/pipe/binary, /obj/effect/spawner/lootdrop/maintenance, /obj/item/stack/sheet/mineral/wood{ pixel_x = -6 @@ -1245,6 +1244,7 @@ pixel_y = 7 }, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general, /turf/open/floor/plasteel/tech/techmaint, /area/hangar) "NF" = ( @@ -1387,10 +1387,10 @@ /area/hangar) "Tb" = ( /obj/structure/catwalk/over/plated_catwalk, -/obj/item/pipe/binary{ - dir = 8 - }, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 + }, /turf/open/floor/plating{ icon_state = "platingdmg3" }, @@ -1442,10 +1442,10 @@ /area/hangar) "Uz" = ( /obj/structure/catwalk/over/plated_catwalk, -/obj/item/pipe/binary{ +/obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general{ dir = 6 }, -/obj/effect/decal/cleanable/dirt, /turf/open/floor/plating{ icon_state = "platingdmg3" }, @@ -1456,10 +1456,10 @@ /turf/open/floor/plasteel, /area/hangar) "UI" = ( -/obj/item/pipe/binary{ - dir = 8 - }, /obj/structure/catwalk/over/plated_catwalk, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 + }, /turf/open/floor/plating, /area/hangar) "UJ" = ( @@ -1502,12 +1502,12 @@ /turf/open/floor/plasteel/patterned/cargo_one, /area/hangar) "Wq" = ( -/obj/item/pipe/binary{ - dir = 8 - }, /obj/structure/catwalk/over/plated_catwalk, /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 + }, /turf/open/floor/plating, /area/hangar) "WI" = ( @@ -1521,14 +1521,14 @@ /turf/open/floor/plasteel/dark, /area/hangar) "WJ" = ( -/obj/item/pipe/binary{ - dir = 8 - }, /obj/structure/catwalk/over/plated_catwalk, /obj/effect/turf_decal/industrial/warning{ dir = 1 }, /obj/effect/decal/cleanable/dirt, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 + }, /turf/open/floor/plating, /area/hangar) "WP" = ( @@ -1606,12 +1606,12 @@ /area/hangar) "YT" = ( /obj/structure/catwalk/over/plated_catwalk, -/obj/item/pipe/binary{ - dir = 8 - }, /obj/structure/sign/poster/contraband/energy_swords{ pixel_y = -32 }, +/obj/machinery/atmospherics/pipe/simple/general{ + dir = 4 + }, /turf/open/floor/plating/rust, /area/hangar) "Zc" = ( diff --git a/_maps/outpost/hangar/test_40x20.dmm b/_maps/outpost/hangar/test_40x20.dmm index c50c8573660c..66b1a7d24b6f 100644 --- a/_maps/outpost/hangar/test_40x20.dmm +++ b/_maps/outpost/hangar/test_40x20.dmm @@ -34,7 +34,7 @@ /turf/open/floor/plasteel, /area/hangar) "n" = ( -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/closed/indestructible/reinforced, /area/hangar) "o" = ( diff --git a/_maps/outpost/hangar/test_40x40.dmm b/_maps/outpost/hangar/test_40x40.dmm index 0bae3295e4e0..d38fcbb3d75d 100644 --- a/_maps/outpost/hangar/test_40x40.dmm +++ b/_maps/outpost/hangar/test_40x40.dmm @@ -46,7 +46,7 @@ /turf/closed/indestructible/reinforced, /area/hangar) "q" = ( -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/closed/indestructible/reinforced, /area/hangar) "r" = ( diff --git a/_maps/outpost/hangar/test_56x20.dmm b/_maps/outpost/hangar/test_56x20.dmm index be5afd91fa78..143bbd3ef8d1 100644 --- a/_maps/outpost/hangar/test_56x20.dmm +++ b/_maps/outpost/hangar/test_56x20.dmm @@ -22,7 +22,7 @@ /turf/closed/indestructible/reinforced, /area/hangar) "h" = ( -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/closed/indestructible/reinforced, /area/hangar) "k" = ( diff --git a/_maps/outpost/hangar/test_56x40.dmm b/_maps/outpost/hangar/test_56x40.dmm index 6ca87ef8e48a..80ba17bd26b6 100644 --- a/_maps/outpost/hangar/test_56x40.dmm +++ b/_maps/outpost/hangar/test_56x40.dmm @@ -49,7 +49,7 @@ /turf/open/floor/plasteel/tech, /area/hangar) "q" = ( -/obj/item/pipe/binary, +/obj/machinery/atmospherics/pipe/simple/general, /turf/closed/indestructible/reinforced, /area/hangar) "s" = ( diff --git a/_maps/shuttles/shiptest/independent_shepherd.dmm b/_maps/shuttles/shiptest/independent_shepherd.dmm index a028ed54fd3f..8c33014c8c76 100644 --- a/_maps/shuttles/shiptest/independent_shepherd.dmm +++ b/_maps/shuttles/shiptest/independent_shepherd.dmm @@ -4979,11 +4979,10 @@ /area/ship/crew/chapel) "Sa" = ( /obj/structure/window/reinforced/spawner/west, +/obj/effect/turf_decal/corner/opaque/lightgrey/mono, /obj/machinery/atmospherics/components/unary/vent_pump/high_volume/siphon/atmos/air_output{ - dir = 8; - piping_layer = 2 + dir = 8 }, -/obj/effect/turf_decal/corner/opaque/lightgrey/mono, /turf/open/floor/engine/air, /area/ship/engineering/atmospherics) "Sb" = ( diff --git a/_maps/shuttles/shiptest/syndicate_luxembourg.dmm b/_maps/shuttles/shiptest/syndicate_luxembourg.dmm index 214eea2fc157..9e30c9c29ab3 100644 --- a/_maps/shuttles/shiptest/syndicate_luxembourg.dmm +++ b/_maps/shuttles/shiptest/syndicate_luxembourg.dmm @@ -536,9 +536,6 @@ /turf/open/floor/plasteel/mono/dark, /area/ship/storage) "kp" = ( -/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer2{ - dir = 4 - }, /obj/structure/rack, /obj/machinery/atmospherics/components/unary/vent_pump/on/layer4{ dir = 8 diff --git a/code/__HELPERS/virtual_z_level.dm b/code/__HELPERS/virtual_z_level.dm index 251b0323601a..b00c77b80b83 100644 --- a/code/__HELPERS/virtual_z_level.dm +++ b/code/__HELPERS/virtual_z_level.dm @@ -49,4 +49,4 @@ /atom/proc/get_relative_location() var/datum/virtual_level/vlevel = get_virtual_level() - return vlevel.get_relative_coords(src) + return vlevel?.get_relative_coords(src) diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 50d6fd96bbeb..16a4b3ff5e22 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -660,8 +660,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new /datum/controller/master/StartLoadingMap() //disallow more than one map to load at once, multithreading it will just cause race conditions - while(map_loading) - stoplag() + UNTIL(!map_loading) for(var/S in subsystems) var/datum/controller/subsystem/SS = S SS.StartLoadingMap() diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index e8f31f6fe343..75e95c53dfb9 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -33,8 +33,17 @@ SUBSYSTEM_DEF(air) var/list/expansion_queue = list() var/list/deferred_airs = list() var/max_deferred_airs = 0 + + ///List of all currently processing atmos machinery that doesn't interact with the air around it var/list/obj/machinery/atmos_machinery = list() + ///List of all currently processing atmos machinery that interacts with its loc's air var/list/obj/machinery/atmos_air_machinery = list() + + ///Atmos machinery that will be added to atmos_machinery once maploading is finished + var/list/obj/machinery/deferred_atmos_machinery = list() + ///Air atmos machinery that will be added to atmos_air_machinery once maploading is finished + var/list/obj/machinery/deferred_atmos_air_machinery = list() + var/list/pipe_init_dirs_cache = list() //atmos singletons @@ -111,13 +120,13 @@ SUBSYSTEM_DEF(air) /datum/controller/subsystem/air/proc/auxtools_update_reactions() /proc/reset_all_air() - SSair.can_fire = 0 + SSair.can_fire = FALSE message_admins("Air reset begun.") for(var/turf/open/T in world) T.Initalize_Atmos(0) CHECK_TICK message_admins("Air reset done.") - SSair.can_fire = 1 + SSair.can_fire = TRUE /datum/controller/subsystem/air/proc/thread_running() return FALSE @@ -271,14 +280,20 @@ SUBSYSTEM_DEF(air) * Arguments: * * machine - The machine to start processing. Can be any /obj/machinery. */ -/datum/controller/subsystem/air/proc/start_processing_machine(obj/machinery/machine) +/datum/controller/subsystem/air/proc/start_processing_machine(obj/machinery/machine, mapload) if(machine.atmos_processing) return machine.atmos_processing = TRUE if(machine.interacts_with_air) - atmos_air_machinery += machine + if(mapload) + deferred_atmos_air_machinery += machine + else + atmos_air_machinery += machine else - atmos_machinery += machine + if(mapload) + deferred_atmos_machinery += machine + else + atmos_machinery += machine /** * Removes a given machine to the processing system for SSAIR_ATMOSMACHINERY processing. @@ -292,8 +307,10 @@ SUBSYSTEM_DEF(air) machine.atmos_processing = FALSE if(machine.interacts_with_air) atmos_air_machinery -= machine + deferred_atmos_air_machinery -= machine else atmos_machinery -= machine + deferred_atmos_machinery -= machine // If we're currently processing atmos machines, there's a chance this machine is in // the currentrun list, which is a cache of atmos_machinery. Remove it from that list @@ -383,12 +400,9 @@ SUBSYSTEM_DEF(air) if(item in net.members) continue if(item.parent) - var/static/pipenetwarnings = 10 - if(pipenetwarnings > 0) - log_mapping("build_pipeline(): [item.type] added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf) around [AREACOORD(item)].") - pipenetwarnings-- - if(pipenetwarnings == 0) - log_mapping("build_pipeline(): further messages about pipenets will be suppressed") + message_admins("Doubled atmosmachine found at [ADMIN_VERBOSEJMP(item)]! Report this to mappers if it's been loaded from a map file!") + log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") + stack_trace("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") net.members += item border += item @@ -456,7 +470,7 @@ SUBSYSTEM_DEF(air) if(!M) atmos_air_machinery -= M if(M.process_atmos(seconds) == PROCESS_KILL) - atmos_air_machinery.Remove(M) + stop_processing_machine(M) if(MC_TICK_CHECK) return @@ -557,6 +571,14 @@ SUBSYSTEM_DEF(air) /datum/controller/subsystem/air/StopLoadingMap() map_loading = FALSE + if(length(deferred_atmos_machinery)) + atmos_machinery += deferred_atmos_machinery + deferred_atmos_machinery.Cut() + + if(length(deferred_atmos_air_machinery)) + atmos_air_machinery += deferred_atmos_air_machinery + deferred_atmos_air_machinery.Cut() + /datum/controller/subsystem/air/proc/setup_allturfs() var/list/turfs_to_init = block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz)) var/times_fired = ++src.times_fired diff --git a/code/game/machinery/airlock_cycle_control.dm b/code/game/machinery/airlock_cycle_control.dm index dbe5bdd5a194..fffb5d5684d3 100644 --- a/code/game/machinery/airlock_cycle_control.dm +++ b/code/game/machinery/airlock_cycle_control.dm @@ -139,7 +139,7 @@ /obj/machinery/advanced_airlock_controller/Initialize(mapload) . = ..() - SSair.start_processing_machine(src) + SSair.start_processing_machine(src, mapload) scan_on_late_init = mapload if(mapload && (. != INITIALIZE_HINT_QDEL)) return INITIALIZE_HINT_LATELOAD diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm index e2b5fd34dca3..414989edabaf 100644 --- a/code/game/machinery/computer/atmos_control.dm +++ b/code/game/machinery/computer/atmos_control.dm @@ -72,9 +72,9 @@ frequency = new_frequency radio_connection = SSradio.add_object(src, frequency, RADIO_ATMOSIA) -/obj/machinery/air_sensor/Initialize() +/obj/machinery/air_sensor/Initialize(mapload) . = ..() - SSair.start_processing_machine(src) + SSair.start_processing_machine(src, mapload) set_frequency(frequency) /obj/machinery/air_sensor/Destroy() diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 5fd89405a6ca..050a8be4139b 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -68,7 +68,7 @@ /obj/machinery/atmospherics/Initialize(mapload) if(init_processing) - SSair.start_processing_machine(src) + SSair.start_processing_machine(src, mapload) return ..() /obj/machinery/atmospherics/Destroy() diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index c1b94eaf8d77..beb4be56ac8c 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -192,8 +192,8 @@ if(!parent) //WARNING("Component is missing a pipenet! Rebuilding...") SSair.add_to_rebuild_queue(src) - else - parent.update = TRUE + return + parent.update = TRUE /obj/machinery/atmospherics/components/returnPipenets() . = list() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index 71828ab24921..15edb1917d95 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -23,10 +23,9 @@ var/heat_capacity = 0 var/interactive = TRUE // So mapmakers can disable interaction. -/obj/machinery/atmospherics/components/unary/thermomachine/Initialize() +/obj/machinery/atmospherics/components/unary/thermomachine/Initialize(mapload) . = ..() initialize_directions = dir - SSair.start_processing_machine(src) //WS edit, initialize thermomachines to SSairs list of tickable machines /obj/machinery/atmospherics/components/unary/thermomachine/on_construction(obj_color, set_layer) var/obj/item/circuitboard/machine/thermomachine/board = circuit diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index 2bda70631d1e..9f3896f29e1d 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -40,22 +40,23 @@ update = air.react(src) /datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/base) - if(!QDELETED(base)) - building = TRUE - var/volume = 0 - if(istype(base, /obj/machinery/atmospherics/pipe)) - var/obj/machinery/atmospherics/pipe/considered_pipe = base - volume = considered_pipe.volume - members += considered_pipe - if(considered_pipe.air_temporary) - air = considered_pipe.air_temporary - considered_pipe.air_temporary = null - else - addMachineryMember(base) - if(!air) - air = new - air.set_volume(volume) - SSair.add_to_expansion(src, base) + if(QDELETED(base)) + return + building = TRUE + var/volume = 0 + if(istype(base, /obj/machinery/atmospherics/pipe)) + var/obj/machinery/atmospherics/pipe/considered_pipe = base + volume = considered_pipe.volume + members += considered_pipe + if(considered_pipe.air_temporary) + air = considered_pipe.air_temporary + considered_pipe.air_temporary = null + else + addMachineryMember(base) + if(!air) + air = new + air.set_volume(volume) + SSair.add_to_expansion(src, base) ///Has the same effect as build_pipeline(), but this doesn't queue its work, so overrun abounds. It's useful for the pregame /datum/pipeline/proc/build_pipeline_blocking(obj/machinery/atmospherics/base) @@ -75,30 +76,32 @@ while(length(possible_expansions.len)) for(var/obj/machinery/atmospherics/borderline in possible_expansions) var/list/result = borderline.pipeline_expansion(src) - if(!result?.len) + if(!length(result)) continue - for(var/obj/machinery/atmospherics/P in result) - if(istype(P, /obj/machinery/atmospherics/pipe)) - var/obj/machinery/atmospherics/pipe/item = P - if(item in members) - continue - - if(item.parent) - message_admins("Doubled atmosmachine found at [ADMIN_VERBOSEJMP(item)]! Report this to mappers if it's been loaded from a map file!") - log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") - CRASH("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") - members += item - possible_expansions += item - - volume += item.volume - item.parent = src - - if(item.air_temporary) - air.merge(item.air_temporary) - item.air_temporary = null - else - P.setPipenet(src, borderline) - addMachineryMember(P) + for(var/obj/machinery/atmospherics/considered_device in result) + if(!istype(considered_device, /obj/machinery/atmospherics/pipe)) + considered_device.setPipenet(src, borderline) + addMachineryMember(considered_device) + continue + + var/obj/machinery/atmospherics/pipe/item = considered_device + if(item in members) + continue + + if(item.parent) + message_admins("Doubled atmosmachine found at [ADMIN_VERBOSEJMP(item)]! Report this to mappers if it's been loaded from a map file!") + log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") + CRASH("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") + + members += item + possible_expansions += item + + volume += item.volume + item.parent = src + + if(item.air_temporary) + air.merge(item.air_temporary) + item.air_temporary = null possible_expansions -= borderline diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm index d48e202adfc6..811979dd4c39 100644 --- a/code/modules/atmospherics/machinery/other/meter.dm +++ b/code/modules/atmospherics/machinery/other/meter.dm @@ -40,7 +40,7 @@ /obj/machinery/meter/Initialize(mapload, new_piping_layer) if(!isnull(new_piping_layer)) target_layer = new_piping_layer - SSair.start_processing_machine(src) + SSair.start_processing_machine(src, mapload) if(!target) reattach_to_layer() return ..() diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 1e11cf479f9b..d107ed723a74 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -15,11 +15,11 @@ var/maximum_pressure = 90 * ONE_ATMOSPHERE -/obj/machinery/portable_atmospherics/Initialize() +/obj/machinery/portable_atmospherics/Initialize(mapload) . = ..() air_contents = new(volume) air_contents.set_temperature(T20C) - SSair.start_processing_machine(src) + SSair.start_processing_machine(src, mapload) /obj/machinery/portable_atmospherics/Destroy() disconnect() diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 86a7a2d3da80..8aca26608a76 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -18,7 +18,7 @@ . = ..() find_circs() connect_to_network() - SSair.start_processing_machine(src) + SSair.start_processing_machine(src, mapload) update_icon() component_parts = list(new /obj/item/circuitboard/machine/generator) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 61bd0f55165c..caf93958fad2 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -269,10 +269,10 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) -/obj/machinery/power/supermatter_crystal/Initialize() +/obj/machinery/power/supermatter_crystal/Initialize(mapload) . = ..() uid = gl_uid++ - SSair.start_processing_machine(src) + SSair.start_processing_machine(src, mapload) countdown = new(src) countdown.start() GLOB.poi_list |= src From 6fb92bcf4f37c4463838acbe857ce957ca886c53 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 1 Aug 2023 00:58:49 -0500 Subject: [PATCH 115/147] final map fixes, hopefully --- _maps/outpost/outpost_test_2.dmm | 8 ++++++-- _maps/shuttles/shiptest/independent_junker.dmm | 6 +++--- _maps/shuttles/shiptest/syndicate_aegis.dmm | 3 --- _maps/shuttles/shiptest/syndicate_luxembourg.dmm | 6 ++++++ code/_compile_options.dm | 2 +- code/controllers/subsystem/air.dm | 8 ++------ code/modules/unit_tests/ruin_placement.dm | 3 --- code/modules/unit_tests/ship_outpost_placement.dm | 3 --- 8 files changed, 18 insertions(+), 21 deletions(-) diff --git a/_maps/outpost/outpost_test_2.dmm b/_maps/outpost/outpost_test_2.dmm index e4f50e5e1ffb..38d7e95e6735 100644 --- a/_maps/outpost/outpost_test_2.dmm +++ b/_maps/outpost/outpost_test_2.dmm @@ -1046,10 +1046,12 @@ /obj/effect/turf_decal/siding/thinplating/dark{ dir = 8 }, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2, /obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4{ dir = 4 }, +/obj/machinery/atmospherics/pipe/manifold/supply/hidden/layer2{ + dir = 8 + }, /turf/open/floor/plasteel/rockvault, /area/outpost/operations) "en" = ( @@ -2814,7 +2816,9 @@ /obj/effect/turf_decal/spline/fancy/opaque/black{ dir = 1 }, -/obj/machinery/atmospherics/components/unary/vent_pump/on/layer2, +/obj/machinery/atmospherics/components/unary/vent_pump/on/layer2{ + dir = 8 + }, /turf/open/floor/plasteel/dark, /area/outpost/operations) "kR" = ( diff --git a/_maps/shuttles/shiptest/independent_junker.dmm b/_maps/shuttles/shiptest/independent_junker.dmm index 0177e79fcac1..8183cf558967 100644 --- a/_maps/shuttles/shiptest/independent_junker.dmm +++ b/_maps/shuttles/shiptest/independent_junker.dmm @@ -2092,7 +2092,7 @@ dir = 8 }, /turf/open/floor/engine/hull, -/area/template_noop) +/area/ship/external) "MW" = ( /obj/docking_port/stationary{ dwidth = 15; @@ -2259,7 +2259,7 @@ /turf/closed/wall/r_wall, /area/ship/bridge) "QN" = ( -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{ +/obj/machinery/atmospherics/pipe/layer_manifold{ dir = 4 }, /turf/closed/wall/mineral/titanium/survival/nodiagonal, @@ -2581,7 +2581,7 @@ /obj/structure/cable{ icon_state = "1-2" }, -/obj/machinery/atmospherics/pipe/layer_manifold{ +/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{ dir = 4 }, /turf/closed/wall/mineral/titanium/survival/nodiagonal, diff --git a/_maps/shuttles/shiptest/syndicate_aegis.dmm b/_maps/shuttles/shiptest/syndicate_aegis.dmm index 5196f2c133a2..ab86fdeef24b 100644 --- a/_maps/shuttles/shiptest/syndicate_aegis.dmm +++ b/_maps/shuttles/shiptest/syndicate_aegis.dmm @@ -3172,9 +3172,6 @@ /area/template_noop) "Ez" = ( /obj/machinery/light/directional/north, -/obj/machinery/atmospherics/components/unary/vent_pump/on/layer2{ - dir = 4 - }, /obj/structure/chair/sofa/left, /turf/open/floor/carpet/red, /area/ship/crew/canteen) diff --git a/_maps/shuttles/shiptest/syndicate_luxembourg.dmm b/_maps/shuttles/shiptest/syndicate_luxembourg.dmm index 9e30c9c29ab3..63a12bda8abc 100644 --- a/_maps/shuttles/shiptest/syndicate_luxembourg.dmm +++ b/_maps/shuttles/shiptest/syndicate_luxembourg.dmm @@ -446,6 +446,9 @@ dir = 5 }, /obj/structure/catwalk/over/plated_catwalk, +/obj/machinery/atmospherics/components/unary/portables_connector{ + dir = 8 + }, /turf/open/floor/plating, /area/ship/engineering) "it" = ( @@ -716,6 +719,9 @@ dir = 9 }, /obj/structure/catwalk/over/plated_catwalk/white, +/obj/machinery/atmospherics/components/unary/portables_connector{ + dir = 4 + }, /turf/open/floor/plating, /area/ship/engineering) "ow" = ( diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 224367aaa9cf..0b73aa7172c3 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -87,7 +87,7 @@ #define TESTING #endif -#if defined(UNIT_TESTS) +#ifdef UNIT_TESTS //Hard del testing defines #define REFERENCE_TRACKING #define REFERENCE_TRACKING_DEBUG diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index 75e95c53dfb9..043a5cedb664 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -76,8 +76,6 @@ SUBSYSTEM_DEF(air) var/excited_group_pressure_goal = 1 - var/is_test_loading = FALSE - /datum/controller/subsystem/air/stat_entry(msg) msg += "C:{" msg += "HP:[round(cost_highpressure,1)]|" @@ -168,8 +166,7 @@ SUBSYSTEM_DEF(air) // This is only machinery like filters, mixers that don't interact with air if(currentpart == SSAIR_ATMOSMACHINERY) timer = TICK_USAGE_REAL - if(!is_test_loading) - process_atmos_machinery(resumed) + process_atmos_machinery(resumed) cost_atmos_machinery = MC_AVERAGE(cost_atmos_machinery, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) if(state != SS_RUNNING) return @@ -206,8 +203,7 @@ SUBSYSTEM_DEF(air) currentpart = SSAIR_ATMOSMACHINERY_AIR if(currentpart == SSAIR_ATMOSMACHINERY_AIR) timer = TICK_USAGE_REAL - if(!is_test_loading) - process_atmos_air_machinery(resumed) + process_atmos_air_machinery(resumed) cost_atmos_machinery = MC_AVERAGE(cost_atmos_machinery, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) if(state != SS_RUNNING) return diff --git a/code/modules/unit_tests/ruin_placement.dm b/code/modules/unit_tests/ruin_placement.dm index 8688e8686245..1df3560ed710 100644 --- a/code/modules/unit_tests/ruin_placement.dm +++ b/code/modules/unit_tests/ruin_placement.dm @@ -1,5 +1,4 @@ /datum/unit_test/ruin_placement/Run() - SSair.is_test_loading = TRUE var/datum/map_zone/mapzone = SSmapping.create_map_zone("Ruin Testing Zone") for(var/planet_name as anything in SSmapping.planet_types) var/datum/planet_type/planet_type = SSmapping.planet_types[planet_name] @@ -24,8 +23,6 @@ vlevel.clear_reservation() qdel(vlevel) - SSair.is_test_loading = FALSE - qdel(mapzone) /* Slow, and usually unecessary diff --git a/code/modules/unit_tests/ship_outpost_placement.dm b/code/modules/unit_tests/ship_outpost_placement.dm index 9fb36d0fdc6d..e1e27097ee6f 100644 --- a/code/modules/unit_tests/ship_outpost_placement.dm +++ b/code/modules/unit_tests/ship_outpost_placement.dm @@ -1,5 +1,4 @@ /datum/unit_test/ship_outpost_placement/Run() - SSair.is_test_loading = TRUE for(var/mapname as anything in SSmapping.ship_purchase_list) var/datum/map_template/shuttle/map = SSmapping.ship_purchase_list[mapname] try @@ -7,8 +6,6 @@ new /datum/overmap/ship/controlled(list("x" = 1, "y" = 1), map) catch(var/exception/e) TEST_FAIL("Runtime error loading ship type ([map.name]): [e] on [e.file]:[e.line]\n[e.desc]") - SSair.is_test_loading = FALSE - for(var/outpost_type in subtypesof(/datum/overmap/outpost)) var/datum/overmap/outpost/test_outpost = new outpost_type() From 8f57a28c6b147791232ead239b6ea34ef5350b65 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 1 Aug 2023 00:59:34 -0500 Subject: [PATCH 116/147] test commit From 9e2eb81fb77e761094a4acad0c012b9f933900bf Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 1 Aug 2023 00:59:41 -0500 Subject: [PATCH 117/147] test commit From 350790dbeb5ba63a99312a579b0ba6a7bb13ffdd Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 1 Aug 2023 00:59:48 -0500 Subject: [PATCH 118/147] test commit From 7380ba2b840451ced75ead3a32582ac41b44c27d Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 1 Aug 2023 18:12:38 -0500 Subject: [PATCH 119/147] small tweaks --- _maps/shuttles/shiptest/inteq_talos.dmm | 19 +++++++++++-------- code/modules/unit_tests/unit_test.dm | 7 +++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/_maps/shuttles/shiptest/inteq_talos.dmm b/_maps/shuttles/shiptest/inteq_talos.dmm index cf5890397960..72638316e378 100644 --- a/_maps/shuttles/shiptest/inteq_talos.dmm +++ b/_maps/shuttles/shiptest/inteq_talos.dmm @@ -1183,11 +1183,11 @@ icon_state = "2-4" }, /obj/structure/railing, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2{ - dir = 4 - }, /obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4, /obj/structure/catwalk/over, +/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2{ + dir = 6 + }, /turf/open/floor/plating, /area/ship/engineering) "hQ" = ( @@ -3142,9 +3142,6 @@ }, /obj/structure/cable, /obj/structure/railing/corner, -/obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2{ - dir = 6 - }, /obj/machinery/atmospherics/pipe/simple/scrubbers/visible/layer4{ dir = 5 }, @@ -4963,6 +4960,9 @@ pixel_x = 6; pixel_y = 4 }, +/obj/machinery/atmospherics/components/unary/vent_pump/on/layer2{ + dir = 1 + }, /turf/open/floor/plasteel/dark, /area/ship/engineering) "Fx" = ( @@ -5666,8 +5666,8 @@ /obj/effect/turf_decal/siding/thinplating/dark{ dir = 4 }, -/obj/machinery/atmospherics/components/unary/vent_pump/on/layer2{ - dir = 1 +/obj/machinery/atmospherics/components/unary/portables_connector/visible{ + dir = 8 }, /turf/open/floor/plasteel/tech, /area/ship/engineering) @@ -6407,6 +6407,9 @@ /obj/machinery/atmospherics/pipe/simple/dark/visible/layer1{ dir = 5 }, +/obj/machinery/atmospherics/components/unary/portables_connector/visible{ + dir = 8 + }, /turf/open/floor/plasteel/tech, /area/ship/engineering/engine) "Qu" = ( diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm index 64e6022fd62e..7240adb33855 100644 --- a/code/modules/unit_tests/unit_test.dm +++ b/code/modules/unit_tests/unit_test.dm @@ -124,11 +124,14 @@ GLOBAL_VAR(test_log) CHECK_TICK var/list/tests_to_run = subtypesof(/datum/unit_test) + var/list/focused_tests = list() for (var/_test_to_run in tests_to_run) var/datum/unit_test/test_to_run = _test_to_run if (initial(test_to_run.focus)) - tests_to_run = list(test_to_run) - break + focused_tests += _test_to_run + + if(length(focused_tests)) + tests_to_run = focused_tests tests_to_run = sortTim(tests_to_run, /proc/cmp_unit_test_priority) From 1c79717ec1dbd32b24ef563cec5186ed60b2569d Mon Sep 17 00:00:00 2001 From: ZephyrTFA Date: Wed, 2 Aug 2023 23:29:59 -0400 Subject: [PATCH 120/147] remove suicide handling --- code/modules/mob/mob.dm | 1 - code/modules/mob/mob_lists.dm | 8 -------- 2 files changed, 9 deletions(-) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 04fbd4e3de3b..e3989fc5ba4e 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -28,7 +28,6 @@ remove_from_mob_list() remove_from_dead_mob_list() remove_from_alive_mob_list() - remove_from_mob_suicide_list() focus = null if(length(progressbars)) stack_trace("[src] destroyed with elements in its progressbars list") diff --git a/code/modules/mob/mob_lists.dm b/code/modules/mob/mob_lists.dm index cda3ce9cc48d..fe9d0c69aa75 100644 --- a/code/modules/mob/mob_lists.dm +++ b/code/modules/mob/mob_lists.dm @@ -22,14 +22,6 @@ if(client) remove_from_current_living_players() -///Adds a mob reference to the list of all suicided mobs -/mob/proc/add_to_mob_suicide_list() - GLOB.suicided_mob_list += src - -///Removes a mob references from the list of all suicided mobs -/mob/proc/remove_from_mob_suicide_list() - GLOB.suicided_mob_list -= src - ///Adds the mob reference to the list of all the dead mobs. If mob is cliented, it adds it to the list of all dead player-mobs. /mob/proc/add_to_dead_mob_list() if(QDELETED(src)) From 0f2740737a7c105ad3231a292b6ab58d1161e585 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 4 Aug 2023 13:41:15 -0500 Subject: [PATCH 121/147] Attempts fix of Runtime, missions, and spiders --- .../mob/living/simple_animal/friendly/cat.dm | 15 ++++++++------- .../living/simple_animal/hostile/giant_spider.dm | 3 ++- code/modules/overmap/missions.dm | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 193c3fdb51fc..1916a7c52adb 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -88,7 +88,7 @@ gold_core_spawnable = NO_SPAWN unique_pet = TRUE var/list/family = list()//var restored from savefile, has count of each child type - var/list/children = list()//Actual mob instances of children + var/list/children = list()//Actual mob weak references of children var/cats_deployed = 0 var/memory_saved = FALSE held_state = "cat" @@ -112,7 +112,7 @@ /mob/living/simple_animal/pet/cat/Runtime/make_babies() var/mob/baby = ..() if(baby) - children += baby + children += WEAKREF(baby) return baby /mob/living/simple_animal/pet/cat/Runtime/death() @@ -139,13 +139,14 @@ var/list/file_data = list() family = list() if(!dead) - for(var/mob/living/simple_animal/pet/cat/kitten/C in children) - if(istype(C,type) || C.stat || !C.z || (C.flags_1 & HOLOGRAM_1)) + for(var/datum/weakref/childRef in children) + var/mob/living/simple_animal/pet/cat/kitten/child = childRef.resolve() + if(istype(child, type) || child.stat || !child.z || (child.flags_1 & HOLOGRAM_1)) continue - if(C.type in family) - family[C.type] += 1 + if(child.type in family) + family[child.type] += 1 else - family[C.type] = 1 + family[child.type] = 1 file_data["family"] = family fdel(json_file) WRITE_FILE(json_file, json_encode(file_data)) diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index cf52013d00ef..fc83f1cbf005 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -121,7 +121,7 @@ var/obj/effect/proc_holder/wrap/wrap var/datum/action/innate/spider/lay_eggs/lay_eggs var/datum/action/innate/spider/set_directive/set_directive - var/static/list/consumed_mobs = list() //the tags of mobs that have been consumed by nurse spiders to lay eggs + var/static/list/consumed_mobs = list() //the refs of mobs that have been consumed by nurse spiders to lay eggs gold_core_spawnable = NO_SPAWN /mob/living/simple_animal/hostile/poison/giant_spider/nurse/Initialize() @@ -137,6 +137,7 @@ RemoveAbility(wrap) QDEL_NULL(lay_eggs) QDEL_NULL(set_directive) + QDEL_NULL(wrap) return ..() //broodmothers are the queen of the spiders, can send messages to all them and web faster. That rare round where you get a queen spider and turn your 'for honor' players into 'r6siege' players will be a fun one. diff --git a/code/modules/overmap/missions.dm b/code/modules/overmap/missions.dm index 98146f3ac4ad..e3461ced00de 100644 --- a/code/modules/overmap/missions.dm +++ b/code/modules/overmap/missions.dm @@ -50,9 +50,11 @@ qdel(src) /datum/mission/Destroy() + UnregisterSignal(source_outpost, COMSIG_PARENT_QDELETING) LAZYREMOVE(source_outpost.missions, src) source_outpost = null if(servant) + UnregisterSignal(servant, COMSIG_PARENT_QDELETING) LAZYREMOVE(servant.missions, src) servant = null for(var/bound in bound_atoms) From a60e6498cf8ebb384be6666e7d2a04fa5a9f74d5 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 4 Aug 2023 13:59:06 -0500 Subject: [PATCH 122/147] SCREAM --- _maps/shuttles/shiptest/independent_kilo.dmm | 4 ++-- code/modules/atmospherics/machinery/datum_pipeline.dm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_maps/shuttles/shiptest/independent_kilo.dmm b/_maps/shuttles/shiptest/independent_kilo.dmm index 6a321e21cde1..ead3f5a0ef26 100644 --- a/_maps/shuttles/shiptest/independent_kilo.dmm +++ b/_maps/shuttles/shiptest/independent_kilo.dmm @@ -1978,10 +1978,10 @@ dir = 8 }, /obj/docking_port/mobile{ - dir = 8; + dir = 4; launch_status = 0; name = "Mining Shuttle"; - preferred_direction = 2; + preferred_direction = 4; port_direction = 2 }, /turf/open/floor/mineral/plastitanium, diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index 9f3896f29e1d..35cea67f3421 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -73,7 +73,7 @@ if(!air) air = new var/list/possible_expansions = list(base) - while(length(possible_expansions.len)) + while(length(possible_expansions)) for(var/obj/machinery/atmospherics/borderline in possible_expansions) var/list/result = borderline.pipeline_expansion(src) if(!length(result)) From 857dff4e0008fd3062ab65b9cbc80b27412962ca Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 4 Aug 2023 16:12:08 -0500 Subject: [PATCH 123/147] bunch more fixes --- code/game/machinery/navbeacon.dm | 4 ++-- code/modules/economy/selling_pad.dm | 2 +- code/modules/mining/minebot.dm | 1 + code/modules/mob/living/simple_animal/bot/bot.dm | 4 ++-- code/modules/mob/living/simple_animal/simple_animal.dm | 4 ++++ code/modules/projectiles/guns/energy.dm | 1 + 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index d752ec68f99b..925936f70b6b 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -68,7 +68,7 @@ codes[e] = "1" /obj/machinery/navbeacon/proc/glob_lists_deregister() - LAZYREMOVE(GLOB.navbeacons["[z]"], src) + LAZYREMOVE(GLOB.navbeacons["[virtual_z()]"], src) GLOB.deliverybeacons -= src GLOB.deliverybeacontags -= location GLOB.wayfindingbeacons -= src @@ -79,7 +79,7 @@ if(!codes) return if(codes["patrol"]) - LAZYADD(GLOB.navbeacons["[z]"], src) + LAZYADD(GLOB.navbeacons["[virtual_z()]"], src) if(codes["delivery"]) GLOB.deliverybeacons += src GLOB.deliverybeacontags += location diff --git a/code/modules/economy/selling_pad.dm b/code/modules/economy/selling_pad.dm index 5dadf5911ce3..56cafbc35a72 100644 --- a/code/modules/economy/selling_pad.dm +++ b/code/modules/economy/selling_pad.dm @@ -76,7 +76,7 @@ /obj/machinery/computer/selling_pad_control/ui_data(mob/user) var/list/data = list() data["points"] = sell_account.account_balance - data["pad"] = pad.resolve() ? TRUE : FALSE + data["pad"] = pad?.resolve() ? TRUE : FALSE data["sending"] = sending data["status_report"] = status_report return data diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 3941e690c59d..707d68a871f7 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -69,6 +69,7 @@ /mob/living/simple_animal/hostile/mining_drone/Destroy() + QDEL_NULL(stored_gun) for (var/datum/action/innate/minedrone/action in actions) qdel(action) return ..() diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index ea152c9baea3..f962780ed500 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -701,7 +701,7 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/proc/get_next_patrol_target() // search the beacon list for the next target in the list. - for(var/obj/machinery/navbeacon/NB in GLOB.navbeacons["[z]"]) + for(var/obj/machinery/navbeacon/NB in GLOB.navbeacons["[virtual_z()]"]) if(NB.location == next_destination) //Does the Beacon location text match the destination? destination = new_destination //We now know the name of where we want to go. patrol_target = NB.loc //Get its location and set it as the target. @@ -709,7 +709,7 @@ Pass a positive integer as an argument to override a bot's default speed. return TRUE /mob/living/simple_animal/bot/proc/find_nearest_beacon() - for(var/obj/machinery/navbeacon/NB in GLOB.navbeacons["[z]"]) + for(var/obj/machinery/navbeacon/NB in GLOB.navbeacons["[virtual_z()]"]) var/dist = get_dist(src, NB) if(nearest_beacon) //Loop though the beacon net to find the true closest beacon. //Ignore the beacon if were are located on it. diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index d8a36828d064..a5a1bd163459 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -168,6 +168,9 @@ nest.spawned_mobs -= src nest = null + if(access_card) + QDEL_NULL(access_card) + return ..() /mob/living/simple_animal/attackby(obj/item/O, mob/user, params) @@ -656,4 +659,5 @@ /mob/living/simple_animal/on_virtual_z_change(new_virtual_z, previous_virtual_z) . = ..() toggle_ai(initial(AIStatus)) + LAZYREMOVEASSOC(SSidlenpcpool.idle_mobs_by_virtual_level, previous_virtual_z, src) check_should_sleep() diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 19722fb11804..b401db7e9a80 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -72,6 +72,7 @@ fire_delay = shot.delay /obj/item/gun/energy/Destroy() + QDEL_LIST(ammo_type) if (cell) QDEL_NULL(cell) STOP_PROCESSING(SSobj, src) From d59537b0185d995cd247be9eb5fe0bc62d0b611e Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 4 Aug 2023 16:38:13 -0500 Subject: [PATCH 124/147] we're getting there --- code/game/objects/items/devices/aicard.dm | 2 +- code/modules/mob/living/simple_animal/simple_animal.dm | 2 +- code/modules/projectiles/ammunition/_ammunition.dm | 4 +++- code/modules/projectiles/guns/energy.dm | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index f5ef31b2e695..343f4e385e56 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -60,7 +60,7 @@ /obj/item/aicard/ui_data() var/list/data = list() - if(AI) + if(!QDELETED(AI)) data["name"] = AI.name data["laws"] = AI.laws.get_law_list(include_zeroth = TRUE, render_html = FALSE) data["health"] = (AI.health + 100) / 2 diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index a5a1bd163459..740d99ea1eb8 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -659,5 +659,5 @@ /mob/living/simple_animal/on_virtual_z_change(new_virtual_z, previous_virtual_z) . = ..() toggle_ai(initial(AIStatus)) - LAZYREMOVEASSOC(SSidlenpcpool.idle_mobs_by_virtual_level, previous_virtual_z, src) + LAZYREMOVEASSOC(SSidlenpcpool.idle_mobs_by_virtual_level, "[previous_virtual_z]", src) check_should_sleep() diff --git a/code/modules/projectiles/ammunition/_ammunition.dm b/code/modules/projectiles/ammunition/_ammunition.dm index d884bd00cbe3..3cfc665d1560 100644 --- a/code/modules/projectiles/ammunition/_ammunition.dm +++ b/code/modules/projectiles/ammunition/_ammunition.dm @@ -54,7 +54,9 @@ /obj/item/ammo_casing/Destroy() . = ..() - if(!BB) + if(BB) + QDEL_NULL(BB) + else SSblackbox.record_feedback("tally", "station_mess_destroyed", 1, name) /obj/item/ammo_casing/update_icon_state() diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index b401db7e9a80..0a5661776c87 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -72,13 +72,16 @@ fire_delay = shot.delay /obj/item/gun/energy/Destroy() - QDEL_LIST(ammo_type) + if(length(ammo_type)) + QDEL_LIST(ammo_type) if (cell) QDEL_NULL(cell) STOP_PROCESSING(SSobj, src) return ..() /obj/item/gun/energy/handle_atom_del(atom/A) + if(QDELETED(src)) + return ..() if(A == cell) cell = null update_icon() From 875697a1dc24dc8fefcde30924076a06e01022cf Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 4 Aug 2023 17:53:41 -0500 Subject: [PATCH 125/147] more tweaks --- code/controllers/subsystem/air.dm | 1 - code/game/objects/effects/spiders.dm | 9 +++++---- code/modules/atmospherics/machinery/datum_pipeline.dm | 3 +-- code/modules/mob/dead/dead.dm | 4 ++++ code/modules/projectiles/guns/energy.dm | 4 +--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index bb145cc34b96..83100dd566aa 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -409,7 +409,6 @@ SUBSYSTEM_DEF(air) if(item in net.members) continue if(item.parent) - message_admins("Doubled atmosmachine found at [ADMIN_VERBOSEJMP(item)]! Report this to mappers if it's been loaded from a map file!") log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") stack_trace("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 8b70a3a6299f..a6544881ade5 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -53,18 +53,19 @@ /obj/structure/spider/stickyweb/genetic //for the spider genes in genetics genetic = TRUE - var/mob/living/allowed_mob + //Reference to the mob that created this + var/allowed_mob_reference /obj/structure/spider/stickyweb/genetic/Initialize(mapload, allowedmob) - allowed_mob = allowedmob + allowed_mob_reference = REF(allowedmob) . = ..() /obj/structure/spider/stickyweb/genetic/CanAllowThrough(atom/movable/mover, border_dir) . = ..() //this is the normal spider web return aka a spider would make this TRUE - if(mover == allowed_mob) + if(REF(mover) == allowed_mob_reference) return TRUE else if(isliving(mover)) //we change the spider to not be able to go through here - if(mover.pulledby == allowed_mob) + if(REF(mover.pulledby) == allowed_mob_reference) return TRUE if(prob(50)) to_chat(mover, "You get stuck in \the [src] for a moment.") diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index 35cea67f3421..fc41589012df 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -89,7 +89,6 @@ continue if(item.parent) - message_admins("Doubled atmosmachine found at [ADMIN_VERBOSEJMP(item)]! Report this to mappers if it's been loaded from a map file!") log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") CRASH("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") @@ -112,7 +111,7 @@ var/list/returned_airs = C.returnPipenetAirs(src) if (!length(returned_airs) || (null in returned_airs)) stack_trace("addMachineryMember: Nonexistent (empty list) or null machinery gasmix added to pipeline datum from [C] \ - which is of type [C.type]. Nearby: ([C.x], [C.y], [C.z])") + which is of type [C.type]. QDELETED: [QDELETED(C) ? "true" : "false"].") other_airs |= returned_airs /datum/pipeline/proc/addMember(obj/machinery/atmospherics/A, obj/machinery/atmospherics/N) diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index 3d22ed748ea7..ee74d0475a34 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -99,6 +99,10 @@ INITIALIZE_IMMEDIATE(/mob/dead) /mob/dead/auto_deadmin_on_login() return +/mob/dead/Destroy() + LAZYREMOVEASSOC(SSmobs.dead_players_by_virtual_z, "[virtual_z()]", src) + return ..() + /mob/dead/Login() . = ..() if(!client) diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 0a5661776c87..eaf916e8d1a2 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -80,8 +80,6 @@ return ..() /obj/item/gun/energy/handle_atom_del(atom/A) - if(QDELETED(src)) - return ..() if(A == cell) cell = null update_icon() @@ -219,7 +217,7 @@ /obj/item/gun/energy/update_overlays() . = ..() - if(!automatic_charge_overlays) + if(!automatic_charge_overlays || QDELETED(src)) return // Every time I see code this "flexible", a kitten fucking dies var/overlay_icon_state = "[icon_state]_charge" From f3cf3479b92f71929e93b1a69001cc47b83793b6 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 4 Aug 2023 20:16:00 -0500 Subject: [PATCH 126/147] sigh --- code/modules/projectiles/guns/energy.dm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index eaf916e8d1a2..de5c3f97b8dd 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -20,7 +20,6 @@ var/use_cyborg_cell = FALSE //whether the gun's cell drains the cyborg user's cell to recharge var/dead_cell = FALSE //set to true so the gun is given an empty cell - //WS Begin - Gun Cells var/internal_cell = FALSE ///if the gun's cell cannot be replaced var/small_gun = FALSE ///if the gun is small and can only fit the small gun cell var/big_gun = FALSE ///if the gun is big and can fit the comically large gun cell @@ -30,7 +29,6 @@ var/eject_sound = 'sound/weapons/gun/general/magazine_remove_full.ogg' //Sound of ejecting a cell. UPDATE PLEASE var/sound_volume = 40 //Volume of loading/unloading sounds var/load_sound_vary = TRUE //Should the load/unload sounds vary? - //WS End /obj/item/gun/energy/emp_act(severity) . = ..() @@ -72,7 +70,7 @@ fire_delay = shot.delay /obj/item/gun/energy/Destroy() - if(length(ammo_type)) + if((flags_1 & INITIALIZED_1) && length(ammo_type)) QDEL_LIST(ammo_type) if (cell) QDEL_NULL(cell) From efb33236e93f30c24980df4ac537a48fb82e3565 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 4 Aug 2023 20:24:10 -0500 Subject: [PATCH 127/147] shrug --- code/modules/projectiles/guns/energy.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index de5c3f97b8dd..0b207c872f3c 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -70,8 +70,6 @@ fire_delay = shot.delay /obj/item/gun/energy/Destroy() - if((flags_1 & INITIALIZED_1) && length(ammo_type)) - QDEL_LIST(ammo_type) if (cell) QDEL_NULL(cell) STOP_PROCESSING(SSobj, src) From d69bb93b4629c543a1f493d80559b156ce6eb9ab Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sat, 5 Aug 2023 13:22:14 -0500 Subject: [PATCH 128/147] more ! --- .../JungleRuins/jungle_bombed_starport.dmm | 148 ++++++++++-------- code/_onclick/hud/alert.dm | 3 +- code/game/atoms_movable.dm | 1 + code/game/machinery/navbeacon.dm | 6 +- code/game/objects/effects/decals/cleanable.dm | 2 + .../mob/living/simple_animal/simple_animal.dm | 19 ++- code/modules/mob/mob_helpers.dm | 2 +- code/modules/projectiles/guns/energy.dm | 3 +- code/modules/recycling/conveyor2.dm | 2 +- 9 files changed, 105 insertions(+), 81 deletions(-) diff --git a/_maps/RandomRuins/JungleRuins/jungle_bombed_starport.dmm b/_maps/RandomRuins/JungleRuins/jungle_bombed_starport.dmm index 8e3fecaab778..d1e21fa909e6 100644 --- a/_maps/RandomRuins/JungleRuins/jungle_bombed_starport.dmm +++ b/_maps/RandomRuins/JungleRuins/jungle_bombed_starport.dmm @@ -1,4 +1,32 @@ //MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE +"aa" = ( +/obj/structure/spider/stickyweb, +/obj/machinery/light/broken/directional/south, +/mob/living/simple_animal/hostile/poison/giant_spider/nurse, +/turf/open/floor/plasteel, +/area/ruin/jungle/starport) +"ab" = ( +/obj/structure/spider/cocoon, +/obj/machinery/atmospherics/pipe/simple/orange/hidden{ + dir = 10 + }, +/mob/living/simple_animal/hostile/poison/giant_spider/hunter/viper, +/turf/open/floor/plating, +/area/ruin/jungle/starport) +"ac" = ( +/obj/structure{ + desc = "A formerly deadly laser cannon, now stuck rusting on a fightercraft."; + dir = 8; + icon = 'icons/obj/turrets.dmi'; + icon_state = "syndie_off"; + name = "defunct laser cannon"; + pixel_x = 26 + }, +/mob/living/simple_animal/hostile/poison/giant_spider/hunter, +/turf/open/floor/concrete/slab_1{ + light_range = 2 + }, +/area/ruin/jungle/starport) "ad" = ( /obj/structure/flora/grass/jungle, /obj/structure/flora/tree/jungle{ @@ -1002,9 +1030,7 @@ }, /area/ruin/jungle/starport) "hq" = ( -/obj/structure/railing{ - dir = 2 - }, +/obj/structure/railing, /obj/effect/decal/cleanable/oil, /turf/open/floor/concrete/slab_1{ light_range = 2 @@ -1474,8 +1500,7 @@ /area/ruin/jungle/starport) "kE" = ( /obj/machinery/door/airlock/glass{ - dir = 4; - pixel_y = 0 + dir = 4 }, /obj/structure/barricade/wooden/crude, /turf/open/floor/plating/rust, @@ -1517,6 +1542,12 @@ icon_state = "wasteland2" }, /area/ruin/jungle/starport) +"kR" = ( +/obj/machinery/atmospherics/pipe/simple/orange/hidden{ + dir = 4 + }, +/turf/open/floor/mineral/plastitanium, +/area/ruin/jungle/starport/plasma) "kS" = ( /obj/structure/rack, /obj/item/storage/box/lights/mixed, @@ -2465,6 +2496,12 @@ }, /turf/open/floor/plasteel/grimy, /area/ruin/jungle/starport) +"rx" = ( +/obj/structure/bed/pod, +/obj/structure/curtain, +/obj/machinery/light/directional/south, +/turf/open/floor/plasteel/grimy, +/area/ruin/jungle/starport) "ry" = ( /obj/structure/railing, /obj/structure/railing{ @@ -2587,9 +2624,7 @@ /turf/open/floor/wood, /area/ruin/jungle/starport) "si" = ( -/obj/structure/railing{ - dir = 2 - }, +/obj/structure/railing, /obj/effect/turf_decal/industrial/warning{ dir = 8 }, @@ -2609,15 +2644,6 @@ light_range = 2 }, /area/ruin/jungle/starport) -"su" = ( -/obj/structure/railing{ - dir = 2 - }, -/obj/structure/spacevine, -/turf/open/floor/concrete/slab_1{ - light_range = 2 - }, -/area/ruin/jungle/starport) "sv" = ( /obj/effect/decal/cleanable/shreds, /obj/structure/spacevine, @@ -3129,20 +3155,6 @@ icon_state = "wasteland2" }, /area/ruin/jungle/starport) -"vB" = ( -/mob/living/simple_animal/hostile/poison/giant_spider/hunter, -/obj/structure{ - desc = "A formerly deadly laser cannon, now stuck rusting on a fightercraft."; - dir = 8; - icon = 'icons/obj/turrets.dmi'; - icon_state = "syndie_off"; - name = "defunct laser cannon"; - pixel_x = 26 - }, -/turf/open/floor/concrete/slab_1{ - light_range = 2 - }, -/area/ruin/jungle/starport) "vD" = ( /obj/structure/cable{ icon_state = "1-2" @@ -4117,7 +4129,6 @@ /area/ruin/jungle/starport) "CW" = ( /obj/item/radio/intercom/directional/south, -/obj/machinery/light/broken/directional/south, /turf/open/floor/plating/rust, /area/ruin/jungle/starport) "CZ" = ( @@ -5211,7 +5222,6 @@ pixel_y = 24 }, /obj/item/stack/sheet/metal, -/obj/machinery/light/directional/north, /turf/open/floor/plasteel, /area/ruin/jungle/starport) "JT" = ( @@ -5293,6 +5303,13 @@ icon_state = "panelscorched" }, /area/ruin/jungle/starport) +"KH" = ( +/obj/structure/spider/stickyweb, +/obj/structure/cable{ + icon_state = "1-2" + }, +/turf/open/floor/plating/rust, +/area/ruin/jungle/starport) "KJ" = ( /obj/effect/turf_decal/borderfloor{ dir = 8 @@ -5514,7 +5531,6 @@ "Mh" = ( /obj/structure/table, /obj/item/radio/intercom/directional/south, -/obj/machinery/light/directional/south, /turf/open/floor/plasteel/grimy, /area/ruin/jungle/starport) "Mi" = ( @@ -5771,14 +5787,6 @@ /mob/living/simple_animal/hostile/poison/giant_spider/nurse/midwife, /turf/open/floor/plasteel, /area/ruin/jungle/starport) -"Op" = ( -/mob/living/simple_animal/hostile/poison/giant_spider/hunter/viper, -/obj/structure/spider/cocoon, -/obj/machinery/atmospherics/pipe/simple/orange/hidden{ - dir = 10 - }, -/turf/open/floor/plating, -/area/ruin/jungle/starport) "Ou" = ( /obj/structure/table, /obj/structure/spider/stickyweb, @@ -5790,9 +5798,7 @@ /turf/open/floor/mineral/plastitanium/red, /area/ruin/jungle/starport/tower) "Oz" = ( -/obj/effect/turf_decal/industrial/traffic/corner{ - dir = 2 - }, +/obj/effect/turf_decal/industrial/traffic/corner, /turf/open/floor/concrete{ light_range = 2 }, @@ -5915,6 +5921,12 @@ /obj/structure/chair, /turf/open/floor/mineral/plastitanium, /area/ruin/jungle/starport/tower) +"PB" = ( +/obj/structure/bed/pod, +/obj/structure/curtain, +/obj/machinery/light/broken/directional/north, +/turf/open/floor/plasteel/grimy, +/area/ruin/jungle/starport) "PC" = ( /obj/machinery/portable_atmospherics/canister/toxins, /obj/structure/window/plasma/reinforced{ @@ -6068,6 +6080,9 @@ /area/ruin/jungle/starport) "Qs" = ( /obj/machinery/light/directional/north, +/obj/machinery/atmospherics/pipe/simple/orange/hidden{ + dir = 10 + }, /turf/open/floor/mineral/plastitanium, /area/ruin/jungle/starport/plasma) "Qv" = ( @@ -6461,15 +6476,6 @@ light_range = 2 }, /area/ruin/jungle/starport) -"SN" = ( -/obj/structure/railing{ - dir = 2 - }, -/obj/structure/spacevine, -/turf/open/floor/plating/dirt/jungle{ - light_range = 2 - }, -/area/ruin/jungle/starport) "SQ" = ( /obj/structure/railing, /turf/open/floor/plasteel/stairs{ @@ -7358,7 +7364,6 @@ /obj/item/radio/intercom/directional/north{ pixel_y = 24 }, -/obj/machinery/light/broken/directional/north, /turf/open/floor/plasteel/grimy, /area/ruin/jungle/starport) "Yp" = ( @@ -7566,6 +7571,11 @@ light_range = 2 }, /area/ruin/jungle/starport) +"ZQ" = ( +/obj/structure/spider/stickyweb, +/obj/machinery/light/directional/north, +/turf/open/floor/plasteel, +/area/ruin/jungle/starport) "ZT" = ( /obj/structure/window/plasma/reinforced/plastitanium, /obj/machinery/door/poddoor{ @@ -8985,7 +8995,7 @@ XM cC zi QE -Op +ab Dm IL rm @@ -11067,7 +11077,7 @@ kf Xq iE QE -vB +ac Su OJ Tf @@ -11397,7 +11407,7 @@ QE iH gt xt -su +Bp XW Mr XM @@ -11540,7 +11550,7 @@ ma Hj XM TM -SN +mK Tf XM cC @@ -11617,7 +11627,7 @@ Am Xu XM TM -SN +mK RM eP Eb @@ -11983,11 +11993,11 @@ UE UE UE Lo -PJ -PJ +kR +kR hE -PJ -PJ +kR +kR Ft wi Tf @@ -13673,12 +13683,12 @@ UE UE UE Wo -wB +ZQ Ic Xz Xz rJ -mv +aa Bx yH qh @@ -13831,7 +13841,7 @@ Hs lo cO ra -AQ +KH cO qt kI @@ -14135,12 +14145,12 @@ UE UE UE Wo -SS +PB Mr kl rv Se -SS +rx Wo yH wg diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index 8071bec684b7..e8e6daccf45b 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -657,12 +657,13 @@ so as to remain in compliance with the most up-to-date laws." desc = "A body was created. You can enter it." icon_state = "template" timeout = 300 - var/atom/target = null + var/datum/weakref/target_ref var/action = NOTIFY_JUMP /atom/movable/screen/alert/notify_action/Click() if(!usr || !usr.client || usr != owner) return + var/atom/target = target_ref?.resolve() if(!target) return var/mob/dead/observer/G = usr diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index e376d823e7b7..5aa9e296f048 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -547,6 +547,7 @@ return TRUE +/// Called when an atom moves to a different virtual z. Warning, it will pass z-level 0 in new_virtual_z on creation and 0 in previous_virtual_z whenever moved to nullspace /atom/movable/proc/on_virtual_z_change(new_virtual_z, previous_virtual_z) SHOULD_NOT_SLEEP(TRUE) SHOULD_CALL_PARENT(TRUE) diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index 925936f70b6b..5ff7e03f2e7c 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -45,8 +45,10 @@ return ..() /obj/machinery/navbeacon/on_virtual_z_change(new_virtual_z, previous_virtual_z) - LAZYADDASSOC(GLOB.navbeacons, "[new_virtual_z]", src) - LAZYREMOVEASSOC(GLOB.navbeacons, "[previous_virtual_z]", src) + if(previous_virtual_z) + LAZYREMOVEASSOC(GLOB.navbeacons, "[previous_virtual_z]", src) + if(new_virtual_z) + LAZYADDASSOC(GLOB.navbeacons, "[new_virtual_z]", src) ..() // set the transponder codes assoc list from codes_txt diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 48e0eabe06e9..932708c7f35c 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -89,6 +89,8 @@ /obj/effect/decal/cleanable/wash(clean_types) ..() + if(!(flags_1 & INITIALIZED_1)) + return FALSE qdel(src) return TRUE diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 740d99ea1eb8..bce19cb91aec 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -626,7 +626,14 @@ if(AIStatus == togglestatus) return + GLOB.simple_animals[AIStatus] -= src + GLOB.simple_animals[togglestatus] += list(src) + AIStatus = togglestatus + var/virt_z = "[virtual_z()]" + if(!virt_z) + return + switch(togglestatus) if(AI_Z_OFF) LAZYADDASSOC(SSidlenpcpool.idle_mobs_by_virtual_level, virt_z, src) @@ -634,16 +641,14 @@ else LAZYREMOVEASSOC(SSidlenpcpool.idle_mobs_by_virtual_level, virt_z, src) - GLOB.simple_animals[AIStatus] -= src - GLOB.simple_animals[togglestatus] += list(src) - AIStatus = togglestatus - /mob/living/simple_animal/proc/check_should_sleep() if (pulledby || shouldwakeup) toggle_ai(AI_ON) return var/virt_z = "[virtual_z()]" + if(!virt_z) + return var/players_on_virtual_z = LAZYACCESS(SSmobs.players_by_virtual_z, virt_z) if(!length(players_on_virtual_z)) toggle_ai(AI_Z_OFF) @@ -658,6 +663,8 @@ /mob/living/simple_animal/on_virtual_z_change(new_virtual_z, previous_virtual_z) . = ..() + if(previous_virtual_z) + LAZYREMOVEASSOC(SSidlenpcpool.idle_mobs_by_virtual_level, "[previous_virtual_z]", src) toggle_ai(initial(AIStatus)) - LAZYREMOVEASSOC(SSidlenpcpool.idle_mobs_by_virtual_level, "[previous_virtual_z]", src) - check_should_sleep() + if(new_virtual_z) + check_should_sleep() diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 58334a8833dc..623f1959943f 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -403,7 +403,7 @@ A.name = header A.desc = message A.action = action - A.target = source + A.target_ref = WEAKREF(source) if(!alert_overlay) alert_overlay = new(source) alert_overlay.layer = FLOAT_LAYER diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 0b207c872f3c..c61cb133b40e 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -73,7 +73,8 @@ if (cell) QDEL_NULL(cell) STOP_PROCESSING(SSobj, src) - return ..() + . = ..() + ammo_type.Cut() /obj/item/gun/energy/handle_atom_del(atom/A) if(A == cell) diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index 53816bc176bc..f6a7bef186a8 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -154,7 +154,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) if(!QDELETED(A) && (A.loc == loc)) A.ConveyorMove(movedir) //Give this a chance to yield if the server is busy - stoplag() + CHECK_TICK conveying = FALSE // attack with item, place item on conveyor From 50d08a70c776016658ed9c14a57eb10933b8ea08 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 6 Aug 2023 20:36:56 -0500 Subject: [PATCH 129/147] Fixes pixelshift + more fixes --- .../mining_mobs/elites/goliath_broodmother.dm | 21 ++++++++++++++----- code/modules/pixelshifting/pixelshift.dm | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/goliath_broodmother.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/goliath_broodmother.dm index 28e8bc82ef71..91fdf286aae7 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/goliath_broodmother.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/goliath_broodmother.dm @@ -53,6 +53,10 @@ var/rand_tent = 0 var/list/mob/living/simple_animal/hostile/asteroid/elite/broodmother_child/children_list = list() +/mob/living/simple_animal/hostile/asteroid/elite/broodmother/Destroy() + children_list.Cut() + return ..() + /datum/action/innate/elite_attack/tentacle_patch name = "Tentacle Patch" button_icon_state = "tentacle_patch" @@ -128,11 +132,10 @@ for(var/i in 1 to 2) if(children_list.len >= 8) return - var/mob/living/simple_animal/hostile/asteroid/elite/broodmother_child/newchild = new /mob/living/simple_animal/hostile/asteroid/elite/broodmother_child(loc) + var/mob/living/simple_animal/hostile/asteroid/elite/broodmother_child/newchild = new /mob/living/simple_animal/hostile/asteroid/elite/broodmother_child(loc, src) newchild.GiveTarget(target) newchild.faction = faction.Copy() visible_message("[newchild] appears below [src]!") - newchild.mother = src children_list += newchild /mob/living/simple_animal/hostile/asteroid/elite/broodmother/proc/rage() @@ -186,7 +189,17 @@ guaranteed_butcher_results = list(/obj/item/stack/sheet/animalhide/goliath_hide = 1) deathmessage = "falls to the ground." status_flags = CANPUSH - var/mob/living/simple_animal/hostile/asteroid/elite/broodmother/mother = null + var/datum/weakref/mother_ref + +/mob/living/simple_animal/hostile/asteroid/elite/broodmother_child/Initialize(mapload, mob/living/simple_animal/hostile/asteroid/elite/broodmother/mother) + . = ..() + mother_ref = WEAKREF(mother) + +/mob/living/simple_animal/hostile/asteroid/elite/broodmother_child/Destroy() + var/mob/living/simple_animal/hostile/asteroid/elite/broodmother/mother = mother_ref?.resolve() + if(mother) + mother.children_list -= src + return ..() /mob/living/simple_animal/hostile/asteroid/elite/broodmother_child/OpenFire(target) ranged_cooldown = world.time + 40 @@ -199,8 +212,6 @@ /mob/living/simple_animal/hostile/asteroid/elite/broodmother_child/death() . = ..() - if(mother != null) - mother.children_list -= src visible_message("[src] explodes!") explosion(get_turf(loc),0,0,0,flame_range = 3, adminlog = FALSE) gib() diff --git a/code/modules/pixelshifting/pixelshift.dm b/code/modules/pixelshifting/pixelshift.dm index 2dbba6fa993b..491dcfd5c3c3 100644 --- a/code/modules/pixelshifting/pixelshift.dm +++ b/code/modules/pixelshifting/pixelshift.dm @@ -63,7 +63,7 @@ /mob/living/CanAllowThrough(atom/movable/mover, border_dir) // Make sure to not allow projectiles of any kind past where they normally wouldn't. - if(!istype(mover, /obj/projectile) && !mover.throwing && passthroughable & get_dir(src, border_dir)) + if(!istype(mover, /obj/projectile) && !mover.throwing && (passthroughable & border_dir)) return TRUE return ..() From e414985bb2f2d4b50454105305da1ef2994746db Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 6 Aug 2023 20:46:34 -0500 Subject: [PATCH 130/147] Reverts docking port changes (oops) --- _maps/shuttles/shiptest/independent_nemo.dmm | 2 +- _maps/shuttles/shiptest/independent_scav.dmm | 3 +-- _maps/shuttles/shiptest/minutemen_asclepius.dmm | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/_maps/shuttles/shiptest/independent_nemo.dmm b/_maps/shuttles/shiptest/independent_nemo.dmm index f0a2a8680c4f..3360e4849c90 100644 --- a/_maps/shuttles/shiptest/independent_nemo.dmm +++ b/_maps/shuttles/shiptest/independent_nemo.dmm @@ -3133,7 +3133,7 @@ }, /obj/docking_port/mobile{ callTime = 250; - dir = 8; + dir = 4; launch_status = 0; name = "Fauna Research Ship"; preferred_direction = 4; diff --git a/_maps/shuttles/shiptest/independent_scav.dmm b/_maps/shuttles/shiptest/independent_scav.dmm index 49793eff70b6..880634f50427 100644 --- a/_maps/shuttles/shiptest/independent_scav.dmm +++ b/_maps/shuttles/shiptest/independent_scav.dmm @@ -833,8 +833,7 @@ can_move_docking_ports = 1; dir = 8; launch_status = 0; - preferred_direction = 4; - port_direction = 2 + preferred_direction = 4 }, /obj/effect/decal/cleanable/dirt/dust, /turf/open/floor/plating, diff --git a/_maps/shuttles/shiptest/minutemen_asclepius.dmm b/_maps/shuttles/shiptest/minutemen_asclepius.dmm index 78af992e8d95..f36449b59e5c 100644 --- a/_maps/shuttles/shiptest/minutemen_asclepius.dmm +++ b/_maps/shuttles/shiptest/minutemen_asclepius.dmm @@ -2796,7 +2796,7 @@ /obj/docking_port/mobile{ can_move_docking_ports = 1; launch_status = 0; - port_direction = 8; + port_direction = 4; preferred_direction = 4 }, /turf/open/floor/plasteel/tech/grid, From ed6d3656c42da455da111ac38efb8c291f664efa Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 6 Aug 2023 23:32:46 -0500 Subject: [PATCH 131/147] Silences this rare spurious error --- code/modules/atmospherics/environmental/LINDA_turf_tile.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index 3d1e1e46602f..f28a9a898588 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -184,7 +184,9 @@ /turf/proc/process_cell(fire_count) /turf/open/proc/equalize_pressure_in_zone(cyclenum) -/turf/open/proc/consider_firelocks(turf/T2) + +/turf/proc/consider_firelocks(turf/T2) //TODO: Find out why this sometimes gets called. Possibly to do with atmos adjacency not being updated in auxmos? +/turf/open/consider_firelocks(turf/T2) if(blocks_air) return for(var/obj/machinery/airalarm/alarm in src) From 79e3a347681b02c4f2ab58f37161ed0c3a16a7d0 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Mon, 7 Aug 2023 15:54:40 -0500 Subject: [PATCH 132/147] ree --- .../whitesands_surface_youreinsane.dmm | 463 +++++------------- 1 file changed, 115 insertions(+), 348 deletions(-) diff --git a/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm b/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm index 2a8bed8bbea5..4ea2350301d7 100644 --- a/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm +++ b/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm @@ -1,150 +1,83 @@ //MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE -"aa" = ( +"a" = ( /turf/template_noop, /area/template_noop) -"ab" = ( -/turf/open/floor/plating{ - icon_state = "panelscorched"; - initial_gas_mix = "ws_atmos" - }, -/area/whitesands/surface/outdoors) -"ac" = ( -/obj/effect/spawner/structure/window/plasma/reinforced, -/turf/open/floor/plating{ - initial_gas_mix = "ws_atmos" - }, -/area/whitesands/surface/outdoors) -"ad" = ( -/obj/effect/decal/cleanable/dirt, +"b" = ( /turf/open/floor/plating{ icon_state = "panelscorched"; initial_gas_mix = "ws_atmos" }, /area/ruin/unpowered) -"ae" = ( +"c" = ( +/obj/effect/spawner/structure/window/plasma/reinforced, /turf/open/floor/plating{ - icon_state = "panelscorched"; initial_gas_mix = "ws_atmos" }, /area/ruin/unpowered) -"af" = ( +"f" = ( /turf/open/floor/plating/asteroid/whitesands, -/area/whitesands/surface/outdoors) -"ag" = ( +/area/ruin/unpowered) +"g" = ( /obj/effect/turf_decal/industrial/outline/yellow{ dir = 1 }, /turf/open/floor/plasteel/dark, -/area/whitesands/surface/outdoors) -"ah" = ( -/obj/machinery/door/airlock/engineering/glass/critical{ - heat_proof = 1; - name = "Supermatter Chamber"; - req_access_txt = "10"; - dir = 4 - }, -/turf/open/floor/plating{ - icon_state = "platingdmg2"; - initial_gas_mix = "ws_atmos" - }, /area/ruin/unpowered) -"ai" = ( +"i" = ( /obj/effect/decal/cleanable/greenglow, /obj/item/disk/plantgene, /turf/open/floor/plating{ icon_state = "platingdmg2"; initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aj" = ( +/area/ruin/unpowered) +"j" = ( /obj/machinery/atmospherics/pipe/simple/general/visible{ dir = 10 }, /turf/closed/wall/r_wall, -/area/whitesands/surface/outdoors) -"ak" = ( +/area/ruin/unpowered) +"k" = ( /obj/structure/window/plasma/reinforced, /obj/machinery/power/rad_collector/anchored, /obj/machinery/atmospherics/pipe/simple/general/visible{ dir = 10 }, /turf/open/floor/plating/asteroid/whitesands, -/area/whitesands/surface/outdoors) -"al" = ( -/obj/structure/girder, -/turf/open/floor/plating{ - initial_gas_mix = "ws_atmos" - }, /area/ruin/unpowered) -"am" = ( -/obj/machinery/door/airlock/engineering/glass/critical{ - heat_proof = 1; - name = "Supermatter Chamber"; - req_access_txt = "10"; - dir = 4 - }, -/turf/open/floor/engine, -/area/ruin/unpowered) -"an" = ( +"n" = ( /obj/effect/decal/cleanable/dirt, /turf/open/floor/plating{ icon_state = "panelscorched"; initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"ao" = ( -/obj/machinery/atmospherics/pipe/simple/general/visible{ - dir = 10 - }, -/turf/closed/wall/r_wall, /area/ruin/unpowered) -"ap" = ( -/obj/effect/turf_decal/industrial/outline/yellow{ - dir = 1 - }, -/turf/open/floor/plasteel/dark, -/area/ruin/unpowered) -"aq" = ( -/obj/effect/decal/cleanable/dirt, -/turf/open/floor/engine, -/area/ruin/unpowered) -"ar" = ( +"r" = ( /obj/machinery/atmospherics/components/unary/vent_scrubber/on, /obj/effect/decal/cleanable/dirt, /turf/open/floor/engine, -/area/whitesands/surface/outdoors) -"as" = ( +/area/ruin/unpowered) +"s" = ( /obj/effect/turf_decal/industrial/outline/yellow{ dir = 1 }, /obj/machinery/portable_atmospherics/canister/nitrogen, /turf/open/floor/plasteel/dark, -/area/whitesands/surface/outdoors) -"at" = ( +/area/ruin/unpowered) +"t" = ( /obj/machinery/atmospherics/components/unary/vent_scrubber/on, /turf/open/floor/engine, -/area/whitesands/surface/outdoors) -"au" = ( +/area/ruin/unpowered) +"u" = ( /obj/machinery/atmospherics/pipe/simple/general/visible{ dir = 9 }, /turf/closed/wall/r_wall, -/area/whitesands/surface/outdoors) -"av" = ( -/obj/structure/window/plasma/reinforced{ - dir = 1 - }, -/obj/machinery/power/rad_collector/anchored, -/obj/machinery/atmospherics/pipe/manifold/general/visible, -/turf/open/floor/plating{ - icon_state = "platingdmg1"; - initial_gas_mix = "ws_atmos" - }, /area/ruin/unpowered) -"aw" = ( +"w" = ( /turf/closed/wall/r_wall, -/area/whitesands/surface/outdoors) -"ax" = ( +/area/ruin/unpowered) +"x" = ( /obj/effect/mob_spawn/human/engineer{ gender = "female"; mob_species = null @@ -156,60 +89,30 @@ }, /obj/item/geiger_counter, /turf/open/floor/engine, -/area/whitesands/surface/outdoors) -"ay" = ( -/turf/open/floor/plating/asteroid/whitesands, /area/ruin/unpowered) -"az" = ( +"z" = ( /obj/effect/decal/cleanable/dirt, /turf/open/floor/plating{ initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aA" = ( -/obj/effect/turf_decal/industrial/hatch/yellow, -/obj/effect/decal/cleanable/dirt, -/turf/open/floor/plasteel/dark, /area/ruin/unpowered) -"aB" = ( +"B" = ( /obj/effect/turf_decal/industrial/hatch/yellow, /obj/effect/decal/cleanable/dirt, /turf/open/floor/plasteel/dark, -/area/whitesands/surface/outdoors) -"aC" = ( +/area/ruin/unpowered) +"C" = ( /obj/effect/decal/cleanable/dirt, /turf/open/floor/engine, -/area/whitesands/surface/outdoors) -"aD" = ( -/obj/machinery/atmospherics/components/binary/pump{ - dir = 8 - }, -/turf/open/floor/plating{ - icon_state = "platingdmg2"; - initial_gas_mix = "ws_atmos" - }, /area/ruin/unpowered) -"aE" = ( +"E" = ( /obj/effect/decal/cleanable/greenglow, /obj/effect/decal/cleanable/dirt, /turf/open/floor/plating{ initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aF" = ( -/obj/structure/window/plasma/reinforced{ - dir = 1 - }, -/obj/structure/frame/machine, -/obj/machinery/atmospherics/pipe/simple/general/visible{ - dir = 9 - }, -/turf/open/floor/plating{ - icon_state = "platingdmg2"; - initial_gas_mix = "ws_atmos" - }, /area/ruin/unpowered) -"aG" = ( +"G" = ( /obj/machinery/atmospherics/components/binary/pump{ dir = 8 }, @@ -217,21 +120,21 @@ icon_state = "platingdmg2"; initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aH" = ( +/area/ruin/unpowered) +"H" = ( /obj/structure/girder/displaced, /turf/open/floor/plating{ initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aI" = ( +/area/ruin/unpowered) +"I" = ( /obj/machinery/atmospherics/components/unary/vent_pump/on{ dir = 1 }, /obj/effect/decal/cleanable/dirt, /turf/open/floor/engine, -/area/whitesands/surface/outdoors) -"aJ" = ( +/area/ruin/unpowered) +"J" = ( /obj/structure/window/plasma/reinforced{ dir = 1 }, @@ -246,13 +149,8 @@ icon_state = "platingdmg2"; initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aK" = ( -/obj/machinery/atmospherics/components/unary/vent_scrubber/on, -/obj/effect/decal/cleanable/dirt, -/turf/open/floor/engine, /area/ruin/unpowered) -"aL" = ( +"L" = ( /obj/structure/window/plasma/reinforced{ dir = 1 }, @@ -262,29 +160,8 @@ icon_state = "platingdmg1"; initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aM" = ( -/obj/structure/girder/displaced, -/turf/open/floor/plating{ - initial_gas_mix = "ws_atmos" - }, /area/ruin/unpowered) -"aN" = ( -/turf/closed/wall/r_wall, -/area/ruin/unpowered) -"aO" = ( -/obj/machinery/atmospherics/components/unary/vent_scrubber/on, -/turf/open/floor/engine, -/area/ruin/unpowered) -"aP" = ( -/obj/structure/window/plasma/reinforced{ - dir = 1 - }, -/obj/structure/frame/machine, -/obj/machinery/atmospherics/pipe/manifold/general/visible, -/turf/open/floor/engine, -/area/ruin/unpowered) -"aQ" = ( +"Q" = ( /obj/machinery/atmospherics/pipe/simple/general/visible{ dir = 6 }, @@ -292,8 +169,8 @@ /turf/open/floor/plating{ initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aR" = ( +/area/ruin/unpowered) +"R" = ( /obj/structure/window/plasma/reinforced, /obj/machinery/power/rad_collector/anchored, /obj/machinery/atmospherics/pipe/manifold/general/visible{ @@ -303,40 +180,27 @@ icon_state = "platingdmg2"; initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aS" = ( +/area/ruin/unpowered) +"S" = ( /turf/open/floor/plating{ initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aT" = ( +/area/ruin/unpowered) +"T" = ( /obj/structure/window/plasma/reinforced{ dir = 1 }, /obj/structure/frame/machine, /obj/machinery/atmospherics/pipe/manifold/general/visible, /turf/open/floor/engine, -/area/whitesands/surface/outdoors) -"aU" = ( -/obj/effect/mob_spawn/human/engineer{ - gender = "female"; - mob_species = null - }, -/obj/item/clothing/suit/radiation, -/obj/item/clothing/head/radiation{ - pixel_x = -1; - pixel_y = 9 - }, -/obj/item/geiger_counter, -/turf/open/floor/engine, /area/ruin/unpowered) -"aV" = ( +"V" = ( /turf/open/floor/plating{ icon_state = "platingdmg1"; initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aW" = ( +/area/ruin/unpowered) +"W" = ( /obj/machinery/door/airlock/engineering/glass/critical{ heat_proof = 1; name = "Supermatter Chamber"; @@ -347,14 +211,14 @@ icon_state = "platingdmg2"; initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aX" = ( +/area/ruin/unpowered) +"X" = ( /obj/structure/girder, /turf/open/floor/plating{ initial_gas_mix = "ws_atmos" }, -/area/whitesands/surface/outdoors) -"aY" = ( +/area/ruin/unpowered) +"Y" = ( /obj/machinery/door/airlock/engineering/glass/critical{ heat_proof = 1; name = "Supermatter Chamber"; @@ -362,19 +226,8 @@ dir = 4 }, /turf/open/floor/engine, -/area/whitesands/surface/outdoors) -"aZ" = ( -/obj/structure/window/plasma/reinforced, -/obj/structure/frame/machine, -/obj/machinery/atmospherics/pipe/manifold/general/visible{ - dir = 1 - }, -/turf/open/floor/plating{ - icon_state = "platingdmg1"; - initial_gas_mix = "ws_atmos" - }, -/area/whitesands/surface/outdoors) -"en" = ( +/area/ruin/unpowered) +"Z" = ( /obj/structure/window/plasma/reinforced, /obj/structure/frame/machine, /obj/machinery/atmospherics/pipe/manifold/general/visible{ @@ -385,167 +238,81 @@ initial_gas_mix = "ws_atmos" }, /area/ruin/unpowered) -"iq" = ( -/obj/machinery/atmospherics/pipe/simple/general/visible{ - dir = 6 - }, -/obj/structure/girder, -/turf/open/floor/plating{ - initial_gas_mix = "ws_atmos" - }, -/area/ruin/unpowered) -"iX" = ( -/turf/open/floor/plating{ - initial_gas_mix = "ws_atmos" - }, -/area/ruin/unpowered) -"tt" = ( -/obj/structure/window/plasma/reinforced, -/obj/machinery/power/rad_collector/anchored, -/obj/machinery/atmospherics/pipe/simple/general/visible{ - dir = 10 - }, -/turf/open/floor/plating/asteroid/whitesands, -/area/ruin/unpowered) -"uB" = ( -/obj/effect/spawner/structure/window/plasma/reinforced, -/turf/open/floor/plating{ - initial_gas_mix = "ws_atmos" - }, -/area/ruin/unpowered) -"uW" = ( -/obj/machinery/atmospherics/components/unary/vent_pump/on{ - dir = 1 - }, -/obj/effect/decal/cleanable/dirt, -/turf/open/floor/engine, -/area/ruin/unpowered) -"yJ" = ( -/obj/effect/turf_decal/industrial/outline/yellow{ - dir = 1 - }, -/obj/machinery/portable_atmospherics/canister/nitrogen, -/turf/open/floor/plasteel/dark, -/area/ruin/unpowered) -"zg" = ( -/obj/effect/decal/cleanable/greenglow, -/obj/item/disk/plantgene, -/turf/open/floor/plating{ - icon_state = "platingdmg2"; - initial_gas_mix = "ws_atmos" - }, -/area/ruin/unpowered) -"zi" = ( -/obj/effect/decal/cleanable/greenglow, -/obj/effect/decal/cleanable/dirt, -/turf/open/floor/plating{ - initial_gas_mix = "ws_atmos" - }, -/area/ruin/unpowered) -"OV" = ( -/turf/open/floor/plating{ - icon_state = "platingdmg1"; - initial_gas_mix = "ws_atmos" - }, -/area/ruin/unpowered) -"SY" = ( -/obj/machinery/atmospherics/pipe/simple/general/visible{ - dir = 9 - }, -/turf/closed/wall/r_wall, -/area/ruin/unpowered) -"UQ" = ( -/obj/structure/window/plasma/reinforced, -/obj/machinery/power/rad_collector/anchored, -/obj/machinery/atmospherics/pipe/manifold/general/visible{ - dir = 1 - }, -/turf/open/floor/plating{ - icon_state = "platingdmg2"; - initial_gas_mix = "ws_atmos" - }, -/area/ruin/unpowered) -"Zv" = ( -/obj/effect/decal/cleanable/dirt, -/turf/open/floor/plating{ - initial_gas_mix = "ws_atmos" - }, -/area/ruin/unpowered) (1,1,1) = {" -aa -Zv -al -aN -ah -aN -aM -aA -aa +a +z +X +w +W +w +H +B +a "} (2,1,1) = {" -yJ -Zv -aN -Zv -aU -aD -aN -ap -aa +s +z +w +z +x +G +w +g +a "} (3,1,1) = {" -aN -al -iq -SY -am -ao -aN -aN -aN +w +X +Q +u +Y +j +w +w +w "} (4,1,1) = {" -aa -OV -UQ -uW -zg -aK -av -ay -aa +a +V +R +I +i +r +L +f +a "} (5,1,1) = {" -aa -Zv -en -uW -zi -aK -aP -ad -ae +a +z +Z +I +E +r +T +n +b "} (6,1,1) = {" -iX -iX -tt -uW -aq -aO -aF -aq -aa +S +S +k +I +C +t +J +C +a "} (7,1,1) = {" -al -aN -aN -aN -uB -aN -aN -al -aN +X +w +w +w +c +w +w +X +w "} From 7dc0fdcb02c06fee68a50e560cdc50fe88c6a788 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Mon, 7 Aug 2023 16:52:16 -0500 Subject: [PATCH 133/147] atmos fixes to hopefully not qdel the blasted vodka --- code/modules/mapping/map_template.dm | 1 + code/modules/shuttle/docking.dm | 2 ++ 2 files changed, 3 insertions(+) diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 57ffb011c438..39d443929e21 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -149,6 +149,7 @@ for(var/turf/turf_to_disable as anything in border) turf_to_disable.blocks_air = TRUE turf_to_disable.set_sleeping(TRUE) + turf_to_disable.air_update_turf(TRUE) // Accept cached maps, but don't save them automatically - we don't want // ruins clogging up memory for the whole round. diff --git a/code/modules/shuttle/docking.dm b/code/modules/shuttle/docking.dm index 64b20d8a2eeb..ec0727a2cc24 100644 --- a/code/modules/shuttle/docking.dm +++ b/code/modules/shuttle/docking.dm @@ -97,9 +97,11 @@ for(var/turf/oldT as anything in old_turfs) oldT.blocks_air = TRUE oldT.set_sleeping(TRUE) + oldT.air_update_turf(TRUE) for(var/turf/newT as anything in new_turfs) newT.blocks_air = TRUE newT.set_sleeping(TRUE) + newT.air_update_turf(TRUE) /obj/docking_port/mobile/proc/throw_exception(exception/e) throw e From 335e28a0c6ffd9c6c6b7f482b5ecd85196c3d9b4 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 8 Aug 2023 17:58:05 -0500 Subject: [PATCH 134/147] fixes doubled pipe and other assorted runtimes, parrot gc redo --- .../SandRuins/whitesands_surface_youreinsane.dmm | 14 ++++++++------ code/game/objects/effects/spiders.dm | 1 + .../machinery/components/components_base.dm | 3 +++ code/modules/mob/living/carbon/life.dm | 6 +++++- code/modules/mob/living/simple_animal/parrot.dm | 12 ++++++++++++ 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm b/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm index 4ea2350301d7..e8932e8b51ed 100644 --- a/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm +++ b/_maps/RandomRuins/SandRuins/whitesands_surface_youreinsane.dmm @@ -79,8 +79,7 @@ /area/ruin/unpowered) "x" = ( /obj/effect/mob_spawn/human/engineer{ - gender = "female"; - mob_species = null + gender = "female" }, /obj/item/clothing/suit/radiation, /obj/item/clothing/head/radiation{ @@ -90,6 +89,12 @@ /obj/item/geiger_counter, /turf/open/floor/engine, /area/ruin/unpowered) +"y" = ( +/obj/machinery/atmospherics/pipe/simple/general/visible{ + dir = 5 + }, +/turf/closed/wall/r_wall, +/area/ruin/unpowered) "z" = ( /obj/effect/decal/cleanable/dirt, /turf/open/floor/plating{ @@ -139,9 +144,6 @@ dir = 1 }, /obj/structure/frame/machine, -/obj/machinery/atmospherics/pipe/simple/general/visible{ - dir = 9 - }, /obj/machinery/atmospherics/pipe/simple/general/visible{ dir = 9 }, @@ -268,7 +270,7 @@ Q u Y j -w +y w w "} diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index a6544881ade5..b1134e471d03 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -119,6 +119,7 @@ /obj/structure/spider/spiderling/Destroy() new/obj/item/reagent_containers/food/snacks/spiderling(get_turf(src)) + walk(src, 0) //Clean up reference for pathing . = ..() /obj/structure/spider/spiderling/Initialize() diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index beb4be56ac8c..2569d4795845 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -136,6 +136,9 @@ /obj/machinery/atmospherics/components/setPipenet(datum/pipeline/reference, obj/machinery/atmospherics/connection) var/connection_index = nodes.Find(connection) + if(!connection_index) + message_admins("Doubled pipe found at [ADMIN_VERBOSEJMP(connection)]! Please report to mappers.") //This will cascade into even more errors. Sorry! + CRASH("Doubled pipe found, causing an error in setPipenet") var/list/datum/pipeline/to_replace = parents[connection_index] //Some references to clean up if it isn't empty if(to_replace) diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index feaf0973c9c9..0fc21db37d8c 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -8,6 +8,10 @@ damageoverlaytemp = 0 update_damage_hud() + //Just don't run if we're qdeleted already + if(QDELETED(src)) + return ..() + if(!IS_IN_STASIS(src)) //Reagent processing needs to come before breathing, to prevent edge cases. @@ -15,7 +19,7 @@ . = ..() - if (QDELETED(src)) + if(QDELETED(src)) return if(.) //not dead diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index e12876388d54..d63c300e8ba6 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -122,6 +122,18 @@ /mob/living/simple_animal/parrot/proc/perch_mob_player)) +/mob/living/simple_animal/parrot/Destroy() + walk(src, 0) + if(ears) + QDEL_NULL(ears) + if(held_item) + QDEL_NULL(held_item) + + set_perch(null) + set_interest(null) + + return ..() + /mob/living/simple_animal/parrot/examine(mob/user) . = ..() if(stat) From f299bbed23bbf5c039bd9c2e3f6d23c3ea4da401 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 8 Aug 2023 18:04:36 -0500 Subject: [PATCH 135/147] makes sure there's no refs to hostile mobs from walk() --- code/modules/mob/living/simple_animal/hostile/hostile.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index e77a3735de49..106c9ad54f60 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -75,6 +75,7 @@ /mob/living/simple_animal/hostile/Destroy() //We can't use losetarget here because fucking cursed blobs override it to do nothing the motherfuckers GiveTarget(null) + walk(src, 0) return ..() /mob/living/simple_animal/hostile/Life() From 76caa3ced4400917494fac0e7aa188b08ed4c0f8 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 9 Aug 2023 17:58:28 -0500 Subject: [PATCH 136/147] mapzone gc fix --- code/datums/map_zones.dm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/code/datums/map_zones.dm b/code/datums/map_zones.dm index 3c8f25f1ff3a..5fef5d995121 100644 --- a/code/datums/map_zones.dm +++ b/code/datums/map_zones.dm @@ -32,8 +32,7 @@ /datum/map_zone/Destroy() SSmapping.map_zones -= src QDEL_NULL(weather_controller) - for(var/datum/virtual_level/vlevel as anything in virtual_levels) - qdel(vlevel) + QDEL_LIST(virtual_levels) return ..() /// Clears all of what's inside the virtual levels managed by the mapzone. @@ -411,10 +410,18 @@ for(var/dir in crosslinked) if(crosslinked[dir]) //Because it could be linking with itself unlink(dir) - var/datum/space_level/level = SSmapping.z_list[z_value] - level.virtual_levels -= src + parent_level.virtual_levels -= src + parent_level = null + LAZYCLEARLIST(SSidlenpcpool.idle_mobs_by_virtual_level["[id]"]) + SSidlenpcpool.idle_mobs_by_virtual_level["[id]"] = null SSmapping.virtual_z_translation -= "[id]" parent_map_zone.remove_virtual_level(src) + if(up_linkage) + up_linkage.down_linkage = null + up_linkage = null + if(down_linkage) + down_linkage.up_linkage = null + down_linkage = null return ..() /datum/virtual_level/proc/mark_turfs() @@ -448,6 +455,7 @@ var/area/old_area = get_area(turf) space_area.contents += turf turf.change_area(old_area, space_area) + turf.virtual_z = 0 CHECK_TICK for(var/turf/turf as anything in block_turfs) From 5047976fa687765831402fed088cb5de135ea687 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 10 Aug 2023 00:53:12 -0500 Subject: [PATCH 137/147] more tweaks --- code/datums/components/pellet_cloud.dm | 12 ++++++------ code/modules/food_and_drinks/drinks/drinks.dm | 2 +- code/modules/overmap/helm.dm | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/datums/components/pellet_cloud.dm b/code/datums/components/pellet_cloud.dm index be6326991e4c..b805b27c97e7 100644 --- a/code/datums/components/pellet_cloud.dm +++ b/code/datums/components/pellet_cloud.dm @@ -157,7 +157,7 @@ pellet_delta += radius * self_harm_radius_mult for(var/i in 1 to radius * self_harm_radius_mult) pew(body) // free shrapnel if it goes off in your hand, and it doesn't even count towards the absorbed. fun! - else if(!(body in bodies)) + else if(!(LAZYISIN(bodies, body))) martyrs += body // promoted from a corpse to a hero for(var/M in martyrs) @@ -267,13 +267,13 @@ /// Our grenade has moved, reset var/list/bodies so we're "on top" of any mobs currently on the tile /datum/component/pellet_cloud/proc/grenade_moved() LAZYCLEARLIST(bodies) - for(var/mob/living/L in get_turf(parent)) - RegisterSignal(L, COMSIG_PARENT_QDELETING, .proc/on_target_qdel, override=TRUE) - bodies += L + for(var/mob/living/new_mob in get_turf(parent)) + RegisterSignal(new_mob, COMSIG_PARENT_QDELETING, .proc/on_target_qdel, override=TRUE) + LAZYADD(bodies, new_mob) /// Someone who was originally "under" the grenade has moved off the tile and is now eligible for being a martyr and "covering" it /datum/component/pellet_cloud/proc/grenade_uncrossed(datum/source, atom/movable/AM, direction) - bodies -= AM + LAZYREMOVE(bodies, AM) /// Our grenade or landmine or caseless shell or whatever tried deleting itself, so we intervene and nullspace it until we're done here /datum/component/pellet_cloud/proc/nullspace_parent() @@ -286,5 +286,5 @@ /datum/component/pellet_cloud/proc/on_target_qdel(atom/target) UnregisterSignal(target, COMSIG_PARENT_QDELETING) targets_hit -= target - bodies -= target + LAZYREMOVE(target, bodies) purple_hearts -= target diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 41b2d4f3b78f..57849b9c43b1 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -123,7 +123,7 @@ /obj/item/reagent_containers/food/drinks/proc/smash(atom/target, mob/thrower, ranged = FALSE) if(!isGlass) return - if(QDELING(src) || !target) //Invalid loc + if(QDELING(src) || !target || !(flags_1 & INITIALIZED_1)) //Invalid loc return if(bartender_check(target) && ranged) return diff --git a/code/modules/overmap/helm.dm b/code/modules/overmap/helm.dm index dee18633f12e..508e031a200a 100644 --- a/code/modules/overmap/helm.dm +++ b/code/modules/overmap/helm.dm @@ -183,7 +183,7 @@ //Detect any ships in this location we can dock to if(istype(object)) - for(var/obj/docking_port/stationary/docking_port in object.shuttle_port.docking_points) + for(var/obj/docking_port/stationary/docking_port as anything in object.shuttle_port.docking_points) if(current_ship.shuttle_port.check_dock(docking_port, silent = TRUE)) available_dock = TRUE break From ce241ee993bbe8384a850c65dee3d526397095ba Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 10 Aug 2023 20:27:29 -0500 Subject: [PATCH 138/147] oops --- check_regex.yaml | 2 +- code/controllers/subsystem/idlenpcpool.dm | 2 +- code/datums/map_zones.dm | 1 - tools/merge-upstream-pull-request.sh | 10 +++++----- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/check_regex.yaml b/check_regex.yaml index bd612289c160..a612fa83cbf2 100644 --- a/check_regex.yaml +++ b/check_regex.yaml @@ -44,7 +44,7 @@ standards: ] - exactly: [0, "incorrect indentations", '^(?: +)(?!\*)'] - exactly: [0, "superflous whitespace", '[ \t]+$'] - - exactly: [12, "mixed indentation", '^( +\t+|\t+ +)'] + - exactly: [4, "mixed indentation", '^( +\t+|\t+ +)'] - exactly: [21, 'padding inside parentheses', '\(([\t ]+([^)"\n\\]*)|([^("\n]+)[\t ]+)\)'] - no_more: diff --git a/code/controllers/subsystem/idlenpcpool.dm b/code/controllers/subsystem/idlenpcpool.dm index bce3f2ced7c2..5c8bb49ab765 100644 --- a/code/controllers/subsystem/idlenpcpool.dm +++ b/code/controllers/subsystem/idlenpcpool.dm @@ -6,7 +6,7 @@ SUBSYSTEM_DEF(idlenpcpool) runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME var/list/currentrun = list() - var/list/idle_mobs_by_virtual_level = list() + var/list/list/idle_mobs_by_virtual_level = list() /datum/controller/subsystem/idlenpcpool/stat_entry(msg) var/list/idlelist = GLOB.simple_animals[AI_IDLE] diff --git a/code/datums/map_zones.dm b/code/datums/map_zones.dm index 5fef5d995121..b0f13fe19302 100644 --- a/code/datums/map_zones.dm +++ b/code/datums/map_zones.dm @@ -412,7 +412,6 @@ unlink(dir) parent_level.virtual_levels -= src parent_level = null - LAZYCLEARLIST(SSidlenpcpool.idle_mobs_by_virtual_level["[id]"]) SSidlenpcpool.idle_mobs_by_virtual_level["[id]"] = null SSmapping.virtual_z_translation -= "[id]" parent_map_zone.remove_virtual_level(src) diff --git a/tools/merge-upstream-pull-request.sh b/tools/merge-upstream-pull-request.sh index 5ec04fce74ea..9f809c47217d 100644 --- a/tools/merge-upstream-pull-request.sh +++ b/tools/merge-upstream-pull-request.sh @@ -82,11 +82,11 @@ if echo "$CHERRY_PICK_OUTPUT" | grep -i 'error: mainline was specified but commi echo "Commit was a squash, retrying" if containsElement "$MERGE_SHA" "${COMMITS[@]}"; then for commit in $COMMITS; do - echo "Cherry-picking: $commit" - git -c core.editor=true cherry-pick "$commit" - # Add all files onto this branch - git add -A . - git -c core.editor=true cherry-pick --continue + echo "Cherry-picking: $commit" + git -c core.editor=true cherry-pick "$commit" + # Add all files onto this branch + git add -A . + git -c core.editor=true cherry-pick --continue done else echo "Cherry-picking: $MERGE_SHA" From c9d1a40bb6725db05051133974c5faa86d6ba8de Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 10 Aug 2023 21:35:12 -0500 Subject: [PATCH 139/147] whar --- tools/tgs_scripts/InstallDeps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/tgs_scripts/InstallDeps.sh b/tools/tgs_scripts/InstallDeps.sh index 140c1485c7ae..c1704df9f4b3 100755 --- a/tools/tgs_scripts/InstallDeps.sh +++ b/tools/tgs_scripts/InstallDeps.sh @@ -18,11 +18,11 @@ if ! ( [ -x "$has_git" ] && [ -x "$has_grep" ] && [ -x "$has_curl" ] && [ -f "/ if ! [ -x "$has_sudo" ]; then dpkg --add-architecture i386 apt-get update - apt-get install -y build-essential g++-multilib libc6-i386 libstdc++6:i386 lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl grep + apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl grep else sudo dpkg --add-architecture i386 sudo apt-get update - sudo apt-get install -y build-essential g++-multilib libc6-i386 libstdc++6:i386 lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl grep + sudo apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl grep fi fi From 7b2915a5ca1f487157be0b0a12b11cab33264555 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 13 Sep 2023 14:09:06 -0500 Subject: [PATCH 140/147] Fixes --- _maps/outpost/outpost_test_2.dmm | 2 +- tools/tgs_scripts/InstallDeps.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_maps/outpost/outpost_test_2.dmm b/_maps/outpost/outpost_test_2.dmm index 7cca0bc2b366..3dab58add4c0 100644 --- a/_maps/outpost/outpost_test_2.dmm +++ b/_maps/outpost/outpost_test_2.dmm @@ -12676,7 +12676,7 @@ }, /area/outpost/maintenance/fore) "SO" = ( -/obj/machinery/photocopier/nt{ +/obj/machinery/photocopier{ pixel_y = 3 }, /obj/effect/decal/cleanable/dirt, diff --git a/tools/tgs_scripts/InstallDeps.sh b/tools/tgs_scripts/InstallDeps.sh index c1704df9f4b3..140c1485c7ae 100755 --- a/tools/tgs_scripts/InstallDeps.sh +++ b/tools/tgs_scripts/InstallDeps.sh @@ -18,11 +18,11 @@ if ! ( [ -x "$has_git" ] && [ -x "$has_grep" ] && [ -x "$has_curl" ] && [ -f "/ if ! [ -x "$has_sudo" ]; then dpkg --add-architecture i386 apt-get update - apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl grep + apt-get install -y build-essential g++-multilib libc6-i386 libstdc++6:i386 lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl grep else sudo dpkg --add-architecture i386 sudo apt-get update - sudo apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl grep + sudo apt-get install -y build-essential g++-multilib libc6-i386 libstdc++6:i386 lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl grep fi fi From 05bc88d3cada265956f5bb3c874ca492878b6f0d Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Wed, 13 Sep 2023 15:32:24 -0500 Subject: [PATCH 141/147] whar --- code/modules/antagonists/blob/structures/core.dm | 8 ++++---- tools/tgs_scripts/PreCompile.sh | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/code/modules/antagonists/blob/structures/core.dm b/code/modules/antagonists/blob/structures/core.dm index ebebdc336676..6a1ccb1dd465 100644 --- a/code/modules/antagonists/blob/structures/core.dm +++ b/code/modules/antagonists/blob/structures/core.dm @@ -21,8 +21,9 @@ update_appearance() . = ..() -/obj/structure/blob/special/core/Destroy() +/obj/structure/blob/core/Destroy() GLOB.blob_cores -= src + GLOB.poi_list -= src if(overmind) overmind.blob_core = null overmind = null @@ -32,7 +33,7 @@ /obj/structure/blob/core/scannerreport() return "Directs the blob's expansion, gradually expands, and sustains nearby blob spores and blobbernauts." -/obj/structure/blob/special/core/update_overlays() +/obj/structure/blob/core/update_overlays() . = ..() var/mutable_appearance/blob_overlay = mutable_appearance('icons/mob/blob.dmi', "blob") if(overmind) @@ -40,9 +41,8 @@ . += blob_overlay . += mutable_appearance('icons/mob/blob.dmi', "blob_core_overlay") -/obj/structure/blob/special/core/update_appearance() +/obj/structure/blob/core/update_appearance() color = null - GLOB.poi_list -= src return ..() /obj/structure/blob/core/ex_act(severity, target) diff --git a/tools/tgs_scripts/PreCompile.sh b/tools/tgs_scripts/PreCompile.sh index 2cc52be12741..6e34ab65af6a 100755 --- a/tools/tgs_scripts/PreCompile.sh +++ b/tools/tgs_scripts/PreCompile.sh @@ -60,5 +60,4 @@ cd .. # compile tgui echo "Compiling tgui..." cd "$1" -chmod +x tools/bootstrap/node # Workaround for https://github.com/tgstation/tgstation-server/issues/1167 env TG_BOOTSTRAP_CACHE="$original_dir" TG_BOOTSTRAP_NODE_LINUX=1 CBT_BUILD_MODE="TGS" tools/bootstrap/node tools/build/build.js From 77025ffd2c502301f46edd39ef7cd54779e0dd04 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 14 Sep 2023 12:04:37 -0500 Subject: [PATCH 142/147] Buncha map fixes --- .../LavaRuins/lavaland_surface_codelab.dmm | 16 ++++++-- _maps/shuttles/shiptest/inteq_vaquero.dmm | 1 - _maps/shuttles/shiptest/solgov_chronicle.dmm | 38 ++++--------------- code/controllers/subsystem/air.dm | 2 +- code/game/objects/effects/decals/decal.dm | 1 + .../atmospherics/machinery/datum_pipeline.dm | 5 ++- 6 files changed, 25 insertions(+), 38 deletions(-) diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_codelab.dmm b/_maps/RandomRuins/LavaRuins/lavaland_surface_codelab.dmm index 04ada2692122..1bbc1b76a834 100644 --- a/_maps/RandomRuins/LavaRuins/lavaland_surface_codelab.dmm +++ b/_maps/RandomRuins/LavaRuins/lavaland_surface_codelab.dmm @@ -238,9 +238,10 @@ /obj/structure/fluff/paper/stack{ dir = 6 }, -/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer4, /obj/machinery/atmospherics/pipe/simple/supply/hidden/layer2, -/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4, +/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4{ + dir = 8 + }, /turf/open/floor/plasteel/white, /area/ruin/unpowered/codelab/subjectrooms) "cO" = ( @@ -424,7 +425,7 @@ icon_state = "4-8" }, /obj/machinery/atmospherics/pipe/manifold/supply/hidden/layer2, -/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4, +/obj/machinery/atmospherics/pipe/manifold4w/scrubbers/hidden/layer4, /turf/open/floor/plasteel/white, /area/ruin/unpowered/codelab/subjectrooms) "eY" = ( @@ -617,6 +618,13 @@ /obj/effect/turf_decal/industrial/stand_clear, /turf/open/floor/plating, /area/ruin/unpowered/codelab/maintenance) +"hB" = ( +/obj/effect/turf_decal/corner/opaque/white/mono, +/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer4{ + dir = 8 + }, +/turf/open/floor/plasteel/white, +/area/ruin/unpowered/codelab/subjectrooms) "hE" = ( /turf/closed/wall/mineral/titanium, /area/ruin/unpowered/codelab/reception) @@ -5162,7 +5170,7 @@ ir XS He rY -GN +hB Ru GN hE diff --git a/_maps/shuttles/shiptest/inteq_vaquero.dmm b/_maps/shuttles/shiptest/inteq_vaquero.dmm index 6e380f8b0bf1..285ade601560 100644 --- a/_maps/shuttles/shiptest/inteq_vaquero.dmm +++ b/_maps/shuttles/shiptest/inteq_vaquero.dmm @@ -1677,7 +1677,6 @@ /turf/open/floor/plasteel/dark, /area/ship/crew/office) "Ax" = ( -/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer4, /obj/effect/turf_decal/corner/opaque/yellow{ dir = 1 }, diff --git a/_maps/shuttles/shiptest/solgov_chronicle.dmm b/_maps/shuttles/shiptest/solgov_chronicle.dmm index a501fcd211f5..56b5e7d3df8a 100644 --- a/_maps/shuttles/shiptest/solgov_chronicle.dmm +++ b/_maps/shuttles/shiptest/solgov_chronicle.dmm @@ -175,8 +175,7 @@ /area/ship/cargo) "bs" = ( /obj/machinery/telecomms/broadcaster/preset_left{ - network = "SolNet"; - pixel_y = 0 + network = "SolNet" }, /obj/machinery/door/window/brigdoor/northright{ dir = 2; @@ -676,7 +675,6 @@ /area/ship/cargo) "gi" = ( /obj/effect/turf_decal/siding/wood{ - dir = 2; color = "#543C30" }, /obj/structure/railing/wood{ @@ -759,7 +757,6 @@ "hp" = ( /obj/structure/table/wood, /obj/structure/railing/wood{ - dir = 2; color = "#792f27" }, /obj/item/reagent_containers/food/snacks/grown/cabbage{ @@ -1833,7 +1830,6 @@ /area/ship/cargo) "sq" = ( /obj/effect/turf_decal/siding/wood{ - dir = 2; color = "#543C30" }, /obj/structure/cable{ @@ -1875,7 +1871,6 @@ /area/ship/security/armory) "sz" = ( /obj/effect/turf_decal/siding/wood{ - dir = 2; color = "#543C30" }, /obj/structure/railing/wood{ @@ -2001,7 +1996,6 @@ req_one_access = list(61,11) }, /obj/machinery/telecomms/message_server{ - pixel_y = 0; autolinkers = list("solgovPDA"); network = "SolNet"; calibrating = 0 @@ -2087,7 +2081,6 @@ /area/ship/engineering) "uK" = ( /obj/effect/turf_decal/siding/wood{ - dir = 2; color = "#543C30" }, /obj/structure/cable{ @@ -2240,7 +2233,6 @@ /obj/item/kirbyplants{ icon_state = "plant-11"; pixel_x = 10; - pixel_y = 0; layer = 2.89 }, /obj/structure/table/wood/fancy/purple, @@ -2571,9 +2563,6 @@ /obj/effect/turf_decal/atmos/oxygen{ layer = 2.04 }, -/obj/machinery/atmospherics/pipe/simple/scrubbers/visible/layer4{ - dir = 4 - }, /obj/machinery/atmospherics/pipe/simple/green/visible{ dir = 4 }, @@ -2581,6 +2570,9 @@ dir = 1 }, /obj/effect/turf_decal/techfloor/orange, +/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4{ + dir = 1 + }, /turf/open/floor/plasteel/tech/grid, /area/ship/engineering/engine) "zs" = ( @@ -2804,7 +2796,6 @@ /obj/machinery/telecomms/processor{ autolinkers = list("processor7"); network = "SolNet"; - pixel_y = 0; id = "Processor" }, /obj/structure/window/reinforced, @@ -3026,7 +3017,6 @@ /area/ship/crew/office) "Ds" = ( /obj/effect/turf_decal/siding/wood{ - dir = 2; color = "#543C30" }, /obj/structure/cable{ @@ -3070,7 +3060,6 @@ }, /obj/machinery/firealarm/directional/north, /obj/machinery/light_switch{ - dir = 2; pixel_y = 22; pixel_x = -12 }, @@ -3220,7 +3209,6 @@ icon_state = "0-8" }, /obj/machinery/light_switch{ - dir = 2; pixel_y = 22; pixel_x = -12 }, @@ -3544,8 +3532,7 @@ "IH" = ( /obj/machinery/telecomms/server/presets/solgov{ autolinkers = list("solgov","sproingle"); - network = "SolNet"; - pixel_y = 0 + network = "SolNet" }, /obj/machinery/door/window/brigdoor/northleft{ dir = 2; @@ -3722,7 +3709,6 @@ /area/ship/engineering) "Kc" = ( /obj/effect/turf_decal/siding/wood{ - dir = 2; color = "#543C30" }, /obj/structure/cable{ @@ -3746,9 +3732,7 @@ /obj/effect/turf_decal/spline/fancy/wood{ dir = 4 }, -/obj/effect/turf_decal/siding/wood/end{ - dir = 2 - }, +/obj/effect/turf_decal/siding/wood/end, /obj/structure/fluff/hedge, /turf/open/floor/wood/walnut, /area/ship/crew/crewtwo) @@ -4016,7 +4000,6 @@ "Nu" = ( /obj/structure/table/wood, /obj/structure/railing/wood{ - dir = 2; color = "#792f27" }, /obj/machinery/light/small/directional/west, @@ -4117,8 +4100,7 @@ pixel_y = -1 }, /obj/item/folder/solgov{ - pixel_x = 4; - pixel_y = 0 + pixel_x = 4 }, /obj/item/pen/solgov{ pixel_x = 2 @@ -4493,7 +4475,6 @@ dir = 8 }, /obj/machinery/light_switch{ - dir = 2; pixel_y = 22; pixel_x = -12 }, @@ -4560,7 +4541,6 @@ "SJ" = ( /obj/machinery/telecomms/receiver/preset_left{ network = "SolNet"; - pixel_y = 0; id = "Receiver" }, /obj/structure/window/reinforced{ @@ -4585,8 +4565,7 @@ pixel_y = -1 }, /obj/item/folder/solgov{ - pixel_x = 4; - pixel_y = 0 + pixel_x = 4 }, /obj/item/pen/solgov{ pixel_x = 2 @@ -5157,7 +5136,6 @@ dir = 8 }, /obj/machinery/light_switch{ - dir = 2; pixel_y = 22; pixel_x = -12 }, diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index 83100dd566aa..56b50beee9ce 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -410,7 +410,7 @@ SUBSYSTEM_DEF(air) continue if(item.parent) log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") - stack_trace("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") + item.stack_trace("Possible doubled atmosmachine") net.members += item border += item diff --git a/code/game/objects/effects/decals/decal.dm b/code/game/objects/effects/decals/decal.dm index 504c49d4a582..e375cfd1117e 100644 --- a/code/game/objects/effects/decals/decal.dm +++ b/code/game/objects/effects/decals/decal.dm @@ -41,6 +41,7 @@ /obj/effect/turf_decal icon = 'icons/turf/decals.dmi' icon_state = "warningline" + plane = FLOOR_PLANE layer = TURF_DECAL_LAYER var/detail_overlay var/detail_color diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index fc41589012df..2ede3d7317b0 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -89,8 +89,9 @@ continue if(item.parent) - log_mapping("Doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") - CRASH("Item added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf, a.k.a. doubled pipes). This is a mapping issue that MUST be fixed. Use the atmosdebug verb to find where it is.") + log_mapping("Possible doubled atmosmachine found at [AREACOORD(item)] with other contents: [json_encode(item.loc.contents)]") + item.stack_trace("Possible doubled atmosmachine found") + continue members += item possible_expansions += item From 26c81229abc7f1dbbcb0f96d6107986d702889bf Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 14 Sep 2023 12:34:17 -0500 Subject: [PATCH 143/147] whoops --- code/modules/unit_tests/create_and_destroy.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index 4d7eff3aee5e..017356d9152a 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -37,9 +37,6 @@ /obj/effect/landmark/subship, //needs a friend :( /obj/effect/mob_spawn/human/demonic_friend, - //Needs a pod - /obj/effect/DPfall, - /obj/effect/DPtarget, //needs a derg /obj/structure/carp_rift, //doesn't have icons @@ -71,6 +68,9 @@ ignore += typesof(/obj/item/reagent_containers/food/snacks/grown) //Nothing to hallucinate if there's nothing to hallicinate ignore += typesof(/obj/effect/hallucination) + //We don't have a pod + ignore += typesof(/obj/effect/pod_landingzone_effect) + ignore += typesof(/obj/effect/pod_landingzone) //These want fried food to take on the shape of, we can't pass that in ignore += typesof(/obj/item/reagent_containers/food/snacks/deepfryholder) //Can't pass in a thing to glow From f0023e81145bbd50eff4032bd440ca2a90bd0ed4 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 14 Sep 2023 13:18:57 -0500 Subject: [PATCH 144/147] supplypod fix --- code/game/objects/structures/crates_lockers/closets.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index fab2ddf2c8cb..788fc28a51c6 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -55,7 +55,7 @@ RegisterSignal(src, COMSIG_ATOM_CANREACH, .proc/canreach_react) /obj/structure/closet/LateInitialize() - take_contents() + take_contents(src) return ..() /obj/structure/closet/proc/canreach_react(datum/source, list/next) @@ -159,8 +159,8 @@ if(throwing) throwing.finalize(FALSE) -/obj/structure/closet/proc/take_contents() - var/atom/L = drop_location() +/obj/structure/closet/proc/take_contents(atom/movable/holder) + var/atom/L = holder.drop_location() for(var/atom/movable/AM in L) if(istype(AM, /obj/effect)) //WS edit, closets and crates do not eat your lamp continue @@ -227,7 +227,7 @@ /obj/structure/closet/proc/close(mob/living/user) if(!opened || !can_close(user)) return FALSE - take_contents() + take_contents(src) playsound(loc, close_sound, close_sound_volume, TRUE, -3) climb_time = initial(climb_time) opened = FALSE From 6cfa4a15ebd9c5ab3961699e9d02591c55db3fe8 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 14 Sep 2023 17:52:48 -0500 Subject: [PATCH 145/147] waogogus --- .../datums/mapgen/planetary/WasteGenerator.dm | 42 +++++++++---------- code/modules/unit_tests/_unit_tests.dm | 1 + code/modules/unit_tests/biome_lists.dm | 13 ++++++ 3 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 code/modules/unit_tests/biome_lists.dm diff --git a/code/datums/mapgen/planetary/WasteGenerator.dm b/code/datums/mapgen/planetary/WasteGenerator.dm index f0cef0c16d2a..e773cbddcc2d 100644 --- a/code/datums/mapgen/planetary/WasteGenerator.dm +++ b/code/datums/mapgen/planetary/WasteGenerator.dm @@ -96,36 +96,36 @@ flora_spawn_list = list( //mech spawners - /obj/effect/spawner/lootdrop/waste/mechwreck = 10, - /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 2, + /obj/effect/spawner/lootdrop/waste/mechwreck = 100, + /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 20.1, //decals and fluff structures - /obj/effect/spawner/lootdrop/waste/trash = 180, - /obj/effect/spawner/lootdrop/waste/radiation = 8, - /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 1, + /obj/effect/spawner/lootdrop/waste/trash = 1800, + /obj/effect/spawner/lootdrop/waste/radiation = 80, + /obj/effect/spawner/lootdrop/waste/radiation/more_rads = 10, //stuff you can actually use - /obj/effect/spawner/lootdrop/waste/girder = 60, - /obj/structure/reagent_dispensers/fueltank = 10, - /obj/structure/reagent_dispensers/watertank = 20, - /obj/item/stack/cable_coil/cut = 50, - /obj/structure/closet/crate/secure/loot = 3, - /obj/effect/spawner/lootdrop/waste/atmos_can = 5, - /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 0.1, - /obj/effect/spawner/lootdrop/waste/salvageable = 30, - /obj/effect/spawner/lootdrop/waste/grille_or_trash = 20, - /obj/effect/spawner/lootdrop/maintenance = 20, - /obj/effect/spawner/lootdrop/maintenance/two = 10, - /obj/effect/spawner/lootdrop/maintenance/three = 5, - /obj/effect/spawner/lootdrop/maintenance/four = 2, + /obj/effect/spawner/lootdrop/waste/girder = 600, + /obj/structure/reagent_dispensers/fueltank = 100, + /obj/structure/reagent_dispensers/watertank = 200, + /obj/item/stack/cable_coil/cut = 500, + /obj/structure/closet/crate/secure/loot = 30, + /obj/effect/spawner/lootdrop/waste/atmos_can = 50, + /obj/effect/spawner/lootdrop/waste/atmos_can/rare = 1, + /obj/effect/spawner/lootdrop/waste/salvageable = 300, + /obj/effect/spawner/lootdrop/waste/grille_or_trash = 200, + /obj/effect/spawner/lootdrop/maintenance = 200, + /obj/effect/spawner/lootdrop/maintenance/two = 100, + /obj/effect/spawner/lootdrop/maintenance/three = 50, + /obj/effect/spawner/lootdrop/maintenance/four = 20, //plants - /obj/structure/flora/ash/garden/waste = 7, - /obj/structure/flora/ash/glowshroom = 20, //more common in caves + /obj/structure/flora/ash/garden/waste = 70, + /obj/structure/flora/ash/glowshroom = 200, //more common in caves //the illusive shrapnel plant - /obj/effect/mine/shrapnel/human_only = 1 + /obj/effect/mine/shrapnel/human_only = 10 ) feature_spawn_list = list( diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index c901e486a1f6..cc12fe0c638f 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -70,6 +70,7 @@ #include "component_tests.dm" #include "connect_loc.dm" #include "create_and_destroy.dm" +#include "biome_lists.dm" #include "emoting.dm" #include "keybinding_init.dm" #include "machine_disassembly.dm" diff --git a/code/modules/unit_tests/biome_lists.dm b/code/modules/unit_tests/biome_lists.dm new file mode 100644 index 000000000000..24d931bbd7fa --- /dev/null +++ b/code/modules/unit_tests/biome_lists.dm @@ -0,0 +1,13 @@ +/datum/unit_test/biome_lists/Run() + for(var/biome_type as anything in SSmapping.biomes) + var/datum/biome/biome = SSmapping.biomes[biome_type] + + validate_chance(biome.mob_spawn_chance, "mob spawn") + validate_chance(biome.flora_spawn_chance, "flora spawn") + validate_chance(biome.feature_spawn_chance, "feature spawn") + +/datum/unit_test/biome_lists/proc/validate_chance(list/to_check, name) + for(var/type in to_check) + var/value = to_check[type] + if(!isnum(value) || value < 1 || value != round(value)) + TEST_FAIL("Biome [name] has invalid [name] chance for [type] ([value])") From 0c42f63902f33a44040762e88debef446b141616 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 14 Sep 2023 18:26:28 -0500 Subject: [PATCH 146/147] oops --- code/modules/unit_tests/biome_lists.dm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/modules/unit_tests/biome_lists.dm b/code/modules/unit_tests/biome_lists.dm index 24d931bbd7fa..8f29a4109a37 100644 --- a/code/modules/unit_tests/biome_lists.dm +++ b/code/modules/unit_tests/biome_lists.dm @@ -2,12 +2,14 @@ for(var/biome_type as anything in SSmapping.biomes) var/datum/biome/biome = SSmapping.biomes[biome_type] - validate_chance(biome.mob_spawn_chance, "mob spawn") - validate_chance(biome.flora_spawn_chance, "flora spawn") - validate_chance(biome.feature_spawn_chance, "feature spawn") + validate_chance(biome.mob_spawn_list, "mob spawn", biome_type) + validate_chance(biome.flora_spawn_list, "flora spawn", biome_type) + validate_chance(biome.feature_spawn_list, "feature spawn", biome_type) -/datum/unit_test/biome_lists/proc/validate_chance(list/to_check, name) +/datum/unit_test/biome_lists/proc/validate_chance(list/to_check, name, biome) + if(!islist(to_check)) + TEST_FAIL("Biome [biome] has invalid [name] list") for(var/type in to_check) var/value = to_check[type] if(!isnum(value) || value < 1 || value != round(value)) - TEST_FAIL("Biome [name] has invalid [name] chance for [type] ([value])") + TEST_FAIL("Biome [biome] has invalid [name] chance for [type] ([value])") From 47b90bc4a1f2a691845263f4202007c6caddf4eb Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Thu, 14 Sep 2023 19:10:34 -0500 Subject: [PATCH 147/147] morefixes --- code/datums/mapgen/planetary/JungleGenerator.dm | 4 ++-- code/datums/mapgen/planetary/WasteGenerator.dm | 2 +- code/modules/unit_tests/biome_lists.dm | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/code/datums/mapgen/planetary/JungleGenerator.dm b/code/datums/mapgen/planetary/JungleGenerator.dm index 86c40769cd11..dd5635d4841f 100644 --- a/code/datums/mapgen/planetary/JungleGenerator.dm +++ b/code/datums/mapgen/planetary/JungleGenerator.dm @@ -175,7 +175,7 @@ mob_spawn_list = list( /mob/living/simple_animal/hostile/asteroid/wolf/random = 1, /mob/living/simple_animal/hostile/retaliate/bat = 1, - /mob/living/simple_animal/hostile/retaliate/poison/snake + /mob/living/simple_animal/hostile/retaliate/poison/snake = 1 ) feature_spawn_chance = 0.5 feature_spawn_list = list( @@ -230,7 +230,7 @@ mob_spawn_list = list( /mob/living/simple_animal/hostile/poison/bees/toxin = 1, /mob/living/simple_animal/hostile/mushroom = 1, - /mob/living/simple_animal/pet/dog/corgi/capybara + /mob/living/simple_animal/pet/dog/corgi/capybara = 1 ) /datum/biome/cave/lush/bright diff --git a/code/datums/mapgen/planetary/WasteGenerator.dm b/code/datums/mapgen/planetary/WasteGenerator.dm index e773cbddcc2d..8fdada12822e 100644 --- a/code/datums/mapgen/planetary/WasteGenerator.dm +++ b/code/datums/mapgen/planetary/WasteGenerator.dm @@ -97,7 +97,7 @@ //mech spawners /obj/effect/spawner/lootdrop/waste/mechwreck = 100, - /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 20.1, + /obj/effect/spawner/lootdrop/waste/mechwreck/rare = 20, //decals and fluff structures /obj/effect/spawner/lootdrop/waste/trash = 1800, diff --git a/code/modules/unit_tests/biome_lists.dm b/code/modules/unit_tests/biome_lists.dm index 8f29a4109a37..7c7500155235 100644 --- a/code/modules/unit_tests/biome_lists.dm +++ b/code/modules/unit_tests/biome_lists.dm @@ -7,9 +7,12 @@ validate_chance(biome.feature_spawn_list, "feature spawn", biome_type) /datum/unit_test/biome_lists/proc/validate_chance(list/to_check, name, biome) - if(!islist(to_check)) + if(to_check && !islist(to_check)) TEST_FAIL("Biome [biome] has invalid [name] list") for(var/type in to_check) var/value = to_check[type] + if(!value) + TEST_FAIL("Biome [biome] has no [name] weight for [type]") + return if(!isnum(value) || value < 1 || value != round(value)) TEST_FAIL("Biome [biome] has invalid [name] chance for [type] ([value])")