mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-01 12:31:32 +00:00
* Allows the connect_loc element to have a listener different from the tracked object (#58276) * Allows the connect_loc element to have a listener different from the tracked object Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
32 lines
864 B
Plaintext
32 lines
864 B
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/LivingWaddle)
|
|
else
|
|
RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/Waddle)
|
|
|
|
/datum/element/waddling/Detach(datum/source)
|
|
. = ..()
|
|
UnregisterSignal(source, COMSIG_MOVABLE_MOVED)
|
|
|
|
|
|
/datum/element/waddling/proc/LivingWaddle(mob/living/target)
|
|
SIGNAL_HANDLER
|
|
|
|
if(target.incapacitated() || target.body_position == LYING_DOWN)
|
|
return
|
|
Waddle(target)
|
|
|
|
|
|
/datum/element/waddling/proc/Waddle(atom/movable/target)
|
|
SIGNAL_HANDLER
|
|
|
|
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)
|