diff --git a/code/game/turfs/baseturfs.dm b/code/game/turfs/baseturfs.dm index 7eaac2f9ef0..91e66b1a4d0 100644 --- a/code/game/turfs/baseturfs.dm +++ b/code/game/turfs/baseturfs.dm @@ -20,27 +20,12 @@ return ChangeTurf(baseturfs, baseturfs, flags) // The bottom baseturf will never go away -// Take the input as baseturfs and put it underneath the current baseturfs -// If fake_turf_type is provided and new_baseturfs is not the baseturfs list will be created identical to the turf type's -// If both or just new_baseturfs is provided they will be inserted below the existing baseturfs -/turf/proc/PlaceOnBottom(list/new_baseturfs, turf/fake_turf_type) - if(fake_turf_type) - if(!new_baseturfs) - if(!length(baseturfs)) - baseturfs = list(baseturfs) - var/list/old_baseturfs = baseturfs.Copy() - assemble_baseturfs(fake_turf_type) - if(!length(baseturfs)) - baseturfs = list(baseturfs) - baseturfs = baseturfs_string_list((baseturfs - (baseturfs & GLOB.blacklisted_automated_baseturfs)) + old_baseturfs, src) - return - else if(!length(new_baseturfs)) - new_baseturfs = list(new_baseturfs, fake_turf_type) - else - new_baseturfs += fake_turf_type - if(!length(baseturfs)) - baseturfs = list(baseturfs) - baseturfs = baseturfs_string_list(new_baseturfs + baseturfs, src) +/// Places the given turf on the bottom of the turf stack. +/turf/proc/place_on_bottom(turf/bottom_turf) + baseturfs = baseturfs_string_list( + list(initial(bottom_turf.baseturfs), bottom_turf) + baseturfs, + src + ) // Make a new turf and put it on top // The args behave identical to PlaceOnBottom except they go on top diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index 92e67fc9082..605638679b4 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -6,8 +6,9 @@ name = "baseturf editor" icon = 'icons/effects/mapping_helpers.dmi' icon_state = "" - + /// Replacing a specific turf var/list/baseturf_to_replace + /// The desired bottom turf var/baseturf plane = POINT_PLANE @@ -33,9 +34,16 @@ qdel(src) +/// Replaces all the requested baseturfs (usually space/baseturfbottom) with the desired baseturf. Skips if its already there /obj/effect/baseturf_helper/proc/replace_baseturf(turf/thing) thing.remove_baseturfs_from_typecache(baseturf_to_replace) - thing.PlaceOnBottom(fake_turf_type = baseturf) + + if(length(thing.baseturfs)) + var/turf/tile = thing.baseturfs[1] + if(tile == baseturf) + return + + thing.place_on_bottom(baseturf) /obj/effect/baseturf_helper/space name = "space baseturf editor" diff --git a/code/modules/unit_tests/baseturfs.dm b/code/modules/unit_tests/baseturfs.dm index 2ac016f38b9..9bc561deeeb 100644 --- a/code/modules/unit_tests/baseturfs.dm +++ b/code/modules/unit_tests/baseturfs.dm @@ -53,7 +53,7 @@ // Do this instead of just ChangeTurf to guarantee that baseturfs is completely default on-init behavior RESET_TO_EXPECTED(run_loc_floor_bottom_left) - run_loc_floor_bottom_left.PlaceOnBottom(fake_turf_type = /turf/closed/wall/rock) + run_loc_floor_bottom_left.place_on_bottom(/turf/closed/wall/rock) TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "PlaceOnBottom shouldn't have changed turf") run_loc_floor_bottom_left.ScrapeAway()