From 8a16be72ee9622d893907d950f26096dc42aae92 Mon Sep 17 00:00:00 2001
From: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Date: Wed, 26 Jun 2024 22:55:50 -0500
Subject: [PATCH] Fix carbons deathgasping twice (#84347)
## About The Pull Request
They deathgasped once on the carbon level and once on the living level
I also realized this check I added a while back breaks lag check
mechanism so let's just change that around
## Changelog
:cl: Melbert
fix: Lizards and Moths don't deathgasp twice when they die
/:cl:
---
code/__DEFINES/living.dm | 3 +++
code/modules/mob/living/carbon/carbon_defines.dm | 2 +-
code/modules/mob/living/carbon/death.dm | 1 -
code/modules/mob/living/death.dm | 7 ++++---
code/modules/wiremod/shell/drone.dm | 2 +-
5 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/code/__DEFINES/living.dm b/code/__DEFINES/living.dm
index 1f2316e8e12..63993f4bc62 100644
--- a/code/__DEFINES/living.dm
+++ b/code/__DEFINES/living.dm
@@ -1,3 +1,6 @@
// living_flags
/// Simple mob trait, indicating it may follow continuous move actions controlled by code instead of by user input.
#define MOVES_ON_ITS_OWN (1<<0)
+/// Always does *deathgasp when they die
+/// If unset mobs will only deathgasp if supplied a death sound or custom death message
+#define ALWAYS_DEATHGASP (1<<1)
diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm
index 85fdeed5d88..dcab69f531e 100644
--- a/code/modules/mob/living/carbon/carbon_defines.dm
+++ b/code/modules/mob/living/carbon/carbon_defines.dm
@@ -11,6 +11,7 @@
usable_hands = 0 //Populated on init through list/bodyparts
mobility_flags = MOBILITY_FLAGS_CARBON_DEFAULT
blocks_emissive = EMISSIVE_BLOCK_NONE
+ living_flags = ALWAYS_DEATHGASP
///List of [/obj/item/organ]s in the mob. They don't go in the contents for some reason I don't want to know.
var/list/obj/item/organ/organs = list()
///Same as [above][/mob/living/carbon/var/organs], but stores "slot ID" - "organ" pairs for easy access.
@@ -122,4 +123,3 @@
var/bodyshape = BODYSHAPE_HUMANOID
COOLDOWN_DECLARE(bleeding_message_cd)
-
diff --git a/code/modules/mob/living/carbon/death.dm b/code/modules/mob/living/carbon/death.dm
index 41a958518c5..5fdd3498f15 100644
--- a/code/modules/mob/living/carbon/death.dm
+++ b/code/modules/mob/living/carbon/death.dm
@@ -5,7 +5,6 @@
losebreath = 0
if(!gibbed)
- INVOKE_ASYNC(src, PROC_REF(emote), "deathgasp")
add_memory_in_range(src, 7, /datum/memory/witnessed_death, protagonist = src)
reagents.end_metabolization(src)
diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm
index 53b08719f6a..03a29762f6d 100644
--- a/code/modules/mob/living/death.dm
+++ b/code/modules/mob/living/death.dm
@@ -104,7 +104,7 @@
if(stat == DEAD)
return FALSE
- if(!gibbed && (death_sound || death_message))
+ if(!gibbed && (death_sound || death_message || (living_flags & ALWAYS_DEATHGASP)))
INVOKE_ASYNC(src, TYPE_PROC_REF(/mob, emote), "deathgasp")
set_stat(DEAD)
@@ -116,8 +116,9 @@
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(player_mob_check)
+ if(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)
diff --git a/code/modules/wiremod/shell/drone.dm b/code/modules/wiremod/shell/drone.dm
index 4627a3cf326..d2922274b7d 100644
--- a/code/modules/wiremod/shell/drone.dm
+++ b/code/modules/wiremod/shell/drone.dm
@@ -9,7 +9,7 @@
icon_state = "setup_medium_med"
maxHealth = 300
health = 300
- living_flags = 0
+ living_flags = NONE
light_system = OVERLAY_LIGHT_DIRECTIONAL
light_on = FALSE