mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 11:12:14 +00:00
## About The Pull Request Renames m_intent to move_intent and moves it to the living level renames tod to station_timestamp_timeofdeath removes stun_absorption and see_override as one was unused and the other was never actually implemented ## Why It's Good For The Game Many vars on the mob and living level were intended to be on the living and carbon level, but weren't for one reason or another. Generally it was out of laziness to ensure the mobs being checked for these vars were the intended mobs, and there's some todo comments on how they want it changed in the future, though it never happened. I'm hoping to get these all down in the future, I originally wanted to move ``stat`` from mob to living but it had hundreds of errors so I didn't want to do it all here. ## Changelog Nothing player-facing.
62 lines
1.7 KiB
Plaintext
62 lines
1.7 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)
|