Refactors Organ Shocking To Use Signals (#15593)

* Refactors Organ Shocking To Use Signals

* proper source

* hush you
This commit is contained in:
Fox McCloud
2021-02-26 13:43:11 -05:00
committed by GitHub
parent b49a99d46e
commit c73cc5aa68
7 changed files with 21 additions and 18 deletions

View File

@@ -67,7 +67,7 @@
H.AdjustWeakened(5) H.AdjustWeakened(5)
H.AdjustStuttering(10) H.AdjustStuttering(10)
to_chat(H, "<span class='danger'>You feel a powerful jolt!</span>") to_chat(H, "<span class='danger'>You feel a powerful jolt!</span>")
H.shock_internal_organs(100) SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
if(emagged && prob(10)) if(emagged && prob(10))
to_chat(user, "<span class='danger'>[src]'s on board scanner indicates that the target is undergoing a cardiac arrest!</span>") to_chat(user, "<span class='danger'>[src]'s on board scanner indicates that the target is undergoing a cardiac arrest!</span>")

View File

@@ -349,7 +349,7 @@
H.emote("gasp") H.emote("gasp")
if(!H.undergoing_cardiac_arrest() && (prob(10) || defib.combat)) // Your heart explodes. if(!H.undergoing_cardiac_arrest() && (prob(10) || defib.combat)) // Your heart explodes.
H.set_heartattack(TRUE) H.set_heartattack(TRUE)
H.shock_internal_organs(100) SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
add_attack_logs(user, M, "Stunned with [src]") add_attack_logs(user, M, "Stunned with [src]")
defib.deductcharge(revivecost) defib.deductcharge(revivecost)
cooldown = TRUE cooldown = TRUE
@@ -400,7 +400,7 @@
update_icon() update_icon()
return return
H.set_heartattack(FALSE) H.set_heartattack(FALSE)
H.shock_internal_organs(100) SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
user.visible_message("<span class='boldnotice'>[defib] pings: Cardiac arrhythmia corrected.</span>") user.visible_message("<span class='boldnotice'>[defib] pings: Cardiac arrhythmia corrected.</span>")
M.visible_message("<span class='warning'>[M]'s body convulses a bit.") M.visible_message("<span class='warning'>[M]'s body convulses a bit.")
playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1) playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
@@ -435,7 +435,7 @@
H.emote("gasp") H.emote("gasp")
if(tplus > tloss) if(tplus > tloss)
H.setBrainLoss( max(0, min(99, ((tlimit - tplus) / tlimit * 100)))) H.setBrainLoss( max(0, min(99, ((tlimit - tplus) / tlimit * 100))))
H.shock_internal_organs(100) SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
H.med_hud_set_health() H.med_hud_set_health()
H.med_hud_set_status() H.med_hud_set_status()
defib.deductcharge(revivecost) defib.deductcharge(revivecost)
@@ -498,7 +498,7 @@
H.Weaken(5) H.Weaken(5)
if(!H.undergoing_cardiac_arrest() && prob(10)) // Your heart explodes. if(!H.undergoing_cardiac_arrest() && prob(10)) // Your heart explodes.
H.set_heartattack(TRUE) H.set_heartattack(TRUE)
H.shock_internal_organs(100) SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1) playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
H.emote("gasp") H.emote("gasp")
add_attack_logs(user, M, "Stunned with [src]") add_attack_logs(user, M, "Stunned with [src]")
@@ -554,7 +554,7 @@
H.emote("gasp") H.emote("gasp")
if(tplus > tloss) if(tplus > tloss)
H.setBrainLoss( max(0, min(99, ((tlimit - tplus) / tlimit * 100)))) H.setBrainLoss( max(0, min(99, ((tlimit - tplus) / tlimit * 100))))
H.shock_internal_organs(100) SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
if(isrobot(user)) if(isrobot(user))
var/mob/living/silicon/robot/R = user var/mob/living/silicon/robot/R = user
R.cell.use(revivecost) R.cell.use(revivecost)

View File

@@ -168,9 +168,7 @@
return return
H.forcesay(GLOB.hit_appends) H.forcesay(GLOB.hit_appends)
if(iscarbon(L)) SEND_SIGNAL(L, COMSIG_LIVING_MINOR_SHOCK, 33)
var/mob/living/carbon/C = L
C.shock_internal_organs(33)
L.Stun(stunforce) L.Stun(stunforce)
L.Weaken(stunforce) L.Weaken(stunforce)

View File

@@ -173,7 +173,6 @@
AdjustJitter(1000) AdjustJitter(1000)
do_jitter_animation(jitteriness) do_jitter_animation(jitteriness)
AdjustStuttering(2) AdjustStuttering(2)
shock_internal_organs(shock_damage)
addtimer(CALLBACK(src, .proc/secondary_shock, should_stun), 20) addtimer(CALLBACK(src, .proc/secondary_shock, should_stun), 20)
return shock_damage return shock_damage
@@ -1176,10 +1175,6 @@ so that different stomachs can handle things in different ways VB*/
update_inv_wear_mask() update_inv_wear_mask()
update_inv_head() update_inv_head()
/mob/living/carbon/proc/shock_internal_organs(intensity)
for(var/obj/item/organ/O in internal_organs)
O.shock_organ(intensity)
/mob/living/carbon/update_sight() /mob/living/carbon/update_sight()
if(!client) if(!client)
return return

View File

@@ -25,6 +25,7 @@
do_sparks(1, 1, src) do_sparks(1, 1, src)
else if(iscarbon(target)) else if(iscarbon(target))
var/mob/living/carbon/C = target var/mob/living/carbon/C = target
SEND_SIGNAL(C, COMSIG_LIVING_MINOR_SHOCK, 33)
if(HAS_TRAIT(C, TRAIT_HULK)) if(HAS_TRAIT(C, TRAIT_HULK))
C.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) C.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
else if(C.status_flags & CANWEAKEN) else if(C.status_flags & CANWEAKEN)

View File

@@ -155,6 +155,17 @@
dead_icon = "heart-c-u-off" dead_icon = "heart-c-u-off"
var/attempted_restart = FALSE var/attempted_restart = FALSE
/obj/item/organ/internal/heart/cybernetic/upgraded/insert(mob/living/carbon/M, special = FALSE)
..()
RegisterSignal(M, COMSIG_LIVING_MINOR_SHOCK, .proc/shock_heart)
RegisterSignal(M, COMSIG_LIVING_ELECTROCUTE_ACT, .proc/shock_heart)
/obj/item/organ/internal/heart/cybernetic/upgraded/remove(mob/living/carbon/M, special = FALSE)
UnregisterSignal(M, COMSIG_LIVING_MINOR_SHOCK)
UnregisterSignal(M, COMSIG_LIVING_ELECTROCUTE_ACT)
return ..()
/obj/item/organ/internal/heart/cybernetic/upgraded/on_life() /obj/item/organ/internal/heart/cybernetic/upgraded/on_life()
if(!ishuman(owner)) if(!ishuman(owner))
return return
@@ -234,8 +245,9 @@
return return
necrotize() necrotize()
/obj/item/organ/internal/heart/cybernetic/upgraded/proc/shock_heart(mob/living/carbon/human/source, intensity)
SIGNAL_HANDLER_DOES_SLEEP
/obj/item/organ/internal/heart/cybernetic/upgraded/shock_organ(intensity)
if(!ishuman(owner)) if(!ishuman(owner))
return return
if(emp_proof) if(emp_proof)

View File

@@ -230,9 +230,6 @@
status &= ~ORGAN_SPLINTED status &= ~ORGAN_SPLINTED
status |= ORGAN_ROBOT status |= ORGAN_ROBOT
/obj/item/organ/proc/shock_organ(intensity)
return
/obj/item/organ/proc/remove(var/mob/living/user,special = 0) /obj/item/organ/proc/remove(var/mob/living/user,special = 0)
if(!istype(owner)) if(!istype(owner))
return return