Files
Kal WoodsideandGitHub c080097bc8 Allow Skittish to Intercept Bump (#96890)
## About The Pull Request

resolves: https://github.com/tgstation/tgstation/issues/56396

Modifies `atoms_movable.dm` and `skittish.md`, as a subscriber to the
`COMSIG_MOVABLE_BUMP` signal, to allow the latter to bubble up an
intercept flag to `living.dm`, so that it can cancel a shove and
function properly.

I looked at every other registered `COMSIG_MOVABLE_BUMP` signal receiver
and found that only one ever possibly returns non-zero, and that is
`/obj/item/clothing/gloves/gauntlets/proc/rocksmash`. However, when
`rocksmash` is called via a bump signal, it will return `NONE` because
the `proximity` parameter will not be set. Therefore, unless I missed
something, there should be no collateral damage from this change.
## Why It's Good For The Game

Skittish has been broken seemingly since its addition to the game. This
fixes that.

<img width="640" height="480" alt="crate"
src="https://github.com/user-attachments/assets/0ce01c07-0e44-498b-aac0-02c448a6d379"
/>
<img width="640" height="480" alt="locker"
src="https://github.com/user-attachments/assets/6fc946fb-e953-43d0-9bd3-9d958a3d9744"
/>

## Changelog
🆑
fix: Fixed Skittish behaving strangely with lockers not against a wall,
and crates in general.
/🆑
2026-07-10 14:05:21 +02:00

64 lines
1.8 KiB
Plaintext

/*
* An element that makes mobs run into lockers when they bump into them.
*/
/datum/element/skittish
/datum/element/skittish/Attach(datum/target)
. = ..()
if(!isliving(target))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_MOVABLE_BUMP, PROC_REF(Bump))
/datum/element/skittish/Detach(datum/target)
UnregisterSignal(target, COMSIG_MOVABLE_BUMP)
. = ..()
/datum/element/skittish/proc/Bump(mob/living/scooby, atom/target)
SIGNAL_HANDLER
if(scooby.stat != CONSCIOUS || scooby.move_intent != MOVE_INTENT_RUN)
return
if(!istype(target, /obj/structure/closet))
return
var/obj/structure/closet/closet = target
if(!closet.divable)
// Things like secure crates can blow up under certain circumstances
return
var/turf/closet_turf = get_turf(closet)
if(!closet.opened)
if(closet.locked)
closet.togglelock(scooby, silent = TRUE)
if(!closet.open(scooby))
// No message if unable to open, since this is on Bump, spammy potential
return
// If it's a crate, "dive for cover" and start resting so people can jump into crates without slamming the lid on their head
if(closet.horizontal)
// need to rest before moving, otherwise "can't get crate to close" message will be printed erroneously
scooby.set_resting(TRUE, silent = TRUE)
scooby.forceMove(closet_turf)
if(!closet.close(scooby))
to_chat(scooby, span_warning("You can't get [closet] to close!"))
if(closet.horizontal)
scooby.set_resting(FALSE, silent = TRUE)
return
closet.togglelock(scooby, silent = TRUE)
if(closet.horizontal)
scooby.set_resting(FALSE, silent = TRUE)
closet_turf.visible_message(span_warning("[scooby] dives into [closet]!"))
// If you run into a locker, you don't want to run out immediately
scooby.Immobilize(0.5 SECONDS)
return COMPONENT_INTERCEPT_BUMPED