mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Remove the snowflake power cells (#12637)
This commit is contained in:
committed by
variableundefined
parent
4714a2d5ed
commit
af8916732b
@@ -20,11 +20,11 @@
|
||||
var/safety = 1 //if you can zap people with the defibs on harm mode
|
||||
var/powered = 0 //if there's a cell in the defib with enough power for a revive, blocks paddles from reviving otherwise
|
||||
var/obj/item/twohanded/shockpaddles/paddles
|
||||
var/obj/item/stock_parts/cell/high/bcell = null
|
||||
var/obj/item/stock_parts/cell/high/cell = null
|
||||
var/combat = 0 //can we revive through space suits?
|
||||
|
||||
/obj/item/defibrillator/get_cell()
|
||||
return bcell
|
||||
return cell
|
||||
|
||||
/obj/item/defibrillator/New() //starts without a cell for rnd
|
||||
..()
|
||||
@@ -35,7 +35,7 @@
|
||||
/obj/item/defibrillator/loaded/New() //starts with hicap
|
||||
..()
|
||||
paddles = make_paddles()
|
||||
bcell = new(src)
|
||||
cell = new(src)
|
||||
update_icon()
|
||||
return
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
. += "<span class='notice'>Ctrl-click to remove the paddles from the defibrillator.</span>"
|
||||
|
||||
/obj/item/defibrillator/proc/update_power()
|
||||
if(bcell)
|
||||
if(bcell.charge < paddles.revivecost)
|
||||
if(cell)
|
||||
if(cell.charge < paddles.revivecost)
|
||||
powered = 0
|
||||
else
|
||||
powered = 1
|
||||
@@ -63,21 +63,21 @@
|
||||
overlays += "[icon_state]-paddles"
|
||||
if(powered)
|
||||
overlays += "[icon_state]-powered"
|
||||
if(!bcell)
|
||||
if(!cell)
|
||||
overlays += "[icon_state]-nocell"
|
||||
if(!safety)
|
||||
overlays += "[icon_state]-emagged"
|
||||
|
||||
/obj/item/defibrillator/proc/update_charge()
|
||||
if(powered) //so it doesn't show charge if it's unpowered
|
||||
if(bcell)
|
||||
var/ratio = bcell.charge / bcell.maxcharge
|
||||
if(cell)
|
||||
var/ratio = cell.charge / cell.maxcharge
|
||||
ratio = Ceiling(ratio*4) * 25
|
||||
overlays += "[icon_state]-charge[ratio]"
|
||||
|
||||
/obj/item/defibrillator/CheckParts(list/parts_list)
|
||||
..()
|
||||
bcell = locate(/obj/item/stock_parts/cell) in contents
|
||||
cell = locate(/obj/item/stock_parts/cell) in contents
|
||||
update_icon()
|
||||
|
||||
/obj/item/defibrillator/ui_action_click()
|
||||
@@ -90,7 +90,7 @@
|
||||
/obj/item/defibrillator/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/stock_parts/cell))
|
||||
var/obj/item/stock_parts/cell/C = W
|
||||
if(bcell)
|
||||
if(cell)
|
||||
to_chat(user, "<span class='notice'>[src] already has a cell.</span>")
|
||||
else
|
||||
if(C.maxcharge < paddles.revivecost)
|
||||
@@ -98,14 +98,14 @@
|
||||
return
|
||||
user.drop_item()
|
||||
W.loc = src
|
||||
bcell = W
|
||||
cell = W
|
||||
to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
|
||||
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
if(bcell)
|
||||
bcell.update_icon()
|
||||
bcell.loc = get_turf(src.loc)
|
||||
bcell = null
|
||||
if(cell)
|
||||
cell.update_icon()
|
||||
cell.loc = get_turf(src.loc)
|
||||
cell = null
|
||||
to_chat(user, "<span class='notice'>You remove the cell from the [src].</span>")
|
||||
|
||||
update_icon()
|
||||
@@ -120,7 +120,7 @@
|
||||
to_chat(user, "<span class='notice'>You silently enable [src]'s safety protocols with the card.")
|
||||
|
||||
/obj/item/defibrillator/emp_act(severity)
|
||||
if(bcell)
|
||||
if(cell)
|
||||
deductcharge(1000 / severity)
|
||||
if(safety)
|
||||
safety = 0
|
||||
@@ -182,15 +182,15 @@
|
||||
var/M = get(paddles, /mob)
|
||||
remove_paddles(M)
|
||||
QDEL_NULL(paddles)
|
||||
QDEL_NULL(bcell)
|
||||
QDEL_NULL(cell)
|
||||
return ..()
|
||||
|
||||
/obj/item/defibrillator/proc/deductcharge(var/chrgdeductamt)
|
||||
if(bcell)
|
||||
if(bcell.charge < (paddles.revivecost+chrgdeductamt))
|
||||
if(cell)
|
||||
if(cell.charge < (paddles.revivecost+chrgdeductamt))
|
||||
powered = 0
|
||||
update_icon()
|
||||
if(bcell.use(chrgdeductamt))
|
||||
if(cell.use(chrgdeductamt))
|
||||
update_icon()
|
||||
return 1
|
||||
else
|
||||
@@ -199,8 +199,8 @@
|
||||
|
||||
/obj/item/defibrillator/proc/cooldowncheck(var/mob/user)
|
||||
spawn(50)
|
||||
if(bcell)
|
||||
if(bcell.charge >= paddles.revivecost)
|
||||
if(cell)
|
||||
if(cell.charge >= paddles.revivecost)
|
||||
user.visible_message("<span class='notice'>[src] beeps: Unit ready.</span>")
|
||||
playsound(get_turf(src), 'sound/machines/defib_ready.ogg', 50, 0)
|
||||
else
|
||||
@@ -226,7 +226,7 @@
|
||||
/obj/item/defibrillator/compact/loaded/New()
|
||||
..()
|
||||
paddles = make_paddles()
|
||||
bcell = new(src)
|
||||
cell = new(src)
|
||||
update_icon()
|
||||
return
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
/obj/item/defibrillator/compact/combat/loaded/New()
|
||||
..()
|
||||
paddles = make_paddles()
|
||||
bcell = new /obj/item/stock_parts/cell/infinite(src)
|
||||
cell = new /obj/item/stock_parts/cell/infinite(src)
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user