From 35758db699bcf5acf1cf3d8f27995b5828a0a4ad Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Thu, 28 Mar 2019 20:34:20 -0400 Subject: [PATCH] Makes Delayed Gibbing a Proc --- code/datums/diseases/gbs.dm | 2 +- code/modules/mob/living/death.dm | 6 ++++++ code/modules/mob/living/living.dm | 4 ++-- .../reagents/chemistry/reagents/medicine.dm | 3 +-- code/modules/reagents/chemistry/reagents/toxins.dm | 14 +++----------- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/code/datums/diseases/gbs.dm b/code/datums/diseases/gbs.dm index 371f38238a1..19d4c287427 100644 --- a/code/datums/diseases/gbs.dm +++ b/code/datums/diseases/gbs.dm @@ -34,7 +34,7 @@ if(5) to_chat(affected_mob, "Your body feels as if it's trying to rip itself open...") if(prob(50)) - affected_mob.gib() + affected_mob.delayed_gib() else return diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 43a811dc3a3..160bb99627a 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -96,3 +96,9 @@ // u no we dead return TRUE + +/mob/living/proc/delayed_gib() + visible_message("[src] starts convulsing violently!", "You feel as if your body is tearing itself apart!") + Weaken(15) + do_jitter_animation(1000, -1) + addtimer(CALLBACK(src, .proc/gib), rand(20, 100)) \ No newline at end of file diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index bf933f568d4..0c4ae01a692 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -786,11 +786,11 @@ ..() floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement. -/mob/living/proc/do_jitter_animation(jitteriness) +/mob/living/proc/do_jitter_animation(jitteriness, loop_amount = 6) var/amplitude = min(4, (jitteriness/100) + 1) var/pixel_x_diff = rand(-amplitude, amplitude) var/pixel_y_diff = rand(-amplitude/3, amplitude/3) - animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = 6) + animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = loop_amount) animate(pixel_x = initial(pixel_x) , pixel_y = initial(pixel_y) , time = 2) floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement. diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index 804904723ea..5aaf77ac4de 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -700,8 +700,7 @@ if(method == INGEST) if(M.stat == DEAD) if(M.getBruteLoss()+M.getFireLoss()+M.getCloneLoss() >= 150) - M.visible_message("[M]'s body starts convulsing!") - M.gib() + M.delayed_gib() return var/mob/dead/observer/ghost = M.get_ghost() if(ghost) diff --git a/code/modules/reagents/chemistry/reagents/toxins.dm b/code/modules/reagents/chemistry/reagents/toxins.dm index 510f3ca1368..7ba6ed01667 100644 --- a/code/modules/reagents/chemistry/reagents/toxins.dm +++ b/code/modules/reagents/chemistry/reagents/toxins.dm @@ -506,19 +506,11 @@ M.fakevomit() update_flags |= M.adjustToxLoss(2, FALSE) update_flags |= M.adjustBruteLoss(2, FALSE) + if(volume > 40 && prob(4)) + M.delayed_gib() + return return ..() | update_flags -/datum/reagent/venom/overdose_process(mob/living/M) - var/update_flags = STATUS_UPDATE_NONE - if(volume >= 40) - if(prob(4)) - M.visible_message("[M] starts convulsing violently!", "You feel as if your body is tearing itself apart!") - update_flags |= M.Weaken(15, FALSE) - M.AdjustJitter(1000) - spawn(rand(20, 100)) - M.gib() - return list(0, update_flags) - /datum/reagent/neurotoxin2 name = "Neurotoxin" id = "neurotoxin2"