Skip to content

Commit

Permalink
readds baton throwing (ParadiseSS13#21481)
Browse files Browse the repository at this point in the history
* readds baton throwing

* forgot this

* judo

* Update code/game/objects/items/weapons/stunbaton.dm

* Update code/game/objects/items/weapons/stunbaton.dm

Co-authored-by: Luc <[email protected]>

* Update code/game/objects/items/weapons/stunbaton.dm

Co-authored-by: Luc <[email protected]>

---------

Co-authored-by: Luc <[email protected]>
  • Loading branch information
GDNgit and lewcc authored Aug 31, 2023
1 parent 89bbd92 commit 6bf9bb9
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions code/game/objects/items/weapons/stunbaton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
icon_state = "[base_icon]_nocell"
else
icon_state = "[base_icon]"

/obj/item/melee/baton/examine(mob/user)
. = ..()
if(isrobot(user))
Expand Down Expand Up @@ -158,6 +159,10 @@
update_icon()
add_fingerprint(user)

/obj/item/melee/baton/throw_impact(mob/living/carbon/human/hit_mob)
. = ..()
if(!. && turned_on && istype(hit_mob))
thrown_baton_stun(hit_mob)

/obj/item/melee/baton/attack(mob/M, mob/living/user)
if(turned_on && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
Expand Down Expand Up @@ -224,6 +229,42 @@
deductcharge(hitcost)
return TRUE

/obj/item/melee/baton/proc/thrown_baton_stun(mob/living/carbon/human/L)
if(cooldown > world.time)
return FALSE

var/user_UID = thrownby
var/mob/user = locateUID(thrownby)
if(!istype(user) || (user.mind?.martial_art?.no_baton && user.mind?.martial_art?.can_use(user)))
return

if(HAS_TRAIT_FROM(L, TRAIT_WAS_BATONNED, user_UID))
return FALSE

cooldown = world.time + initial(cooldown)
if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK))
playsound(L, 'sound/weapons/genhit.ogg', 50, TRUE)
return FALSE
L.Confused(4 SECONDS)
L.Jitter(4 SECONDS)
L.adjustStaminaLoss(30)
L.SetStuttering(4 SECONDS)

ADD_TRAIT(L, TRAIT_WAS_BATONNED, user_UID) // so one person cannot hit the same person with two separate batons
L.apply_status_effect(STATUS_EFFECT_DELAYED, 2 SECONDS, CALLBACK(L, TYPE_PROC_REF(/mob/living, KnockDown), knockdown_duration), COMSIG_LIVING_CLEAR_STUNS)
addtimer(CALLBACK(src, PROC_REF(baton_delay), L, user_UID), 2 SECONDS)

SEND_SIGNAL(L, COMSIG_LIVING_MINOR_SHOCK, 33)

L.lastattacker = user.real_name
L.lastattackerckey = user.ckey
L.visible_message("<span class='danger'>[user] has stunned [L] with [src]!</span>",
"<span class='userdanger'>[L == user ? "You stun yourself" : "[user] has stunned you"] with [src]!</span>")
add_attack_logs(user, L, "stunned")
playsound(src, 'sound/weapons/egloves.ogg', 50, TRUE, -1)
deductcharge(hitcost)
return TRUE

/obj/item/melee/baton/proc/baton_delay(mob/living/target, user_UID)
REMOVE_TRAIT(target, TRAIT_WAS_BATONNED, user_UID)

Expand Down

0 comments on commit 6bf9bb9

Please sign in to comment.