From 173e1cb391532be374ebbae13d00aa2afb34050d Mon Sep 17 00:00:00 2001 From: Giacomand Date: Mon, 23 Dec 2013 17:56:58 +0000 Subject: [PATCH] * Refactored gib() and dust() * Refactored ex_act(), for mobs, a little. * Removed the code which gibbed dead bodies with any severity. --- code/modules/mob/dead/death.dm | 2 +- code/modules/mob/death.dm | 47 +------------- code/modules/mob/living/carbon/alien/death.dm | 48 ++++---------- .../living/carbon/alien/humanoid/humanoid.dm | 13 +--- .../mob/living/carbon/alien/larva/larva.dm | 13 +--- code/modules/mob/living/carbon/brain/death.dm | 22 +------ code/modules/mob/living/carbon/carbon.dm | 2 +- code/modules/mob/living/carbon/human/death.dm | 44 +++---------- code/modules/mob/living/carbon/human/human.dm | 17 +---- .../mob/living/carbon/metroid/metroid.dm | 10 +-- .../modules/mob/living/carbon/monkey/death.dm | 44 ++----------- .../mob/living/carbon/monkey/monkey.dm | 27 ++------ code/modules/mob/living/death.dm | 62 +++++++++++++++++++ code/modules/mob/living/living.dm | 3 + code/modules/mob/living/silicon/ai/ai.dm | 9 +-- code/modules/mob/living/silicon/death.dm | 41 ++---------- code/modules/mob/living/silicon/pai/pai.dm | 5 +- .../modules/mob/living/silicon/robot/death.dm | 49 ++++----------- .../modules/mob/living/silicon/robot/robot.dm | 20 ++---- .../mob/living/simple_animal/simple_animal.dm | 6 +- tgstation.dme | 1 + 21 files changed, 139 insertions(+), 346 deletions(-) create mode 100644 code/modules/mob/living/death.dm diff --git a/code/modules/mob/dead/death.dm b/code/modules/mob/dead/death.dm index 7c827e55ffe..784b114690f 100644 --- a/code/modules/mob/dead/death.dm +++ b/code/modules/mob/dead/death.dm @@ -1,5 +1,5 @@ /mob/dead/dust() //ghosts can't be vaporised. return -/mob/dead/gib() //ghosts can't be gibbed. +/mob/dead/gib(var/animation = 1) //ghosts can't be gibbed. return diff --git a/code/modules/mob/death.dm b/code/modules/mob/death.dm index d0c60fb4609..90c3bb529b7 100644 --- a/code/modules/mob/death.dm +++ b/code/modules/mob/death.dm @@ -1,54 +1,13 @@ //This is the proc for gibbing a mob. Cannot gib ghosts. //added different sort of gibs and animations. N /mob/proc/gib() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - - gibs(loc, viruses) - - dead_mob_list -= src - spawn(15) - if(animation) del(animation) - if(src) del(src) - + return //This is the proc for turning a mob into ash. Mostly a copy of gib code (above). //Originally created for wizard disintegrate. I've removed the virus code since it's irrelevant here. //Dusting robots does not eject the MMI, so it's a bit more powerful than gib() /N /mob/proc/dust() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - -// flick("dust-m", animation) - new /obj/effect/decal/cleanable/ash(loc) - - dead_mob_list -= src - spawn(15) - if(animation) del(animation) - if(src) del(src) - + return /mob/proc/death(gibbed) - timeofdeath = world.time - - living_mob_list -= src - dead_mob_list += src - return ..(gibbed) + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/death.dm b/code/modules/mob/living/carbon/alien/death.dm index 0f9607f16b7..e8c0ac96c79 100644 --- a/code/modules/mob/living/carbon/alien/death.dm +++ b/code/modules/mob/living/carbon/alien/death.dm @@ -1,41 +1,17 @@ -/mob/living/carbon/alien/gib() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - - flick("gibbed-a", animation) +/mob/living/carbon/alien/spawn_gibs() xgibs(loc, viruses) - dead_mob_list -= src - spawn(15) - if(animation) del(animation) - if(src) del(src) +/mob/living/carbon/alien/gib_animation(var/animate) + ..(animate, "gibbed-a") -/mob/living/carbon/alien/dust() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - - flick("dust-a", animation) +/mob/living/carbon/alien/spawn_dust() new /obj/effect/decal/remains/xeno(loc) - dead_mob_list -= src - spawn(15) - if(animation) del(animation) - if(src) del(src) +/mob/living/carbon/alien/spawn_dust() + new /obj/effect/decal/remains/xeno(loc) + +/mob/living/carbon/alien/dust_animation(var/animate) + ..(animate, "dust-a") + +/mob/living/carbon/alien/dust(var/animation = 1) + ..() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 0ea869a2aec..a3dedef0122 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -59,17 +59,7 @@ ..() /mob/living/carbon/alien/humanoid/ex_act(severity) - if(!blinded) - flick("flash", flash) - - if (stat == 2 && client) - gib() - return - - else if (stat == 2 && !client) - xgibs(loc, viruses) - del(src) - return + ..() var/shielded = 0 @@ -77,7 +67,6 @@ var/f_loss = null switch (severity) if (1.0) - b_loss += 500 gib() return diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 272ed81d3b8..7f88fb56c6b 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -55,23 +55,12 @@ /mob/living/carbon/alien/larva/ex_act(severity) - if(!blinded) - flick("flash", flash) - - if (stat == 2 && client) - gib() - return - - else if (stat == 2 && !client) - gibs(loc, viruses) - del(src) - return + ..() var/b_loss = null var/f_loss = null switch (severity) if (1.0) - b_loss += 500 gib() return diff --git a/code/modules/mob/living/carbon/brain/death.dm b/code/modules/mob/living/carbon/brain/death.dm index 7f5c308efaa..c39f1039943 100644 --- a/code/modules/mob/living/carbon/brain/death.dm +++ b/code/modules/mob/living/carbon/brain/death.dm @@ -19,28 +19,10 @@ return ..(gibbed) -/mob/living/carbon/brain/gib() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - -// flick("gibbed-m", animation) - gibs(loc, viruses, dna) - - dead_mob_list -= src +/mob/living/carbon/brain/gib(var/animation = 0) if(container && istype(container, /obj/item/device/mmi)) del(container)//Gets rid of the MMI if there is one if(loc) if(istype(loc,/obj/item/organ/brain)) del(loc)//Gets rid of the brain item - spawn(15) - if(animation) del(animation) - if(src) del(src) \ No newline at end of file + ..() \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 4f829ca40be..56903541193 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -38,7 +38,7 @@ stomach_contents.Remove(A) src.gib() -/mob/living/carbon/gib() +/mob/living/carbon/gib(var/animation = 1) for(var/mob/M in src) if(M in stomach_contents) stomach_contents.Remove(M) diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index b11fa29d273..978b9b9729e 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -1,44 +1,18 @@ -/mob/living/carbon/human/gib() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 +/mob/living/carbon/human/gib_animation(var/animate) + ..(animate, "gibbed-h") - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src +/mob/living/carbon/human/dust_animation(var/animate) + ..(animate, "dust-h") - flick("gibbed-h", animation) +/mob/living/carbon/human/dust(var/animation = 1) + ..() + +/mob/living/carbon/human/spawn_gibs() hgibs(loc, viruses, dna) - spawn(15) - if(animation) del(animation) - if(src) del(src) - -/mob/living/carbon/human/dust() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - - flick("dust-h", animation) +/mob/living/carbon/human/spawn_dust() new /obj/effect/decal/remains/human(loc) - spawn(15) - if(animation) del(animation) - if(src) del(src) - - /mob/living/carbon/human/death(gibbed) if(stat == DEAD) return if(healths) healths.icon_state = "health5" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 50ce92f4b6f..3eb9e044d4f 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -129,20 +129,7 @@ /mob/living/carbon/human/ex_act(severity) - if(!blinded) - flick("flash", flash) - -// /obj/item/clothing/suit/bomb_suit(src) -// /obj/item/clothing/head/bomb_hood(src) - - if (stat == 2 && client) - gib() - return - - else if (stat == 2 && !client) - gibs(loc, viruses) - del(src) - return + ..() var/shielded = 0 var/b_loss = null @@ -480,4 +467,4 @@ . = 0 if(!. && error_msg && user) // Might need re-wording. - user << "There is no exposed flesh or thin material [target_zone == "head" ? "on their head" : "on their body"]." + user << "There is no exposed flesh or thin material [target_zone == "head" ? "on their head" : "on their body"]." diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index 45f6d940dc4..6ef25327102 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -210,19 +210,13 @@ ..() /mob/living/carbon/slime/ex_act(severity) - - if (stat == 2 && client) - return - - else if (stat == 2 && !client) - del(src) - return + ..() var/b_loss = null var/f_loss = null switch (severity) if (1.0) - b_loss += 500 + del(src) return if (2.0) diff --git a/code/modules/mob/living/carbon/monkey/death.dm b/code/modules/mob/living/carbon/monkey/death.dm index a13342620cb..2aa321ffdee 100644 --- a/code/modules/mob/living/carbon/monkey/death.dm +++ b/code/modules/mob/living/carbon/monkey/death.dm @@ -1,43 +1,11 @@ -/mob/living/carbon/monkey/gib() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 +/mob/living/carbon/monkey/gib_animation(var/animate) + ..(animate, "gibbed-m") - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - - flick("gibbed-m", animation) - gibs(loc, viruses, dna) - - spawn(15) - if(animation) del(animation) - if(src) del(src) - -/mob/living/carbon/monkey/dust() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - - flick("dust-m", animation) - new /obj/effect/decal/cleanable/ash(loc) - - spawn(15) - if(animation) del(animation) - if(src) del(src) +/mob/living/carbon/monkey/dust_animation(var/animate) + ..(animate, "dust-m") +/mob/living/carbon/monkey/dust(var/animation = 1) + ..() /mob/living/carbon/monkey/death(gibbed) if(stat == DEAD) return diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 5562cae73a1..8217f0df4a9 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -341,33 +341,18 @@ /mob/living/carbon/monkey/var/temperature_resistance = T0C+75 /mob/living/carbon/monkey/ex_act(severity) - if(!blinded) - flick("flash", flash) - if (stat == 2 && client) - gib() - return - - if (stat == 2 && !client) - gibs(loc, viruses) - del(src) - return + ..() switch(severity) if(1.0) - if (stat != 2) - adjustBruteLoss(200) - health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() + gib() + return if(2.0) - if (stat != 2) - adjustBruteLoss(60) - adjustFireLoss(60) - health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() + adjustBruteLoss(60) + adjustFireLoss(60) if(3.0) - if (stat != 2) - adjustBruteLoss(30) - health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() + adjustBruteLoss(30) if (prob(50)) Paralyse(10) - else return /mob/living/carbon/monkey/blob_act() diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm new file mode 100644 index 00000000000..d618319ba85 --- /dev/null +++ b/code/modules/mob/living/death.dm @@ -0,0 +1,62 @@ +/mob/living/gib(var/animation = 1) + var/prev_lying = lying + death(1) + + var/atom/movable/overlay/animate = setup_animation(animation, prev_lying) + if(animate) + gib_animation(animate) + + spawn_gibs() + + end_animation(animate) // Will del(src) + +/mob/living/proc/spawn_gibs() + gibs(loc, viruses) + +/mob/living/proc/gib_animation(var/animate, var/flick_name = "gibbed") + flick(flick_name, animate) + +/mob/living/dust(var/animation = 0) + death(1) + var/atom/movable/overlay/animate = setup_animation(animation, 0) + if(animate) + dust_animation(animate) + + spawn_dust() + end_animation(animate) + +/mob/living/proc/spawn_dust() + new /obj/effect/decal/cleanable/ash(loc) + +/mob/living/proc/dust_animation(var/animate, var/flick_name = "") + flick(flick_name, animate) + +/mob/living/death(gibbed) + timeofdeath = world.time + + living_mob_list -= src + if(!gibbed) + dead_mob_list += src + + +/mob/living/proc/setup_animation(var/animation, var/prev_lying) + var/atom/movable/overlay/animate = null + monkeyizing = 1 + canmove = 0 + icon = null + invisibility = 101 + + if(!prev_lying && animation) + animate = new(loc) + animate.icon_state = "blank" + animate.icon = 'icons/mob/mob.dmi' + animate.master = src + return animate + +/mob/living/proc/end_animation(var/animate) + if(!animate) + del(src) + else + spawn(15) + if(animate) del(animate) + if(src) del(src) \ No newline at end of file diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 41a4882f910..e74a6eded7f 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -14,6 +14,9 @@ src << "\blue You have given up life and succumbed to death." death() +/mob/living/ex_act(severity) + if(client && !blinded) + flick("flash", src.flash) /mob/living/proc/updatehealth() if(status_flags & GODMODE) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index eb6292fa4a5..16d00f211d9 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -305,14 +305,11 @@ var/list/ai_list = list() ..() /mob/living/silicon/ai/ex_act(severity) - if(!blinded) - flick("flash", flash) + ..() switch(severity) if(1.0) - if (stat != 2) - adjustBruteLoss(100) - adjustFireLoss(100) + gib() if(2.0) if (stat != 2) adjustBruteLoss(60) @@ -321,7 +318,7 @@ var/list/ai_list = list() if (stat != 2) adjustBruteLoss(30) - updatehealth() + return /mob/living/silicon/ai/Topic(href, href_list) diff --git a/code/modules/mob/living/silicon/death.dm b/code/modules/mob/living/silicon/death.dm index 8e1f035ce67..bc3ed069bba 100644 --- a/code/modules/mob/living/silicon/death.dm +++ b/code/modules/mob/living/silicon/death.dm @@ -1,41 +1,8 @@ -/mob/living/silicon/gib() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - -// flick("gibbed-r", animation) +/mob/living/silicon/spawn_gibs() robogibs(loc, viruses) - dead_mob_list -= src - spawn(15) - if(animation) del(animation) - if(src) del(src) +/mob/living/silicon/gib(var/animation = 0) // Please don't remove this thinking this proc does nothing, it is changing the default value for animation. + ..() -/mob/living/silicon/dust() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - -// flick("dust-r", animation) +/mob/living/silicon/spawn_dust() new /obj/effect/decal/remains/robot(loc) - - dead_mob_list -= src - spawn(15) - if(animation) del(animation) - if(src) del(src) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 1766c59348b..8e9a4fec80f 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -143,8 +143,7 @@ src << "You feel an electric surge run through your circuitry and become acutely aware at how lucky you are that you can still feel at all." /mob/living/silicon/pai/ex_act(severity) - if(!blinded) - flick("flash", src.flash) + ..() switch(severity) if(1.0) @@ -159,7 +158,7 @@ if (src.stat != 2) adjustBruteLoss(30) - src.updatehealth() + return // See software.dm for Topic() diff --git a/code/modules/mob/living/silicon/robot/death.dm b/code/modules/mob/living/silicon/robot/death.dm index 41be911e75e..1fcafeb374a 100644 --- a/code/modules/mob/living/silicon/robot/death.dm +++ b/code/modules/mob/living/silicon/robot/death.dm @@ -1,47 +1,22 @@ -/mob/living/silicon/robot/gib() - //robots don't die when gibbed. instead they drop their MMI'd brain - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 +/mob/living/silicon/robot/gib(var/animation = 1) + ..() - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - - flick("gibbed-r", animation) +/mob/living/silicon/robot/spawn_gibs() robogibs(loc, viruses) - living_mob_list -= src - dead_mob_list -= src - spawn(15) - if(animation) del(animation) - if(src) del(src) +/mob/living/silicon/robot/gib_animation(var/animate) + ..(animate, "gibbed-r") -/mob/living/silicon/robot/dust() - death(1) - var/atom/movable/overlay/animation = null - monkeyizing = 1 - canmove = 0 - icon = null - invisibility = 101 +/mob/living/silicon/robot/dust(var/animation = 1) + if(mmi) + del(mmi) + ..() - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - - flick("dust-r", animation) +/mob/living/silicon/robot/spawn_dust() new /obj/effect/decal/remains/robot(loc) - if(mmi) del(mmi) //Delete the MMI first so that it won't go popping out. - - dead_mob_list -= src - spawn(15) - if(animation) del(animation) - if(src) del(src) +/mob/living/silicon/robot/dust_animation(var/animate) + ..(animate, "dust-r") /mob/living/silicon/robot/death(gibbed) if(stat == DEAD) return diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index ddcf73ec5ad..7a234920db6 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -292,24 +292,12 @@ /mob/living/silicon/robot/ex_act(severity) - if(!blinded) - flick("flash", flash) - - if (stat == 2 && client) - gib() - return - - else if (stat == 2 && !client) - del(src) - return + ..() switch(severity) if(1.0) - if (stat != 2) - adjustBruteLoss(100) - adjustFireLoss(100) - gib() - return + gib() + return if(2.0) if (stat != 2) adjustBruteLoss(60) @@ -318,7 +306,7 @@ if (stat != 2) adjustBruteLoss(30) - updatehealth() + return /mob/living/silicon/robot/meteorhit(obj/O as obj) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 0b5b38906a4..a3de44be600 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -209,7 +209,7 @@ else ..() -/mob/living/simple_animal/gib() +/mob/living/simple_animal/gib(var/animation = 0) if(icon_gib) flick(icon_gib, src) if(meat_amount && meat_type) @@ -438,11 +438,9 @@ return /mob/living/simple_animal/ex_act(severity) - if(!blinded) - flick("flash", flash) + ..() switch (severity) if (1.0) - adjustBruteLoss(500) gib() return diff --git a/tgstation.dme b/tgstation.dme index cfc1a9b2115..289b8deb271 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -860,6 +860,7 @@ #include "code\modules\mob\dead\observer\observer.dm" #include "code\modules\mob\dead\observer\say.dm" #include "code\modules\mob\living\damage_procs.dm" +#include "code\modules\mob\living\death.dm" #include "code\modules\mob\living\emote.dm" #include "code\modules\mob\living\living.dm" #include "code\modules\mob\living\living_defense.dm"