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 18:46:14 +02:00
committed by Erki
parent def00ac176
commit 58519daeba
16 changed files with 133 additions and 85 deletions
+5 -2
View File
@@ -4,6 +4,7 @@
icon_state = "energy"
fire_sound = 'sound/weapons/Taser.ogg'
fire_sound_text = "laser blast"
update_icon_on_init = TRUE
var/obj/item/weapon/cell/power_supply //What type of power cell this uses
var/charge_cost = 200 //How much energy is needed to fire.
@@ -34,7 +35,10 @@
/obj/item/weapon/gun/energy/emp_act(severity)
..()
update_icon()
queue_icon_update()
/obj/item/weapon/gun/energy/get_cell()
return power_supply
/obj/item/weapon/gun/energy/Initialize()
. = ..()
@@ -42,7 +46,6 @@
power_supply = new cell_type(src)
else
power_supply = new /obj/item/weapon/cell/device/variable(src, max_shots*charge_cost)
update_icon()
/obj/item/weapon/gun/energy/Destroy()
QDEL_NULL(power_supply)
@@ -187,6 +187,10 @@ obj/item/weapon/gun/energy/staff/focus/attack_self(mob/living/user as mob)
projectile_type = /obj/item/projectile/magic
origin_tech = list(TECH_COMBAT = 6, TECH_MAGNET = 5, TECH_BLUESPACE = 6)
charge_meter = 0
charge_failure_message = null
/obj/item/weapon/gun/energy/wand/get_cell()
return DEVICE_NO_CELL
/obj/item/weapon/gun/energy/wand/handle_click_empty(mob/user = null)
if (user)
@@ -40,6 +40,7 @@
modifystate = null
var/reliability = 95
turret_sprite_set = "nuclear"
charge_failure_message = "'s charging socket was removed to make room for a minaturized reactor."
firemodes = list(
list(mode_name="stun", projectile_type=/obj/item/projectile/beam/stun, fire_sound='sound/weapons/Taser.ogg'),
@@ -48,6 +49,8 @@
var/lightfail = 0
/obj/item/weapon/gun/energy/gun/nuclear/get_cell()
return DEVICE_NO_CELL
/obj/item/weapon/gun/energy/gun/nuclear/proc/failcheck()
lightfail = 0
@@ -50,6 +50,10 @@
charge_meter = 0
can_turret = 1
turret_sprite_set = "crossbow"
charge_failure_message = "'s charging socket was removed to make room for a minaturized reactor."
/obj/item/weapon/gun/energy/crossbow/get_cell()
return DEVICE_NO_CELL
/obj/item/weapon/gun/energy/crossbow/ninja
name = "energy dart thrower"