From a53c58b8a2e4c69dc11f264dde8267d4d9e8fa83 Mon Sep 17 00:00:00 2001
From: Luc <89928798+lewcc@users.noreply.github.com>
Date: Thu, 4 Aug 2022 14:24:21 -0700
Subject: [PATCH] Make chitinous armor removable with a saw or chainsaw
(#18628)
* Adds ability to saw through chitinous armor
* Improved messages
* gnarg
* No more traits (vine thud)
* Address reviews
---
.../changeling/powers/mutations.dm | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/code/modules/antagonists/changeling/powers/mutations.dm b/code/modules/antagonists/changeling/powers/mutations.dm
index 2dfe5271290..0ae0ebed05f 100644
--- a/code/modules/antagonists/changeling/powers/mutations.dm
+++ b/code/modules/antagonists/changeling/powers/mutations.dm
@@ -463,6 +463,62 @@
if(ismob(loc))
loc.visible_message("[loc.name]\'s flesh turns black, quickly transforming into a hard, chitinous mass!", "We harden our flesh, creating a suit of armor!", "You hear organic matter ripping and tearing!")
+
+/obj/item/clothing/suit/armor/changeling/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text, final_block_chance, damage, attack_type)
+ . = ..()
+
+ if(!IS_HORIZONTAL(owner))
+ return
+
+ var/obj/item/I = hitby
+
+ if(!istype(I.loc, /mob/living))
+ // Maybe it's on the ground? Maybe it's being used telekinetically? IDK
+ return
+
+ // The user who's wielding the tool
+ var/mob/living/user = I.loc
+
+ // snowflake checks my beloved
+ // this will become tooltype checks I swear
+ if(!istype(I, /obj/item/circular_saw) && !istype(I, /obj/item/twohanded/required/chainsaw) && !istype(I, /obj/item/twohanded/chainsaw))
+ return
+
+ user.visible_message(
+ "[user] starts to saw through [owner]'s [name].",
+ "You start to saw through [owner]'s [name].",
+ "You hear a loud grinding noise."
+ )
+
+ if(!do_after(user, 15 SECONDS, target = owner))
+ user.visible_message(
+ "[user] fails to cut through [owner]'s [name].",
+ "You fail to cut through [owner]'s [name].",
+ "You hear the grinding stop."
+ )
+ return FALSE
+
+ // check again after the do_after to make sure they haven't gotten up
+ if(!IS_HORIZONTAL(owner))
+ return FALSE
+
+ user.visible_message(
+ "\The [name] turns to shreds as [user] cleaves through it!",
+ "\The [name] turns to shreds as you cleave through it!",
+ "You hear something fall as the grinding ends."
+ )
+
+ playsound(I, I.hitsound, 50)
+ // you've torn it up, get rid of it.
+ new /obj/effect/decal/cleanable/shreds(owner.loc)
+ // just unequip them since they qdel on drop
+ owner.unEquip(src, TRUE, TRUE)
+ if(istype(owner.head, /obj/item/clothing/head/helmet/changeling))
+ owner.unEquip(owner.head, TRUE, TRUE)
+
+ return TRUE
+
+
/obj/item/clothing/head/helmet/changeling
name = "chitinous mass"
desc = "A tough, hard covering of black chitin with transparent chitin in front."