Change spiderwebs to drain stamina when mobs enter (#95197)

## About The Pull Request
This changes spiderwebs to drain stamina from mobs whenever they enter a
turf filled with spiderwebs.

## Why It's Good For The Game
The old movement code was very janky and buggy. Because it used the
`CanAllowThrough` proc, a mob could spam several dozens of movement
attempts per second, resulting in a massive amount of shaking and `stuck
in the web` messages. This had the effect of not really slowing or
stopping movement, since the RNG was being rolled so fast that it was a
minor inconvenience.

I feel like the stamina drain effect makes more sense and feels more
natural.

## Changelog
🆑
balance: Sticky spider webs now drain stamina when mobs enter the turf
/🆑
This commit is contained in:
Tim
2026-03-15 09:57:11 +01:00
committed by GitHub
parent 0caa154d1d
commit 4f50fab294
+32 -13
View File
@@ -57,6 +57,11 @@
if (has_frill)
pixel_x = -9
pixel_y = -9
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)
return ..()
/obj/structure/spider/stickyweb/attack_hand(mob/user, list/modifiers)
@@ -79,23 +84,37 @@
return
if(sealed)
return FALSE
if(isliving(mover))
if(HAS_TRAIT(mover, TRAIT_WEB_SURFER))
return TRUE
if(mover.pulledby && HAS_TRAIT(mover.pulledby, TRAIT_WEB_SURFER))
return TRUE
if(prob(stuck_chance))
stuck_react(mover)
return FALSE
return .
if(isprojectile(mover))
return prob(projectile_stuck_chance)
return .
/// Show some feedback when you can't pass through something
/obj/structure/spider/stickyweb/proc/stuck_react(atom/movable/stuck_guy)
loc.balloon_alert(stuck_guy, "stuck in web!")
stuck_guy.Shake(duration = 0.1 SECONDS)
/obj/structure/spider/stickyweb/proc/on_entered(datum/source, atom/movable/victim, old_loc)
SIGNAL_HANDLER
if(!isliving(victim))
return
if(HAS_TRAIT(victim, TRAIT_WEB_SURFER))
return
if(victim.pulledby && HAS_TRAIT(victim.pulledby, TRAIT_WEB_SURFER))
return
if(prob(stuck_chance))
stuck_react(victim)
/// Drains stamina and shows feedback when you get stuck moving thru a web
/obj/structure/spider/stickyweb/proc/stuck_react(mob/living/victim)
if(victim.get_stamina_loss() > 90)
if(victim.body_position != LYING_DOWN)
to_chat(victim, span_warning("You trip over \the [src] due to exhaustion!"))
victim.SetKnockdown(3 SECONDS)
return
if(prob(25))
loc.balloon_alert(victim, "stuck in web!")
victim.Shake(duration = 0.2 SECONDS)
victim.adjust_stamina_loss(rand(10, 15))
/// Web made by geneticists, needs special handling to allow them to pass through their own webs
/obj/structure/spider/stickyweb/genetic