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] Fixes some tackle business #2191

Merged
merged 1 commit into from
Feb 29, 2024
Merged
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
30 changes: 13 additions & 17 deletions code/datums/components/tackle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@
neutral_outcome(user, target, tackle_word) //Forces a neutral outcome so you're not screwed too much from being blocked while tackling
return COMPONENT_MOVABLE_IMPACT_FLIP_HITPUSH



switch(roll)
if(-INFINITY to -1)
negative_outcome(user, target, roll, tackle_word) //OOF
Expand All @@ -178,6 +176,15 @@

return COMPONENT_MOVABLE_IMPACT_FLIP_HITPUSH

/// Helper to do a grab and then adjust the grab state if necessary
/datum/component/tackler/proc/do_grab(mob/living/carbon/tackler, mob/living/carbon/tackled, skip_to_state = GRAB_PASSIVE)
set waitfor = FALSE

if(!tackler.grab(tackled) || tackler.pulling != tackled)
return
if(tackler.grab_state != skip_to_state)
tackler.setGrabState(skip_to_state)

/**
* Our positive tackling outcomes.
*
Expand All @@ -198,15 +205,10 @@
var/potential_outcome = (roll * 10)

if(ishuman(target))
var/mob/living/carbon/human/human_target = target
var/target_armor = human_target.run_armor_check(BODY_ZONE_CHEST, MELEE)
potential_outcome *= ((100 - target_armor) /100)
potential_outcome *= ((100 - target.run_armor_check(BODY_ZONE_CHEST, MELEE)) /100)
else
potential_outcome *= 0.9

var/mob/living/carbon/human/human_target = target
var/mob/living/carbon/human/human_sacker = user

switch(potential_outcome)
if(-INFINITY to 0) //I don't want to know how this has happened, okay?
neutral_outcome(user, target, roll, tackle_word) //Default to neutral
Expand All @@ -233,9 +235,7 @@
target.Paralyze(0.5 SECONDS)
target.Knockdown(3 SECONDS)
target.adjust_staggered_up_to(STAGGERED_SLOWDOWN_LENGTH * 2, 10 SECONDS)
if(ishuman(target) && ishuman(user))
INVOKE_ASYNC(human_sacker, TYPE_PROC_REF(/mob/living, grab), human_sacker, human_target)
human_sacker.setGrabState(GRAB_PASSIVE)
do_grab(user, target)

if(50 to INFINITY) // absolutely BODIED
var/stamcritted_user = HAS_TRAIT_FROM(user, TRAIT_INCAPACITATED, STAMINA)
Expand All @@ -259,9 +259,7 @@
target.Paralyze(0.5 SECONDS)
target.Knockdown(3 SECONDS)
target.adjust_staggered_up_to(STAGGERED_SLOWDOWN_LENGTH * 3, 10 SECONDS)
if(ishuman(target) && ishuman(user))
INVOKE_ASYNC(human_sacker, TYPE_PROC_REF(/mob/living, grab), human_sacker, human_target)
human_sacker.setGrabState(GRAB_AGGRESSIVE)
do_grab(user, target, GRAB_AGGRESSIVE)

/**
* Our neutral tackling outcome.
Expand Down Expand Up @@ -300,9 +298,7 @@
var/potential_roll_outcome = (roll * -10)

if(ishuman(user))
var/mob/living/carbon/human/human_sacker = target
var/attacker_armor = human_sacker.run_armor_check(BODY_ZONE_CHEST, MELEE)
potential_roll_outcome *= ((100 - attacker_armor) /100)
potential_roll_outcome *= ((100 - target.run_armor_check(BODY_ZONE_CHEST, MELEE)) /100)
else
potential_roll_outcome *= 0.9

Expand Down
Loading