From 4f50fab294bbab84a3cbc69edb9867dca3dc4a93 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 15 Mar 2026 03:57:11 -0500 Subject: [PATCH] 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 :cl: balance: Sticky spider webs now drain stamina when mobs enter the turf /:cl: --- code/game/objects/effects/spiderwebs.dm | 45 ++++++++++++++++++------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/code/game/objects/effects/spiderwebs.dm b/code/game/objects/effects/spiderwebs.dm index d47c0059000..3dc4c0865dd 100644 --- a/code/game/objects/effects/spiderwebs.dm +++ b/code/game/objects/effects/spiderwebs.dm @@ -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