From 7dc4fc9c708cc10b76c3a708bd54c5735e2e192e Mon Sep 17 00:00:00 2001 From: TDSSS <32099540+TDSSS@users.noreply.github.com> Date: Fri, 30 Oct 2020 10:48:08 +0100 Subject: [PATCH] Powering off unpowered but active cores/relays --- code/game/machinery/tcomms/core.dm | 6 +++++- code/game/machinery/tcomms/relay.dm | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/tcomms/core.dm b/code/game/machinery/tcomms/core.dm index 9f84f3af963..0801d34510f 100644 --- a/code/game/machinery/tcomms/core.dm +++ b/code/game/machinery/tcomms/core.dm @@ -156,7 +156,11 @@ continue // If another core is active, return FALSE if(C.active) - return FALSE + if(C.stat & NOPOWER) // If another core has no power but is supposed to be on, we shut it down so we can continue. + C.active = FALSE // Since only one active core is allowed per z level, give priority to the one actually working. + C.update_icon() + else + return FALSE // If we got here there isnt an active core on this Z-level. So return true return TRUE diff --git a/code/game/machinery/tcomms/relay.dm b/code/game/machinery/tcomms/relay.dm index 27d4e750bc5..ebd2d5bda10 100644 --- a/code/game/machinery/tcomms/relay.dm +++ b/code/game/machinery/tcomms/relay.dm @@ -88,7 +88,11 @@ continue // If another relay is active, return FALSE if(R.active) - return FALSE + if(R.stat & NOPOWER) // If another relay has no power but is supposed to be on, we shut it down so we can continue. + R.active = FALSE // Since only one active relay is allowed per z level, give priority to the one that's actually working. + R.update_icon() + else + return FALSE // If we got here there isnt an active relay on this Z-level. So return TRUE return TRUE