diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 12376f06cc5..fd9de80a374 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -1402,15 +1402,14 @@ GLOBAL_LIST_EMPTY(transformation_animation_objects) sleep(duration) cut_overlay(overlay_image) -///Perform a shake on an atom, resets its position afterwards -/atom/proc/Shake(pixelshiftx = 15, pixelshifty = 15, duration = 250) +/// Perform a shake on an atom, resets its position afterwards +/atom/proc/Shake(pixelshiftx = 2, pixelshifty = 2, duration = 2.5 SECONDS, shake_interval = 0.02 SECONDS) var/initialpixelx = pixel_x var/initialpixely = pixel_y - var/shiftx = rand(-pixelshiftx,pixelshiftx) - var/shifty = rand(-pixelshifty,pixelshifty) - animate(src, pixel_x = pixel_x + shiftx, pixel_y = pixel_y + shifty, time = 0.2, loop = duration) - pixel_x = initialpixelx - pixel_y = initialpixely + animate(src, pixel_x = initialpixelx + rand(-pixelshiftx,pixelshiftx), pixel_y = initialpixelx + rand(-pixelshifty,pixelshifty), time = shake_interval, flags = ANIMATION_PARALLEL) + for (var/i in 3 to ((duration / shake_interval))) // Start at 3 because we already applied one, and need another to reset + animate(pixel_x = initialpixelx + rand(-pixelshiftx,pixelshiftx), pixel_y = initialpixely + rand(-pixelshifty,pixelshifty), time = shake_interval) + animate(pixel_x = initialpixelx, pixel_y = initialpixely, time = shake_interval) ///Checks if the given iconstate exists in the given file, caching the result. Setting scream to TRUE will print a stack trace ONCE. /proc/icon_exists(file, state, scream) diff --git a/code/datums/actions/mobs/charge.dm b/code/datums/actions/mobs/charge.dm index 17d5c3600a5..71e145a6720 100644 --- a/code/datums/actions/mobs/charge.dm +++ b/code/datums/actions/mobs/charge.dm @@ -173,8 +173,10 @@ cooldown_time = 6 SECONDS charge_delay = 1.5 SECONDS charge_distance = 4 + /// How long to shake for before charging var/shake_duration = 1 SECONDS - var/shake_pixel_shift = 15 + /// Intensity of shaking animation + var/shake_pixel_shift = 2 /datum/action/cooldown/mob_cooldown/charge/basic_charge/do_charge_indicator(atom/charger, atom/charge_target) charger.Shake(shake_pixel_shift, shake_pixel_shift, shake_duration) diff --git a/code/game/machinery/dna_infuser/dna_infuser.dm b/code/game/machinery/dna_infuser/dna_infuser.dm index bb279178f05..24596e4ea6f 100644 --- a/code/game/machinery/dna_infuser/dna_infuser.dm +++ b/code/game/machinery/dna_infuser/dna_infuser.dm @@ -77,7 +77,7 @@ to_chat(human_occupant, span_danger("Little needles repeatedly prick you!")) human_occupant.take_overall_damage(10) human_occupant.add_mob_memory(/datum/memory/dna_infusion, protagonist = human_occupant, deuteragonist = infusing_from, mutantlike = infusing_into.infusion_desc) - Shake(15, 15, INFUSING_TIME) + Shake(duration = INFUSING_TIME) addtimer(CALLBACK(human_occupant, TYPE_PROC_REF(/mob, emote), "scream"), INFUSING_TIME - 1 SECONDS) addtimer(CALLBACK(src, PROC_REF(end_infuse)), INFUSING_TIME) update_appearance() diff --git a/code/game/objects/items/v8_engine.dm b/code/game/objects/items/v8_engine.dm index 86363e40b21..e143aed2401 100644 --- a/code/game/objects/items/v8_engine.dm +++ b/code/game/objects/items/v8_engine.dm @@ -24,7 +24,7 @@ if (!COOLDOWN_FINISHED(src, engine_sound_cooldown)) return playsound(src, 'sound/items/car_engine_start.ogg', vol = 75, vary = FALSE, extrarange = 3) - Shake(7, 7, ENGINE_COOLDOWN) + Shake(duration = ENGINE_COOLDOWN) to_chat(user, span_notice("Darn thing... it's too old to keep on without retrofitting it! Without modifications, it works like it's junk.")) COOLDOWN_START(src, engine_sound_cooldown, ENGINE_COOLDOWN) diff --git a/code/game/objects/structures/mystery_box.dm b/code/game/objects/structures/mystery_box.dm index f3f8f4f1dc9..817b0f4ba45 100644 --- a/code/game/objects/structures/mystery_box.dm +++ b/code/game/objects/structures/mystery_box.dm @@ -174,7 +174,7 @@ GLOBAL_LIST_INIT(mystery_box_extended, list( SSsounds.free_sound_channel(current_sound_channel) current_sound_channel = null box_state = MYSTERY_BOX_STANDBY - Shake(10, 0, 0.5 SECONDS) + Shake(3, 0, 0.5 SECONDS) /// Someone attacked the box with an empty hand, spawn the shown prize and give it to them, then close the box /obj/structure/mystery_box/proc/grant_weapon(mob/living/user) diff --git a/code/modules/mob/living/basic/basic_defense.dm b/code/modules/mob/living/basic/basic_defense.dm index d22ae01c2d4..7d00dbda288 100644 --- a/code/modules/mob/living/basic/basic_defense.dm +++ b/code/modules/mob/living/basic/basic_defense.dm @@ -194,7 +194,7 @@ if(EMP_LIGHT) visible_message(span_danger("[src] shakes violently, its parts coming loose!")) apply_damage(maxHealth * 0.6) - Shake(5, 5, 1 SECONDS) + Shake(duration = 1 SECONDS) if(EMP_HEAVY) visible_message(span_danger("[src] suddenly bursts apart!")) apply_damage(maxHealth) diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index c51b2c644b9..4f2cd0f19ee 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -191,7 +191,7 @@ if (EMP_LIGHT) visible_message(span_danger("[src] shakes violently, its parts coming loose!")) apply_damage(maxHealth * 0.6) - Shake(5, 5, 1 SECONDS) + Shake(duration = 1 SECONDS) if (EMP_HEAVY) visible_message(span_danger("[src] suddenly bursts apart!")) apply_damage(maxHealth) diff --git a/code/modules/vehicles/mecha/combat/savannah_ivanov.dm b/code/modules/vehicles/mecha/combat/savannah_ivanov.dm index a571b2fb261..1ffc40fc10b 100644 --- a/code/modules/vehicles/mecha/combat/savannah_ivanov.dm +++ b/code/modules/vehicles/mecha/combat/savannah_ivanov.dm @@ -111,16 +111,16 @@ playsound(chassis, 'sound/items/rped.ogg', 50, TRUE) if(2) chassis.visible_message(span_warning("[chassis] begins to shake, the sounds of electricity growing louder.")) - chassis.Shake(5, 5, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother + chassis.Shake(1, 1, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother if(3) chassis.visible_message(span_warning("[chassis] assumes a pose as it rattles violently.")) - chassis.Shake(7, 7, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother + chassis.Shake(2, 2, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother chassis.spark_system.start() chassis.update_appearance(UPDATE_ICON_STATE) if(4) chassis.visible_message(span_warning("[chassis] sparks and shutters as it finalizes preparation.")) playsound(chassis, 'sound/mecha/skyfall_power_up.ogg', 50, TRUE) - chassis.Shake(10, 10, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother + chassis.Shake(3, 3, SKYFALL_SINGLE_CHARGE_TIME-1) // -1 gives space between the animates, so they don't interrupt eachother chassis.spark_system.start() if(SKYFALL_CHARGELEVEL_LAUNCH) chassis.visible_message(span_danger("[chassis] leaps into the air!"))