Battery ETA

This commit is contained in:
davipatury
2017-03-04 18:40:16 -03:00
parent 5fb5e1eedd
commit 8496523a6c
5 changed files with 29 additions and 25 deletions
@@ -191,7 +191,7 @@
icon_state = icon_state_unpowered
else
icon_state = icon_state_powered
if(active_program)
if(active_program && active_program.program_state != PROGRAM_STATE_KILLED)
overlays += active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu
else
overlays += icon_state_menu
@@ -56,6 +56,18 @@
power_failure()
return FALSE
/obj/item/device/modular_computer/proc/get_power_eta()
var/obj/item/weapon/computer_hardware/battery/battery_module = all_components[MC_CELL]
if(battery_module && battery_module.battery)
var/hours = 0
var/minutes = (battery_module.battery.charge) / (last_power_usage / 20) // 20 = obj processing interval
if(minutes > 60)
hours = minutes/60
minutes = (hours - round(hours)) * 60
var/seconds = (minutes - round(minutes)) * 60
return list("hours" = hours, "minutes" = minutes, "seconds" = seconds)
return list()
// Used by child types if they have other power source than battery or recharger
/obj/item/device/modular_computer/proc/check_power_override()
return FALSE