From 1d5f2b5b370f8c3067c5f800b8bee3ee75a4e957 Mon Sep 17 00:00:00 2001 From: ItsSelis Date: Mon, 4 Jul 2022 00:06:02 +0200 Subject: [PATCH] Wires Colors & Exemptions --- code/_unit_tests.dm | 2 +- code/unit_tests/map_tests.dm | 42 ++++++++++++++++++++++------------- maps/tether/tether_defines.dm | 8 +++++++ maps/~map_system/maps.dm | 3 ++- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/code/_unit_tests.dm b/code/_unit_tests.dm index 7a1a4cbbf38..3c6a5943e4d 100644 --- a/code/_unit_tests.dm +++ b/code/_unit_tests.dm @@ -7,4 +7,4 @@ * Should you wish to edit set UNIT_TEST to 1 like so: * #define UNIT_TEST 1 */ -#define UNIT_TEST 0 +#define UNIT_TEST 1 diff --git a/code/unit_tests/map_tests.dm b/code/unit_tests/map_tests.dm index d5979208a28..e988835fc4d 100644 --- a/code/unit_tests/map_tests.dm +++ b/code/unit_tests/map_tests.dm @@ -73,6 +73,8 @@ name = "MAP: Cable Test (Defined Z-Levels)" /datum/unit_test/wire_test/start_test() + set background=1 + var/wire_test_count = 0 var/bad_tests = 0 var/turf/T = null @@ -80,25 +82,35 @@ var/list/cable_turfs = list() var/list/dirs_checked = list() + var/list/exempt_from_wires = list() + exempt_from_wires += using_map.unit_test_exempt_from_wires.Copy() + var/list/zs_to_test = using_map.unit_test_z_levels || list(1) //Either you set it, or you just get z1 - for(C in world) - T = null + for(var/color in possible_cable_coil_colours) + cable_turfs = list() - T = get_turf(C) - if(T && (T.z in zs_to_test)) - cable_turfs |= get_turf(C) + for(C in world) + T = null - for(T in cable_turfs) - var/bad_msg = "--------------- [T.name] \[[T.x] / [T.y] / [T.z]\]" - dirs_checked.Cut() - for(C in T) - wire_test_count++ - var/combined_dir = "[C.d1]-[C.d2]" - if(combined_dir in dirs_checked) - bad_tests++ - log_unit_test("[bad_msg] Contains multiple wires with same direction on top of each other.") - dirs_checked.Add(combined_dir) + T = get_turf(C) + var/area/A = get_area(T) + if(T && (T.z in zs_to_test) && !(A.type in exempt_from_wires)) + if(C.color == possible_cable_coil_colours[color]) + cable_turfs |= get_turf(C) + + for(T in cable_turfs) + var/bad_msg = "--------------- [T.name] \[[T.x] / [T.y] / [T.z]\] [color]" + dirs_checked.Cut() + for(C in T) + wire_test_count++ + var/combined_dir = "[C.d1]-[C.d2]" + if(combined_dir in dirs_checked) + bad_tests++ + log_unit_test("[bad_msg] Contains multiple wires with same direction on top of each other.") + dirs_checked.Add(combined_dir) + + log_unit_test("[color] wires checked.") if(bad_tests) fail("\[[bad_tests] / [wire_test_count]\] Some turfs had overlapping wires going the same direction.") diff --git a/maps/tether/tether_defines.dm b/maps/tether/tether_defines.dm index 1b213ad32cc..303c3eafcd8 100644 --- a/maps/tether/tether_defines.dm +++ b/maps/tether/tether_defines.dm @@ -148,6 +148,7 @@ unit_test_exempt_from_atmos = list( /area/engineering/atmos_intake, // Outside, + /area/engineering/engine_gas, /area/rnd/external, // Outside, /area/rnd/outpost/xenobiology/outpost_stairs, /area/tether/surfacebase/entertainment/stage, // Connected to entertainment area @@ -162,6 +163,13 @@ /area/vacant/vacant_bar_upper // Maint ) + unit_test_exempt_from_wires = list( + /area/shuttle/medivac/general, + /area/shuttle/medivac/engines, + /area/shuttle/securiship/general, + /area/shuttle/securiship/engines + ) + unit_test_z_levels = list( Z_LEVEL_SURFACE_LOW, Z_LEVEL_SURFACE_MID, diff --git a/maps/~map_system/maps.dm b/maps/~map_system/maps.dm index 7fc7fca28f8..f94fa19a39a 100644 --- a/maps/~map_system/maps.dm +++ b/maps/~map_system/maps.dm @@ -133,6 +133,7 @@ var/list/all_maps = list() var/list/unit_test_exempt_areas = list() var/list/unit_test_exempt_from_atmos = list() var/list/unit_test_exempt_from_apc = list() + var/list/unit_test_exempt_from_wires = list() var/list/unit_test_z_levels //To test more than Z1, set your z-levels to test here. var/list/planet_datums_to_make = list() // Types of `/datum/planet`s that will be instantiated by SSPlanets. @@ -353,4 +354,4 @@ var/list/all_maps = list() return ..() /datum/map/proc/get_map_info() - return "No map information available" \ No newline at end of file + return "No map information available"