From 7947258e518c326979305f4eec08aeda9336bdf2 Mon Sep 17 00:00:00 2001 From: keronshb Date: Wed, 5 May 2021 23:57:01 -0400 Subject: [PATCH] Off balance disarm If it hits a wall or a person while under the effect of off balance. --- code/__DEFINES/combat.dm | 5 +---- code/datums/status_effects/debuffs.dm | 2 +- .../modules/mob/living/carbon/human/species.dm | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index d12fe77448..b44f2dfa66 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -158,10 +158,7 @@ /// how long they're staggered for #define SHOVE_STAGGER_DURATION 35 /// how long they're off balance for -#define SHOVE_OFFBALANCE_DURATION 30 -//Shove disarming item list -GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list( - /obj/item/gun))) +#define SHOVE_OFFBALANCE_DURATION 25 //Embedded objects diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index a958d20276..1c49f61996 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -108,7 +108,7 @@ /datum/status_effect/off_balance/on_remove() var/active_item = owner.get_active_held_item() - if(is_type_in_typecache(active_item, GLOB.shove_disarming_types)) + if(active_item) owner.visible_message("[owner.name] regains their grip on \the [active_item]!", "You regain your grip on \the [active_item]", null, COMBAT_MESSAGE_RANGE) return ..() diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index c1a797dea0..7dcd188b41 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -2003,6 +2003,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) var/turf/target_shove_turf = get_step(target.loc, shove_dir) var/mob/living/carbon/human/target_collateral_human var/shove_blocked = FALSE //Used to check if a shove is blocked so that if it is knockdown logic can be applied + var/targetatrest = !CHECK_MOBILITY(target, MOBILITY_STAND) //Thank you based whoneedsspace target_collateral_human = locate(/mob/living/carbon/human) in target_shove_turf.contents @@ -2017,7 +2018,6 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) var/append_message = "" if(shove_blocked && !target.buckled) var/directional_blocked = !target.Adjacent(target_shove_turf) - var/targetatrest = !CHECK_MOBILITY(target, MOBILITY_STAND) if((directional_blocked || !(target_collateral_human || target_shove_turf.shove_act(target, user))) && !targetatrest) target.DefaultCombatKnockdown(SHOVE_KNOCKDOWN_SOLID) target.visible_message("[user.name] shoves [target.name], knocking them down!", @@ -2038,8 +2038,6 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) user, "You shove [target.name]!") target.Stagger(SHOVE_STAGGER_DURATION) var/obj/item/target_held_item = target.get_active_held_item() - if(!is_type_in_typecache(target_held_item, GLOB.shove_disarming_types)) - target_held_item = null if(!target.has_status_effect(STATUS_EFFECT_OFF_BALANCE)) if(target_held_item) if(!HAS_TRAIT(target_held_item, TRAIT_NODROP)) @@ -2048,11 +2046,15 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) append_message += ", loosening their grip on [target_held_item]" else append_message += ", but couldn't loose their grip on [target_held_item]" - else if(target_held_item) - if(target.dropItemToGround(target_held_item)) - target.visible_message("[target.name] drops \the [target_held_item]!!", - "You drop \the [target_held_item]!!", null, COMBAT_MESSAGE_RANGE) - append_message += ", causing them to drop [target_held_item]" + else if(target.has_status_effect(STATUS_EFFECT_OFF_BALANCE)) + if(target_held_item) + if(shove_blocked) + if (targetatrest || target.buckled) + return + else if(target.dropItemToGround(target_held_item)) + target.visible_message("[target.name] drops \the [target_held_item]!!", + "You drop \the [target_held_item]!!", null, COMBAT_MESSAGE_RANGE) + append_message += ", causing them to drop [target_held_item]" target.ShoveOffBalance(SHOVE_OFFBALANCE_DURATION) log_combat(user, target, "shoved", append_message)