[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.
/🆑

* Fix APC related issues

---------

Co-authored-by: thebleh <43266738+rdragan@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-07-23 04:41:06 +02:00
committed by GitHub
parent 16479f380b
commit c19c197b95
8 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -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)
@@ -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()
+2 -2
View File
@@ -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)
+4 -4
View File
@@ -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]")
+1 -1
View File
@@ -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]."
@@ -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
@@ -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)
+1 -1
View File
@@ -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()