mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 02:57:48 +01:00
Further Improves Attack Animations
This commit is contained in:
@@ -363,3 +363,70 @@
|
||||
target.fingerprints += fingerprints
|
||||
target.fingerprintshidden += fingerprintshidden
|
||||
target.fingerprintslast = fingerprintslast
|
||||
|
||||
/atom/movable/proc/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y)
|
||||
if(!no_effect && (visual_effect_icon || used_item))
|
||||
do_item_attack_animation(A, visual_effect_icon, used_item)
|
||||
|
||||
if(A == src)
|
||||
return //don't do an animation if attacking self
|
||||
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)
|
||||
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 = final_pixel_y, time = 2)
|
||||
|
||||
/atom/movable/proc/do_item_attack_animation(atom/A, visual_effect_icon, obj/item/used_item)
|
||||
var/image/I
|
||||
if(visual_effect_icon)
|
||||
I = image('icons/effects/effects.dmi', A, visual_effect_icon, A.layer + 0.1)
|
||||
else if(used_item)
|
||||
I = image(used_item.icon, A, used_item.icon_state, A.layer + 0.1)
|
||||
|
||||
// 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
|
||||
|
||||
if(!I)
|
||||
return
|
||||
|
||||
// Who can see the attack?
|
||||
var/list/viewing = list()
|
||||
for(var/mob/M in viewers(A))
|
||||
if(M.client && M.client.prefs.show_ghostitem_attack)
|
||||
viewing |= M.client
|
||||
|
||||
flick_overlay(I, viewing, 5) // 5 ticks/half a second
|
||||
|
||||
// And animate the attack!
|
||||
animate(I, alpha = 175, pixel_x = 0, pixel_y = 0, pixel_z = 0, time = 3)
|
||||
@@ -278,7 +278,7 @@
|
||||
|
||||
C.visible_message("<span class='danger'>[src] impales [C] with [I]!</span>", "<span class='userdanger'>[src] impales you with [I]!</span>")
|
||||
C.apply_damage(I.force, BRUTE, "chest")
|
||||
do_attack_animation(C)
|
||||
do_item_attack_animation(C, used_item = I)
|
||||
add_blood(C)
|
||||
playsound(get_turf(src), I.hitsound, 75, 1)
|
||||
|
||||
|
||||
@@ -469,15 +469,17 @@
|
||||
|
||||
/obj/mecha/attack_hand(mob/living/user)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(src)
|
||||
log_message("Attack by hand/paw. Attacker - [user].",1)
|
||||
|
||||
if((HULK in user.mutations) && !prob(deflect_chance))
|
||||
do_attack_animation(src, ATTACK_EFFECT_SMASH)
|
||||
take_damage(15)
|
||||
check_for_internal_damage(list(MECHA_INT_TEMP_CONTROL,MECHA_INT_TANK_BREACH,MECHA_INT_CONTROL_LOST))
|
||||
user.visible_message("<span class='danger'>[user] hits [name], doing some damage.</span>",
|
||||
"<span class='danger'>You hit [name] with all your might. The metal creaks and bends.</span>")
|
||||
else
|
||||
user.do_attack_animation(src, ATTACK_EFFECT_PUNCH)
|
||||
playsound(loc, 'sound/weapons/tap.ogg', 40, 1, -1)
|
||||
user.visible_message("<span class='danger'>[user] hits [name]. Nothing happens</span>","<span class='danger'>You hit [name] with no visible effect.</span>")
|
||||
log_append_to_last("Armor saved.")
|
||||
return
|
||||
@@ -1478,3 +1480,15 @@
|
||||
if(occupant_sight_flags)
|
||||
if(user == occupant)
|
||||
user.sight |= occupant_sight_flags
|
||||
|
||||
/obj/mecha/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y)
|
||||
if(!no_effect)
|
||||
if(selected)
|
||||
used_item = selected
|
||||
else if(!visual_effect_icon)
|
||||
visual_effect_icon = ATTACK_EFFECT_SMASH
|
||||
if(damtype == BURN)
|
||||
visual_effect_icon = ATTACK_EFFECT_MECHFIRE
|
||||
else if(damtype == TOX)
|
||||
visual_effect_icon = ATTACK_EFFECT_MECHTOXIN
|
||||
..()
|
||||
@@ -204,7 +204,7 @@
|
||||
|
||||
/obj/structure/foamedmetal/attack_hand(mob/user)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(src)
|
||||
user.do_attack_animation(src, ATTACK_EFFECT_PUNCH)
|
||||
if((HULK in user.mutations) || (prob(75 - metal*25)))
|
||||
user.visible_message("<span class='warning'>[user] smashes through \the [src].</span>", "<span class='notice'>You smash through \the [src].</span>")
|
||||
qdel(src)
|
||||
|
||||
@@ -443,10 +443,11 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d
|
||||
|
||||
playsound(loc, src.hitsound, 30, 1, -1)
|
||||
|
||||
user.do_attack_animation(M)
|
||||
|
||||
if(M != user)
|
||||
M.visible_message("<span class='danger'>[user] has stabbed [M] in the eye with [src]!</span>", \
|
||||
"<span class='userdanger'>[user] stabs you in the eye with [src]!</span>")
|
||||
user.do_attack_animation(M)
|
||||
else
|
||||
user.visible_message( \
|
||||
"<span class='danger'>[user] has stabbed themself in the eyes with [src]!</span>", \
|
||||
|
||||
@@ -295,7 +295,7 @@ var/global/list/captain_display_cases = list()
|
||||
else
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(src)
|
||||
user.do_attack_animation(src, ATTACK_EFFECT_KICK)
|
||||
user.visible_message("<span class='danger'>[user.name] kicks \the [src]!</span>", \
|
||||
"<span class='danger'>You kick \the [src]!</span>", \
|
||||
"You hear glass crack.")
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
/obj/structure/grille/attack_hand(mob/living/user)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(src)
|
||||
user.do_attack_animation(src, ATTACK_EFFECT_KICK)
|
||||
user.visible_message("<span class='warning'>[user] kicks [src].</span>", \
|
||||
"<span class='warning'>You kick [src].</span>", \
|
||||
"You hear twisting metal.")
|
||||
|
||||
@@ -616,7 +616,7 @@
|
||||
if(user.weakened || user.resting || user.lying)
|
||||
return
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(src)
|
||||
user.do_attack_animation(src, ATTACK_EFFECT_KICK)
|
||||
user.visible_message("<span class='warning'>[user] kicks [src].</span>", \
|
||||
"<span class='danger'>You kick [src].</span>")
|
||||
take_damage(rand(4,8), BRUTE, "melee", 1)
|
||||
|
||||
Reference in New Issue
Block a user