From 755ddf169f6ccf3c26b7837bd379462cbcee1470 Mon Sep 17 00:00:00 2001
From: S34N <12197162+S34NW@users.noreply.github.com>
Date: Thu, 29 Jul 2021 12:57:29 +0100
Subject: [PATCH] Refactors and tweaks krav maga disarms (#15722)
* refactors stinky krav disarms
* refactors the refactor of disarm messages
maybe it shouldn't say it disarmed when it didn't for NODROP, and it should definitely not duplicate DROPDEL items...
* do the same for CQC
* Apply suggestions from code review
Co-authored-by: dearmochi <1496804+dearmochi@users.noreply.github.com>
* Update code/modules/martial_arts/krav_maga.dm
* Update code/modules/martial_arts/cqc.dm
Co-authored-by: dearmochi <1496804+dearmochi@users.noreply.github.com>
---
code/modules/martial_arts/cqc.dm | 4 ++--
code/modules/martial_arts/krav_maga.dm | 17 +++++------------
2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/code/modules/martial_arts/cqc.dm b/code/modules/martial_arts/cqc.dm
index 49a08c1bd3c..2c2fa0a3391 100644
--- a/code/modules/martial_arts/cqc.dm
+++ b/code/modules/martial_arts/cqc.dm
@@ -76,8 +76,8 @@
I = D.get_active_hand()
D.visible_message("[A] strikes [D]'s jaw with their hand!", \
"[A] strikes your jaw, disorienting you!")
- playsound(get_turf(D), 'sound/weapons/cqchit1.ogg', 50, 1, -1)
- if(I && D.drop_item())
+ playsound(get_turf(D), 'sound/weapons/cqchit1.ogg', 50, TRUE, -1)
+ if(D.unEquip(I) && !(QDELETED(I) || (I.flags & ABSTRACT)))
A.put_in_hands(I)
D.Jitter(2)
D.apply_damage(5, BRUTE)
diff --git a/code/modules/martial_arts/krav_maga.dm b/code/modules/martial_arts/krav_maga.dm
index cad7d6451bc..6705503f8fe 100644
--- a/code/modules/martial_arts/krav_maga.dm
+++ b/code/modules/martial_arts/krav_maga.dm
@@ -104,20 +104,13 @@
/datum/martial_art/krav_maga/disarm_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
MARTIAL_ARTS_ACT_CHECK
- if(prob(60))
- if(D.hand)
- if(istype(D.l_hand, /obj/item))
- var/obj/item/I = D.l_hand
- if(D.drop_item())
- A.put_in_hands(I)
- else
- if(istype(D.r_hand, /obj/item))
- var/obj/item/I = D.r_hand
- if(D.drop_item())
- A.put_in_hands(I)
+ var/obj/item/I = D.get_active_hand()
+ if(prob(60) && D.unEquip(I))
+ if(!(QDELETED(I) || (I.flags & ABSTRACT)))
+ A.put_in_hands(I)
D.visible_message("[A] has disarmed [D]!", \
"[A] has disarmed [D]!")
- playsound(D, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
+ playsound(D, 'sound/weapons/thudswoosh.ogg', 50, TRUE, -1)
else
D.visible_message("[A] attempted to disarm [D]!", \
"[A] attempted to disarm [D]!")