Files
Bubberstation/code/game/objects/items/weapons/defib.dm
phil235 5f835bfc26 Obj damaging system, acid damage, and fire damage refactor (WIP) (#20793)
Please refer to #20867 and #20870 for a easier view of the changes. Those two PRs show all meaningful changes (hopefully) and doesn't show the files changed with just 3 lines changed.

This PR does three things:

    It makes all children of /obj/ use the same damage system.
    Previously to make your new machine/structure be destroyable you needed to give it a var/health, and its own version of many damage related proc such as bullet_act(), take_damage(), attacked_by(), attack_animal(), attack_hulk(), ex_act(), etc... But now, all /obj/ use the same version of those procs at the /obj/ level in code/game/obj_defense.dm. All these obj share the same necessary vars: obj_integrity (health), max_integrity, integrity_failure (optional, below that health level failure happens), and the armor list var which was previously only for items, as well as the resistance_flags bitfield. When you want your new object to be destroyable, you only have to give it a value for those vars and maybe override one proc if you want a special behavior but that's it. This reorganization removes a lot of copypasta (most bullet_act() version for each obj were nearly identical). Two new elements are added to the armor list var: fire and acid armor values.
    How much damage an obj take depends on the armor value for each damage category. But some objects are INDESTRUCTIBLE and simply never take any damage no matter the type.
    The armor categories are:
    -melee(punches, item attacks, xeno/animal/hulk attacks, blob attacks, thrown weapons)
    -bullet
    -laser
    -energy (used by projectiles like ionrifle, taser, and also by EMPs)
    -bio (unused for this, only here because clothes use them when worn)
    -rad (same)
    -bomb (self-explanatory)
    -fire (for fire damage, not for heat damage though)
    -acid
    For machines and structures, when their health reaches zero the object is not just deleted but gets somewhat forcedeconstructed (the proc used is shared with the actual deconstruction system) which can drops things. To not frustrates players most of these objects drop most of the elements necessary to rebuild them (think window dropping shards). Machines drop a machine frame and all components for example (but the frame can then be itself smashed to pieces).
    For clothes, when they are damaged, they get a "damaged" overlay, which can also be seen when worn, similar to the "bloody" overlay.

    It refactors acid. See #20537.
    Some objects are ACID_PROOF and take no damage from acid, while others take varying amounts
    of damage depending on their acid armor value. Some objects are even UNACIDABLE, no acid effect can even land on them. Acid on objects can be washed off using water.

    It changes some aspect of damage from fires.
    All /obj/ can now take fire damage and be flammable, instead of just items. And instead of having just FLAMMABLE objs that become ON_FIRE as soon as some fire touch them (paper), we now have objects that are non flammable but do take damage from fire and become ashes if their health reaches zero (only for items). The damage taken varies depending on the obj's fire armor value and total health. There's also still obj and items that are FIRE_PROOF (although some might still be melted by lava if they're not LAVA_PROOF).
    When a mob is on fire, its clothes now take fire damage and can turn to ashes. Similarly, when a mob takes melee damages, its clothes gets damaged a bit and can turn to shreds. You can repair clothes with cloth that is produceable by botany's biogenerator.

    It also does many minor things:
        Clicking a structure/machine with an item on help intent never results in an attack (so you don't destroy a structure while trying to figure out which tool to use).
        I moved a lot of objects away from /obj/effect, it should only be used for visual effects, decals and stuff, not for things you can hit and destroy.
        I tweaked a bit how clothes shredding from bombs work.
        I made a machine or structure un/anchorable with the wrench, I don't remember which object...
        Since I changed the meaning of the FIRE_PROOF bitflag to actually mean fire immune, I'm buffing the slime extract that you apply on items to make them fire proof. well now they're really 100% fire proof!
        animals with environment_smash = 1 no longer one-hit destroy tables and stuff, we give them a decent obj_damage value so they can destroy most obj relatively fast depending on the animal.
        Probably a million things I forgot.

If you want to know how the damage system works all you need is the three obj vars "obj_integrity", "max_integrity", "integrity_failure", as well as the armor list var and the resistance_flags bitfield, and read the file obj_defense.dm
2016-10-10 11:14:59 +13:00

568 lines
20 KiB
Plaintext

//backpack item
/obj/item/weapon/defibrillator
name = "defibrillator"
desc = "A device that delivers powerful shocks to detachable paddles that resuscitate incapacitated patients."
icon = 'icons/obj/weapons.dmi'
icon_state = "defibunit"
item_state = "defibunit"
slot_flags = SLOT_BACK
force = 5
throwforce = 6
w_class = 4
origin_tech = "biotech=4"
actions_types = list(/datum/action/item_action/toggle_paddles)
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 50, acid = 50)
var/on = 0 //if the paddles are equipped (1) or on the defib (0)
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/weapon/twohanded/shockpaddles/paddles
var/obj/item/weapon/stock_parts/cell/high/bcell = null
var/combat = 0 //can we revive through space suits?
var/grab_ghost = FALSE // Do we pull the ghost back into their body?
/obj/item/weapon/defibrillator/New() //starts without a cell for rnd
..()
paddles = make_paddles()
update_icon()
return
/obj/item/weapon/defibrillator/loaded/New() //starts with hicap
..()
paddles = make_paddles()
bcell = new(src)
update_icon()
return
/obj/item/weapon/defibrillator/update_icon()
update_power()
update_overlays()
update_charge()
/obj/item/weapon/defibrillator/proc/update_power()
if(bcell)
if(bcell.charge < paddles.revivecost)
powered = 0
else
powered = 1
else
powered = 0
/obj/item/weapon/defibrillator/proc/update_overlays()
cut_overlays()
if(!on)
add_overlay("[initial(icon_state)]-paddles")
if(powered)
add_overlay("[initial(icon_state)]-powered")
if(!bcell)
add_overlay("[initial(icon_state)]-nocell")
if(!safety)
add_overlay("[initial(icon_state)]-emagged")
/obj/item/weapon/defibrillator/proc/update_charge()
if(powered) //so it doesn't show charge if it's unpowered
if(bcell)
var/ratio = bcell.charge / bcell.maxcharge
ratio = Ceiling(ratio*4) * 25
add_overlay("[initial(icon_state)]-charge[ratio]")
/obj/item/weapon/defibrillator/CheckParts(list/parts_list)
..()
bcell = locate(/obj/item/weapon/stock_parts/cell) in contents
update_icon()
/obj/item/weapon/defibrillator/ui_action_click()
toggle_paddles()
/obj/item/weapon/defibrillator/attack_hand(mob/user)
if(loc == user)
if(slot_flags == SLOT_BACK)
if(user.get_item_by_slot(slot_back) == src)
ui_action_click()
else
user << "<span class='warning'>Put the defibrillator on your back first!</span>"
else if(slot_flags == SLOT_BELT)
if(user.get_item_by_slot(slot_belt) == src)
ui_action_click()
else
user << "<span class='warning'>Strap the defibrillator's belt on first!</span>"
return
..()
/obj/item/weapon/defibrillator/MouseDrop(obj/over_object)
if(ismob(src.loc))
var/mob/M = src.loc
if(istype(over_object, /obj/screen/inventory/hand))
var/obj/screen/inventory/hand/H = over_object
if(!M.unEquip(src))
return
M.put_in_hand(src, H.held_index)
/obj/item/weapon/defibrillator/attackby(obj/item/weapon/W, mob/user, params)
if(W == paddles)
paddles.unwield()
toggle_paddles()
else if(istype(W, /obj/item/weapon/stock_parts/cell))
var/obj/item/weapon/stock_parts/cell/C = W
if(bcell)
user << "<span class='notice'>[src] already has a cell.</span>"
else
if(C.maxcharge < paddles.revivecost)
user << "<span class='notice'>[src] requires a higher capacity cell.</span>"
return
if(!user.unEquip(W))
return
W.loc = src
bcell = W
user << "<span class='notice'>You install a cell in [src].</span>"
update_icon()
else if(istype(W, /obj/item/weapon/screwdriver))
if(bcell)
bcell.updateicon()
bcell.loc = get_turf(src.loc)
bcell = null
user << "<span class='notice'>You remove the cell from [src].</span>"
update_icon()
else
return ..()
/obj/item/weapon/defibrillator/emag_act(mob/user)
if(safety)
safety = 0
user << "<span class='warning'>You silently disable [src]'s safety protocols with the cryptographic sequencer."
else
safety = 1
user << "<span class='notice'>You silently enable [src]'s safety protocols with the cryptographic sequencer."
/obj/item/weapon/defibrillator/emp_act(severity)
if(bcell)
deductcharge(1000 / severity)
if(safety)
safety = 0
src.visible_message("<span class='notice'>[src] beeps: Safety protocols disabled!</span>")
playsound(get_turf(src), 'sound/machines/defib_saftyOff.ogg', 50, 0)
else
safety = 1
src.visible_message("<span class='notice'>[src] beeps: Safety protocols enabled!</span>")
playsound(get_turf(src), 'sound/machines/defib_saftyOn.ogg', 50, 0)
update_icon()
..()
/obj/item/weapon/defibrillator/proc/toggle_paddles()
set name = "Toggle Paddles"
set category = "Object"
on = !on
var/mob/living/carbon/human/user = usr
if(on)
//Detach the paddles into the user's hands
if(!usr.put_in_hands(paddles))
on = 0
user << "<span class='warning'>You need a free hand to hold the paddles!</span>"
update_icon()
return
paddles.loc = user
else
//Remove from their hands and back onto the defib unit
paddles.unwield()
remove_paddles(user)
update_icon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/weapon/defibrillator/proc/make_paddles()
return new /obj/item/weapon/twohanded/shockpaddles(src)
/obj/item/weapon/defibrillator/equipped(mob/user, slot)
..()
if((slot_flags == SLOT_BACK && slot != slot_back) || (slot_flags == SLOT_BELT && slot != slot_belt))
remove_paddles(user)
update_icon()
/obj/item/weapon/defibrillator/item_action_slot_check(slot, mob/user)
if(slot == user.getBackSlot())
return 1
/obj/item/weapon/defibrillator/proc/remove_paddles(mob/user) //this fox the bug with the paddles when other player stole you the defib when you have the paddles equiped
if(ismob(paddles.loc))
var/mob/M = paddles.loc
M.unEquip(paddles,1)
return
/obj/item/weapon/defibrillator/Destroy()
if(on)
var/M = get(paddles, /mob)
remove_paddles(M)
. = ..()
update_icon()
/obj/item/weapon/defibrillator/proc/deductcharge(chrgdeductamt)
if(bcell)
if(bcell.charge < (paddles.revivecost+chrgdeductamt))
powered = 0
update_icon()
if(bcell.use(chrgdeductamt))
update_icon()
return 1
else
update_icon()
return 0
/obj/item/weapon/defibrillator/proc/cooldowncheck(mob/user)
spawn(50)
if(bcell)
if(bcell.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
user.visible_message("<span class='notice'>[src] beeps: Charge depleted.</span>")
playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
paddles.cooldown = 0
paddles.update_icon()
update_icon()
/obj/item/weapon/defibrillator/compact
name = "compact defibrillator"
desc = "A belt-equipped defibrillator that can be rapidly deployed."
icon_state = "defibcompact"
item_state = "defibcompact"
w_class = 3
slot_flags = SLOT_BELT
origin_tech = "biotech=5"
/obj/item/weapon/defibrillator/compact/item_action_slot_check(slot, mob/user)
if(slot == user.getBeltSlot())
return 1
/obj/item/weapon/defibrillator/compact/loaded/New()
..()
paddles = make_paddles()
bcell = new(src)
update_icon()
return
/obj/item/weapon/defibrillator/compact/combat
name = "combat defibrillator"
desc = "A belt-equipped blood-red defibrillator that can be rapidly deployed. Does not have the restrictions or safeties of conventional defibrillators and can revive through space suits."
combat = 1
safety = 0
/obj/item/weapon/defibrillator/compact/combat/loaded/New()
..()
paddles = make_paddles()
bcell = new /obj/item/weapon/stock_parts/cell/infinite(src)
update_icon()
return
/obj/item/weapon/defibrillator/compact/combat/loaded/attackby(obj/item/weapon/W, mob/user, params)
if(W == paddles)
paddles.unwield()
toggle_paddles()
update_icon()
return
//paddles
/obj/item/weapon/twohanded/shockpaddles
name = "defibrillator paddles"
desc = "A pair of plastic-gripped paddles with flat metal surfaces that are used to deliver powerful electric shocks."
icon = 'icons/obj/weapons.dmi'
icon_state = "defibpaddles"
item_state = "defibpaddles"
force = 0
throwforce = 6
w_class = 4
flags = NODROP
var/revivecost = 1000
var/cooldown = 0
var/busy = 0
var/obj/item/weapon/defibrillator/defib
var/req_defib = 1
var/combat = 0 //If it penetrates armor and gives additional functionality
var/grab_ghost = FALSE
/obj/item/weapon/twohanded/shockpaddles/proc/recharge(var/time)
if(req_defib || !time)
return
cooldown = 1
update_icon()
sleep(time)
var/turf/T = get_turf(src)
T.audible_message("<span class='notice'>[src] beeps: Unit is recharged.</span>")
playsound(T, 'sound/machines/defib_ready.ogg', 50, 0)
cooldown = 0
update_icon()
/obj/item/weapon/twohanded/shockpaddles/New(mainunit)
..()
if(check_defib_exists(mainunit, src) && req_defib)
defib = mainunit
loc = defib
busy = 0
update_icon()
return
/obj/item/weapon/twohanded/shockpaddles/update_icon()
icon_state = "defibpaddles[wielded]"
item_state = "defibpaddles[wielded]"
if(cooldown)
icon_state = "defibpaddles[wielded]_cooldown"
/obj/item/weapon/twohanded/shockpaddles/suicide_act(mob/user)
user.visible_message("<span class='danger'>[user] is putting the live paddles on \his chest! It looks like \he's trying to commit suicide.</span>")
if(req_defib)
defib.deductcharge(revivecost)
playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
return (OXYLOSS)
/obj/item/weapon/twohanded/shockpaddles/dropped(mob/user)
if(!req_defib)
return ..()
if(user)
var/obj/item/weapon/twohanded/offhand/O = user.get_inactive_held_item()
if(istype(O))
O.unwield()
user << "<span class='notice'>The paddles snap back into the main unit.</span>"
defib.on = 0
loc = defib
defib.update_icon()
return unwield(user)
/obj/item/weapon/twohanded/shockpaddles/proc/check_defib_exists(mainunit, mob/living/carbon/human/M, obj/O)
if(!req_defib)
return 1 //If it doesn't need a defib, just say it exists
if (!mainunit || !istype(mainunit, /obj/item/weapon/defibrillator)) //To avoid weird issues from admin spawns
M.unEquip(O)
qdel(O)
return 0
else
return 1
/obj/item/weapon/twohanded/shockpaddles/attack(mob/M, mob/user)
var/halfwaycritdeath = (HEALTH_THRESHOLD_CRIT + HEALTH_THRESHOLD_DEAD) / 2
if(busy)
return
if(req_defib && !defib.powered)
user.visible_message("<span class='notice'>[defib] beeps: Unit is unpowered.</span>")
playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
return
if(!wielded)
if(iscyborg(user))
user << "<span class='warning'>You must activate the paddles in your active module before you can use them on someone!</span>"
else
user << "<span class='warning'>You need to wield the paddles in both hands before you can use them on someone!</span>"
return
if(cooldown)
if(req_defib)
user << "<span class='warning'>[defib] is recharging!</span>"
else
user << "<span class='warning'>[src] are recharging!</span>"
return
if(!ishuman(M))
if(req_defib)
user << "<span class='warning'>The instructions on [defib] don't mention how to revive that...</span>"
else
user << "<span class='warning'>You aren't sure how to revive that...</span>"
return
var/mob/living/carbon/human/H = M
if(user.a_intent == "disarm")
if(req_defib && defib.safety)
return
if(!req_defib && !combat)
return
busy = 1
H.visible_message("<span class='danger'>[user] has touched [H.name] with [src]!</span>", \
"<span class='userdanger'>[user] has touched [H.name] with [src]!</span>")
H.adjustStaminaLoss(50)
H.Weaken(5)
H.updatehealth() //forces health update before next life tick
playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
H.emote("gasp")
add_logs(user, M, "stunned", src)
if(req_defib)
defib.deductcharge(revivecost)
cooldown = 1
busy = 0
update_icon()
if(req_defib)
defib.cooldowncheck(user)
else
recharge(60)
return
if(user.zone_selected != "chest")
user << "<span class='warning'>You need to target your patient's \
chest with [src]!</span>"
return
if(user.a_intent == "harm")
if(req_defib && defib.safety)
return
if(!req_defib && !combat)
return
user.visible_message("<span class='warning'>[user] begins to place [src] on [M.name]'s chest.</span>",
"<span class='warning'>You overcharge the paddles and begin to place them onto [M]'s chest...</span>")
busy = 1
update_icon()
if(do_after(user, 30, target = M))
user.visible_message("<span class='notice'>[user] places [src] on [M.name]'s chest.</span>",
"<span class='warning'>You place [src] on [M.name]'s chest and begin to charge them.</span>")
var/turf/T = get_turf(defib)
playsound(get_turf(src), 'sound/machines/defib_charge.ogg', 50, 0)
if(req_defib)
T.audible_message("<span class='warning'>\The [defib] lets out an urgent beep and lets out a steadily rising hum...</span>")
else
user.audible_message("<span class='warning'>[src] let out an urgent beep.</span>")
if(do_after(user, 30, target = M)) //Takes longer due to overcharging
if(!M)
busy = 0
update_icon()
return
if(M && M.stat == DEAD)
user << "<span class='warning'>[M] is dead.</span>"
playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
busy = 0
update_icon()
return
user.visible_message("<span class='boldannounce'><i>[user] shocks [M] with \the [src]!</span>", "<span class='warning'>You shock [M] with \the [src]!</span>")
playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 100, 1, -1)
playsound(loc, 'sound/weapons/Egloves.ogg', 100, 1, -1)
var/mob/living/carbon/human/HU = M
M.emote("scream")
if(!HU.heart_attack)
HU.heart_attack = 1
if(!HU.stat)
HU.visible_message("<span class='warning'>[M] thrashes wildly, clutching at their chest!</span>",
"<span class='userdanger'>You feel a horrible agony in your chest!</span>")
HU.apply_damage(50, BURN, "chest")
add_logs(user, M, "overloaded the heart of", defib)
M.Weaken(5)
M.Jitter(100)
if(req_defib)
defib.deductcharge(revivecost)
cooldown = 1
busy = 0
update_icon()
if(!req_defib)
recharge(60)
if(req_defib && (defib.cooldowncheck(user)))
return
busy = 0
update_icon()
return
if((!req_defib && grab_ghost) || (req_defib && defib.grab_ghost))
H.notify_ghost_cloning("Your heart is being defibrillated!")
H.grab_ghost() // Shove them back in their body.
else if(!H.suiciding && !(H.disabilities & NOCLONE)&& !H.hellbound)
H.notify_ghost_cloning("Your heart is being defibrillated. Re-enter your corpse if you want to be revived!", source = src)
user.visible_message("<span class='warning'>[user] begins to place [src] on [M.name]'s chest.</span>", "<span class='warning'>You begin to place [src] on [M.name]'s chest...</span>")
busy = 1
update_icon()
if(do_after(user, 30, target = M)) //beginning to place the paddles on patient's chest to allow some time for people to move away to stop the process
user.visible_message("<span class='notice'>[user] places [src] on [M.name]'s chest.</span>", "<span class='warning'>You place [src] on [M.name]'s chest.</span>")
playsound(get_turf(src), 'sound/machines/defib_charge.ogg', 50, 0)
var/tplus = world.time - H.timeofdeath
// past this much time the patient is unrecoverable
// (in deciseconds)
var/tlimit = DEFIB_TIME_LIMIT * 10
// brain damage starts setting in on the patient after
// some time left rotting
var/tloss = DEFIB_TIME_LOSS * 10
var/total_burn = 0
var/total_brute = 0
if(do_after(user, 20, target = M)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
for(var/obj/item/carried_item in H.contents)
if(istype(carried_item, /obj/item/clothing/suit/space))
if((!src.combat && !req_defib) || (req_defib && !defib.combat))
user.audible_message("<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Patient's chest is obscured. Operation aborted.</span>")
playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
busy = 0
update_icon()
return
if(H.stat == DEAD)
M.visible_message("<span class='warning'>[M]'s body convulses a bit.")
playsound(get_turf(src), "bodyfall", 50, 1)
playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
total_brute = H.getBruteLoss()
total_burn = H.getFireLoss()
var/failed = null
if (H.suiciding || (H.disabilities & NOCLONE))
failed = "<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Recovery of patient impossible. Further attempts futile.</span>"
else if (H.hellbound)
failed = "<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Patient's soul appears to be on another plane of existance. Further attempts futile.</span>"
else if (tplus > tlimit)
failed = "<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Body has decayed for too long. Further attempts futile.</span>"
else if (!H.getorgan(/obj/item/organ/heart))
failed = "<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Patient's heart is missing.</span>"
else if(total_burn >= 180 || total_brute >= 180)
failed = "<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Severe tissue damage makes recovery of patient impossible via defibrillator. Further attempts futile.</span>"
else if(H.get_ghost())
failed = "<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - No activity in patient's brain. Further attempts may be successful.</span>"
else
var/obj/item/organ/brain/BR = H.getorgan(/obj/item/organ/brain)
if(!BR || BR.damaged_brain)
failed = "<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Patient's brain is missing or damaged beyond point of no return. Further attempts futile.</span>"
if(failed)
user.visible_message(failed)
playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
else
//If the body has been fixed so that they would not be in crit when defibbed, give them oxyloss to put them back into crit
if (H.health > halfwaycritdeath)
H.adjustOxyLoss(H.health - halfwaycritdeath, 0)
else
var/overall_damage = total_brute + total_burn + H.getToxLoss() + H.getOxyLoss()
var/mobhealth = H.health
H.adjustOxyLoss((mobhealth - halfwaycritdeath) * (H.getOxyLoss() / overall_damage), 0)
H.adjustToxLoss((mobhealth - halfwaycritdeath) * (H.getToxLoss() / overall_damage), 0)
H.adjustFireLoss((mobhealth - halfwaycritdeath) * (total_burn / overall_damage), 0)
H.adjustBruteLoss((mobhealth - halfwaycritdeath) * (total_brute / overall_damage), 0)
user.visible_message("<span class='notice'>[req_defib ? "[defib]" : "[src]"] pings: Resuscitation successful.</span>")
playsound(get_turf(src), 'sound/machines/defib_success.ogg', 50, 0)
H.revive()
H.emote("gasp")
if(tplus > tloss)
H.setBrainLoss( max(0, min(99, ((tlimit - tplus) / tlimit * 100))))
add_logs(user, M, "revived", defib)
if(req_defib)
defib.deductcharge(revivecost)
cooldown = 1
update_icon()
if(req_defib)
defib.cooldowncheck(user)
else
recharge(60)
else if(H.heart_attack)
H.heart_attack = 0
user.visible_message("<span class='notice'>[req_defib ? "[defib]" : "[src]"] pings: Patient's heart is now beating again.</span>")
playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
else if (!H.getorgan(/obj/item/organ/heart))
user.visible_message("<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Patient's heart is missing. Operation aborted.</span>")
playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
else
user.visible_message("<span class='warning'>[req_defib ? "[defib]" : "[src]"] buzzes: Patient is not in a valid state. Operation aborted.</span>")
playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
busy = 0
update_icon()
/obj/item/weapon/twohanded/shockpaddles/syndicate
name = "syndicate defibrillator paddles"
desc = "A pair of paddles used to revive deceased operatives. It possesses both the ability to penetrate armor and to deliver powerful shocks offensively."
combat = 1
icon = 'icons/obj/weapons.dmi'
icon_state = "defibpaddles0"
item_state = "defibpaddles0"
req_defib = 0