From cf0f039c8e3d2a46e232ecc33e7c65743292576c Mon Sep 17 00:00:00 2001
From: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Date: Wed, 28 Sep 2022 00:33:27 -0500
Subject: [PATCH] Reverts #68155 (Fix simple mob deaths causing deadchat
notifications), Fixes living level mobs being able to die while dead (#70103)
---
code/__DEFINES/flags.dm | 3 +++
code/__DEFINES/traits.dm | 2 --
code/_globalvars/bitfields.dm | 10 +++++-----
code/_globalvars/traits.dm | 1 -
code/game/area/areas/centcom.dm | 1 +
code/modules/antagonists/morph/morph.dm | 1 -
code/modules/antagonists/revenant/revenant.dm | 1 -
code/modules/mob/living/death.dm | 16 +++++++++++-----
.../living/simple_animal/hostile/giant_spider.dm | 2 --
.../hostile/mining_mobs/elites/elite.dm | 1 -
.../living/simple_animal/hostile/space_dragon.dm | 1 -
11 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm
index 817f36f972f..526aa80c925 100644
--- a/code/__DEFINES/flags.dm
+++ b/code/__DEFINES/flags.dm
@@ -126,6 +126,9 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define AREA_USES_STARLIGHT (1<<14)
/// If engravings are persistent in this area
#define PERSISTENT_ENGRAVINGS (1<<15)
+/// Mobs that die in this area don't produce a dead chat message
+#define NO_DEATH_MESSAGE (1<<16)
+
/*
These defines are used specifically with the atom/pass_flags bitmask
the atom/checkpass() proc uses them (tables will call movable atom checkpass(PASSTABLE) for example)
diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm
index 3f556a4338e..f05e682fd90 100644
--- a/code/__DEFINES/traits.dm
+++ b/code/__DEFINES/traits.dm
@@ -381,8 +381,6 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_BLUSHING "blushing"
/// This person is crying
#define TRAIT_CRYING "crying"
-/// For simple mobs controlled by a player. Sends a death alert in deadchat (used by space dragons, morphs, revenants, elite lavaland mobs, brood spiders)
-#define TRAIT_ALERT_GHOSTS_ON_DEATH "trait_alert_ghosts_on_death"
#define TRAIT_NOBLEED "nobleed" //This carbon doesn't bleed
/// This atom can ignore the "is on a turf" check for simple AI datum attacks, allowing them to attack from bags or lockers as long as any other conditions are met
#define TRAIT_AI_BAGATTACK "bagattack"
diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm
index c8cfd23a1fc..3266c995a16 100644
--- a/code/_globalvars/bitfields.dm
+++ b/code/_globalvars/bitfields.dm
@@ -51,22 +51,22 @@ DEFINE_BITFIELD(appearance_flags, list(
DEFINE_BITFIELD(area_flags, list(
"ABDUCTOR_PROOF" = ABDUCTOR_PROOF,
+ "AREA_USES_STARLIGHT" = AREA_USES_STARLIGHT,
"BLOBS_ALLOWED" = BLOBS_ALLOWED,
"BLOCK_SUICIDE" = BLOCK_SUICIDE,
+ "CAVES_ALLOWED" = CAVES_ALLOWED,
"CULT_PERMITTED" = CULT_PERMITTED,
"FLORA_ALLOWED" = FLORA_ALLOWED,
"HIDDEN_AREA" = HIDDEN_AREA,
"MEGAFAUNA_SPAWN_ALLOWED" = MEGAFAUNA_SPAWN_ALLOWED,
"MOB_SPAWN_ALLOWED" = MOB_SPAWN_ALLOWED,
- "NO_ALERTS" = NO_ALERTS,
"NOTELEPORT" = NOTELEPORT,
- "CAVES_ALLOWED" = CAVES_ALLOWED,
+ "NO_ALERTS" = NO_ALERTS,
+ "NO_DEATH_MESSAGE" = NO_DEATH_MESSAGE,
+ "PERSISTENT_ENGRAVINGS" = PERSISTENT_ENGRAVINGS,
"UNIQUE_AREA" = UNIQUE_AREA,
"VALID_TERRITORY" = VALID_TERRITORY,
"XENOBIOLOGY_COMPATIBLE" = XENOBIOLOGY_COMPATIBLE,
- "NO_ALERTS" = NO_ALERTS,
- "AREA_USES_STARLIGHT" = AREA_USES_STARLIGHT,
- "PERSISTENT_ENGRAVINGS" = PERSISTENT_ENGRAVINGS,
))
DEFINE_BITFIELD(turf_flags, list(
diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm
index ad1a2846570..b347107fc6c 100644
--- a/code/_globalvars/traits.dm
+++ b/code/_globalvars/traits.dm
@@ -177,7 +177,6 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_SHIFTY_EYES" = TRAIT_SHIFTY_EYES,
"TRAIT_CANNOT_BE_UNBUCKLED" = TRAIT_CANNOT_BE_UNBUCKLED,
"TRAIT_GAMER" = TRAIT_GAMER,
- "TRAIT_ALERT_GHOSTS_ON_DEATH" = TRAIT_ALERT_GHOSTS_ON_DEATH,
),
/obj/item/bodypart = list(
"TRAIT_PARALYSIS" = TRAIT_PARALYSIS,
diff --git a/code/game/area/areas/centcom.dm b/code/game/area/areas/centcom.dm
index 01e5282c48c..0aa1d91984d 100644
--- a/code/game/area/areas/centcom.dm
+++ b/code/game/area/areas/centcom.dm
@@ -242,6 +242,7 @@ The areas used here are STRICTLY on the CC Z level.
base_lighting_alpha = 255
has_gravity = STANDARD_GRAVITY
flags_1 = NONE
+ area_flags = UNIQUE_AREA | NOTELEPORT | NO_DEATH_MESSAGE
/area/centcom/ctf/control_room
name = "Control Room A"
diff --git a/code/modules/antagonists/morph/morph.dm b/code/modules/antagonists/morph/morph.dm
index 743989729e9..548df16fa1b 100644
--- a/code/modules/antagonists/morph/morph.dm
+++ b/code/modules/antagonists/morph/morph.dm
@@ -45,7 +45,6 @@
/mob/living/simple_animal/hostile/morph/Initialize(mapload)
. = ..()
- ADD_TRAIT(src, TRAIT_ALERT_GHOSTS_ON_DEATH, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
AddElement(/datum/element/content_barfer)
diff --git a/code/modules/antagonists/revenant/revenant.dm b/code/modules/antagonists/revenant/revenant.dm
index f4786655954..5232966b79c 100644
--- a/code/modules/antagonists/revenant/revenant.dm
+++ b/code/modules/antagonists/revenant/revenant.dm
@@ -71,7 +71,6 @@
AddElement(/datum/element/simple_flying)
ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_SIXTHSENSE, INNATE_TRAIT)
- ADD_TRAIT(src, TRAIT_ALERT_GHOSTS_ON_DEATH, INNATE_TRAIT)
// Starting spells
var/datum/action/cooldown/spell/night_vision/revenant/vision = new(src)
diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm
index a778a68ee61..baff3eeaccf 100644
--- a/code/modules/mob/living/death.dm
+++ b/code/modules/mob/living/death.dm
@@ -69,14 +69,21 @@
* * gibbed - Was the mob gibbed?
*/
/mob/living/proc/death(gibbed)
+ if(stat == DEAD)
+ return FALSE
+
set_stat(DEAD)
unset_machine()
timeofdeath = world.time
tod = station_time_timestamp()
- var/turf/T = get_turf(src)
- if(mind && mind.name && mind.active && !istype(T.loc, /area/centcom/ctf))
- if(!isanimal_or_basicmob(src) || HAS_TRAIT(src, TRAIT_ALERT_GHOSTS_ON_DEATH))
- deadchat_broadcast(" has died at [get_area_name(T)].", "[mind.name]", follow_target = src, turf_target = T, message_type=DEADCHAT_DEATHRATTLE)
+ var/turf/death_turf = get_turf(src)
+ var/area/death_area = get_area(src)
+ // Display a death message if the mob is a player mob (has an active mind)
+ var/player_mob_check = mind && mind.name && mind.active
+ // and, display a death message if the area allows it (or if they're in nullspace)
+ var/valid_area_check = !death_area || !(death_area.area_flags & NO_DEATH_MESSAGE)
+ if(player_mob_check && valid_area_check)
+ deadchat_broadcast(" has died at [get_area_name(death_turf)].", "[mind.name]", follow_target = src, turf_target = death_turf, message_type=DEADCHAT_DEATHRATTLE)
if(SSlag_switch.measures[DISABLE_DEAD_KEYLOOP] && !client?.holder)
to_chat(src, span_deadsay(span_big("Observer freelook is disabled.\nPlease use Orbit, Teleport, and Jump to look around.")))
ghostize(TRUE)
@@ -91,7 +98,6 @@
med_hud_set_status()
stop_pulling()
-
SEND_SIGNAL(src, COMSIG_LIVING_DEATH, gibbed)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_MOB_DEATH, src, gibbed)
diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
index 8d27edf144a..a0738b1deca 100644
--- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
+++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
@@ -300,8 +300,6 @@
var/datum/action/innate/spider/comm/not_hivemind_talk = new(src)
not_hivemind_talk.Grant(src)
- ADD_TRAIT(src, TRAIT_ALERT_GHOSTS_ON_DEATH, INNATE_TRAIT)
-
/datum/action/innate/spider
icon_icon = 'icons/mob/actions/actions_animal.dmi'
background_icon_state = "bg_alien"
diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm
index d33529be570..93d57b4aee7 100644
--- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm
+++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm
@@ -28,7 +28,6 @@
//Gives player-controlled variants the ability to swap attacks
/mob/living/simple_animal/hostile/asteroid/elite/Initialize(mapload)
. = ..()
- ADD_TRAIT(src, TRAIT_ALERT_GHOSTS_ON_DEATH, INNATE_TRAIT)
for(var/action_type in attack_action_types)
var/datum/action/innate/elite_attack/attack_action = new action_type()
attack_action.Grant(src)
diff --git a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm
index f46f7a5c34e..aab35678633 100644
--- a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm
+++ b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm
@@ -88,7 +88,6 @@
ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_NO_FLOATING_ANIM, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_HEALS_FROM_CARP_RIFTS, INNATE_TRAIT)
- ADD_TRAIT(src, TRAIT_ALERT_GHOSTS_ON_DEATH, INNATE_TRAIT)
AddElement(/datum/element/content_barfer)
small_sprite = new
small_sprite.Grant(src)