From efe3f3dfefac3f5c4fe9ecf3ec5dedaf77d66ba0 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Tue, 11 Jun 2024 21:48:01 -0700 Subject: [PATCH] Warns for genturf failures more clearly, makes planetary cleanup better (#83809) ## About The Pull Request Ok so like, we recently had an issue where a genturf was not being replaced, which fucked ALL of icemoon's atmosphere. The fix was to not use a genturf with a conditionally generating area, but that aside. (why is it CONDITIONAL TIME GREEEEEN) Planetary turfs should act like immutable ones when roundstart equalizing. In addition, we should test to ensure none leaves genturfs floating around post roundstart to avoid this sorta issue. --------- Co-authored-by: Afevis --- code/game/area/areas/mining.dm | 11 ++++++++--- .../environmental/LINDA_turf_tile.dm | 18 +++++++++++++----- code/modules/unit_tests/_unit_tests.dm | 1 + code/modules/unit_tests/orphaned_genturf.dm | 7 +++++++ 4 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 code/modules/unit_tests/orphaned_genturf.dm diff --git a/code/game/area/areas/mining.dm b/code/game/area/areas/mining.dm index 59ceb242887..ff8e22b17b8 100644 --- a/code/game/area/areas/mining.dm +++ b/code/game/area/areas/mining.dm @@ -214,13 +214,18 @@ base_lighting_alpha = 145 return ..() -/area/icemoon/surface/outdoors/nospawn // this is the area you use for stuff to not spawn, but if you still want weather. +/// this is the area you use for stuff to not spawn, but if you still want weather. +/area/icemoon/surface/outdoors/nospawn -/area/icemoon/surface/outdoors/nospawn/New() // unless you roll forested trait lol +// unless you roll forested trait lol (fuck you time green) +/area/icemoon/surface/outdoors/nospawn/New() . = ..() + // this area SOMETIMES does map generation. Often it doesn't at all + // so it SHOULD NOT be used with the genturf turf type, as it is not always replaced if(HAS_TRAIT(SSstation, STATION_TRAIT_FORESTED)) map_generator = /datum/map_generator/cave_generator/icemoon/surface/forested - area_flags = MOB_SPAWN_ALLOWED | FLORA_ALLOWED//flip this on, the generator has already disabled dangerous fauna + // flip this on, the generator has already disabled dangerous fauna + area_flags = MOB_SPAWN_ALLOWED | FLORA_ALLOWED /area/icemoon/surface/outdoors/noteleport // for places like the cursed spring water area_flags = UNIQUE_AREA | FLORA_ALLOWED | NOTELEPORT diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index a5822084b61..85b95feb6d5 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -470,11 +470,19 @@ for(var/turf/open/group_member as anything in turf_list) //Cache? var/datum/gas_mixture/turf/mix = group_member.air - if (roundstart && istype(group_member.air, /datum/gas_mixture/immutable)) - imumutable_in_group = TRUE - shared_mix.copy_from(group_member.air) //This had better be immutable young man - shared_gases = shared_mix.gases //update the cache - break + if (roundstart) + if(istype(group_member.air, /datum/gas_mixture/immutable)) + imumutable_in_group = TRUE + shared_mix.copy_from(group_member.air) //This had better be immutable young man + shared_gases = shared_mix.gases //update the cache + break + // If we're planetary use THAT mix, and stop here + if(group_member.planetary_atmos) + imumutable_in_group = TRUE + var/datum/gas_mixture/planetary_mix = SSair.planetary[group_member.initial_gas_mix] + shared_mix.copy_from(planetary_mix) + shared_gases = shared_mix.gases // Cache update + break //"borrowing" this code from merge(), I need to play with the temp portion. Lets expand it out //temperature = (giver.temperature * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity var/capacity = mix.heat_capacity() diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index e6275bc02e1..b8ea671945f 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -204,6 +204,7 @@ #include "organ_bodypart_shuffle.dm" #include "organ_set_bonus.dm" #include "organs.dm" +#include "orphaned_genturf.dm" #include "outfit_sanity.dm" #include "oxyloss_suffocation.dm" #include "paintings.dm" diff --git a/code/modules/unit_tests/orphaned_genturf.dm b/code/modules/unit_tests/orphaned_genturf.dm new file mode 100644 index 00000000000..289b883d2de --- /dev/null +++ b/code/modules/unit_tests/orphaned_genturf.dm @@ -0,0 +1,7 @@ +/// Ensures we do not leave genturfs sitting around post work +/// They serve as notice to the mapper and have no functionality, but it's good to make note of it here +/datum/unit_test/orphaned_genturf + +/datum/unit_test/orphaned_genturf/Run() + for(var/turf/open/genturf/orphaned in ALL_TURFS()) + TEST_FAIL("Floating genturf ([orphaned.type]) detected at ([orphaned.x], [orphaned.y], [orphaned.z]) : [orphaned.loc.type]. Why was it not replaced?")