[MIRROR] Fixes defibrillator paddles and wall mounts not detecting charge changes. (#6227)

* - fixed various charge-related bugs of defib and defib wall mounts (#59366)

Co-authored-by: norill <4>

* Fixes defibrillator paddles and wall mounts not detecting charge changes.

Co-authored-by: norill <norill@wp.pl>
This commit is contained in:
SkyratBot
2021-06-10 23:50:32 +01:00
committed by GitHub
co-authored by norill <4> norill
parent 722c0009d1
commit f6c9fd9599
4 changed files with 15 additions and 5 deletions
+2 -2
View File
@@ -317,9 +317,9 @@
/obj/machinery/proc/auto_use_power()
if(!powered(power_channel))
return FALSE
if(use_power == 1)
if(use_power == IDLE_POWER_USE)
use_power(idle_power_usage,power_channel)
else if(use_power >= 2)
else if(use_power >= ACTIVE_POWER_USE)
use_power(active_power_usage,power_channel)
return TRUE
+1 -1
View File
@@ -232,7 +232,7 @@
if(C.charge < C.maxcharge)
use_power(50 * delta_time)
C.give(40 * delta_time)
update_appearance()
defib.update_power()
//wallframe, for attaching the mounts easily
/obj/item/wallframe/defib_mount
+11 -2
View File
@@ -41,6 +41,13 @@
update_power()
return
/obj/item/defibrillator/examine(mob/user)
. = ..()
if(cell)
. += "<span class='notice'>Use a screwdriver to remove the cell.</span>"
else
. += "<span class='warning'>It has no power cell!</span>"
/obj/item/defibrillator/fire_act(exposed_temperature, exposed_volume)
. = ..()
if(paddles?.loc == src)
@@ -60,6 +67,8 @@
else
powered = FALSE
update_appearance()
if(istype(loc, /obj/machinery/defibrillator_mount))
loc.update_appearance()
/obj/item/defibrillator/update_overlays()
. = ..()
@@ -128,7 +137,6 @@
cell = W
to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
update_power()
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(cell)
cell.update_appearance()
@@ -415,8 +423,9 @@
/obj/item/shockpaddles/attack(mob/M, mob/living/user, params)
if(busy)
return
defib?.update_power()
if(req_defib && !defib.powered)
user.visible_message("<span class='notice'>[defib] beeps: Unit is unpowered.</span>")
user.visible_message("<span class='warning'>[defib] beeps: Not enough charge!</span>")
playsound(src, 'sound/machines/defib_failed.ogg', 50, FALSE)
return
if(!wielded)
+1
View File
@@ -204,6 +204,7 @@
/obj/item/stock_parts/cell/empty/Initialize()
. = ..()
charge = 0
update_appearance()
/obj/item/stock_parts/cell/crap
name = "\improper Nanotrasen brand rechargeable AA battery"