mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-20 19:49:39 +01:00
## About The Pull Request From the creator of 'cosmetic' elements such as footstep_override and immerse... I've made an element called elevation that nudges mobs a few pixels up while standing on things like tables, crates and beds. Screenshots of many clones of the same character standing on different objects:  ## Why It's Good For The Game It makes it look like the mob is actually standing on an elevated surface. ## Changelog 🆑 add: Standing on structures such as crates, tables and bed will now look like it. /🆑
29 lines
1010 B
Plaintext
29 lines
1010 B
Plaintext
/datum/element/waddling
|
|
|
|
/datum/element/waddling/Attach(datum/target)
|
|
. = ..()
|
|
if(!ismovable(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
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)
|