From b831ab50aaeaa6ca9e294d8a68c94beeac8d95d0 Mon Sep 17 00:00:00 2001 From: Emmett Gaines Date: Fri, 13 Apr 2018 08:59:01 -0400 Subject: [PATCH] Updates baseturf helpers to the new baseturf system (#37154) --- _maps/map_files/Mining/Lavaland.dmm | 42 +++------------ code/modules/mapping/mapping_helpers.dm | 69 ++++++++++++------------- 2 files changed, 40 insertions(+), 71 deletions(-) diff --git a/_maps/map_files/Mining/Lavaland.dmm b/_maps/map_files/Mining/Lavaland.dmm index 30bc85eb008..4bd0ce5e755 100644 --- a/_maps/map_files/Mining/Lavaland.dmm +++ b/_maps/map_files/Mining/Lavaland.dmm @@ -801,9 +801,6 @@ /turf/open/floor/plating, /area/mine/eva) "cq" = ( -/obj/effect/baseturf_helper/picky/lava_land/basalt{ - whitelist = /turf/open/floor - }, /turf/open/floor/mech_bay_recharge_floor, /area/mine/eva) "cr" = ( @@ -834,9 +831,6 @@ /area/lavaland/surface/outdoors) "cw" = ( /obj/machinery/computer/secure_data, -/obj/effect/baseturf_helper/picky/lava_land/basalt{ - whitelist = /turf/open/floor - }, /turf/open/floor/plasteel, /area/mine/laborcamp/security) "cx" = ( @@ -1035,9 +1029,6 @@ /obj/effect/turf_decal/loading_area{ dir = 8 }, -/obj/effect/baseturf_helper/picky/lava_land/basalt{ - whitelist = /turf/open/floor - }, /turf/open/floor/plasteel, /area/mine/production) "dc" = ( @@ -1211,9 +1202,6 @@ dir = 8; network = list("mine") }, -/obj/effect/baseturf_helper/picky/lava_land/basalt{ - whitelist = /turf/open/floor - }, /turf/open/floor/circuit, /area/mine/maintenance) "dB" = ( @@ -3278,7 +3266,7 @@ /turf/open/floor/plating/asteroid/basalt/lava_land_surface, /area/lavaland/surface/outdoors) "Wt" = ( -/obj/effect/baseturf_helper/picky/lava_land/plating, +/obj/effect/baseturf_helper/lava_land/surface, /turf/closed/wall, /area/mine/laborcamp/security) "Wz" = ( @@ -3337,39 +3325,25 @@ /turf/open/floor/plasteel, /area/mine/production) "WF" = ( -/obj/effect/baseturf_helper/picky/lava_land/plating, +/obj/effect/baseturf_helper/lava_land/surface, /turf/closed/wall, /area/mine/laborcamp) -"WG" = ( -/obj/effect/baseturf_helper/picky/lava_land/basalt{ - whitelist = /turf/open/floor - }, -/turf/open/floor/plasteel, -/area/mine/laborcamp) "WH" = ( -/obj/effect/baseturf_helper/picky/lava_land/plating, +/obj/effect/baseturf_helper/lava_land/surface, /turf/closed/wall, /area/mine/eva) "WI" = ( -/obj/effect/baseturf_helper/picky/lava_land/plating, +/obj/effect/baseturf_helper/lava_land/surface, /turf/closed/wall, /area/mine/production) "WJ" = ( -/obj/effect/baseturf_helper/picky/lava_land/plating, +/obj/effect/baseturf_helper/lava_land/surface, /turf/closed/wall/r_wall, /area/mine/maintenance) "WK" = ( -/obj/effect/baseturf_helper/picky/lava_land/plating, +/obj/effect/baseturf_helper/lava_land/surface, /turf/closed/wall, /area/mine/living_quarters) -"WL" = ( -/obj/effect/baseturf_helper/picky/lava_land/basalt{ - whitelist = /turf/open/floor - }, -/turf/open/floor/plasteel/purple/corner{ - dir = 8 - }, -/area/mine/living_quarters) (1,1,1) = {" aa @@ -8728,7 +8702,7 @@ aq ba aq bj -WG +az az aq ca @@ -13111,7 +13085,7 @@ dQ ec er dZ -WL +eL fh ft eL diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index 1fd5e304241..1786052ebe7 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -6,19 +6,44 @@ name = "baseturf editor" icon = 'icons/effects/mapping_helpers.dmi' icon_state = "" - var/baseturf = null + + var/list/baseturf_to_replace + var/baseturf + layer = POINT_LAYER /obj/effect/baseturf_helper/Initialize() . = ..() - var/area/thearea = get_area(src) - for(var/turf/T in get_area_turfs(thearea, z)) - replace_baseturf(T) - return INITIALIZE_HINT_QDEL + return INITIALIZE_HINT_LATELOAD + +/obj/effect/baseturf_helper/LateInitialize() + if(!baseturf_to_replace) + baseturf_to_replace = typecacheof(/turf/open/space) + else if(!length(baseturf_to_replace)) + baseturf_to_replace = list(baseturf_to_replace = TRUE) + else if(baseturf_to_replace[baseturf_to_replace[1]] != TRUE) // It's not associative + var/list/formatted = list() + for(var/i in baseturf_to_replace) + formatted[i] = TRUE + baseturf_to_replace = formatted + + var/area/our_area = get_area(src) + for(var/i in get_area_turfs(our_area, z)) + replace_baseturf(i) + + qdel(src) /obj/effect/baseturf_helper/proc/replace_baseturf(turf/thing) - if(thing.baseturfs != thing.type) - thing.baseturfs = baseturf + var/list/baseturf_cache = thing.baseturfs + if(length(baseturf_cache)) + for(var/i in baseturf_cache) + if(baseturf_to_replace[i]) + baseturf_cache -= i + else if(baseturf_to_replace[thing.baseturfs]) + thing.assemble_baseturfs(baseturf) + return + + thing.PlaceOnBottom(null, baseturf) /obj/effect/baseturf_helper/space name = "space baseturf editor" @@ -56,36 +81,6 @@ name = "lavaland baseturf editor" baseturf = /turf/open/lava/smooth/lava_land_surface -// Does the same thing as baseturf_helper but only the specified kinds of turf (the kind it's placed on or varedited) -/obj/effect/baseturf_helper/picky - var/list/whitelist - // Can be mapedited as: a single type, a list of types, or a typecache-like list - // The first 2 make a typecache of the given values - // The last uses it as is - -/obj/effect/baseturf_helper/picky/Initialize() - if(!whitelist) - whitelist = list(loc.type) - else if(!islist(whitelist)) - whitelist = list(whitelist) - else if(whitelist[whitelist[1]]) // Checking if it's a typecache-like list - return ..() - whitelist = typecacheof(whitelist) - return ..() - -/obj/effect/baseturf_helper/picky/replace_baseturf(turf/thing) - if(!whitelist[thing.type]) - return - return ..() - -/obj/effect/baseturf_helper/picky/lava_land/plating - name = "picky lavaland plating baseturf helper" - baseturf = /turf/open/floor/plating/lavaland_baseturf - -/obj/effect/baseturf_helper/picky/lava_land/basalt - name = "picky lavaland basalt baseturf helper" - baseturf = /turf/open/floor/plating/asteroid/basalt/lava_land_surface - /obj/effect/mapping_helpers icon = 'icons/effects/mapping_helpers.dmi'