Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] [READY] The Tackleling: Unarmed bonuses and features contribute to tackle success and failure, significant outcome overhaul, among other things #776

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions code/__DEFINES/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ DEFINE_BITFIELD(status_flags, list(
#define SHOVE_KNOCKDOWN_TABLE 20
#define SHOVE_KNOCKDOWN_COLLATERAL 1
#define SHOVE_CHAIN_PARALYZE 30
//Shove slowdown
#define SHOVE_SLOWDOWN_LENGTH 30
#define SHOVE_SLOWDOWN_STRENGTH 0.85 //multiplier
//Staggered slowdown, an effect caused by shoving and a few other features, such as tackling
#define STAGGERED_SLOWDOWN_LENGTH 30
#define STAGGERED_SLOWDOWN_STRENGTH 0.85 //multiplier
//Shove disarming item list
GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list(
/obj/item/gun)))
Expand Down
5 changes: 5 additions & 0 deletions code/__DEFINES/status_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@
#define set_dizzy(duration) set_timed_status_effect(duration, /datum/status_effect/dizziness)
#define set_dizzy_if_lower(duration) set_timed_status_effect(duration, /datum/status_effect/dizziness, TRUE)

#define adjust_staggered(duration) adjust_timed_status_effect(duration, /datum/status_effect/staggered)
#define adjust_staggered_up_to(duration, up_to) adjust_timed_status_effect(duration, /datum/status_effect/staggered, up_to)
#define set_staggered(duration) set_timed_status_effect(duration, /datum/status_effect/staggered)
#define set_staggered_if_lower(duration) set_timed_status_effect(duration, /datum/status_effect/staggered, TRUE)

#define adjust_jitter(duration) adjust_timed_status_effect(duration, /datum/status_effect/jitter)
#define adjust_jitter_up_to(duration, up_to) adjust_timed_status_effect(duration, /datum/status_effect/jitter, up_to)
#define set_jitter(duration) set_timed_status_effect(duration, /datum/status_effect/jitter)
Expand Down
235 changes: 176 additions & 59 deletions code/datums/components/tackle.dm

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions code/datums/status_effects/debuffs/staggered.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/datum/status_effect/staggered
id = "staggered"
tick_interval = 0.5 SECONDS
alert_type = null
remove_on_fullheal = TRUE

/datum/status_effect/staggered/on_creation(mob/living/new_owner, duration = 10 SECONDS)
src.duration = duration
return ..()

/datum/status_effect/staggered/on_apply()

//a very mild animation, but you can't stagger the dead.
if(owner.stat == DEAD)
owner.do_stagger_animation(duration / 10)
return FALSE

RegisterSignal(owner, COMSIG_LIVING_DEATH, PROC_REF(clear_staggered))
owner.add_movespeed_modifier(/datum/movespeed_modifier/staggered)
return TRUE

/datum/status_effect/staggered/on_remove()
UnregisterSignal(owner, COMSIG_LIVING_DEATH)
owner.remove_movespeed_modifier(/datum/movespeed_modifier/staggered)
// Resetting both X on remove so we're back to normal
owner.pixel_x = owner.base_pixel_x

/// Signal proc that self deletes our staggered effect
/datum/status_effect/staggered/proc/clear_staggered(datum/source)
SIGNAL_HANDLER

qdel(src)

/datum/status_effect/staggered/tick(seconds_between_ticks)
owner.do_stagger_animation()

/// Helper proc that causes the mob to do a stagger animation.
/// Doesn't change significantly, just meant to represent swaying back and forth
/mob/living/proc/do_stagger_animation()
animate(src, pixel_x = 4, time = 0.2 SECONDS, loop = 6, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL)
animate(pixel_x = -4, time = 0.2 SECONDS, flags = ANIMATION_RELATIVE)
1 change: 1 addition & 0 deletions code/game/objects/items/storage/garment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
new /obj/item/clothing/under/rank/security/head_of_security/grey(src)
new /obj/item/clothing/under/rank/security/head_of_security/parade(src)
new /obj/item/clothing/under/rank/security/head_of_security/parade/female(src)
new /obj/item/clothing/gloves/tackler/combat(src)
new /obj/item/clothing/suit/armor/hos(src)
new /obj/item/clothing/suit/armor/hos/hos_formal(src)
new /obj/item/clothing/suit/armor/hos/trenchcoat/winter(src)
Expand Down
5 changes: 1 addition & 4 deletions code/game/objects/structures/beds_chairs/chair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool/bar, 0)
new /obj/item/stack/rods(get_turf(loc), 2)
qdel(src)




/obj/item/chair/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK, damage_type = BRUTE)
if(attack_type == UNARMED_ATTACK && prob(hit_reaction_chance))
if(attack_type == UNARMED_ATTACK && prob(hit_reaction_chance) || attack_type == LEAP_ATTACK && prob(hit_reaction_chance))
owner.visible_message(span_danger("[owner] fends off [attack_text] with [src]!"))
return TRUE
return FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
new /obj/item/radio/headset/headset_sec/alt(src)
new /obj/item/clothing/glasses/hud/security/sunglasses(src)
new /obj/item/flashlight/seclite(src)
new /obj/item/clothing/gloves/tackler(src)

/obj/structure/closet/secure_closet/security/sec

Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/gloves/tacklers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/// See: [/datum/component/tackler/var/speed]
var/tackle_speed = 1
/// See: [/datum/component/tackler/var/skill_mod]
var/skill_mod = 0
var/skill_mod = 1

/obj/item/clothing/gloves/tackler/Destroy()
tackler = null
Expand Down
4 changes: 1 addition & 3 deletions code/modules/clothing/shoes/_shoes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,7 @@

if(14 to 25) // 1.3ish% chance to stumble and be a bit off balance (like being disarmed)
to_chat(our_guy, span_danger("You stumble a bit on your untied shoelaces!"))
if(!our_guy.has_movespeed_modifier(/datum/movespeed_modifier/shove))
our_guy.add_movespeed_modifier(/datum/movespeed_modifier/shove)
addtimer(CALLBACK(our_guy, TYPE_PROC_REF(/mob/living/carbon, clear_shove_slowdown)), SHOVE_SLOWDOWN_LENGTH)
our_guy.adjust_staggered_up_to(STAGGERED_SLOWDOWN_LENGTH, 10 SECONDS)

if(26 to 1000)
wiser = FALSE
Expand Down
5 changes: 3 additions & 2 deletions code/modules/clothing/suits/armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,14 @@

/obj/item/clothing/suit/armor/swat
name = "MK.I SWAT Suit"
desc = "A tactical suit first developed in a joint effort by the defunct IS-ERI and Nanotrasen in 2321 for military operations. It has a minor slowdown, but offers decent protection."
desc = "A tactical suit first developed in a joint effort by the defunct IS-ERI and Nanotrasen in 2321 for military operations. \
It has a minor slowdown, but offers decent protection and helps the wearer resist shoving in close quarters."
icon_state = "heavy"
inhand_icon_state = "swat_suit"
armor_type = /datum/armor/armor_swat
strip_delay = 120
resistance_flags = FIRE_PROOF | ACID_PROOF
clothing_flags = THICKMATERIAL
clothing_flags = BLOCKS_SHOVE_KNOCKDOWN | THICKMATERIAL
cold_protection = CHEST | GROIN | LEGS | FEET | ARMS | HANDS
min_cold_protection_temperature = SPACE_SUIT_MIN_TEMP_PROTECT_OFF
heat_protection = CHEST | GROIN | LEGS | FEET | ARMS | HANDS
Expand Down
19 changes: 3 additions & 16 deletions code/modules/mob/living/carbon/carbon_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -383,21 +383,14 @@
if(!is_type_in_typecache(target_held_item, GLOB.shove_disarming_types)) //It's too expensive we'll get caught
target_held_item = null

if(!target.has_movespeed_modifier(/datum/movespeed_modifier/shove))
target.add_movespeed_modifier(/datum/movespeed_modifier/shove)
target.emote("sway")
if(target_held_item)
append_message = "loosening [target.p_their()] grip on [target_held_item]"
target.visible_message(span_danger("[target.name]'s grip on \the [target_held_item] loosens!"), //He's already out what are you doing
span_warning("Your grip on \the [target_held_item] loosens!"), null, COMBAT_MESSAGE_RANGE)
addtimer(CALLBACK(target, TYPE_PROC_REF(/mob/living/carbon, clear_shove_slowdown)), SHOVE_SLOWDOWN_LENGTH)

else if(target_held_item)
if(target_held_item && target.get_timed_status_effect_duration(/datum/status_effect/staggered))
target.dropItemToGround(target_held_item)
append_message = "causing [target.p_them()] to drop [target_held_item]"
target.visible_message(span_danger("[target.name] drops \the [target_held_item]!"),
span_warning("You drop \the [target_held_item]!"), null, COMBAT_MESSAGE_RANGE)

target.adjust_staggered_up_to(STAGGERED_SLOWDOWN_LENGTH, 10 SECONDS)

log_combat(src, target, "shoved", append_message)

/mob/living/carbon/proc/is_shove_knockdown_blocked() //If you want to add more things that block shove knockdown, extend this
Expand All @@ -406,12 +399,6 @@
return TRUE
return FALSE

/mob/living/carbon/proc/clear_shove_slowdown()
remove_movespeed_modifier(/datum/movespeed_modifier/shove)
var/active_item = get_active_held_item()
if(is_type_in_typecache(active_item, GLOB.shove_disarming_types))
visible_message(span_warning("[name] regains their grip on \the [active_item]!"), span_warning("You regain your grip on \the [active_item]"), null, COMBAT_MESSAGE_RANGE)

/mob/living/carbon/blob_act(obj/structure/blob/B)
if (stat == DEAD)
return
Expand Down
14 changes: 7 additions & 7 deletions code/modules/mob/living/carbon/human/_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1167,14 +1167,14 @@ GLOBAL_LIST_EMPTY(features_by_species)
return FALSE
user.do_attack_animation(target, atk_effect)

//has our target been shoved recently? If so, they're off-balance and we get an easy hit.
var/off_balance = FALSE
//has our target been shoved recently? If so, they're staggered and we get an easy hit.
var/staggered = FALSE

//Someone in a grapple is much more vulnerable to being harmed by punches.
var/grappled = FALSE

if(target.has_movespeed_modifier(/datum/movespeed_modifier/shove))
off_balance = TRUE
if(target.get_timed_status_effect_duration(/datum/status_effect/staggered))
staggered = TRUE

if(target.pulledby && target.pulledby.grab_state >= GRAB_AGGRESSIVE)
grappled = TRUE
Expand All @@ -1186,7 +1186,7 @@ GLOBAL_LIST_EMPTY(features_by_species)

var/miss_chance = 100//calculate the odds that a punch misses entirely. considers stamina and brute damage of the puncher. punches miss by default to prevent weird cases
if(attacking_bodypart.unarmed_damage_low)
if((target.body_position == LYING_DOWN) || HAS_TRAIT(user, TRAIT_PERFECT_ATTACKER) || off_balance) //kicks and attacks against off-balance targets never miss (provided your species deals more than 0 damage)
if((target.body_position == LYING_DOWN) || HAS_TRAIT(user, TRAIT_PERFECT_ATTACKER) || staggered) //kicks and attacks against staggered targets never miss (provided your species deals more than 0 damage)
miss_chance = 0
else
miss_chance = clamp(UNARMED_MISS_CHANCE_BASE - limb_accuracy + user.getStaminaLoss() + (user.getBruteLoss()*0.5), 0, UNARMED_MISS_CHANCE_MAX) //Limb miss chance + various damage. capped at 80 so there is at least a chance to land a hit.
Expand Down Expand Up @@ -1229,8 +1229,8 @@ GLOBAL_LIST_EMPTY(features_by_species)
target.force_say()
log_combat(user, target, "punched")

//If we rolled a punch high enough to hit our stun threshold, or our target is off-balance and they have at least 40 damage+stamina loss, we knock them down
if((target.stat != DEAD) && prob(limb_accuracy) || (target.stat != DEAD) && off_balance && (target.getStaminaLoss() + user.getBruteLoss()) >= 40)
//If we rolled a punch high enough to hit our stun threshold, or our target is staggered and they have at least 40 damage+stamina loss, we knock them down
if((target.stat != DEAD) && prob(limb_accuracy) || (target.stat != DEAD) && staggered && (target.getStaminaLoss() + user.getBruteLoss()) >= 40)
target.visible_message(span_danger("[user] knocks [target] down!"), \
span_userdanger("You're knocked down by [user]!"), span_hear("You hear aggressive shuffling followed by a loud thud!"), COMBAT_MESSAGE_RANGE, user)
to_chat(user, span_danger("You knock [target] down!"))
Expand Down
3 changes: 2 additions & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,8 @@

/mob/living/resist_grab(moving_resist)
. = TRUE
if(pulledby.grab_state || body_position == LYING_DOWN || HAS_TRAIT(src, TRAIT_GRABWEAKNESS) || has_movespeed_modifier(/datum/movespeed_modifier/shove) && getStaminaLoss() > STAMINA_THRESHOLD_HARD_RESIST) //SKYRAT EDIT CHANGE - ORIGINAL : if(pulledby.grab_state || body_position == LYING_DOWN || HAS_TRAIT(src, TRAIT_GRABWEAKNESS) || has_movespeed_modifier(/datum/movespeed_modifier/shove) && getStaminaLoss() >= 30)
//If we're in an aggressive grab or higher, we're lying down, we're vulnerable to grabs, or we're staggered and we have some amount of stamina loss, we must resist
if(pulledby.grab_state || body_position == LYING_DOWN || HAS_TRAIT(src, TRAIT_GRABWEAKNESS) || get_timed_status_effect_duration(/datum/status_effect/staggered) && getStaminaLoss() > STAMINA_THRESHOLD_HARD_RESIST) //SKYRAT EDIT CHANGE - ORIGINAL : if(pulledby.grab_state || body_position == LYING_DOWN || HAS_TRAIT(src, TRAIT_GRABWEAKNESS) || get_timed_status_effect_duration(/datum/status_effect/staggered) && getStaminaLoss() >= 30)
var/altered_grab_state = pulledby.grab_state
if(body_position == LYING_DOWN || HAS_TRAIT(src, TRAIT_GRABWEAKNESS) && pulledby.grab_state < GRAB_KILL) //If prone, resisting out of a grab is equivalent to 1 grab state higher. won't make the grab state exceed the normal max, however - SKYRAT EDIT CHANGE: if((resting || HAS_TRAIT(src, TRAIT_GRABWEAKNESS)) && pulledby.grab_state < GRAB_KILL) //If resting, resisting out of a grab is equivalent to 1 grab state higher. won't make the grab state exceed the normal max, however
altered_grab_state++
Expand Down
4 changes: 2 additions & 2 deletions code/modules/movespeed/modifiers/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
blacklisted_movetypes = FLOATING
variable = TRUE

/datum/movespeed_modifier/shove
multiplicative_slowdown = SHOVE_SLOWDOWN_STRENGTH
/datum/movespeed_modifier/staggered
multiplicative_slowdown = STAGGERED_SLOWDOWN_STRENGTH

/datum/movespeed_modifier/human_carry
multiplicative_slowdown = HUMAN_CARRY_SLOWDOWN
Expand Down
2 changes: 1 addition & 1 deletion code/modules/vending/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/obj/item/storage/box/evidence = 6,
/obj/item/flashlight/seclite = 4,
/obj/item/restraints/legcuffs/bola/energy = 7,
/obj/item/clothing/gloves/tackler = 5,
)
contraband = list(
/obj/item/clothing/glasses/sunglasses = 2,
Expand All @@ -26,7 +27,6 @@
/obj/item/coin/antagtoken = 1,
/obj/item/clothing/head/helmet/blueshirt = 1,
/obj/item/clothing/suit/armor/vest/blueshirt = 1,
/obj/item/clothing/gloves/tackler = 5,
/obj/item/grenade/stingbang = 1,
/obj/item/watertank/pepperspray = 2,
/obj/item/storage/belt/holster/energy = 4,
Expand Down
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1847,6 +1847,7 @@
#include "code\datums\status_effects\debuffs\slimed.dm"
#include "code\datums\status_effects\debuffs\spacer.dm"
#include "code\datums\status_effects\debuffs\speech_debuffs.dm"
#include "code\datums\status_effects\debuffs\staggered.dm"
#include "code\datums\status_effects\debuffs\static_vision.dm"
#include "code\datums\status_effects\debuffs\strandling.dm"
#include "code\datums\status_effects\debuffs\terrified.dm"
Expand Down
Loading