Fixes COMSIG_LIVING_EARLY_UNARMED_ATTACK arguments (#80783)

## About The Pull Request

Fixes #80566 

Fixes the wrong arguments being passed to
`COMSIG_LIVING_EARLY_UNARMED_ATTACK`.
It now properly receives the proximity flag. 

Changes clicking with handcuffs to no longer always assume no proximity.

Replaces some checks for hands blocked to some checks for
`can_unarmed_attack` (which, currently, JUST checks for hands blocked,
but this is good for future reasons, just in case)

## Changelog

🆑 Melbert
fix: Strong arm implant users can shove more correctly. 
/🆑
This commit is contained in:
MrMelbert
2024-01-05 18:08:06 +00:00
committed by GitHub
parent 6db9e0d39d
commit d5c547e459
11 changed files with 26 additions and 19 deletions
+5 -5
View File
@@ -115,7 +115,7 @@
if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
changeNext_move(CLICK_CD_HANDCUFFED) //Doing shit in cuffs shall be vey slow
UnarmedAttack(A, FALSE, modifiers)
UnarmedAttack(A, Adjacent(A), modifiers)
return
if(throw_mode)
@@ -144,7 +144,7 @@
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
UnarmedAttack(A, FALSE, modifiers)
UnarmedAttack(A, TRUE, modifiers)
return
//Can't reach anything else in lockers or other weirdness
@@ -164,7 +164,7 @@
else
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
UnarmedAttack(A,1,modifiers)
UnarmedAttack(A, TRUE, modifiers)
else
if(W)
if(LAZYACCESS(modifiers, RIGHT_CLICK))
@@ -173,12 +173,12 @@
if(after_attack_secondary_result == SECONDARY_ATTACK_CALL_NORMAL)
W.afterattack(A, src, FALSE, params)
else
W.afterattack(A,src,0,params)
W.afterattack(A, src, FALSE, params)
else
if(LAZYACCESS(modifiers, RIGHT_CLICK))
ranged_secondary_attack(A, modifiers)
else
RangedAttack(A,modifiers)
RangedAttack(A, modifiers)
/// Is the atom obscured by a PREVENT_CLICK_UNDER_1 object above it
/atom/proc/IsObscured()
+1 -1
View File
@@ -190,7 +190,7 @@
change attack_robot() above to the proper function
*/
/mob/living/silicon/robot/UnarmedAttack(atom/A, proximity_flag, list/modifiers)
if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
if(!can_unarmed_attack())
return
A.attack_robot(src)
+3 -1
View File
@@ -11,6 +11,8 @@
/**
* Checks if this mob is in a valid state to punch someone.
*
* (Potentially) gives feedback to the mob if they cannot.
*/
/mob/living/proc/can_unarmed_attack()
return !HAS_TRAIT(src, TRAIT_HANDS_BLOCKED)
@@ -34,7 +36,7 @@
/mob/living/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers)
// The sole reason for this signal needing to exist is making FotNS incompatible with Hulk.
// Note that it is send before [proc/can_unarmed_attack] is called, keep this in mind.
var/sigreturn = SEND_SIGNAL(src, COMSIG_LIVING_EARLY_UNARMED_ATTACK, attack_target, modifiers)
var/sigreturn = SEND_SIGNAL(src, COMSIG_LIVING_EARLY_UNARMED_ATTACK, attack_target, proximity_flag, modifiers)
if(sigreturn & COMPONENT_CANCEL_ATTACK_CHAIN)
return TRUE
if(sigreturn & COMPONENT_SKIP_ATTACK)
@@ -321,15 +321,18 @@
INVOKE_ASYNC(weapon, TYPE_PROC_REF(/obj/item, attack), stabbed_carbon, src)
stabbed_carbon.Knockdown(2 SECONDS)
/mob/living/basic/bot/cleanbot/proc/pre_attack(mob/living/source, atom/target)
/mob/living/basic/bot/cleanbot/proc/pre_attack(mob/living/source, atom/target, proximity, modifiers)
SIGNAL_HANDLER
if(!proximity || !can_unarmed_attack())
return NONE
if(is_type_in_typecache(target, huntable_pests) && !isnull(our_mop))
INVOKE_ASYNC(our_mop, TYPE_PROC_REF(/obj/item, melee_attack_chain), src, target)
return COMPONENT_CANCEL_ATTACK_CHAIN
if(!iscarbon(target) && !is_type_in_typecache(target, huntable_trash))
return
return NONE
visible_message(span_danger("[src] sprays hydrofluoric acid at [target]!"))
playsound(src, 'sound/effects/spray2.ogg', 50, TRUE, -6)
@@ -22,7 +22,7 @@
return ..()
/mob/living/basic/guardian/explosive/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers)
if(LAZYACCESS(modifiers, RIGHT_CLICK) && proximity_flag && isobj(attack_target))
if(LAZYACCESS(modifiers, RIGHT_CLICK) && proximity_flag && isobj(attack_target) && can_unarmed_attack())
bomb.Trigger(target = attack_target)
return
return ..()
@@ -57,7 +57,7 @@
return TRUE
/mob/living/basic/guardian/gravitokinetic/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers)
if (LAZYACCESS(modifiers, RIGHT_CLICK) && proximity_flag && !gravity_targets[attack_target])
if (LAZYACCESS(modifiers, RIGHT_CLICK) && proximity_flag && !gravity_targets[attack_target] && can_unarmed_attack())
slam_turf(attack_target)
return
return ..()
@@ -73,9 +73,12 @@
/mob/living/basic/pet/cat/proc/pre_unarmed_attack(mob/living/hitter, atom/target, proximity, modifiers)
SIGNAL_HANDLER
if(istype(target, /obj/machinery/oven/range))
target.attack_hand(src)
return COMPONENT_CANCEL_ATTACK_CHAIN
if(!proximity || !can_unarmed_attack())
return NONE
if(!istype(target, /obj/machinery/oven/range))
return NONE
target.attack_hand(src)
return COMPONENT_CANCEL_ATTACK_CHAIN
/mob/living/basic/pet/cat/Exited(atom/movable/gone, direction)
. = ..()
@@ -77,7 +77,7 @@
/mob/living/simple_animal/bot/firebot/UnarmedAttack(atom/A, proximity_flag, list/modifiers)
if(!(bot_mode_flags & BOT_MODE_ON))
return
if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
if(!can_unarmed_attack())
return
if(internal_ext)
internal_ext.afterattack(A, src)
@@ -316,4 +316,3 @@
#undef SPEECH_INTERVAL
#undef DETECTED_VOICE_INTERVAL
#undef FOAM_INTERVAL
@@ -397,7 +397,7 @@
return ..()
/mob/living/simple_animal/bot/floorbot/UnarmedAttack(atom/A, proximity_flag, list/modifiers)
if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
if(!can_unarmed_attack())
return
if(isturf(A))
repair(A)
@@ -769,7 +769,7 @@
unload()
/mob/living/simple_animal/bot/mulebot/UnarmedAttack(atom/A, proximity_flag, list/modifiers)
if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
if(!can_unarmed_attack())
return
if(isturf(A) && isturf(loc) && loc.Adjacent(A) && load)
unload(get_dir(loc, A))
@@ -278,7 +278,7 @@
/mob/living/simple_animal/bot/secbot/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers)
if(!(bot_mode_flags & BOT_MODE_ON))
return
if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
if(!can_unarmed_attack())
return
if(!iscarbon(attack_target))
return ..()