From 5c0c095079753e69b4d84a165060a8e89ecc9fd8 Mon Sep 17 00:00:00 2001 From: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Sat, 24 Jun 2023 16:16:38 -0400 Subject: [PATCH] Makes decals only caught on mapload & removes turf_loc_check (#76130) Theres one player-facing change in this PR and it's that I removed human gibs from being valid in space turfs, making it more consistent with the other gib decals. I've cleaned up many instances of decals spawning in bad turfs on mapload in https://github.com/tgstation/tgstation/pull/75189, but making it error anytime in-game a decal is put over an invalid turf is bad as it punishes contributors for not optimizing their decals properly. This changes it so it only errors if it's on mapload, unit testing or not. I've also removed ``turf_loc_check`` and replaced instances of it with overwriting ``NeverShouldHaveComeHere``, which gives us greater control of where decals can be placed. This let me remove 2 subtypes that were made to have decals in specific places (which then got placed elsewhere, ruining it all). Mappers are still able to set decals to be placed anywhere, they just need to add it as a valid turf for that decal. --- _maps/RandomRuins/SpaceRuins/cyborg_mothership.dmm | 2 +- _maps/map_files/Birdshot/birdshot.dmm | 2 +- .../objects/effects/decals/cleanable/aliens.dm | 2 +- .../objects/effects/decals/cleanable/humans.dm | 7 ++++--- code/game/objects/effects/decals/cleanable/misc.dm | 5 ++--- .../objects/effects/decals/cleanable/robots.dm | 2 +- code/game/objects/effects/decals/crayon.dm | 4 ++-- code/game/objects/effects/decals/decal.dm | 14 +++++++------- code/game/objects/effects/decals/remains.dm | 7 ++++++- code/game/objects/structures/morgue.dm | 4 ++-- code/modules/clothing/head/mind_monkey_helmet.dm | 2 +- .../ruins/lavalandruin_code/elephantgraveyard.dm | 7 ++----- 12 files changed, 30 insertions(+), 28 deletions(-) diff --git a/_maps/RandomRuins/SpaceRuins/cyborg_mothership.dmm b/_maps/RandomRuins/SpaceRuins/cyborg_mothership.dmm index ccd2818eb32d6..842a6899450aa 100644 --- a/_maps/RandomRuins/SpaceRuins/cyborg_mothership.dmm +++ b/_maps/RandomRuins/SpaceRuins/cyborg_mothership.dmm @@ -7,7 +7,7 @@ /turf/open/misc/asteroid/airless, /area/space) "d" = ( -/obj/effect/decal/remains/human/grave, +/obj/effect/decal/remains/human, /turf/open/misc/asteroid/airless, /area/space) "e" = ( diff --git a/_maps/map_files/Birdshot/birdshot.dmm b/_maps/map_files/Birdshot/birdshot.dmm index dd01eb26c37e3..dabecfcae82e2 100644 --- a/_maps/map_files/Birdshot/birdshot.dmm +++ b/_maps/map_files/Birdshot/birdshot.dmm @@ -6381,7 +6381,7 @@ dir = 1 }, /obj/effect/decal/cleanable/dirt, -/obj/effect/decal/remains/human/grave{ +/obj/effect/decal/remains/human{ pixel_x = 6; pixel_y = 6 }, diff --git a/code/game/objects/effects/decals/cleanable/aliens.dm b/code/game/objects/effects/decals/cleanable/aliens.dm index 4bccd80a0ea48..8b494e8bac366 100644 --- a/code/game/objects/effects/decals/cleanable/aliens.dm +++ b/code/game/objects/effects/decals/cleanable/aliens.dm @@ -51,7 +51,7 @@ /obj/effect/decal/cleanable/xenoblood/xgibs/proc/spread_movement_effects(datum/move_loop/has_target/source) SIGNAL_HANDLER - if(isclosedturf(loc) || (isgroundlessturf(loc) && !SSmapping.get_turf_below(loc))) + if(NeverShouldHaveComeHere(loc)) return new /obj/effect/decal/cleanable/xenoblood/xsplatter(loc) diff --git a/code/game/objects/effects/decals/cleanable/humans.dm b/code/game/objects/effects/decals/cleanable/humans.dm index ba78e7462fd05..d291d31c7f6e7 100644 --- a/code/game/objects/effects/decals/cleanable/humans.dm +++ b/code/game/objects/effects/decals/cleanable/humans.dm @@ -73,9 +73,11 @@ layer = ABOVE_WINDOW_LAYER plane = GAME_PLANE vis_flags = VIS_INHERIT_PLANE - turf_loc_check = FALSE alpha = 180 +/obj/effect/decal/cleanable/blood/splatter/over_window/NeverShouldHaveComeHere(turf/here_turf) + return isgroundlessturf(here_turf) + /obj/effect/decal/cleanable/blood/tracks icon_state = "tracks" desc = "They look like tracks left by wheels." @@ -103,7 +105,6 @@ plane = GAME_PLANE random_icon_states = list("gib1", "gib2", "gib3", "gib4", "gib5", "gib6") mergeable_decal = FALSE - turf_loc_check = FALSE dryname = "rotting gibs" drydesc = "They look bloody and gruesome while some terrible smell fills the air." @@ -169,7 +170,7 @@ /obj/effect/decal/cleanable/blood/gibs/proc/spread_movement_effects(datum/move_loop/has_target/source) SIGNAL_HANDLER - if(isclosedturf(loc) || (isgroundlessturf(loc) && !SSmapping.get_turf_below(loc))) + if(NeverShouldHaveComeHere(loc)) return new /obj/effect/decal/cleanable/blood/splatter(loc, streak_diseases) diff --git a/code/game/objects/effects/decals/cleanable/misc.dm b/code/game/objects/effects/decals/cleanable/misc.dm index a7f8f141a2e9b..1985366036195 100644 --- a/code/game/objects/effects/decals/cleanable/misc.dm +++ b/code/game/objects/effects/decals/cleanable/misc.dm @@ -20,9 +20,8 @@ pixel_x = base_pixel_x + rand(-5, 5) pixel_y = base_pixel_y + rand(-5, 5) -/obj/effect/decal/cleanable/ash/crematorium -//crematoriums need their own ash cause default ash deletes itself if created in an obj - turf_loc_check = FALSE +/obj/effect/decal/cleanable/ash/NeverShouldHaveComeHere(turf/here_turf) + return !istype(here_turf, /obj/structure/bodycontainer/crematorium) && ..() /obj/effect/decal/cleanable/ash/large name = "large pile of ashes" diff --git a/code/game/objects/effects/decals/cleanable/robots.dm b/code/game/objects/effects/decals/cleanable/robots.dm index 4ca68e8c0ccf4..e20314d161e68 100644 --- a/code/game/objects/effects/decals/cleanable/robots.dm +++ b/code/game/objects/effects/decals/cleanable/robots.dm @@ -36,7 +36,7 @@ /obj/effect/decal/cleanable/robot_debris/proc/spread_movement_effects(datum/move_loop/has_target/source) SIGNAL_HANDLER - if(isclosedturf(loc) || (isgroundlessturf(loc) && !SSmapping.get_turf_below(loc))) + if(NeverShouldHaveComeHere(loc)) return if (prob(40)) new /obj/effect/decal/cleanable/oil/streak(loc) diff --git a/code/game/objects/effects/decals/crayon.dm b/code/game/objects/effects/decals/crayon.dm index 17ff9c6d69557..f0db747c2ce44 100644 --- a/code/game/objects/effects/decals/crayon.dm +++ b/code/game/objects/effects/decals/crayon.dm @@ -31,8 +31,8 @@ add_atom_colour(paint_colour, FIXED_COLOUR_PRIORITY) RegisterSignal(src, COMSIG_OBJ_PAINTED, PROC_REF(on_painted)) -/obj/effect/decal/cleanable/crayon/NeverShouldHaveComeHere(turf/T) - return isgroundlessturf(T) +/obj/effect/decal/cleanable/crayon/NeverShouldHaveComeHere(turf/here_turf) + return isgroundlessturf(here_turf) /obj/effect/decal/cleanable/crayon/proc/on_painted(datum/source, mob/user, obj/item/toy/crayon/spraycan/spraycan, is_dark_color) SIGNAL_HANDLER diff --git a/code/game/objects/effects/decals/decal.dm b/code/game/objects/effects/decals/decal.dm index 291b9b9cb4f2f..ade4b4b510867 100644 --- a/code/game/objects/effects/decals/decal.dm +++ b/code/game/objects/effects/decals/decal.dm @@ -8,12 +8,11 @@ /obj/effect/decal/Initialize(mapload) . = ..() - if(turf_loc_check && NeverShouldHaveComeHere(loc)) -#ifdef UNIT_TESTS - stack_trace("[name] spawned in a bad turf ([loc]) at [AREACOORD(src)] in \the [get_area(src)]. Please remove it or set turf_loc_check to FALSE on the decal if intended.") -#else + if(NeverShouldHaveComeHere(loc)) + if(mapload) + stack_trace("[name] spawned in a bad turf ([loc]) at [AREACOORD(src)] in \the [get_area(src)]. \ + Please remove it or allow it to pass NeverShouldHaveComeHere if it's intended.") return INITIALIZE_HINT_QDEL -#endif var/static/list/loc_connections = list( COMSIG_TURF_CHANGE = PROC_REF(on_decal_move), ) @@ -23,8 +22,9 @@ if(B && B.loc == loc) qdel(src) -/obj/effect/decal/proc/NeverShouldHaveComeHere(turf/T) - return isclosedturf(T) || (isgroundlessturf(T) && !SSmapping.get_turf_below(T)) +///Checks if we are allowed to be in `here_turf`, and returns that result. Subtypes should override this when necessary. +/obj/effect/decal/proc/NeverShouldHaveComeHere(turf/here_turf) + return isclosedturf(here_turf) || (isgroundlessturf(here_turf) && !SSmapping.get_turf_below(here_turf)) /obj/effect/decal/ex_act(severity, target) qdel(src) diff --git a/code/game/objects/effects/decals/remains.dm b/code/game/objects/effects/decals/remains.dm index 940efd0c752e7..82a4c77603bcc 100644 --- a/code/game/objects/effects/decals/remains.dm +++ b/code/game/objects/effects/decals/remains.dm @@ -14,6 +14,9 @@ desc = "They look like human remains. They have a strange aura about them." icon_state = "remains" +/obj/effect/decal/remains/human/NeverShouldHaveComeHere(turf/here_turf) + return !istype(here_turf, /obj/structure/closet/crate/grave/filled) && ..() + /obj/effect/decal/remains/human/smokey desc = "They look like human remains. They have a strange, smokey aura about them..." ///Our proximity monitor, for detecting nearby looters. @@ -48,7 +51,9 @@ /obj/effect/decal/remains/plasma icon_state = "remainsplasma" - turf_loc_check = FALSE + +/obj/effect/decal/remains/plasma/NeverShouldHaveComeHere(turf/here_turf) + return isclosedturf(here_turf) /obj/effect/decal/remains/xeno desc = "They look like the remains of something... alien. They have a strange aura about them." diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 669a5064a927b..d7b71b88f4b7e 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -236,7 +236,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an if(!length(compiled)) // No mobs? icon_state = "morgue3" return ..() - + if(!(obj_flags & EMAGGED)) for(var/mob/living/occupant as anything in compiled) var/mob/living/mob_occupant = get_mob_or_brainmob(occupant) @@ -337,7 +337,7 @@ GLOBAL_LIST_EMPTY(crematoriums) qdel(O) if(!locate(/obj/effect/decal/cleanable/ash) in get_step(src, dir))//prevent pile-up - new/obj/effect/decal/cleanable/ash/crematorium(src) + new/obj/effect/decal/cleanable/ash(src) sleep(3 SECONDS) diff --git a/code/modules/clothing/head/mind_monkey_helmet.dm b/code/modules/clothing/head/mind_monkey_helmet.dm index 83fa277d2258d..f95a05f5fe872 100644 --- a/code/modules/clothing/head/mind_monkey_helmet.dm +++ b/code/modules/clothing/head/mind_monkey_helmet.dm @@ -94,7 +94,7 @@ playsound(src, SFX_SPARKS, 100, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) visible_message(span_warning("[src] fizzles and breaks apart!")) magnification = null - new /obj/effect/decal/cleanable/ash/crematorium(drop_location()) //just in case they're in a locker or other containers it needs to use crematorium ash, see the path itself for an explanation + new /obj/effect/decal/cleanable/ash(drop_location()) //just in case they're in a locker or other containers it needs to use crematorium ash, see the path itself for an explanation /obj/item/clothing/head/helmet/monkey_sentience/dropped(mob/user) . = ..() diff --git a/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm b/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm index 8ce3869bf60eb..4ec58a92c7f1f 100644 --- a/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm +++ b/code/modules/mapfluff/ruins/lavalandruin_code/elephantgraveyard.dm @@ -73,7 +73,7 @@ if(prob(10)) new /obj/item/stack/ore/iron(src, 1) new /obj/item/stack/ore/glass(src, 1) - new /obj/effect/decal/remains/human/grave(src, 1) + new /obj/effect/decal/remains/human(src, 1) else new /obj/item/stack/sheet/bone(src, 1) @@ -166,7 +166,7 @@ /obj/structure/closet/crate/grave/filled/PopulateContents() //GRAVEROBBING IS NOW A FEATURE ..() - new /obj/effect/decal/remains/human/grave(src) + new /obj/effect/decal/remains/human(src) switch(rand(1,8)) if(1) new /obj/item/coin/gold(src) @@ -278,9 +278,6 @@ new /obj/effect/decal/cleanable/blood/gibs/old(src) new /obj/item/book/granter/crafting_recipe/boneyard_notes(src) -/obj/effect/decal/remains/human/grave - turf_loc_check = FALSE - //***Fluff items for lore/intrigue /obj/item/paper/crumpled/muddy/fluff/elephant_graveyard name = "posted warning"