From 2ff5f9b259832777d3f99853fa57725fbf7e5c7c Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 10 Nov 2020 22:01:47 +0100 Subject: [PATCH] [MIRROR] Move death(), gib(), and dust() from /mob to /mob/living (#1634) * Move death(), gib(), and dust() from /mob to /mob/living * a Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com> Co-authored-by: Azarak --- code/__DEFINES/dcs/signals.dm | 7 ++-- code/datums/components/manual_blinking.dm | 4 +- code/datums/components/manual_breathing.dm | 4 +- code/datums/components/nanites.dm | 4 +- code/datums/components/summoning.dm | 2 +- code/datums/mind.dm | 4 +- code/game/machinery/computer/arcade.dm | 16 ++++--- code/game/objects/items/food/pizza.dm | 2 +- code/game/objects/items/grenades/plastic.dm | 2 +- code/game/objects/items/theft_tools.dm | 7 ++-- code/modules/admin/verbs/randomverbs.dm | 29 ++++++++----- code/modules/antagonists/blob/blob.dm | 2 +- .../antagonists/changeling/powers/headcrab.dm | 2 +- .../eldritch_cult/knowledge/flesh_lore.dm | 8 ++-- .../nukeop/equipment/nuclearbomb.dm | 7 ++-- code/modules/awaymissions/capture_the_flag.dm | 23 +++++----- .../kitchen_machinery/gibber.dm | 10 ++--- .../kitchen_machinery/processor.dm | 4 +- code/modules/hydroponics/grown/melon.dm | 2 +- code/modules/mob/dead/dead.dm | 6 --- code/modules/mob/death.dm | 14 ------- .../carbon/human/species_types/jellypeople.dm | 4 +- code/modules/mob/living/death.dm | 33 ++++++++++++--- code/modules/mob/living/silicon/ai/ai.dm | 4 +- .../living/simple_animal/eldritch_demons.dm | 4 +- .../hostile/megafauna/colossus.dm | 2 +- .../hostile/megafauna/demonic_frost_miner.dm | 2 +- .../mob/living/simple_animal/hostile/ooze.dm | 2 +- code/modules/projectiles/projectile/magic.dm | 42 +++++++++++-------- code/modules/research/destructive_analyzer.dm | 4 +- .../research/xenobiology/xenobiology.dm | 2 +- .../ruins/spaceruin_code/hilbertshotel.dm | 2 +- code/modules/spells/spell_types/godhand.dm | 21 +++++----- code/modules/spells/spell_types/lichdom.dm | 2 +- code/modules/spells/spell_types/shapeshift.dm | 18 ++++++-- code/modules/vehicles/mecha/_mecha.dm | 4 +- tgstation.dme | 1 - 37 files changed, 169 insertions(+), 137 deletions(-) delete mode 100644 code/modules/mob/death.dm diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 2e2fe50f867..69441d93b9d 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -14,7 +14,7 @@ #define COMSIG_GLOB_EXPLOSION "!explosion" /// mob was created somewhere : (mob) #define COMSIG_GLOB_MOB_CREATED "!mob_created" -/// mob died somewhere : (mob , gibbed) +/// mob died somewhere : (mob/living, gibbed) #define COMSIG_GLOB_MOB_DEATH "!mob_death" /// global living say plug - use sparingly: (mob/speaker , message) #define COMSIG_GLOB_LIVING_SAY_SPECIAL "!say_special" @@ -310,8 +310,6 @@ #define COMSIG_MOB_LOGIN "mob_login" ///from base of /mob/Logout(): () #define COMSIG_MOB_LOGOUT "mob_logout" -///from base of mob/death(): (gibbed) -#define COMSIG_MOB_DEATH "mob_death" ///from base of mob/set_stat(): (new_stat) #define COMSIG_MOB_STATCHANGE "mob_statchange" ///from base of mob/clickon(): (atom/A, params) @@ -387,6 +385,9 @@ ///Sent when bloodcrawl ends in mob/living/phasein(): (phasein_decal) #define COMSIG_LIVING_AFTERPHASEIN "living_phasein" +///from base of mob/living/death(): (gibbed) +#define COMSIG_LIVING_DEATH "living_death" + ///sent from borg recharge stations: (amount, repairs) #define COMSIG_PROCESS_BORGCHARGER_OCCUPANT "living_charge" ///sent when a mob/login() finishes: (client) diff --git a/code/datums/components/manual_blinking.dm b/code/datums/components/manual_blinking.dm index aa986672189..f15e61911a2 100644 --- a/code/datums/components/manual_blinking.dm +++ b/code/datums/components/manual_blinking.dm @@ -33,14 +33,14 @@ RegisterSignal(parent, COMSIG_CARBON_GAIN_ORGAN, .proc/check_added_organ) RegisterSignal(parent, COMSIG_CARBON_LOSE_ORGAN, .proc/check_removed_organ) RegisterSignal(parent, COMSIG_LIVING_REVIVE, .proc/restart) - RegisterSignal(parent, COMSIG_MOB_DEATH, .proc/pause) + RegisterSignal(parent, COMSIG_LIVING_DEATH, .proc/pause) /datum/component/manual_blinking/UnregisterFromParent() UnregisterSignal(parent, COMSIG_MOB_EMOTE) UnregisterSignal(parent, COMSIG_CARBON_GAIN_ORGAN) UnregisterSignal(parent, COMSIG_CARBON_LOSE_ORGAN) UnregisterSignal(parent, COMSIG_LIVING_REVIVE) - UnregisterSignal(parent, COMSIG_MOB_DEATH) + UnregisterSignal(parent, COMSIG_LIVING_DEATH) /datum/component/manual_blinking/proc/restart() SIGNAL_HANDLER diff --git a/code/datums/components/manual_breathing.dm b/code/datums/components/manual_breathing.dm index 9fba5b46b83..e71303dad02 100644 --- a/code/datums/components/manual_breathing.dm +++ b/code/datums/components/manual_breathing.dm @@ -33,14 +33,14 @@ RegisterSignal(parent, COMSIG_CARBON_GAIN_ORGAN, .proc/check_added_organ) RegisterSignal(parent, COMSIG_CARBON_LOSE_ORGAN, .proc/check_removed_organ) RegisterSignal(parent, COMSIG_LIVING_REVIVE, .proc/restart) - RegisterSignal(parent, COMSIG_MOB_DEATH, .proc/pause) + RegisterSignal(parent, COMSIG_LIVING_DEATH, .proc/pause) /datum/component/manual_breathing/UnregisterFromParent() UnregisterSignal(parent, COMSIG_MOB_EMOTE) UnregisterSignal(parent, COMSIG_CARBON_GAIN_ORGAN) UnregisterSignal(parent, COMSIG_CARBON_LOSE_ORGAN) UnregisterSignal(parent, COMSIG_LIVING_REVIVE) - UnregisterSignal(parent, COMSIG_MOB_DEATH) + UnregisterSignal(parent, COMSIG_LIVING_DEATH) /datum/component/manual_breathing/proc/restart() SIGNAL_HANDLER diff --git a/code/datums/components/nanites.dm b/code/datums/components/nanites.dm index 1a06bf872a3..7c4b369dd11 100644 --- a/code/datums/components/nanites.dm +++ b/code/datums/components/nanites.dm @@ -60,7 +60,7 @@ if(isliving(parent)) RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, .proc/on_emp) - RegisterSignal(parent, COMSIG_MOB_DEATH, .proc/on_death) + RegisterSignal(parent, COMSIG_LIVING_DEATH, .proc/on_death) RegisterSignal(parent, COMSIG_MOB_ALLOWED, .proc/check_access) RegisterSignal(parent, COMSIG_LIVING_ELECTROCUTE_ACT, .proc/on_shock) RegisterSignal(parent, COMSIG_LIVING_MINOR_SHOCK, .proc/on_minor_shock) @@ -85,7 +85,7 @@ COMSIG_NANITE_SCAN, COMSIG_NANITE_SYNC, COMSIG_ATOM_EMP_ACT, - COMSIG_MOB_DEATH, + COMSIG_LIVING_DEATH, COMSIG_MOB_ALLOWED, COMSIG_LIVING_ELECTROCUTE_ACT, COMSIG_LIVING_MINOR_SHOCK, diff --git a/code/datums/components/summoning.dm b/code/datums/components/summoning.dm index f23229c9d8d..482d88a54be 100644 --- a/code/datums/components/summoning.dm +++ b/code/datums/components/summoning.dm @@ -66,7 +66,7 @@ spawned_mobs += L if(faction != null) L.faction = faction - RegisterSignal(L, COMSIG_MOB_DEATH, .proc/on_spawned_death) // so we can remove them from the list, etc (for mobs with corpses) + RegisterSignal(L, COMSIG_LIVING_DEATH, .proc/on_spawned_death) // so we can remove them from the list, etc (for mobs with corpses) playsound(spawn_location,spawn_sound, 50, TRUE) spawn_location.visible_message("[L] [spawn_text].") diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 3796b6a5435..2acf74d9881 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -101,7 +101,7 @@ original_character = null if(current) // remove ourself from our old body's mind variable current.mind = null - UnregisterSignal(current, COMSIG_MOB_DEATH) + UnregisterSignal(current, COMSIG_LIVING_DEATH) SStgui.on_transfer(current, new_character) if(key) @@ -128,7 +128,7 @@ transfer_antag_huds(hud_to_transfer) //inherit the antag HUD transfer_actions(new_character) transfer_martial_arts(new_character) - RegisterSignal(new_character, COMSIG_MOB_DEATH, .proc/set_death_time) + RegisterSignal(new_character, COMSIG_LIVING_DEATH, .proc/set_death_time) if(active || force_key_move) new_character.key = key //now transfer the key to link the client to our new body if(new_character.client) diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm index 93898994a5a..ff6ff5587e7 100644 --- a/code/game/machinery/computer/arcade.dm +++ b/code/game/machinery/computer/arcade.dm @@ -560,7 +560,9 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( playsound(loc, 'sound/arcade/lose.ogg', 50, TRUE) xp_gained += 10//pity points if(obj_flags & EMAGGED) - user.gib() + var/mob/living/living_user = user + if (istype(living_user)) + living_user.gib() SSblackbox.record_feedback("nested tally", "arcade_results", 1, list("loss", "hp", (obj_flags & EMAGGED ? "emagged":"normal"))) if(gameover) @@ -775,8 +777,11 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( R.fields["m_stat"] = "*Unstable*" return -/obj/machinery/computer/arcade/orion_trail/ui_interact(mob/user) +/obj/machinery/computer/arcade/orion_trail/ui_interact(mob/_user) . = ..() + if (!isliving(_user)) + return + var/mob/living/user = _user if(fuel <= 0 || food <=0 || settlers.len == 0) gameStatus = ORION_STATUS_GAMEOVER event = null @@ -1025,11 +1030,12 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( playsound(loc,'sound/weapons/gun/pistol/shot.ogg', 100, TRUE) killed_crew++ + var/mob/living/user = usr + if(settlers.len == 0 || alive == 0) say("The last crewmember [sheriff], shot themselves, GAME OVER!") if(obj_flags & EMAGGED) - usr.death(0) - obj_flags &= EMAGGED + user.death() gameStatus = ORION_STATUS_GAMEOVER event = null @@ -1039,7 +1045,7 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( else if(obj_flags & EMAGGED) if(usr.name == sheriff) say("The crew of the ship chose to kill [usr.name]!") - usr.death(0) + user.death() if(event == ORION_TRAIL_LING) //only ends the ORION_TRAIL_LING event, since you can do this action in multiple places event = null diff --git a/code/game/objects/items/food/pizza.dm b/code/game/objects/items/food/pizza.dm index a30f2f4679f..5efc1660fef 100644 --- a/code/game/objects/items/food/pizza.dm +++ b/code/game/objects/items/food/pizza.dm @@ -188,7 +188,7 @@ user.visible_message("\The [src] breaks off [user]'s arm!", "\The [src] breaks off your arm!") playsound(user, "desecration", 50, TRUE, -1) -/obj/item/food/proc/i_kill_you(obj/item/I, mob/user) +/obj/item/food/proc/i_kill_you(obj/item/I, mob/living/user) if(istype(I, /obj/item/reagent_containers/food/snacks/pineappleslice)) to_chat(user, "If you want something crazy like pineapple, I'll kill you.") //this is in bigger text because it's hard to spam something that gibs you, and so that you're perfectly aware of the reason why you died user.gib() //if you want something crazy like pineapple, i'll kill you diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm index b7e1b291a9a..4e13eae9a5e 100644 --- a/code/game/objects/items/grenades/plastic.dm +++ b/code/game/objects/items/grenades/plastic.dm @@ -143,7 +143,7 @@ message_say = "FOR THE FEDERATION!" M.say(message_say, forced="C4 suicide") -/obj/item/grenade/c4/suicide_act(mob/user) +/obj/item/grenade/c4/suicide_act(mob/living/user) message_admins("[ADMIN_LOOKUPFLW(user)] suicided with [src] at [ADMIN_VERBOSEJMP(user)]") log_game("[key_name(user)] suicided with [src] at [AREACOORD(user)]") user.visible_message("[user] activates [src] and holds it above [user.p_their()] head! It looks like [user.p_theyre()] going out with a bang!") diff --git a/code/game/objects/items/theft_tools.dm b/code/game/objects/items/theft_tools.dm index e9428885c06..d1d5aff2196 100644 --- a/code/game/objects/items/theft_tools.dm +++ b/code/game/objects/items/theft_tools.dm @@ -177,13 +177,12 @@ ..() if(!isliving(user) || user.status_flags & GODMODE) //try to keep this in sync with supermatter's consume fail conditions return FALSE - var/mob/ded = user - user.visible_message("[ded] reaches out and tries to pick up [src]. [ded.p_their()] body starts to glow and bursts into flames before flashing into dust!",\ + user.visible_message("[user] reaches out and tries to pick up [src]. [user.p_their()] body starts to glow and bursts into flames before flashing into dust!",\ "You reach for [src] with your hands. That was dumb.",\ "Everything suddenly goes silent.") radiation_pulse(user, 500, 2) playsound(src, 'sound/effects/supermatter.ogg', 50, TRUE) - ded.dust() + user.dust() /obj/item/nuke_core_container/supermatter name = "supermatter bin" @@ -270,7 +269,7 @@ update_icon() return ..() -/obj/item/hemostat/supermatter/proc/Consume(atom/movable/AM, mob/user) +/obj/item/hemostat/supermatter/proc/Consume(atom/movable/AM, mob/living/user) if(ismob(AM)) if(!isliving(AM)) return diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 250727e731f..92bed51c146 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -664,7 +664,7 @@ Traitors and the like can also be revived with the previous role mostly intact. else return -/client/proc/cmd_admin_gib(mob/M in GLOB.mob_list) +/client/proc/cmd_admin_gib(mob/victim in GLOB.mob_list) set category = "Admin.Fun" set name = "Gib" @@ -675,19 +675,23 @@ Traitors and the like can also be revived with the previous role mostly intact. if(confirm == "Cancel") return //Due to the delay here its easy for something to have happened to the mob - if(!M) + if(!victim) return - log_admin("[key_name(usr)] has gibbed [key_name(M)]") - message_admins("[key_name_admin(usr)] has gibbed [key_name_admin(M)]") + log_admin("[key_name(usr)] has gibbed [key_name(victim)]") + message_admins("[key_name_admin(usr)] has gibbed [key_name_admin(victim)]") - if(isobserver(M)) - new /obj/effect/gibspawner/generic(get_turf(M)) + if(isobserver(victim)) + new /obj/effect/gibspawner/generic(get_turf(victim)) return - if(confirm == "Yes") - M.gib() - else - M.gib(1) + + var/mob/living/living_victim = victim + if (istype(living_victim)) + if(confirm == "Yes") + living_victim.gib() + else + living_victim.gib(TRUE) + SSblackbox.record_feedback("tally", "admin_verb", 1, "Gib") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/cmd_admin_gib_self() @@ -699,7 +703,10 @@ Traitors and the like can also be revived with the previous role mostly intact. log_admin("[key_name(usr)] used gibself.") message_admins("[key_name_admin(usr)] used gibself.") SSblackbox.record_feedback("tally", "admin_verb", 1, "Gib Self") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - mob.gib(1, 1, 1) + + var/mob/living/ourself = mob + if (istype(ourself)) + ourself.gib(TRUE, TRUE, TRUE) /client/proc/cmd_admin_check_contents(mob/living/M in GLOB.mob_list) set category = "Debug" diff --git a/code/modules/antagonists/blob/blob.dm b/code/modules/antagonists/blob/blob.dm index 69ae8604e1d..0709ff412db 100644 --- a/code/modules/antagonists/blob/blob.dm +++ b/code/modules/antagonists/blob/blob.dm @@ -49,7 +49,7 @@ button_icon_state = "blob" /datum/action/innate/blobpop/Activate() - var/mob/old_body = owner + var/mob/living/old_body = owner var/datum/antagonist/blob/blobtag = owner.mind.has_antag_datum(/datum/antagonist/blob) if(!blobtag) Remove() diff --git a/code/modules/antagonists/changeling/powers/headcrab.dm b/code/modules/antagonists/changeling/powers/headcrab.dm index 22cad0e0b7e..e96b5f4cf02 100644 --- a/code/modules/antagonists/changeling/powers/headcrab.dm +++ b/code/modules/antagonists/changeling/powers/headcrab.dm @@ -7,7 +7,7 @@ dna_cost = 1 req_human = 1 -/datum/action/changeling/headcrab/sting_action(mob/user) +/datum/action/changeling/headcrab/sting_action(mob/living/user) set waitfor = FALSE if(alert("Are we sure we wish to kill ourself and create a headslug?",,"Yes", "No") == "No") return diff --git a/code/modules/antagonists/eldritch_cult/knowledge/flesh_lore.dm b/code/modules/antagonists/eldritch_cult/knowledge/flesh_lore.dm index e1fbe3a8623..aceaf6a3be2 100644 --- a/code/modules/antagonists/eldritch_cult/knowledge/flesh_lore.dm +++ b/code/modules/antagonists/eldritch_cult/knowledge/flesh_lore.dm @@ -55,14 +55,14 @@ var/datum/antagonist/heretic/master = user.mind.has_antag_datum(/datum/antagonist/heretic) heretic_monster.set_owner(master) atoms -= humie - RegisterSignal(humie,COMSIG_MOB_DEATH,.proc/remove_ghoul) + RegisterSignal(humie,COMSIG_LIVING_DEATH,.proc/remove_ghoul) ghouls += humie /datum/eldritch_knowledge/flesh_ghoul/proc/remove_ghoul(datum/source) var/mob/living/carbon/human/humie = source ghouls -= humie humie.mind.remove_antag_datum(/datum/antagonist/heretic_monster) - UnregisterSignal(source,COMSIG_MOB_DEATH) + UnregisterSignal(source,COMSIG_LIVING_DEATH) /datum/eldritch_knowledge/flesh_grasp name = "Grasp of Flesh" @@ -102,7 +102,7 @@ log_game("[key_name_admin(human_target)] has become a ghoul, their master is [user.real_name]") //we change it to true only after we know they passed all the checks . = TRUE - RegisterSignal(human_target,COMSIG_MOB_DEATH,.proc/remove_ghoul) + RegisterSignal(human_target,COMSIG_LIVING_DEATH,.proc/remove_ghoul) human_target.revive(full_heal = TRUE, admin_revive = TRUE) human_target.setMaxHealth(25) human_target.health = 25 @@ -131,7 +131,7 @@ var/mob/living/carbon/human/humie = source spooky_scaries -= humie humie.mind.remove_antag_datum(/datum/antagonist/heretic_monster) - UnregisterSignal(source, COMSIG_MOB_DEATH) + UnregisterSignal(source, COMSIG_LIVING_DEATH) /datum/eldritch_knowledge/flesh_mark name = "Mark of flesh" diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm index a2bcfc5c5a7..a68aeeb11e6 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm @@ -585,9 +585,10 @@ /proc/KillEveryoneOnZLevel(z) if(!z) return - for(var/mob/M in GLOB.mob_list) - if(M.stat != DEAD && M.z == z) - M.gib() + for(var/_victim in GLOB.mob_living_list) + var/mob/living/victim = _victim + if(victim.stat != DEAD && victim.z == z) + victim.gib() /* This is here to make the tiles around the station mininuke change when it's armed. diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm index 41e04322645..bdf55ae4150 100644 --- a/code/modules/awaymissions/capture_the_flag.dm +++ b/code/modules/awaymissions/capture_the_flag.dm @@ -297,14 +297,15 @@ victory() /obj/machinery/capture_the_flag/proc/victory() - for(var/mob/M in GLOB.mob_list) - var/area/mob_area = get_area(M) + for(var/mob/_competitor in GLOB.mob_living_list) + var/mob/living/competitor = _competitor + var/area/mob_area = get_area(competitor) if(istype(mob_area, /area/ctf)) - to_chat(M, "[team] team wins!") - to_chat(M, "Teams have been cleared. Click on the machines to vote to begin another round.") - for(var/obj/item/ctf/W in M) - M.dropItemToGround(W) - M.dust() + to_chat(competitor, "[team] team wins!") + to_chat(competitor, "Teams have been cleared. Click on the machines to vote to begin another round.") + for(var/obj/item/ctf/W in competitor) + competitor.dropItemToGround(W) + competitor.dust() for(var/obj/machinery/control_point/control in GLOB.machines) control.icon_state = "dominator" control.controlling = null @@ -359,10 +360,10 @@ ctf_enabled = FALSE arena_reset = FALSE var/area/A = get_area(src) - for(var/i in GLOB.mob_list) - var/mob/M = i - if((get_area(A) == A) && (M.ckey in team_members)) - M.dust() + for(var/_competitor in GLOB.mob_living_list) + var/mob/living/competitor = _competitor + if((get_area(A) == A) && (competitor.ckey in team_members)) + competitor.dust() team_members.Cut() spawned_mobs.Cut() recently_dead_ckeys.Cut() diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index 5bcd0c3a11e..4efb1ad61a1 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -230,9 +230,9 @@ /obj/machinery/gibber/autogibber/Bumped(atom/movable/AM) var/atom/input = get_step(src, input_dir) - if(ismob(AM)) - var/mob/M = AM + if(isliving(AM)) + var/mob/living/victim = AM - if(M.loc == input) - M.forceMove(src) - M.gib() + if(victim.loc == input) + victim.forceMove(src) + victim.gib() diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm index 710f3b8ab81..ad8a7e1216b 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm @@ -30,8 +30,8 @@ if (recipe.output && loc && !QDELETED(src)) for(var/i = 0, i < (rating_amount * recipe.multiplier), i++) new recipe.output(drop_location()) - if (ismob(what)) - var/mob/themob = what + if (isliving(what)) + var/mob/living/themob = what themob.gib(TRUE,TRUE,TRUE) else qdel(what) diff --git a/code/modules/hydroponics/grown/melon.dm b/code/modules/hydroponics/grown/melon.dm index 6383c3eca77..88e424d41f5 100644 --- a/code/modules/hydroponics/grown/melon.dm +++ b/code/modules/hydroponics/grown/melon.dm @@ -15,7 +15,7 @@ mutatelist = list(/obj/item/seeds/watermelon/holy, /obj/item/seeds/watermelon/barrel) reagents_add = list(/datum/reagent/water = 0.2, /datum/reagent/consumable/nutriment/vitamin = 0.04, /datum/reagent/consumable/nutriment = 0.2) -/obj/item/seeds/watermelon/suicide_act(mob/user) +/obj/item/seeds/watermelon/suicide_act(mob/living/user) user.visible_message("[user] is swallowing [src]! It looks like [user.p_theyre()] trying to commit suicide!") user.gib() new product(drop_location()) diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index dfe69566189..1dca1c7d993 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -25,12 +25,6 @@ INITIALIZE_IMMEDIATE(/mob/dead) /mob/dead/canUseStorage() return FALSE -/mob/dead/dust(just_ash, drop_items, force) //ghosts can't be vaporised. - return - -/mob/dead/gib() //ghosts can't be gibbed. - return - /mob/dead/forceMove(atom/destination) var/turf/old_turf = get_turf(src) var/turf/new_turf = get_turf(destination) diff --git a/code/modules/mob/death.dm b/code/modules/mob/death.dm deleted file mode 100644 index 5eb20b8dfa8..00000000000 --- a/code/modules/mob/death.dm +++ /dev/null @@ -1,14 +0,0 @@ -//This is the proc for gibbing a mob. Cannot gib ghosts. -//added different sort of gibs and animations. N -/mob/proc/gib() - 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(just_ash, drop_items, force) - return - -/mob/proc/death(gibbed) - SEND_SIGNAL(src, COMSIG_MOB_DEATH, gibbed) - SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MOB_DEATH, src , gibbed) diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index eed6b58e844..d5b283c1cdd 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -620,7 +620,7 @@ var/datum/action/innate/linked_speech/action = new(src) linked_actions.Add(action) action.Grant(M) - RegisterSignal(M, COMSIG_MOB_DEATH , .proc/unlink_mob) + RegisterSignal(M, COMSIG_LIVING_DEATH , .proc/unlink_mob) RegisterSignal(M, COMSIG_PARENT_QDELETING, .proc/unlink_mob) return TRUE @@ -628,7 +628,7 @@ var/link_id = linked_mobs.Find(M) if(!(link_id)) return - UnregisterSignal(M, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING)) + UnregisterSignal(M, list(COMSIG_LIVING_DEATH, COMSIG_PARENT_QDELETING)) var/datum/action/innate/linked_speech/action = linked_actions[link_id] action.Remove(M) to_chat(M, "You are no longer connected to [slimelink_owner.real_name]'s Slime Link.") diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index e89d75a4629..0d8ed8982d1 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -1,4 +1,12 @@ -/mob/living/gib(no_brain, no_organs, no_bodyparts) +/** + * Blow up the mob into giblets + * + * Arguments: + * * no_brain - Should the mob NOT drop a brain? + * * no_organs - Should the mob NOT drop organs? + * * no_bodyparts - Should the mob NOT drop bodyparts? +*/ +/mob/living/proc/gib(no_brain, no_organs, no_bodyparts) var/prev_lying = lying_angle if(stat != DEAD) death(TRUE) @@ -26,7 +34,16 @@ /mob/living/proc/spread_bodyparts() return -/mob/living/dust(just_ash, drop_items, force) +/** + * This is the proc for turning a mob into ash. + * Dusting robots does not eject the MMI, so it's a bit more powerful than gib() + * + * Arguments: + * * just_ash - If TRUE, ash will spawn where the mob was, as opposed to remains + * * drop_items - Should the mob drop their items before dusting? + * * force - Should this mob be FORCABLY dusted? +*/ +/mob/living/proc/dust(just_ash, drop_items, force) death(TRUE) if(drop_items) @@ -45,8 +62,13 @@ /mob/living/proc/spawn_dust(just_ash = FALSE) new /obj/effect/decal/cleanable/ash(loc) - -/mob/living/death(gibbed) +/* + * Called when the mob dies. Can also be called manually to kill a mob. + * + * Arguments: + * * gibbed - Was the mob gibbed? +*/ +/mob/living/proc/death(gibbed) set_stat(DEAD) unset_machine() timeofdeath = world.time @@ -70,7 +92,8 @@ med_hud_set_status() stop_pulling() - . = ..() + SEND_SIGNAL(src, COMSIG_LIVING_DEATH, gibbed) + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MOB_DEATH, src, gibbed) if (client) client.move_delay = initial(client.move_delay) diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 020f7196f6e..713ff857c24 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -958,7 +958,7 @@ return else if(mind) - RegisterSignal(target, COMSIG_MOB_DEATH, .proc/disconnect_shell) + RegisterSignal(target, COMSIG_LIVING_DEATH, .proc/disconnect_shell) deployed_shell = target target.deploy_init(src) mind.transfer_to(target) @@ -996,7 +996,7 @@ if(deployed_shell) //Forcibly call back AI in event of things such as damage, EMP or power loss. to_chat(src, "Your remote connection has been reset!") deployed_shell.undeploy() - UnregisterSignal(deployed_shell, COMSIG_MOB_DEATH) + UnregisterSignal(deployed_shell, COMSIG_LIVING_DEATH) diag_hud_set_deployed() /mob/living/silicon/ai/resist() diff --git a/code/modules/mob/living/simple_animal/eldritch_demons.dm b/code/modules/mob/living/simple_animal/eldritch_demons.dm index c1b8e99a825..639d1cf5f13 100644 --- a/code/modules/mob/living/simple_animal/eldritch_demons.dm +++ b/code/modules/mob/living/simple_animal/eldritch_demons.dm @@ -85,7 +85,7 @@ var/datum/action/innate/mansus_speech/action = new(src) linked_mobs[mob_linked] = action action.Grant(mob_linked) - RegisterSignal(mob_linked, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING), .proc/unlink_mob) + RegisterSignal(mob_linked, list(COMSIG_LIVING_DEATH, COMSIG_PARENT_QDELETING), .proc/unlink_mob) return TRUE /mob/living/simple_animal/hostile/eldritch/raw_prophet/proc/unlink_mob(mob/living/mob_linked) @@ -93,7 +93,7 @@ if(!linked_mobs[mob_linked]) return - UnregisterSignal(mob_linked, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING)) + UnregisterSignal(mob_linked, list(COMSIG_LIVING_DEATH, COMSIG_PARENT_QDELETING)) var/datum/action/innate/mansus_speech/action = linked_mobs[mob_linked] action.Remove(mob_linked) qdel(action) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index 7a8f0f87605..1d94c5c82c2 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -817,7 +817,7 @@ Difficulty: Very Hard action_icon_state = "exit_possession" sound = null -/obj/effect/proc_holder/spell/targeted/exit_possession/cast(list/targets, mob/user = usr) +/obj/effect/proc_holder/spell/targeted/exit_possession/cast(list/targets, mob/living/user = usr) if(!isfloorturf(user.loc)) return var/datum/mind/target_mind = user.mind diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm index 48d8c8e6b4e..3b05fa93355 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm @@ -286,7 +286,7 @@ Difficulty: Extremely Hard return forceMove(user) to_chat(user, "You feel a bit safer... but a demonic presence lurks in the back of your head...") - RegisterSignal(user, COMSIG_MOB_DEATH, .proc/resurrect) + RegisterSignal(user, COMSIG_LIVING_DEATH, .proc/resurrect) /// Resurrects the target when they die by moving them and dusting a clone in their place, one life for another /obj/item/resurrection_crystal/proc/resurrect(mob/living/carbon/user, gibbed) diff --git a/code/modules/mob/living/simple_animal/hostile/ooze.dm b/code/modules/mob/living/simple_animal/hostile/ooze.dm index 9c94a3a0092..2a9e9de616e 100644 --- a/code/modules/mob/living/simple_animal/hostile/ooze.dm +++ b/code/modules/mob/living/simple_animal/hostile/ooze.dm @@ -207,7 +207,7 @@ ///Register for owner death /datum/action/consume/New(Target) . = ..() - RegisterSignal(owner, COMSIG_MOB_DEATH, .proc/on_owner_death) + RegisterSignal(owner, COMSIG_LIVING_DEATH, .proc/on_owner_death) RegisterSignal(owner, COMSIG_PARENT_PREQDELETED, .proc/handle_mob_deletion) /datum/action/consume/proc/handle_mob_deletion() diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 1deb8067f8e..2b1ab775aa4 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -11,25 +11,24 @@ name = "bolt of death" icon_state = "pulse1_bl" -/obj/projectile/magic/death/on_hit(target) +/obj/projectile/magic/death/on_hit(mob/living/target) . = ..() - if(ismob(target)) - var/mob/M = target - if(M.anti_magic_check()) - M.visible_message("[src] vanishes on contact with [target]!") - return BULLET_ACT_BLOCK - if(isliving(M)) - var/mob/living/L = M - if(L.mob_biotypes & MOB_UNDEAD) //negative energy heals the undead - if(L.revive(full_heal = TRUE, admin_revive = TRUE)) - L.grab_ghost(force = TRUE) // even suicides - to_chat(L, "You rise with a start, you're undead!!!") - else if(L.stat != DEAD) - to_chat(L, "You feel great!") - else - L.death(0) - else - M.death(0) + if(!istype(target)) + return + + if(target.anti_magic_check()) + target.visible_message("[src] vanishes on contact with [target]!") + return BULLET_ACT_BLOCK + + if(target.mob_biotypes & MOB_UNDEAD) //negative energy heals the undead + if(target.revive(full_heal = TRUE, admin_revive = TRUE)) + target.grab_ghost(force = TRUE) // even suicides + to_chat(target, "You rise with a start, you're undead!!!") + else if(target.stat != DEAD) + to_chat(target, "You feel great!") + return + + target.death() /obj/projectile/magic/resurrection name = "bolt of resurrection" @@ -155,6 +154,13 @@ qdel(src) /proc/wabbajack(mob/living/M, randomize) + // If the mob has a shapeshifted form, we want to pull out the reference of the caster's original body from it. + // We then want to restore this original body through the shapeshift holder itself. + var/obj/shapeshift_holder/shapeshift = locate() in M + if(shapeshift) + M = shapeshift.stored + shapeshift.restore() + if(!istype(M) || M.stat == DEAD || M.notransform || (GODMODE & M.status_flags)) return diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm index 020dd683c7c..d8a228b5f9a 100644 --- a/code/modules/research/destructive_analyzer.dm +++ b/code/modules/research/destructive_analyzer.dm @@ -63,8 +63,8 @@ Note: Must be placed within 3 tiles of the R&D Console var/list/food = thing.GetDeconstructableContents() for(var/obj/item/innerthing in food) destroy_item(innerthing, TRUE) - for(var/mob/M in thing) - M.death() + for(var/mob/living/victim in thing) + victim.death() qdel(thing) loaded_item = null diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index d3980f0ffad..a7b6f8f8c50 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -765,7 +765,7 @@ var/prompted = 0 var/animal_type = SENTIENCE_ORGANIC -/obj/item/slimepotion/transference/afterattack(mob/living/M, mob/user, proximity) +/obj/item/slimepotion/transference/afterattack(mob/living/M, mob/living/user, proximity) if(!proximity) return if(prompted || !ismob(M)) diff --git a/code/modules/ruins/spaceruin_code/hilbertshotel.dm b/code/modules/ruins/spaceruin_code/hilbertshotel.dm index ebef8b93848..745eba4ae08 100644 --- a/code/modules/ruins/spaceruin_code/hilbertshotel.dm +++ b/code/modules/ruins/spaceruin_code/hilbertshotel.dm @@ -371,7 +371,7 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999)) return // Prepare for... - var/mob/unforeseen_consequences = get_atom_on_turf(H, /mob) + var/mob/living/unforeseen_consequences = get_atom_on_turf(H, /mob/living) // Turns out giving anyone who grabs a Hilbert's Hotel a free, complementary warp whistle is probably bad. // Let's gib the last person to have selected a room number in it. diff --git a/code/modules/spells/spell_types/godhand.dm b/code/modules/spells/spell_types/godhand.dm index f4a31e58fc4..d6d1d310825 100644 --- a/code/modules/spells/spell_types/godhand.dm +++ b/code/modules/spells/spell_types/godhand.dm @@ -53,35 +53,34 @@ icon_state = "disintegrate" inhand_icon_state = "disintegrate" -/obj/item/melee/touch_attack/disintegrate/afterattack(atom/target, mob/living/carbon/user, proximity) - if(!proximity || target == user || !ismob(target) || !iscarbon(user) || !(user.mobility_flags & MOBILITY_USE)) //exploding after touching yourself would be bad +/obj/item/melee/touch_attack/disintegrate/afterattack(mob/living/target, mob/living/carbon/user, proximity) + if(!proximity || target == user || !istype(target) || !iscarbon(user) || !(user.mobility_flags & MOBILITY_USE)) //exploding after touching yourself would be bad return if(!user.can_speak_vocal()) to_chat(user, "You can't get the words out!") return - var/mob/M = target - do_sparks(4, FALSE, M.loc) + do_sparks(4, FALSE, target.loc) for(var/mob/living/L in view(src, 7)) if(L != user) L.flash_act(affect_silicon = FALSE) - var/atom/A = M.anti_magic_check() + var/atom/A = target.anti_magic_check() if(A) if(isitem(A)) target.visible_message("[target]'s [A] glows brightly as it wards off the spell!") - user.visible_message("The feedback blows [user]'s arm off!","The spell bounces from [M]'s skin back into your arm!") + user.visible_message("The feedback blows [user]'s arm off!","The spell bounces from [target]'s skin back into your arm!") user.flash_act() var/obj/item/bodypart/part = user.get_holding_bodypart_of_item(src) if(part) part.dismember() return ..() - var/obj/item/clothing/suit/hooded/bloated_human/suit = M.get_item_by_slot(ITEM_SLOT_OCLOTHING) + var/obj/item/clothing/suit/hooded/bloated_human/suit = target.get_item_by_slot(ITEM_SLOT_OCLOTHING) if(istype(suit)) - M.visible_message("[M]'s [suit] explodes off of them into a puddle of gore!") - M.dropItemToGround(suit) + target.visible_message("[target]'s [suit] explodes off of them into a puddle of gore!") + target.dropItemToGround(suit) qdel(suit) - new /obj/effect/gibspawner(M.loc) + new /obj/effect/gibspawner(target.loc) return ..() - M.gib() + target.gib() return ..() /obj/item/melee/touch_attack/fleshtostone diff --git a/code/modules/spells/spell_types/lichdom.dm b/code/modules/spells/spell_types/lichdom.dm index 9b0ede9e446..0ec4095d3a4 100644 --- a/code/modules/spells/spell_types/lichdom.dm +++ b/code/modules/spells/spell_types/lichdom.dm @@ -121,7 +121,7 @@ if(!item_turf) return "[src] is not at a turf? NULLSPACE!?" - var/mob/old_body = mind.current + var/mob/living/old_body = mind.current var/mob/living/carbon/human/lich = new(item_turf) lich.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal/magic(lich), ITEM_SLOT_FEET) diff --git a/code/modules/spells/spell_types/shapeshift.dm b/code/modules/spells/spell_types/shapeshift.dm index 643ff543f74..7e8e203aea7 100644 --- a/code/modules/spells/spell_types/shapeshift.dm +++ b/code/modules/spells/spell_types/shapeshift.dm @@ -149,11 +149,12 @@ shape.apply_damage(damapply, source.convert_damage_type, forced = TRUE, wound_bonus=CANT_WOUND); shape.blood_volume = stored.blood_volume; - stored.RegisterSignal(src, COMSIG_PARENT_QDELETING, .proc/shape_death) - stored.RegisterSignal(shape, list(COMSIG_PARENT_QDELETING, COMSIG_MOB_DEATH), .proc/shape_death) - shape.RegisterSignal(stored, list(COMSIG_PARENT_QDELETING, COMSIG_MOB_DEATH), .proc/shape_death) + RegisterSignal(shape, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH), .proc/shape_death) + RegisterSignal(stored, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH), .proc/caster_death) /obj/shapeshift_holder/Destroy() + // Restore manages signal unregistering. If restoring is TRUE, we've already unregistered the signals and we're here + // because restore() qdel'd src. if(!restoring) restore() stored = null @@ -191,6 +192,10 @@ restore() /obj/shapeshift_holder/proc/restore(death=FALSE) + // Destroy() calls this proc if it hasn't been called. Unregistering here prevents multiple qdel loops + // when caster and shape both die at the same time. + UnregisterSignal(shape, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH)) + UnregisterSignal(stored, list(COMSIG_PARENT_QDELETING, COMSIG_LIVING_DEATH)) restoring = TRUE stored.forceMove(shape.loc) stored.notransform = FALSE @@ -207,5 +212,10 @@ stored.apply_damage(damapply, source.convert_damage_type, forced = TRUE, wound_bonus=CANT_WOUND) if(source.convert_damage) stored.blood_volume = shape.blood_volume; - QDEL_NULL(shape) + + // This guard is important because restore() can also be called on COMSIG_PARENT_QDELETING for shape, as well as on death. + // This can happen in, for example, [/proc/wabbajack] where the mob hit is qdel'd. + if(!QDELETED(shape)) + QDEL_NULL(shape) + qdel(src) diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index 3a983872889..f26818da2a3 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -1081,14 +1081,14 @@ /obj/vehicle/sealed/mecha/add_occupant(mob/M, control_flags) - RegisterSignal(M, COMSIG_MOB_DEATH, .proc/mob_exit) + RegisterSignal(M, COMSIG_LIVING_DEATH, .proc/mob_exit) RegisterSignal(M, COMSIG_MOB_CLICKON, .proc/on_mouseclick) RegisterSignal(M, COMSIG_MOB_SAY, .proc/display_speech_bubble) . = ..() update_icon() /obj/vehicle/sealed/mecha/remove_occupant(mob/M) - UnregisterSignal(M, COMSIG_MOB_DEATH) + UnregisterSignal(M, COMSIG_LIVING_DEATH) UnregisterSignal(M, COMSIG_MOB_CLICKON) UnregisterSignal(M, COMSIG_MOB_SAY) M.clear_alert("charge") diff --git a/tgstation.dme b/tgstation.dme index 2ad0efbec28..190f9dcd25e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -2207,7 +2207,6 @@ #include "code\modules\mining\lavaland\ash_flora.dm" #include "code\modules\mining\lavaland\necropolis_chests.dm" #include "code\modules\mining\lavaland\ruins\gym.dm" -#include "code\modules\mob\death.dm" #include "code\modules\mob\emote.dm" #include "code\modules\mob\inventory.dm" #include "code\modules\mob\login.dm"