From ac385bdf5dbe5582d37debfc14c04e6154ad6dce Mon Sep 17 00:00:00 2001
From: DGamerL <108773801+DGamerL@users.noreply.github.com>
Date: Sun, 1 Oct 2023 17:20:18 +0200
Subject: [PATCH] Stops you from grabbing someone if you are horizontal
(#22563)
* Gotcha! Oh wait-
* Update code/modules/mob/living/living_defense.dm
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
* Works for now, oculd use a cleanup later
* Nice it works
* Contra review
---------
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
---
code/modules/martial_arts/brawling.dm | 1 +
code/modules/martial_arts/judo.dm | 6 ++++++
code/modules/martial_arts/krav_maga.dm | 1 +
code/modules/martial_arts/martial.dm | 2 ++
code/modules/mob/living/living_defense.dm | 4 ++++
5 files changed, 14 insertions(+)
diff --git a/code/modules/martial_arts/brawling.dm b/code/modules/martial_arts/brawling.dm
index cee3f297d42..14a67dfc7f3 100644
--- a/code/modules/martial_arts/brawling.dm
+++ b/code/modules/martial_arts/brawling.dm
@@ -45,6 +45,7 @@
/datum/martial_art/drunk_brawling
name = "Drunken Brawling"
weight = 2
+ can_horizontally_grab = FALSE
/datum/martial_art/drunk_brawling/grab_act(mob/living/carbon/human/A, mob/living/carbon/human/D)
if(prob(70))
diff --git a/code/modules/martial_arts/judo.dm b/code/modules/martial_arts/judo.dm
index 31191ba9d3f..765e57e4554 100644
--- a/code/modules/martial_arts/judo.dm
+++ b/code/modules/martial_arts/judo.dm
@@ -5,6 +5,7 @@
combos = list(/datum/martial_combo/judo/discombobulate, /datum/martial_combo/judo/eyepoke, /datum/martial_combo/judo/judothrow, /datum/martial_combo/judo/armbar, /datum/martial_combo/judo/wheelthrow)
weight = 5 //takes priority over boxing and drunkneness, less priority than krav or CQC/carp
no_baton_reason = "The baton feels off balance in your hand due to your judo training!"
+ can_horizontally_grab = FALSE
//Corporate Judo Belt
@@ -58,6 +59,11 @@
add_attack_logs(A, D, "Melee attacked with [src]")
return TRUE
+/datum/martial_art/judo/grab_act(mob/living/carbon/human/attacker, mob/living/carbon/human/defender)
+ if(IS_HORIZONTAL(attacker))
+ return FALSE
+ return ..()
+
/datum/martial_art/judo/explaination_header(user)
to_chat(user, "You recall the teachings of Corporate Judo.")
diff --git a/code/modules/martial_arts/krav_maga.dm b/code/modules/martial_arts/krav_maga.dm
index 133f385e108..b7ea3c33a65 100644
--- a/code/modules/martial_arts/krav_maga.dm
+++ b/code/modules/martial_arts/krav_maga.dm
@@ -5,6 +5,7 @@
var/datum/action/leg_sweep/legsweep = new/datum/action/leg_sweep()
var/datum/action/lung_punch/lungpunch = new/datum/action/lung_punch()
var/datum/action/neutral_stance/neutral = new/datum/action/neutral_stance()
+ can_horizontally_grab = FALSE
/datum/action/neutral_stance
name = "Neutral Stance - You relax, cancelling your last Krav Maga stance attack."
diff --git a/code/modules/martial_arts/martial.dm b/code/modules/martial_arts/martial.dm
index 7b4c5e9b92a..6ca2bec8087 100644
--- a/code/modules/martial_arts/martial.dm
+++ b/code/modules/martial_arts/martial.dm
@@ -39,6 +39,8 @@
var/weight = 0
/// Message displayed when someone uses a baton when its forbidden by a martial art
var/no_baton_reason = "Your martial arts training prevents you from wielding batons."
+ /// Whether or not you can grab someone while horizontal with this Martial Art
+ var/can_horizontally_grab = TRUE
/datum/martial_art/New()
. = ..()
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 924b2a93e7d..fd31b22d414 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -268,6 +268,10 @@
return FALSE
if(user.pull_force < move_force)
return FALSE
+ // This if-statement checks if the user is horizontal, and if the user either has no martial art, or has judo, drunk fighting or krav, in which case it should also fail
+ if(IS_HORIZONTAL(user) && (!user.mind.martial_art || !user.mind.martial_art.can_horizontally_grab))
+ to_chat(user, "You fail to get a good grip on [src]!")
+ return
for(var/obj/item/grab/G in grabbed_by)
if(G.assailant == user)