PCUs and SR Connected Computers (#4040)

* PCU and Connected Consoles

* Clean this up
This commit is contained in:
Zandario
2022-05-14 06:45:56 -07:00
committed by GitHub
parent 843e7e15fe
commit 03aacd017e
39 changed files with 617 additions and 462 deletions
@@ -1,14 +1,14 @@
/obj/item/modular_computer/proc/power_failure(var/malfunction = 0)
/obj/item/modular_computer/proc/power_failure(malfunction = FALSE)
if(enabled) // Shut down the computer
visible_message("<span class='danger'>\The [src]'s screen flickers briefly and then goes dark.</span>")
visible_message(SPAN_DANGER("\The [src]'s screen flickers briefly and then goes dark."))
if(active_program)
active_program.event_powerfailure(0)
for(var/datum/computer_file/program/PRG in idle_threads)
PRG.event_powerfailure(1)
shutdown_computer(0)
// Tries to use power from battery. Passing 0 as parameter results in this proc returning whether battery is functional or not.
/obj/item/modular_computer/proc/battery_power(var/power_usage = 0)
/// Tries to use power from battery. Passing 0 as parameter results in this proc returning whether battery is functional or not.
/obj/item/modular_computer/proc/battery_power(power_usage = 0)
apc_powered = FALSE
if(!battery_module || !battery_module.check_functionality() || battery_module.battery.charge <= 0)
return FALSE
@@ -16,8 +16,8 @@
return TRUE
return FALSE
// Tries to use power from APC, if present.
/obj/item/modular_computer/proc/apc_power(var/power_usage = 0)
/// Tries to use power from APC, if present.
/obj/item/modular_computer/proc/apc_power(power_usage = 0)
apc_powered = TRUE
// Tesla link was originally limited to machinery only, but this probably works too, and the benefit of being able to power all devices from an APC outweights
// the possible minor performance loss.
@@ -35,7 +35,7 @@
A.use_power_oneoff(power_usage, EQUIP)
return TRUE
// Handles power-related things, such as battery interaction, recharging, shutdown when it's discharged
/// Handles power-related things, such as battery interaction, recharging, shutdown when it's discharged
/obj/item/modular_computer/proc/handle_power()
var/power_usage = screen_on ? base_active_power_usage : base_idle_power_usage
for(var/obj/item/computer_hardware/H in get_all_components())