From c67f138d237eed468b0709ed89f9b0eab017ca35 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Wed, 27 Nov 2019 06:10:08 +0100
Subject: [PATCH 1/4] patching some combat mode edge cases and issues.
---
code/datums/status_effects/debuffs.dm | 2 ++
code/modules/mob/living/carbon/carbon.dm | 2 ++
code/modules/mob/living/carbon/death.dm | 11 ++++++++--
.../hostile/megafauna/colossus.dm | 2 +-
.../code/modules/mob/living/carbon/carbon.dm | 21 ++++++++++---------
5 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm
index 84ed012b82..c3625b4eca 100644
--- a/code/datums/status_effects/debuffs.dm
+++ b/code/datums/status_effects/debuffs.dm
@@ -38,6 +38,7 @@
/datum/status_effect/incapacitating/unconscious
id = "unconscious"
needs_update_stat = TRUE
+ blocks_combatmode = TRUE
/datum/status_effect/incapacitating/unconscious/tick()
if(owner.getStaminaLoss())
@@ -48,6 +49,7 @@
id = "sleeping"
alert_type = /obj/screen/alert/status_effect/asleep
needs_update_stat = TRUE
+ blocks_combatmode = TRUE
var/mob/living/carbon/carbon_owner
var/mob/living/carbon/human/human_owner
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 23ccc665b6..095affe45d 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -789,6 +789,8 @@
if(IsUnconscious() || IsSleeping() || getOxyLoss() > 50 || (HAS_TRAIT(src, TRAIT_DEATHCOMA)) || (health <= HEALTH_THRESHOLD_FULLCRIT && !HAS_TRAIT(src, TRAIT_NOHARDCRIT)))
stat = UNCONSCIOUS
blind_eyes(1)
+ if(combatmode)
+ toggle_combat_mode(TRUE, TRUE)
else
if(health <= crit_threshold && !HAS_TRAIT(src, TRAIT_NOSOFTCRIT))
stat = SOFT_CRIT
diff --git a/code/modules/mob/living/carbon/death.dm b/code/modules/mob/living/carbon/death.dm
index ae0e223e08..6a75429c27 100644
--- a/code/modules/mob/living/carbon/death.dm
+++ b/code/modules/mob/living/carbon/death.dm
@@ -7,13 +7,15 @@
if(!gibbed)
emote("deathgasp")
+ if(combatmode)
+ toggle_combat_mode(TRUE, TRUE)
. = ..()
-
+
for(var/T in get_traumas())
var/datum/brain_trauma/BT = T
BT.on_death()
-
+
if(SSticker.mode)
SSticker.mode.check_win() //Calls the rounds wincheck, mainly for wizard, malf, and changeling now
@@ -63,3 +65,8 @@
var/obj/item/bodypart/BP = X
BP.drop_limb()
BP.throw_at(get_edge_target_turf(src,pick(GLOB.alldirs)),rand(1,3),5)
+
+/mob/living/carbon/ghostize(can_reenter_corpse = TRUE, special = FALSE, penalize = FALSE)
+ if(combatmode)
+ toggle_combat_mode(TRUE, TRUE)
+ return ..()
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 de5732941f..f685ff1f97 100644
--- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm
+++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm
@@ -651,7 +651,7 @@ Difficulty: Very Hard
L.heal_overall_damage(heal_power, heal_power)
new /obj/effect/temp_visual/heal(get_turf(target), "#80F5FF")
-/mob/living/simple_animal/hostile/lightgeist/ghostize(can_reenter_corpse = TRUE, special = FALSE)
+/mob/living/simple_animal/hostile/lightgeist/ghostize(can_reenter_corpse = TRUE, special = FALSE, penalize = FALSE)
. = ..()
if(.)
death()
diff --git a/modular_citadel/code/modules/mob/living/carbon/carbon.dm b/modular_citadel/code/modules/mob/living/carbon/carbon.dm
index 4cc8edac1b..4132631006 100644
--- a/modular_citadel/code/modules/mob/living/carbon/carbon.dm
+++ b/modular_citadel/code/modules/mob/living/carbon/carbon.dm
@@ -18,7 +18,7 @@
return FALSE
return .
-/mob/living/carbon/proc/toggle_combat_mode(forced)
+/mob/living/carbon/proc/toggle_combat_mode(forced, silent)
if(recoveringstam)
return TRUE
if(!forced)
@@ -28,20 +28,21 @@
combatmode = !combatmode
if(voremode)
toggle_vore_mode()
- if(combatmode)
- playsound_local(src, 'sound/misc/ui_toggle.ogg', 50, FALSE, pressure_affected = FALSE) //Sound from interbay!
- else
- playsound_local(src, 'sound/misc/ui_toggleoff.ogg', 50, FALSE, pressure_affected = FALSE) //Slightly modified version of the above!
+ if(!silent)
+ if(combatmode)
+ if(world.time >= combatmessagecooldown)
+ if(a_intent != INTENT_HELP)
+ visible_message("[src] [resting ? "tenses up" : (prob(95)? "drops into a combative stance" : (prob(95)? "poses aggressively" : "asserts dominance with their pose"))].")
+ else
+ visible_message("[src] [pick("looks","seems","goes")] [pick("alert","attentive","vigilant")].")
+ playsound_local(src, 'sound/misc/ui_toggle.ogg', 50, FALSE, pressure_affected = FALSE) //Sound from interbay!
+ else
+ playsound_local(src, 'sound/misc/ui_toggleoff.ogg', 50, FALSE, pressure_affected = FALSE) //Slightly modified version of the above!
if(client)
client.show_popup_menus = !combatmode // So we can right-click for alternate actions and all that other good shit. Also moves examine to shift+rightclick to make it possible to attack while sprinting
if(hud_used && hud_used.static_inventory)
for(var/obj/screen/combattoggle/selector in hud_used.static_inventory)
selector.rebasetointerbay(src)
- if(world.time >= combatmessagecooldown && combatmode)
- if(a_intent != INTENT_HELP)
- visible_message("[src] [resting ? "tenses up" : (prob(95)? "drops into a combative stance" : (prob(95)? "poses aggressively" : "asserts dominance with their pose"))].")
- else
- visible_message("[src] [pick("looks","seems","goes")] [pick("alert","attentive","vigilant")].")
combatmessagecooldown = 10 SECONDS + world.time //This is set 100% of the time to make sure squeezing regen out of process cycles doesn't result in the combat mode message getting spammed
SEND_SIGNAL(src, COMSIG_COMBAT_TOGGLED, src, combatmode)
return TRUE
From d43d996c38572e11c548ecedb6c28b2bcda7dcb3 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Wed, 27 Nov 2019 06:19:17 +0100
Subject: [PATCH 2/4] ouch
---
code/datums/mind.dm | 5 ++++-
code/datums/status_effects/debuffs.dm | 2 --
code/modules/mob/living/carbon/carbon.dm | 2 ++
modular_citadel/code/modules/mob/living/carbon/carbon.dm | 7 ++++---
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index 5cf03e2684..0ded5f9912 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -91,7 +91,10 @@
if(current) // remove ourself from our old body's mind variable
current.mind = null
SStgui.on_transfer(current, new_character)
-
+ if(iscarbon(current))
+ var/mob/living/carbon/C = current
+ if(C.combatmode)
+ C.toggle_combat_mode(TRUE, TRUE)
if(!language_holder)
var/datum/language_holder/mob_holder = new_character.get_language_holder(shadow = FALSE)
language_holder = mob_holder.copy(src)
diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm
index c3625b4eca..84ed012b82 100644
--- a/code/datums/status_effects/debuffs.dm
+++ b/code/datums/status_effects/debuffs.dm
@@ -38,7 +38,6 @@
/datum/status_effect/incapacitating/unconscious
id = "unconscious"
needs_update_stat = TRUE
- blocks_combatmode = TRUE
/datum/status_effect/incapacitating/unconscious/tick()
if(owner.getStaminaLoss())
@@ -49,7 +48,6 @@
id = "sleeping"
alert_type = /obj/screen/alert/status_effect/asleep
needs_update_stat = TRUE
- blocks_combatmode = TRUE
var/mob/living/carbon/carbon_owner
var/mob/living/carbon/human/human_owner
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 095affe45d..7e52f010cc 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -794,6 +794,8 @@
else
if(health <= crit_threshold && !HAS_TRAIT(src, TRAIT_NOSOFTCRIT))
stat = SOFT_CRIT
+ if(combatmode)
+ toggle_combat_mode(TRUE, TRUE)
else
stat = CONSCIOUS
adjust_blindness(-1)
diff --git a/modular_citadel/code/modules/mob/living/carbon/carbon.dm b/modular_citadel/code/modules/mob/living/carbon/carbon.dm
index 4132631006..1c6b957d9f 100644
--- a/modular_citadel/code/modules/mob/living/carbon/carbon.dm
+++ b/modular_citadel/code/modules/mob/living/carbon/carbon.dm
@@ -19,10 +19,11 @@
return .
/mob/living/carbon/proc/toggle_combat_mode(forced, silent)
- if(recoveringstam)
- return TRUE
if(!forced)
- for(var/datum/status_effect/S in status_effects)
+ if(recoveringstam || stat != CONSCIOUS)
+ return TRUE
+ for(var/i in status_effects)
+ var/datum/status_effect/S = i
if(S.blocks_combatmode)
return TRUE
combatmode = !combatmode
From d1d201ff26102dfa0aa28f4b330bf3bc201ee845 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Wed, 27 Nov 2019 06:39:09 +0100
Subject: [PATCH 3/4] Sanity check.
---
code/modules/mob/living/carbon/carbon.dm | 5 +++++
code/modules/mob/mob.dm | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 7e52f010cc..3a9495a5cb 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -956,3 +956,8 @@
if(mood)
if(mood.sanity < SANITY_UNSTABLE)
return TRUE
+
+/mob/living/carbon/transfer_ckey(mob/new_mob, send_signal = TRUE)
+ if(combatmode)
+ toggle_combat_mode(TRUE, TRUE)
+ return ..()
\ No newline at end of file
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index e3daa8e3c1..ca0141bec4 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -449,7 +449,8 @@
return
/mob/proc/transfer_ckey(mob/new_mob, send_signal = TRUE)
- if(!ckey)
+ if(!ckey || !new_mob)
+ CRASH("transfer_ckey() called [ckey ? "" : "on a ckey-less mob[new_mob ? "" : " and "]"][new_mob ? "" : "without a valid mob target"]!")
return FALSE
if(send_signal)
SEND_SIGNAL(src, COMSIG_MOB_KEY_CHANGE, new_mob, src)
From 3f077df500bb451496247862b6ed2217fd2b936b Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Wed, 27 Nov 2019 06:40:32 +0100
Subject: [PATCH 4/4] redundant.
---
code/modules/mob/mob.dm | 1 -
1 file changed, 1 deletion(-)
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index ca0141bec4..7a4603228a 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -451,7 +451,6 @@
/mob/proc/transfer_ckey(mob/new_mob, send_signal = TRUE)
if(!ckey || !new_mob)
CRASH("transfer_ckey() called [ckey ? "" : "on a ckey-less mob[new_mob ? "" : " and "]"][new_mob ? "" : "without a valid mob target"]!")
- return FALSE
if(send_signal)
SEND_SIGNAL(src, COMSIG_MOB_KEY_CHANGE, new_mob, src)
new_mob.ckey = ckey