Files
Bubberstation/code/datums/elements/waddling.dm
SkyratBot 56f02d7e30 [MIRROR] Cardboard cutouts are now tactical. (#26545)
* Cardboard cutouts are now tactical. (#81245)

## About The Pull Request
Basically, this means players holding cardboard cutouts will now assume
their appearance, just like for potted plants. Good for pranking.

I've had to tweak the tactical component and the waddling element a bit
to get them to work as intended while dealing with the multiple sources
of the waddling element.

## Why It's Good For The Game
![](https://media1.tenor.com/m/X1GimXmuByYAAAAd/tom-cruise-doorbell.gif)

## Changelog

🆑
add: Players holding cardboard cutouts will now assume their appearance,
just like for potted plants.
/🆑

* Cardboard cutouts are now tactical.

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2024-02-17 13:25:03 -05:00

31 lines
1.1 KiB
Plaintext

/datum/element/waddling
/datum/element/waddling/Attach(datum/target)
. = ..()
if(!ismovable(target))
return ELEMENT_INCOMPATIBLE
if(!HAS_TRAIT(target, TRAIT_WADDLING))
stack_trace("[type] added to [target] without adding TRAIT_WADDLING first. Please use AddElementTrait instead.")
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(Waddle))
/datum/element/waddling/Detach(datum/source)
. = ..()
UnregisterSignal(source, COMSIG_MOVABLE_MOVED)
/datum/element/waddling/proc/Waddle(atom/movable/moved, atom/oldloc, direction, forced)
SIGNAL_HANDLER
if(forced || CHECK_MOVE_LOOP_FLAGS(moved, MOVEMENT_LOOP_OUTSIDE_CONTROL))
return
if(isliving(moved))
var/mob/living/living_moved = moved
if (living_moved.incapacitated() || living_moved.body_position == LYING_DOWN)
return
waddling_animation(moved)
/datum/element/waddling/proc/waddling_animation(atom/movable/target)
var/prev_pixel_z = target.pixel_z
animate(target, pixel_z = target.pixel_z + 4, time = 0)
var/prev_transform = target.transform
animate(pixel_z = prev_pixel_z, transform = turn(target.transform, pick(-12, 0, 12)), time=2)
animate(transform = prev_transform, time = 0)