Merge pull request #8173 from Trilbyspaceclone/2.0Defibs

Defib upgrade tech
This commit is contained in:
kevinz000
2019-04-02 05:35:04 -07:00
committed by GitHub
4 changed files with 132 additions and 4 deletions
+79 -4
View File
@@ -23,6 +23,10 @@
var/obj/item/stock_parts/cell/high/cell
var/combat = FALSE //can we revive through space suits?
var/grab_ghost = FALSE // Do we pull the ghost back into their body?
var/healdisk = FALSE // Will we shock people dragging the body?
var/pullshocksafely = FALSE //Dose the unit have the healdisk upgrade?
var/primetime = 0 // is the defib faster
var/timedeath = 10
/obj/item/defibrillator/get_cell()
return cell
@@ -441,7 +445,9 @@
return (!H.suiciding && !(H.has_trait(TRAIT_NOCLONE)) && !H.hellbound && ((world.time - H.timeofdeath) < tlimit) && (H.getBruteLoss() < 180) && (H.getFireLoss() < 180) && H.getorgan(/obj/item/organ/heart) && BR && !BR.damaged_brain)
/obj/item/twohanded/shockpaddles/proc/shock_touching(dmg, mob/H)
if(isliving(H.pulledby)) //CLEAR!
if(defib.pullshocksafely && isliving(H.pulledby))
H.visible_message("<span class='danger'>The defibrillator safely discharges the excessive charge into the floor!</span>")
else
var/mob/living/M = H.pulledby
if(M.electrocute_act(30, src))
M.visible_message("<span class='danger'>[M] is electrocuted by [M.p_their()] contact with [H]!</span>")
@@ -534,7 +540,7 @@
user.visible_message("<span class='warning'>[user] begins to place [src] on [H]'s chest.</span>", "<span class='warning'>You begin to place [src] on [H]'s chest...</span>")
busy = TRUE
update_icon()
if(do_after(user, 30, target = H)) //beginning to place the paddles on patient's chest to allow some time for people to move away to stop the process
if(do_after(user, 30 - defib.primetime, target = H)) //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 [H]'s chest.</span>", "<span class='warning'>You place [src] on [H]'s chest.</span>")
playsound(src, 'sound/machines/defib_charge.ogg', 75, 0)
var/tplus = world.time - H.timeofdeath
@@ -542,10 +548,10 @@
// (in deciseconds)
// brain damage starts setting in on the patient after
// some time left rotting
var/tloss = DEFIB_TIME_LOSS * 10
var/tloss = DEFIB_TIME_LOSS * defib.timedeath
var/total_burn = 0
var/total_brute = 0
if(do_after(user, 20, target = H)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
if(do_after(user, 20 - defib.primetime, target = H)) //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((!combat && !req_defib) || (req_defib && !defib.combat))
@@ -605,6 +611,8 @@
if(tplus > tloss)
H.adjustBrainLoss( max(0, min(99, ((tlimit - tplus) / tlimit * 100))), 150)
log_combat(user, H, "revived", defib)
if(defib.healdisk)
H.heal_overall_damage(25, 25)
if(req_defib)
defib.deductcharge(revivecost)
cooldown = 1
@@ -628,6 +636,37 @@
busy = FALSE
update_icon()
/obj/item/defibrillator/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/disk/medical/defib_heal))
if(healdisk)
to_chat(user, "<span class='notice'>This unit is already upgraded with this disk!</span>")
return TRUE
to_chat(user, "<span class='notice'>You upgrade the unit with Heal upgrade disk!</span>")
healdisk = TRUE
return TRUE
if(istype(I, /obj/item/disk/medical/defib_shock))
if(pullshocksafely)
to_chat(user, "<span class='notice'>This unit is already upgraded with this disk!</span>")
return TRUE
to_chat(user, "<span class='notice'>You upgrade the unit with Shock Safety upgrade disk!</span>")
pullshocksafely = TRUE
return TRUE
if(istype(I, /obj/item/disk/medical/defib_speed))
if(!primetime == initial(primetime))
to_chat(user, "<span class='notice'>This unit is already upgraded with this disk!</span>")
return TRUE
to_chat(user, "<span class='notice'>You upgrade the unit with Speed upgrade disk!</span>")
primetime = 10
return TRUE
if(istype(I, /obj/item/disk/medical/defib_decay))
if(!timedeath == initial(timedeath))
to_chat(user, "<span class='notice'>This unit is already upgraded with this disk!</span>")
return TRUE
to_chat(user, "<span class='notice'>You upgrade the unit with Longer Decay upgrade disk!</span>")
timedeath = 20
return TRUE
return ..()
/obj/item/twohanded/shockpaddles/cyborg
name = "cyborg defibrillator paddles"
icon = 'icons/obj/items_and_weapons.dmi'
@@ -656,4 +695,40 @@
item_state = "defibpaddles0"
req_defib = FALSE
///////////////////////////////////////////
/////////Dedibrillators Disks//////////////
///////////////////////////////////////////
/obj/item/disk/medical
name = "Defibrillator Upgrade Disk"
desc = "A blank defibrillator disk..."
icon = 'modular_citadel/icons/obj/defib_disks.dmi'
icon_state = "upgrade_disk"
item_state = "heal_disk"
w_class = WEIGHT_CLASS_SMALL
/obj/item/disk/medical/defib_heal
name = "Defibrillator Healing Disk"
desc = "A disk alowing for grater amounts of healing"
icon_state = "heal_disk"
materials = list(MAT_METAL=16000, MAT_GLASS = 18000, MAT_GOLD = 6000, MAT_SILVER = 6000)
/obj/item/disk/medical/defib_shock
name = "Defibrillator Anti-Shock Disk"
desc = "A disk that helps agains shocking anyone, other then the intented target"
icon_state = "zap_disk"
materials = list(MAT_METAL=16000, MAT_GLASS = 18000, MAT_GOLD = 6000, MAT_SILVER = 6000)
/obj/item/disk/medical/defib_decay
name = "Defibrillator Body-Decay Extender Disk"
desc = "A disk that helps defibrillators revive the longer decayed"
icon_state = "body_disk"
materials = list(MAT_METAL=16000, MAT_GLASS = 18000, MAT_GOLD = 16000, MAT_SILVER = 6000, MAT_TITANIUM = 2000)
/obj/item/disk/medical/defib_speed
name = "Defibrllator Pre-Primer Disk"
desc = "A disk that cuts the time charg time in half for defibrillator use"
icon_state = "fast_disk"
materials = list(MAT_METAL=16000, MAT_GLASS = 8000, MAT_GOLD = 26000, MAT_SILVER = 26000)
#undef HALFWAYCRITDEATH
@@ -195,6 +195,50 @@
category = list("Medical Designs")
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL
/datum/design/defib_heal
name = "Defibrillartor Healing disk"
desc = "A disk allowing for greater amounts of healing"
id = "defib_heal"
build_type = PROTOLATHE
materials = list(MAT_METAL=16000, MAT_GLASS = 18000, MAT_GOLD = 6000, MAT_SILVER = 6000)
build_path = /obj/item/disk/medical/defib_heal
construction_time = 10
category = list("Misc")
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL
/datum/design/defib_shock
name = "Defibrillartor Anit-Shock Disk"
desc = "A disk that helps agains shocking anyone, other then the intented target"
id = "defib_shock"
build_type = PROTOLATHE
materials = list(MAT_METAL=16000, MAT_GLASS = 18000, MAT_GOLD = 6000, MAT_SILVER = 6000)
build_path = /obj/item/disk/medical/defib_shock
construction_time = 10
category = list("Misc")
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL
/datum/design/defib_decay
name = "Defibrillartor Body-Decay extender Disk"
desc = "A disk that helps defibrillator revive the longer decayed dead"
id = "defib_decay"
build_type = PROTOLATHE
materials = list(MAT_METAL=16000, MAT_GLASS = 18000, MAT_GOLD = 16000, MAT_SILVER = 6000, MAT_TITANIUM = 2000)
build_path = /obj/item/disk/medical/defib_decay
construction_time = 10
category = list("Misc")
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL
/datum/design/defib_speed
name = "Defibrllartor Pre-Primer Disk"
desc = "A disk that cuts the time charg time in half for defibrillator use"
id = "defib_speed"
build_type = PROTOLATHE
build_path = /obj/item/disk/medical/defib_speed
materials = list(MAT_METAL=16000, MAT_GLASS = 8000, MAT_GOLD = 26000, MAT_SILVER = 26000)
construction_time = 10
category = list("Misc")
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL
/////////////////////////////////////////
//////////Alien Surgery Tools////////////
@@ -100,6 +100,15 @@
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000
/datum/techweb_node/adv_defibrillator_tec
id = "adv_defibrillator_tec"
display_name = "Adv Defibrillator tec"
description = "More ways to bring back the freshly dead."
prereq_ids = list("adv_biotech", "exp_surgery", "adv_engi", "adv_power")
design_ids = list("defib_decay", "defib_shock", "defib_heal", "defib_speed")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000
/////////////////////////Advanced Surgery/////////////////////////
/datum/techweb_node/adv_surgery
id = "adv_surgery"