[MIRROR] Add an animation for shaking (#456)

* Merge pull request #52975 from Jared-Fogle/shake-animation

Add an animation for shaking

* Add an animation for shaking

Co-authored-by: nemvar <47324920+nemvar@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-08-21 14:23:30 +01:00
committed by GitHub
co-authored by nemvar
parent c51a521449
commit 7b58d32063
@@ -1,3 +1,5 @@
#define SHAKE_ANIMATION_OFFSET 4
/mob/living/carbon/get_eye_protection()
. = ..()
var/obj/item/organ/eyes/E = getorganslot(ORGAN_SLOT_EYES)
@@ -469,6 +471,13 @@
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, TRUE, -1)
// Shake animation
if (incapacitated())
var/direction = prob(50) ? -1 : 1
animate(src, pixel_x = pixel_x + SHAKE_ANIMATION_OFFSET * direction, time = 1, easing = QUAD_EASING | EASE_OUT)
animate(pixel_x = pixel_x - (SHAKE_ANIMATION_OFFSET * 2 * direction), time = 1)
animate(pixel_x = pixel_x + SHAKE_ANIMATION_OFFSET * direction, time = 1, easing = QUAD_EASING | EASE_IN)
/// Check ourselves to see if we've got any shrapnel, return true if we do. This is a much simpler version of what humans do, we only indicate we're checking ourselves if there's actually shrapnel
/mob/living/carbon/proc/check_self_for_injuries()
if(stat == DEAD || stat == UNCONSCIOUS)
@@ -625,3 +634,5 @@
var/obj/item/bodypart/limb = _limb
if (limb.status != BODYPART_ORGANIC)
. += (limb.brute_dam * limb.body_damage_coeff) + (limb.burn_dam * limb.body_damage_coeff)
#undef SHAKE_ANIMATION_OFFSET