mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 02:24:11 +01:00
Ports TG's Improved Attack Animations
This commit is contained in:
@@ -387,7 +387,6 @@ This function restores all organs.
|
||||
dmgIcon.pixel_y = (!lying) ? rand(-11,9) : rand(-10,1)
|
||||
flick_overlay(dmgIcon, attack_bubble_recipients, 9)
|
||||
|
||||
receive_damage()
|
||||
|
||||
if(BURN)
|
||||
damageoverlaytemp = 20
|
||||
|
||||
@@ -872,48 +872,71 @@
|
||||
gib()
|
||||
return
|
||||
|
||||
/atom/movable/proc/do_attack_animation(atom/A)
|
||||
/atom/movable/proc/do_attack_animation(atom/A, end_pixel_y)
|
||||
var/pixel_x_diff = 0
|
||||
var/pixel_y_diff = 0
|
||||
var/final_pixel_y = initial(pixel_y)
|
||||
if(end_pixel_y)
|
||||
final_pixel_y = end_pixel_y
|
||||
|
||||
var/direction = get_dir(src, A)
|
||||
switch(direction)
|
||||
if(NORTH)
|
||||
pixel_y_diff = 8
|
||||
if(SOUTH)
|
||||
pixel_y_diff = -8
|
||||
if(EAST)
|
||||
pixel_x_diff = 8
|
||||
if(WEST)
|
||||
pixel_x_diff = -8
|
||||
if(NORTHEAST)
|
||||
pixel_x_diff = 8
|
||||
pixel_y_diff = 8
|
||||
if(NORTHWEST)
|
||||
pixel_x_diff = -8
|
||||
pixel_y_diff = 8
|
||||
if(SOUTHEAST)
|
||||
pixel_x_diff = 8
|
||||
pixel_y_diff = -8
|
||||
if(SOUTHWEST)
|
||||
pixel_x_diff = -8
|
||||
pixel_y_diff = -8
|
||||
if(direction & NORTH)
|
||||
pixel_y_diff = 8
|
||||
else if(direction & SOUTH)
|
||||
pixel_y_diff = -8
|
||||
|
||||
if(direction & EAST)
|
||||
pixel_x_diff = 8
|
||||
else if(direction & WEST)
|
||||
pixel_x_diff = -8
|
||||
|
||||
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, time = 2)
|
||||
animate(pixel_x = initial(pixel_x), pixel_y = initial(pixel_y), time = 2)
|
||||
animate(pixel_x = initial(pixel_x), pixel_y = final_pixel_y, time = 2)
|
||||
|
||||
|
||||
/mob/living/do_attack_animation(atom/A)
|
||||
..()
|
||||
var/final_pixel_y = get_standard_pixel_y_offset(lying)
|
||||
..(A, final_pixel_y)
|
||||
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
|
||||
|
||||
// What icon do we use for the attack?
|
||||
var/image/I
|
||||
if(hand && l_hand) // Attacked with item in left hand.
|
||||
I = image(l_hand.icon, A, l_hand.icon_state, A.layer + 1)
|
||||
else if(!hand && r_hand) // Attacked with item in right hand.
|
||||
I = image(r_hand.icon, A, r_hand.icon_state, A.layer + 1)
|
||||
else // Attacked with a fist?
|
||||
return
|
||||
|
||||
/atom/movable/proc/receive_damage(atom/A)
|
||||
var/pixel_x_diff = rand(-3,3)
|
||||
var/pixel_y_diff = rand(-3,3)
|
||||
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, time = 2)
|
||||
animate(pixel_x = initial(pixel_x), pixel_y = initial(pixel_y), time = 2)
|
||||
// Who can see the attack?
|
||||
var/list/viewing = list()
|
||||
for(var/mob/M in viewers(A))
|
||||
if(M.client)
|
||||
viewing |= M.client
|
||||
flick_overlay(I, viewing, 5) // 5 ticks/half a second
|
||||
|
||||
/mob/living/receive_damage(atom/A)
|
||||
..()
|
||||
floating = 0 // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
|
||||
// Scale the icon.
|
||||
I.transform *= 0.75
|
||||
// The icon should not rotate.
|
||||
I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
|
||||
|
||||
// Set the direction of the icon animation.
|
||||
var/direction = get_dir(src, A)
|
||||
if(direction & NORTH)
|
||||
I.pixel_y = -16
|
||||
else if(direction & SOUTH)
|
||||
I.pixel_y = 16
|
||||
|
||||
if(direction & EAST)
|
||||
I.pixel_x = -16
|
||||
else if(direction & WEST)
|
||||
I.pixel_x = 16
|
||||
|
||||
if(!direction) // Attacked self?!
|
||||
I.pixel_z = 16
|
||||
|
||||
// And animate the attack!
|
||||
animate(I, alpha = 175, pixel_x = 0, pixel_y = 0, pixel_z = 0, time = 3)
|
||||
|
||||
/mob/living/proc/do_jitter_animation(jitteriness)
|
||||
var/amplitude = min(4, (jitteriness/100) + 1)
|
||||
|
||||
Reference in New Issue
Block a user