Skip to content

Commit 7e35319

Browse files
authored
1 parent bbbb21c commit 7e35319

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

code/__HELPERS/icons.dm

+9-7
Original file line numberDiff line numberDiff line change
@@ -1126,15 +1126,17 @@ GLOBAL_LIST_EMPTY(transformation_animation_objects)
11261126
sleep(duration)
11271127
source.cut_overlay(overlay_image)
11281128

1129-
///Perform a shake on an atom, resets its position afterwards
1130-
/atom/proc/Shake(pixelshiftx = 15, pixelshifty = 15, duration = 250)
1129+
/// Perform a shake on an atom, resets its position afterwards
1130+
/atom/proc/Shake(pixelshiftx = 2, pixelshifty = 2, duration = 2.5 SECONDS, shake_interval = 0.02 SECONDS)
11311131
var/initialpixelx = pixel_x
11321132
var/initialpixely = pixel_y
1133-
var/shiftx = rand(-pixelshiftx,pixelshiftx)
1134-
var/shifty = rand(-pixelshifty,pixelshifty)
1135-
animate(src, pixel_x = pixel_x + shiftx, pixel_y = pixel_y + shifty, time = 0.2, loop = duration)
1136-
pixel_x = initialpixelx
1137-
pixel_y = initialpixely
1133+
1134+
animate(src, pixel_x = initialpixelx + rand(-pixelshiftx,pixelshiftx), pixel_y = initialpixelx + rand(-pixelshifty,pixelshifty), time = shake_interval, flags = ANIMATION_PARALLEL)
1135+
1136+
for (var/i in 3 to ((duration / shake_interval))) // Start at 3 because we already applied one, and need another to reset
1137+
animate(pixel_x = initialpixelx + rand(-pixelshiftx,pixelshiftx), pixel_y = initialpixely + rand(-pixelshifty,pixelshifty), time = shake_interval)
1138+
1139+
animate(pixel_x = initialpixelx, pixel_y = initialpixely, time = shake_interval)
11381140

11391141
///Checks if the given iconstate exists in the given file, caching the result. Setting scream to TRUE will print a stack trace ONCE.
11401142
/proc/icon_exists(file, state, scream)

code/datums/actions/mobs/charge.dm

+3-1
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@
187187
cooldown_time = 6 SECONDS
188188
charge_delay = 1.5 SECONDS
189189
charge_distance = 4
190+
/// How long to shake before charging
190191
var/shake_duration = 1 SECONDS
191-
var/shake_pixel_shift = 15
192+
/// Intensity of shaking animation
193+
var/shake_pixel_shift = 2
192194

193195
/datum/action/cooldown/mob_cooldown/charge/basic_charge/do_charge_indicator(atom/charger, atom/charge_target)
194196
charger.Shake(shake_pixel_shift, shake_pixel_shift, shake_duration)

code/modules/mob/living/basic/basic_defense.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
if (EMP_LIGHT)
197197
visible_message(span_danger("[src] shakes violently, its parts coming loose!"))
198198
apply_damage(maxHealth * 0.6)
199-
Shake(5, 5, 1 SECONDS)
199+
Shake(duration = 1 SECONDS)
200200
if (EMP_HEAVY)
201201
visible_message(span_danger("[src] suddenly bursts apart!"))
202202
apply_damage(maxHealth)

code/modules/mob/living/simple_animal/animal_defense.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
if (EMP_LIGHT)
168168
visible_message(span_danger("[src] shakes violently, its parts coming loose!"))
169169
apply_damage(maxHealth * 0.6)
170-
Shake(5, 5, 1 SECONDS)
170+
Shake(duration = 1 SECONDS)
171171
if (EMP_HEAVY)
172172
visible_message(span_danger("[src] suddenly bursts apart!"))
173173
apply_damage(maxHealth)

code/modules/vehicles/mecha/combat/savannah_ivanov.dm

+3-3
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,16 @@
9898
playsound(chassis, 'sound/items/rped.ogg', 50, TRUE)
9999
if(2)
100100
chassis.visible_message(span_warning("[chassis] begins to shake, the sounds of electricity growing louder."))
101-
chassis.Shake(5, 5, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother
101+
chassis.Shake(1, 1, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother
102102
if(3)
103103
chassis.visible_message(span_warning("[chassis] assumes a pose as it rattles violently."))
104-
chassis.Shake(7, 7, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother
104+
chassis.Shake(2, 2, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother
105105
chassis.spark_system.start()
106106
chassis.update_appearance(UPDATE_ICON_STATE)
107107
if(4)
108108
chassis.visible_message(span_warning("[chassis] sparks and shutters as it finalizes preparation."))
109109
playsound(chassis, 'sound/mecha/skyfall_power_up.ogg', 50, TRUE)
110-
chassis.Shake(10, 10, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother
110+
chassis.Shake(3, 3, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother
111111
chassis.spark_system.start()
112112
if(SKYFALL_CHARGELEVEL_LAUNCH)
113113
chassis.visible_message(span_danger("[chassis] leaps into the air!"))

0 commit comments

Comments
 (0)