Recharger QoL Tweaks (#3826)

changes:

Rechargers now briefly show a progress bar showing the current charge level of the device currently charging.
Examining a recharger will now specify what is in the charger.
Atoms can now mark themselves as requiring an icon update on initialize instead of overriding Initialize() just to call update_icon().
Charger code is now slightly more modular, using proc/get_cell() to get a ref to the power cell instead of hard-coded if-else chains for each supported type.
This commit is contained in:
Lohikar
2017-11-18 10:46:14 -06:00
committed by Erki
parent def00ac176
commit 58519daeba
16 changed files with 133 additions and 85 deletions
@@ -8,7 +8,7 @@
malfunction_probability = 1
origin_tech = list(TECH_POWER = 1, TECH_ENGINEERING = 1)
var/battery_rating = 750
var/obj/item/weapon/cell/battery = null
var/obj/item/weapon/cell/battery
/obj/item/weapon/computer_hardware/battery_module/advanced
name = "advanced battery"
@@ -51,24 +51,27 @@
// This is not intended to be obtainable in-game. Intended for adminbus and debugging purposes.
/obj/item/weapon/computer_hardware/battery_module/lambda
name = "lambda coil"
desc = "A very complex device that creates it's own bluespace dimension. This dimension may be used to store massive amounts of energy."
desc = "A very complex device that creates its own bluespace dimension. This dimension may be used to store massive amounts of energy."
icon_state = "battery_lambda"
hardware_size = 1
battery_rating = 1000000
/obj/item/weapon/computer_hardware/battery_module/lambda/New()
..()
/obj/item/weapon/computer_hardware/battery_module/lambda/Initialize()
. = ..()
battery = new/obj/item/weapon/cell/infinite(src)
/obj/item/weapon/computer_hardware/battery_module/diagnostics(var/mob/user)
..()
user << "Internal battery charge: [battery.charge]/[battery.maxcharge] CU"
user << "Internal battery charge: [battery.charge]/[battery.maxcharge] mAh"
/obj/item/weapon/computer_hardware/battery_module/New()
battery = new/obj/item/weapon/cell(src)
battery.maxcharge = battery_rating
/obj/item/weapon/computer_hardware/battery_module/Initialize()
. = ..()
battery = new/obj/item/weapon/cell/device/variable(src, battery_rating)
battery.charge = 0
..()
/obj/item/weapon/computer_hardware/battery_module/proc/charge_to_full()
if(battery)
battery.charge = battery.maxcharge
/obj/item/weapon/computer_hardware/battery_module/get_cell()
return battery