From 549fa16cbc24bdec868c74f63f34c0a9fc207838 Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Fri, 4 Sep 2020 01:10:55 +0200
Subject: [PATCH] [MIRROR] Skeletons can treat their bone wounds again,
improves door crush dislocation fix (#626)
* Skeletons can treat their bone wounds again, improves door crush dislocation fix (#53307)
* Skeletons can treat their bone wounds again, improves door crush dislocation fix
Co-authored-by: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com>
---
code/__DEFINES/dcs/signals.dm | 2 ++
code/datums/wounds/_wounds.dm | 12 ++++++------
code/datums/wounds/bones.dm | 12 +++++++++++-
code/game/machinery/doors/door.dm | 6 +-----
code/modules/mob/living/carbon/human/human.dm | 16 ++++++++++------
5 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm
index 658d1082b8b..4b0d0bd4ec9 100644
--- a/code/__DEFINES/dcs/signals.dm
+++ b/code/__DEFINES/dcs/signals.dm
@@ -355,6 +355,8 @@
///from base of mob/swap_hand(): (obj/item)
#define COMSIG_MOB_SWAP_HANDS "mob_swap_hands"
#define COMPONENT_BLOCK_SWAP (1<<0)
+///from /obj/structure/door/crush(): (mob/living/crushed, /obj/machinery/door/crushing_door)
+#define COMSIG_LIVING_DOORCRUSHED "living_doorcrush"
///from base of mob/living/resist() (/mob/living)
#define COMSIG_LIVING_RESIST "living_resist"
diff --git a/code/datums/wounds/_wounds.dm b/code/datums/wounds/_wounds.dm
index 20a0bf24f77..3ec83cbf535 100644
--- a/code/datums/wounds/_wounds.dm
+++ b/code/datums/wounds/_wounds.dm
@@ -250,8 +250,12 @@
to_chat(user, "You're already interacting with [victim]!")
return TRUE
- if(!victim.can_inject(user, TRUE))
- return TRUE
+ // next we check if the bodypart in actually accessible (not under thick clothing). We skip the species trait check since skellies
+ // & such may need to use bone gel but may be wearing a space suit for..... whatever reason a skeleton would wear a space suit for
+ if(ishuman(victim))
+ var/mob/living/carbon/human/victim_human = victim
+ if(!victim_human.can_inject(user, TRUE, ignore_species = TRUE))
+ return TRUE
// lastly, treat them
treat(I, user)
@@ -295,10 +299,6 @@
/datum/wound/proc/on_stasis()
return
-/// Called when we're crushed in an airlock or firedoor, for one of the improvised joint dislocation fixes
-/datum/wound/proc/crush()
- return
-
/// Used when we're being dragged while bleeding, the value we return is how much bloodloss this wound causes from being dragged. Since it's a proc, you can let bandages soak some of the blood
/datum/wound/proc/drag_bleed_amount()
return
diff --git a/code/datums/wounds/bones.dm b/code/datums/wounds/bones.dm
index 51f0c789514..1fd448ad13f 100644
--- a/code/datums/wounds/bones.dm
+++ b/code/datums/wounds/bones.dm
@@ -199,7 +199,17 @@
status_effect_type = /datum/status_effect/wound/blunt/moderate
scar_keyword = "bluntmoderate"
-/datum/wound/blunt/moderate/crush()
+/datum/wound/blunt/moderate/Destroy()
+ if(victim)
+ UnregisterSignal(victim, COMSIG_LIVING_DOORCRUSHED)
+ return ..()
+
+/datum/wound/blunt/moderate/wound_injury(datum/wound/old_wound)
+ . = ..()
+ RegisterSignal(victim, COMSIG_LIVING_DOORCRUSHED, .proc/door_crush)
+
+/// Getting smushed in an airlock/firelock is a last-ditch attempt to try relocating your limb
+/datum/wound/blunt/moderate/proc/door_crush()
if(prob(33))
victim.visible_message("[victim]'s dislocated [limb.name] pops back into place!", "Your dislocated [limb.name] pops back into place! Ow!")
remove_wound()
diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm
index d581ca1de3a..609d9bcc34b 100644
--- a/code/game/machinery/doors/door.dm
+++ b/code/game/machinery/doors/door.dm
@@ -337,11 +337,7 @@
/obj/machinery/door/proc/crush()
for(var/mob/living/L in get_turf(src))
L.visible_message("[src] closes on [L], crushing [L.p_them()]!", "[src] closes on you and crushes you!")
- if(iscarbon(L))
- var/mob/living/carbon/C = L
- for(var/i in C.all_wounds) // should probably replace with signal
- var/datum/wound/W = i
- W.crush(DOOR_CRUSH_DAMAGE)
+ SEND_SIGNAL(L, COMSIG_LIVING_DOORCRUSHED, src)
if(isalien(L)) //For xenos
L.adjustBruteLoss(DOOR_CRUSH_DAMAGE * 1.5) //Xenos go into crit after aproximately the same amount of crushes as humans.
L.emote("roar")
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 32ddac430fd..f2fd5f07d81 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -533,12 +533,16 @@
/mob/living/carbon/human/proc/canUseHUD()
return (mobility_flags & MOBILITY_USE)
-/mob/living/carbon/human/can_inject(mob/user, error_msg, target_zone, penetrate_thick = 0)
- . = 1 // Default to returning true.
+/mob/living/carbon/human/can_inject(mob/user, error_msg, target_zone, penetrate_thick = FALSE, ignore_species = FALSE)
+ . = TRUE // Default to returning true.
if(user && !target_zone)
target_zone = user.zone_selected
- if(HAS_TRAIT(src, TRAIT_PIERCEIMMUNE))
- . = 0
+ // we may choose to ignore species trait pierce immunity in case we still want to check skellies for thick clothing without insta failing them (wounds)
+ if(ignore_species)
+ if(HAS_TRAIT_NOT_FROM(src, TRAIT_PIERCEIMMUNE, SPECIES_TRAIT))
+ . = FALSE
+ else if(HAS_TRAIT(src, TRAIT_PIERCEIMMUNE))
+ . = FALSE
// If targeting the head, see if the head item is thin enough.
// If targeting anything else, see if the wear suit is thin enough.
if (!penetrate_thick)
@@ -546,12 +550,12 @@
if(head && istype(head, /obj/item/clothing))
var/obj/item/clothing/CH = head
if (CH.clothing_flags & THICKMATERIAL)
- . = 0
+ . = FALSE
else
if(wear_suit && istype(wear_suit, /obj/item/clothing))
var/obj/item/clothing/CS = wear_suit
if (CS.clothing_flags & THICKMATERIAL)
- . = 0
+ . = FALSE
if(!. && error_msg && user)
// Might need re-wording.
to_chat(user, "There is no exposed flesh or thin material [above_neck(target_zone) ? "on [p_their()] head" : "on [p_their()] body"].")