From c19c197b9544a4bfaa32bb6b76c61ec7f61fcf27 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 23 Jul 2023 04:41:06 +0200 Subject: [PATCH] [MIRROR] Fix APC related issues [MDB IGNORE] (#22635) * Fix APC related issues (#77005) ## About The Pull Request Fixes a bunch of stuff broken by #76822, including APC control console, malf blackout ability, shunted malf pinpointing, Admin APC recharge and others. ## Why It's Good For The Game Yes. ## Changelog :cl:Thebleh fix: Fixed several APC related issues. /:cl: * Fix APC related issues --------- Co-authored-by: thebleh <43266738+rdragan@users.noreply.github.com> --- code/controllers/subsystem/nightshift.dm | 2 +- code/datums/station_traits/negative_traits.dm | 2 +- code/game/gamemodes/events.dm | 4 ++-- code/game/machinery/computer/apc_control.dm | 8 ++++---- code/modules/admin/verbs/debug.dm | 2 +- code/modules/antagonists/malf_ai/malf_ai_modules.dm | 2 +- code/modules/antagonists/nukeop/equipment/pinpointer.dm | 2 +- code/modules/events/electrical_storm.dm | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code/controllers/subsystem/nightshift.dm b/code/controllers/subsystem/nightshift.dm index c82c7c1e771..78583cef350 100644 --- a/code/controllers/subsystem/nightshift.dm +++ b/code/controllers/subsystem/nightshift.dm @@ -46,7 +46,7 @@ SUBSYSTEM_DEF(nightshift) /datum/controller/subsystem/nightshift/proc/update_nightshift(active, announce = TRUE, resumed = FALSE, forced = FALSE) if(!resumed) - currentrun = SSmachines.get_machines_by_type(/obj/machinery/power/apc) + currentrun = SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc) nightshift_active = active if(announce) if (active) diff --git a/code/datums/station_traits/negative_traits.dm b/code/datums/station_traits/negative_traits.dm index 4fc6a464a9c..8914b50c780 100644 --- a/code/datums/station_traits/negative_traits.dm +++ b/code/datums/station_traits/negative_traits.dm @@ -81,7 +81,7 @@ /datum/station_trait/blackout/on_round_start() . = ..() - for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) if(is_station_level(apc.z) && prob(60)) apc.overload_lighting() diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index ff11c15c65f..8810ffc0fc6 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -31,7 +31,7 @@ station_area.power_environ = FALSE station_area.power_change() - for(var/obj/machinery/power/apc/C as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + for(var/obj/machinery/power/apc/C as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) if(C.cell && is_station_level(C.z)) var/area/A = C.area if(GLOB.typecache_powerfailure_safe_areas[A.type]) @@ -46,7 +46,7 @@ */ /proc/power_restore() priority_announce("Power has been restored to [station_name()]. We apologize for the inconvenience.", "Power Systems Nominal", ANNOUNCER_POWERON) - for(var/obj/machinery/power/apc/C as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + for(var/obj/machinery/power/apc/C as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) if(C.cell && is_station_level(C.z)) C.cell.charge = C.cell.maxcharge COOLDOWN_RESET(C, failure_timer) diff --git a/code/game/machinery/computer/apc_control.dm b/code/game/machinery/computer/apc_control.dm index eb4975eb073..2b5cfa14c7c 100644 --- a/code/game/machinery/computer/apc_control.dm +++ b/code/game/machinery/computer/apc_control.dm @@ -94,7 +94,7 @@ for(var/entry in logs) data["logs"] += list(list("entry" = entry)) - for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) if(check_apc(apc)) var/has_cell = (apc.cell) ? TRUE : FALSE data["apcs"] += list(list( @@ -157,7 +157,7 @@ if("access-apc") var/ref = params["ref"] playsound(src, SFX_TERMINAL_TYPE, 50, FALSE) - var/obj/machinery/power/apc/APC = locate(ref) in SSmachines.get_machines_by_type(/obj/machinery/power/apc) + var/obj/machinery/power/apc/APC = locate(ref) in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc) connect_apc(APC, usr) if("check-logs") log_activity("Checked Logs") @@ -167,7 +167,7 @@ var/ref = params["ref"] var/type = params["type"] var/value = params["value"] - var/obj/machinery/power/apc/target = locate(ref) in SSmachines.get_machines_by_type(/obj/machinery/power/apc) + var/obj/machinery/power/apc/target = locate(ref) in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc) if(!target) return @@ -196,7 +196,7 @@ usr.log_message("set APC [target.area.name] [type] to [setTo]]", LOG_GAME) if("breaker") var/ref = params["ref"] - var/obj/machinery/power/apc/target = locate(ref) in SSmachines.get_machines_by_type(/obj/machinery/power/apc) + var/obj/machinery/power/apc/target = locate(ref) in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc) target.toggle_breaker(usr) var/setTo = target.operating ? "On" : "Off" log_activity("Turned APC [target.area.name]'s breaker [setTo]") diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 968921cd685..b131fc935d1 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -299,7 +299,7 @@ areas_all.Add(A.type) CHECK_TICK - for(var/obj/machinery/power/apc/APC as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + for(var/obj/machinery/power/apc/APC as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) var/area/A = APC.area if(!A) dat += "Skipped over [APC] in invalid location, [APC.loc]." diff --git a/code/modules/antagonists/malf_ai/malf_ai_modules.dm b/code/modules/antagonists/malf_ai/malf_ai_modules.dm index 3f93a6fd155..582c5df4e6d 100644 --- a/code/modules/antagonists/malf_ai/malf_ai_modules.dm +++ b/code/modules/antagonists/malf_ai/malf_ai_modules.dm @@ -565,7 +565,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) desc = "[desc] It has [uses] use\s remaining." /datum/action/innate/ai/blackout/Activate() - for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) if(prob(30 * apc.overload)) apc.overload_lighting() else diff --git a/code/modules/antagonists/nukeop/equipment/pinpointer.dm b/code/modules/antagonists/nukeop/equipment/pinpointer.dm index 03faaa5d0ef..da72e41ef51 100644 --- a/code/modules/antagonists/nukeop/equipment/pinpointer.dm +++ b/code/modules/antagonists/nukeop/equipment/pinpointer.dm @@ -48,7 +48,7 @@ var/mob/living/silicon/ai/A = V if(A.nuking) target = A - for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) if(apc.malfhack && apc.occupier) target = apc if(TRACK_INFILTRATOR) diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm index 3dc4e5bf051..84086260ea6 100644 --- a/code/modules/events/electrical_storm.dm +++ b/code/modules/events/electrical_storm.dm @@ -30,6 +30,6 @@ return for(var/centre in epicentreList) - for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type(/obj/machinery/power/apc)) + for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc)) if(get_dist(centre, apc) <= lightsoutRange) apc.overload_lighting()