From b8de7dbb9f4f37e91854440e014719d2e9924852 Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Fri, 8 Mar 2019 06:39:15 -0500 Subject: [PATCH] Merge pull request #43036 from BuffEngineering/sip-fix Fixes non-shameful, nonlethal suicides --- code/__DEFINES/combat.dm | 13 +++++++------ code/modules/assembly/signaler.dm | 4 +++- code/modules/client/verbs/suicide.dm | 7 +++++-- code/modules/food_and_drinks/drinks/drinks.dm | 2 +- code/modules/mining/ores_coins.dm | 4 +++- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index 74765e9cd782..b67a326a62cb 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -12,12 +12,13 @@ #define BRAIN "brain" //bitflag damage defines used for suicide_act -#define BRUTELOSS (1<<0) -#define FIRELOSS (1<<1) -#define TOXLOSS (1<<2) -#define OXYLOSS (1<<3) -#define SHAME (1<<4) -#define MANUAL_SUICIDE (1<<5) //suicide_act will do the actual killing. +#define BRUTELOSS (1<<0) +#define FIRELOSS (1<<1) +#define TOXLOSS (1<<2) +#define OXYLOSS (1<<3) +#define SHAME (1<<4) +#define MANUAL_SUICIDE (1<<5) //suicide_act will do the actual killing. +#define MANUAL_SUICIDE_NONLETHAL (1<<6) //when the suicide is conditionally lethal #define EFFECT_STUN "stun" #define EFFECT_KNOCKDOWN "knockdown" diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index d8eac4f606d1..28dcedac73d6 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -21,12 +21,14 @@ playsound(src, 'sound/items/eatfood.ogg', 50, TRUE) user.transferItemToLoc(src, user, TRUE) suicider = user - return MANUAL_SUICIDE + return MANUAL_SUICIDE_NONLETHAL /obj/item/assembly/signaler/proc/manual_suicide(mob/living/carbon/user) user.visible_message("[user]'s \the [src] receives a signal, killing [user.p_them()] instantly!") user.adjustOxyLoss(200)//it sends an electrical pulse to their heart, killing them. or something. user.death(0) + user.set_suicide(TRUE) + user.suicide_log() /obj/item/assembly/signaler/Initialize() . = ..() diff --git a/code/modules/client/verbs/suicide.dm b/code/modules/client/verbs/suicide.dm index c2a3d9fe3da6..a8dfa31b9bf4 100644 --- a/code/modules/client/verbs/suicide.dm +++ b/code/modules/client/verbs/suicide.dm @@ -39,17 +39,19 @@ if(!canSuicide()) return if(confirm == "Yes") - set_suicide(TRUE) var/obj/item/held_item = get_active_held_item() if(held_item) var/damagetype = held_item.suicide_act(src) if(damagetype) if(damagetype & SHAME) adjustStaminaLoss(200) - set_suicide(FALSE) SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "shameful_suicide", /datum/mood_event/shameful_suicide) return + if(damagetype & MANUAL_SUICIDE_NONLETHAL) //Make sure to call the necessary procs if it does kill later + return + + set_suicide(TRUE) suicide_log() var/damage_mod = 0 @@ -103,6 +105,7 @@ visible_message("[suicide_message]", "[suicide_message]") + set_suicide(TRUE) suicide_log() adjustOxyLoss(max(200 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index d239af674dc5..53f66d7bee6e 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -417,7 +417,7 @@ sleep(50) playsound(H,'sound/items/drink.ogg', 80, 1) H.say(pick("Another day, another dollar.", "I wonder if I should hold?", "Diversifying is for young'ns.", "Yeap, times were good back then.")) - return MANUAL_SUICIDE + return MANUAL_SUICIDE_NONLETHAL sleep(20) //dramatic pause return TOXLOSS diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index 8cabbb322c46..73313ffde803 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -323,7 +323,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\ user.visible_message("[user] couldn't flip \the [src]!") return SHAME addtimer(CALLBACK(src, .proc/manual_suicide, user), 10)//10 = time takes for flip animation - return MANUAL_SUICIDE + return MANUAL_SUICIDE_NONLETHAL /obj/item/coin/proc/manual_suicide(mob/living/user) var/index = sideslist.Find(coinflip) @@ -331,6 +331,8 @@ GLOBAL_LIST_INIT(sand_recipes, list(\ user.visible_message("\the [src] lands on [coinflip]! [user] promptly falls over, dead!") user.adjustOxyLoss(200) user.death(0) + user.set_suicide(TRUE) + user.suicide_log() else user.visible_message("\the [src] lands on [coinflip]! [user] keeps on living!")