From 2b3aa458075acfae8689a810e26d3dd698185c09 Mon Sep 17 00:00:00 2001 From: san7890 Date: Tue, 24 May 2022 17:53:04 -0600 Subject: [PATCH] Moves APC Mapping Checks to Mapload rather than New (CI IS SAVED EDITION) (#67193) * Moves APC Mapping Checks to Mapload rather than New We've been dealing with this issue for a few months now, and I've grown tired of explaining the problem after I figured it out and decided to finally fix it today. Basically, this check ran at _all_ times, rather than just on mapload (even though it logs to log_mapping). Not good, let's fix that by shuffling some stuff around. I tested this code and I was able to organically create an APC, and all the APCs on load didn't appear to be absolutely fucked in some horrific way. * dmdoc --- code/modules/power/apc/apc_main.dm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index 5d0fff00451..4afe6b87f93 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -105,6 +105,8 @@ var/obj/machinery/computer/apc_control/remote_control = null ///Represents a signel source of power alarms for this apc var/datum/alarm_handler/alarm_manager + /// Offsets the object by APC_PIXEL_OFFSET (defined in apc_defines.dm) pixels in the direction we want it placed in. This allows the APC to be embedded in a wall, yet still inside an area (like mapping). + var/offset_old /obj/machinery/power/apc/New(turf/loc, ndir, building=0) if(!req_access) @@ -126,9 +128,6 @@ addtimer(CALLBACK(src, .proc/update), 5) dir = ndir - // offset APC_PIXEL_OFFSET pixels in direction of dir - // this allows the APC to be embedded in a wall, yet still inside an area - var/offset_old switch(dir) if(NORTH) offset_old = pixel_y @@ -142,8 +141,6 @@ if(WEST) offset_old = pixel_x pixel_x = -APC_PIXEL_OFFSET - if(abs(offset_old) != APC_PIXEL_OFFSET && !building) - log_mapping("APC: ([src]) at [AREACOORD(src)] with dir ([dir] | [uppertext(dir2text(dir))]) has pixel_[dir & (WEST|EAST) ? "x" : "y"] value [offset_old] - should be [dir & (SOUTH|EAST) ? "-" : ""][APC_PIXEL_OFFSET]. Use the directional/ helpers!") /obj/machinery/power/apc/Initialize(mapload) . = ..() @@ -183,6 +180,10 @@ addtimer(CALLBACK(src, .proc/update), 5) + ///This is how we test to ensure that mappers use the directional subtypes of APCs, rather than use the parent and pixel-shift it themselves. + if(abs(offset_old) != APC_PIXEL_OFFSET) + log_mapping("APC: ([src]) at [AREACOORD(src)] with dir ([dir] | [uppertext(dir2text(dir))]) has pixel_[dir & (WEST|EAST) ? "x" : "y"] value [offset_old] - should be [dir & (SOUTH|EAST) ? "-" : ""][APC_PIXEL_OFFSET]. Use the directional/ helpers!") + /obj/machinery/power/apc/Destroy() GLOB.apcs_list -= src