Files
Bubberstation/code/__HELPERS/animations.dm
SkyratBot 2c60091ec7 [MIRROR] Adds a few (very) basic hallucinations, to keep people on their toes [MDB IGNORE] (#16709)
Adds a few (very) basic hallucinations, to keep people on their toes

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2022-10-09 23:05:33 +01:00

30 lines
1.3 KiB
Plaintext

/**
* Causes the passed atom / image to appear floating,
* playing a simple animation where they move up and down by 2 pixels (looping)
*
* In most cases you should NOT call this manually, instead use [/datum/element/movetype_handler]!
* This is just so you can apply the animation to things which can be animated but are not movables (like images)
*/
#define DO_FLOATING_ANIM(target) \
animate(target, pixel_y = 2, time = 1 SECONDS, loop = -1, flags = ANIMATION_RELATIVE); \
animate(pixel_y = -2, time = 1 SECONDS, flags = ANIMATION_RELATIVE)
/**
* Stops the passed atom / image from appearing floating
* (Living mobs also have a 'body_position_pixel_y_offset' variable that has to be taken into account here)
*
* In most cases you should NOT call this manually, instead use [/datum/element/movetype_handler]!
* This is just so you can apply the animation to things which can be animated but are not movables (like images)
*/
#define STOP_FLOATING_ANIM(target) \
var/final_pixel_y = 0; \
if(ismovable(target)) { \
var/atom/movable/movable_target = target; \
final_pixel_y = movable_target.base_pixel_y; \
}; \
if(isliving(target)) { \
var/mob/living/living_target = target; \
final_pixel_y += living_target.body_position_pixel_y_offset; \
}; \
animate(target, pixel_y = final_pixel_y, time = 1 SECONDS)