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

[MISSED MIRROR] Fixes COMSIG_LIVING_EARLY_UNARMED_ATTACK arguments (#80783) #1476

Merged
merged 1 commit into from
Jan 6, 2024
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
10 changes: 5 additions & 5 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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))
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/cyborg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions code/modules/mob/living/basic/bots/cleanbot/cleanbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()
Expand Down
9 changes: 6 additions & 3 deletions code/modules/mob/living/basic/pets/cat/cat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
. = ..()
Expand Down
3 changes: 1 addition & 2 deletions code/modules/mob/living/simple_animal/bot/firebot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -316,4 +316,3 @@
#undef SPEECH_INTERVAL
#undef DETECTED_VOICE_INTERVAL
#undef FOAM_INTERVAL

2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/bot/floorbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/bot/mulebot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/bot/secbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()
Expand Down
Loading