Files
Bubberstation/code/datums/elements/waddling.dm
Ghom 7bc5e03ae5 Late adjustments to my previous move_loop PR. [NO GBP] (#75778)
## About The Pull Request
Lemon guy was a bit too late in reviewing #75732 because it got already
merged by someone else, and I too hadn't managed to make some adjustment
to that PR in time.

This PR applies suggested changes, turns a simple proc into a macro, and
makes it so that also waddling, squeaky shoes and swivel chair sounds
don't running when moved by conveyor belt.

This doesn't stop squeaking from happening when other
conveyor-belt-moved objects or mobs cross its tile. That'd be hacky and
I'm not here to fight sfx-spamming machines.

## Why It's Good For The Game
These are changes that should have been included in #75732 but couldn't.
See that PR for the general idea.

## Changelog

🆑
fix: waddling, squeaky shoes and swivel chair sound effects no longer
run when moved by conveyor belt.
/🆑

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2023-06-08 17:41:28 -07:00

37 lines
1.2 KiB
Plaintext

/datum/element/waddling
/datum/element/waddling/Attach(datum/target)
. = ..()
if(!ismovable(target))
return ELEMENT_INCOMPATIBLE
if(isliving(target))
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(LivingWaddle))
else
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(Waddle))
/datum/element/waddling/Detach(datum/source)
. = ..()
UnregisterSignal(source, COMSIG_MOVABLE_MOVED)
/datum/element/waddling/proc/LivingWaddle(mob/living/target, atom/oldloc, direction, forced)
SIGNAL_HANDLER
if(forced || target.incapacitated() || target.body_position == LYING_DOWN || CHECK_MOVE_LOOP_FLAGS(target, MOVEMENT_LOOP_OUTSIDE_CONTROL))
return
waddling_animation(target)
/datum/element/waddling/proc/Waddle(atom/movable/target, atom/oldloc, direction, forced)
SIGNAL_HANDLER
if(forced || CHECK_MOVE_LOOP_FLAGS(target, MOVEMENT_LOOP_OUTSIDE_CONTROL))
return
waddling_animation(target)
/datum/element/waddling/proc/waddling_animation(atom/movable/target)
animate(target, pixel_z = 4, time = 0)
var/prev_trans = matrix(target.transform)
animate(pixel_z = 0, transform = turn(target.transform, pick(-12, 0, 12)), time=2)
animate(pixel_z = 0, transform = prev_trans, time = 0)