unify ranged_disarm procs (#19613)

* unify ranged_disarm procs

* clarity

* shoot at that
This commit is contained in:
Will
2026-07-16 22:39:56 -04:00
committed by GitHub
parent 12b3d80872
commit 036a7450d3
3 changed files with 55 additions and 79 deletions
@@ -142,10 +142,10 @@
if(I_HURT)
if(prob(10) && ishuman(target) && (user.zone_sel in list(BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT, BP_L_ARM, BP_R_ARM, BP_L_HAND, BP_R_HAND)))
to_chat(target, span_warning("\The [src] rips at your hands!"))
ranged_disarm(target)
ranged_disarm(target, user)
if(I_DISARM)
if(prob(min(90, force * 3)) && ishuman(target) && (user.zone_sel in list(BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT, BP_L_ARM, BP_R_ARM, BP_L_HAND, BP_R_HAND)))
ranged_disarm(target)
ranged_disarm(target, user)
else
target.visible_message(span_danger("\The [src] sends \the [target] stumbling away."))
target.Move(get_step(target,get_dir(user,target)))
@@ -158,44 +158,6 @@
..()
/obj/item/material/whip/proc/ranged_disarm(mob/living/carbon/human/H, mob/living/user)
if(istype(H))
var/list/holding = list(H.get_active_hand() = 40, H.get_inactive_hand() = 20)
if(user.zone_sel in list(BP_L_ARM, BP_R_ARM, BP_L_HAND, BP_R_HAND))
for(var/obj/item/gun/W in holding)
if(W && prob(holding[W]))
var/list/turfs = list()
for(var/turf/T in view())
turfs += T
if(turfs.len)
var/turf/target = pick(turfs)
visible_message(span_danger("[H]'s [W] goes off due to \the [src]!"))
return W.afterattack(target,H)
if(!(H.species.flags & NO_SLIP) && prob(10) && (user.zone_sel in list(BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT)))
var/armor_check = H.run_armor_check(user.zone_sel, "melee")
H.apply_effect(3, WEAKEN, armor_check)
playsound(src, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
if(armor_check < 60)
visible_message(span_danger("\The [src] has tripped [H]!"))
else
visible_message(span_warning("\The [src] attempted to trip [H]!"))
return
else
if(H.break_all_grabs(user))
playsound(src, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
return
if(user.zone_sel in list(BP_L_ARM, BP_R_ARM, BP_L_HAND, BP_R_HAND))
for(var/obj/item/I in holding)
if(I && prob(holding[I]))
H.drop_from_inventory(I)
visible_message(span_danger("\The [src] has disarmed [H]!"))
playsound(src, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
return
/obj/item/material/whip/attack_self(mob/user)
. = ..(user)
if(.)