From 7eb4ea54244e19e5a7614b35074447d057324a4e Mon Sep 17 00:00:00 2001 From: NamelessFairy <40036527+NamelessFairy@users.noreply.github.com> Date: Fri, 17 Feb 2023 22:54:50 +0000 Subject: [PATCH] [NO GBP] Reinforced plating mapping helper actually function correctly. (#73464) ## About The Pull Request Reinforced plating mapping helpers worked for only a feew specific use-case which ended up being the only usecases I tested, I've modified the code so it should work as expected in all usecases. In short this fixes reinforced plating appearing in places where there is not actually plating for it to replace, and stacking multiple layers of plating where there should not be multiple layers. ## Why It's Good For The Game Fixes a bug I introduced myself. ## Changelog :cl: fix: Reinforced Plating baseturf helpers work and should now be bug free enough to be used in maps. /:cl: --- code/game/turfs/baseturfs.dm | 8 ++++++++ code/modules/mapping/mapping_helpers.dm | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/code/game/turfs/baseturfs.dm b/code/game/turfs/baseturfs.dm index 0e1ca44e60f..7eaac2f9ef0 100644 --- a/code/game/turfs/baseturfs.dm +++ b/code/game/turfs/baseturfs.dm @@ -189,3 +189,11 @@ var/list/baseturfs_copy = baseturfs.Copy() baseturfs_copy.Insert(level, turf_type) baseturfs = baseturfs_string_list(baseturfs_copy, src) + +/// Places a baseturf ontop of a searched for baseturf. +/turf/proc/stack_ontop_of_baseturf(floor, roof) + if (!islist(baseturfs)) + baseturfs = list(baseturfs) + var/floor_position = baseturfs.Find(floor) + if(floor_position != 0) + insert_baseturf(floor_position + 1, roof) diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index fddbf014e22..eaeee5d3f53 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -76,7 +76,12 @@ /obj/effect/baseturf_helper/reinforced_plating name = "reinforced plating baseturf editor" baseturf = /turf/open/floor/plating/reinforced - baseturf_to_replace = list(/turf/open/floor/plating,/turf/open/space,/turf/baseturf_bottom) + baseturf_to_replace = list(/turf/open/floor/plating) + +/obj/effect/baseturf_helper/reinforced_plating/replace_baseturf(turf/thing) + if(istype(thing, /turf/open/floor/plating)) + return //Plates should not be placed under other plates + thing.stack_ontop_of_baseturf(/turf/open/floor/plating, baseturf) //This applies the reinforced plating to the above Z level for every tile in the area where this is placed /obj/effect/baseturf_helper/reinforced_plating/ceiling