[s] fixes that one baton bug again (#26365)

This commit is contained in:
Qwertytoforty
2024-08-01 11:06:00 -04:00
committed by GitHub
parent b739ab5d0f
commit 4d2171d41e
+9 -7
View File
@@ -183,9 +183,12 @@
var/mob/living/L = M
if(user.a_intent == INTENT_HARM)
. = ..() // Whack them too if in harm intent
if(!isnull(.)) // Attack returns null when successful
return
if(turned_on)
baton_stun(L, user)
return ..() // Whack them too if in harm intent
baton_stun(L, user, ignore_shield_check = TRUE)
return
if(!turned_on)
user.do_attack_animation(L)
@@ -196,11 +199,10 @@
if(baton_stun(L, user))
user.do_attack_animation(L)
/// returning false results in no baton attack animation, returning true results in an animation.
/obj/item/melee/baton/proc/baton_stun(mob/living/L, mob/user, skip_cooldown = FALSE)
/// returning false results in no baton attack animation, returning true results in an animation. If ignore_shield_check is true, the baton will not run check shields, and will hit if not on cooldown.
/obj/item/melee/baton/proc/baton_stun(mob/living/L, mob/user, skip_cooldown = FALSE, ignore_shield_check = FALSE)
if(cooldown > world.time && !skip_cooldown)
return FALSE
var/user_UID = user.UID()
if(HAS_TRAIT_FROM(L, TRAIT_WAS_BATONNED, user_UID)) // prevents double baton cheese.
return FALSE
@@ -208,7 +210,7 @@
cooldown = world.time + initial(cooldown) // tracks the world.time when hitting will be next available.
if(ishuman(L))
var/mob/living/carbon/human/H = L
if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
if(!ignore_shield_check && H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
playsound(L, 'sound/weapons/genhit.ogg', 50, TRUE)
return FALSE
H.Confused(10 SECONDS)
@@ -311,7 +313,7 @@
QDEL_NULL(sparkler)
return ..()
/obj/item/melee/baton/cattleprod/baton_stun(mob/living/L, mob/user, skip_cooldown = FALSE)
/obj/item/melee/baton/cattleprod/baton_stun(mob/living/L, mob/user, skip_cooldown = FALSE, ignore_shield_check = FALSE)
if(sparkler.activate())
return ..()