From 51626dea32d17cd103d07e948d19208608745710 Mon Sep 17 00:00:00 2001 From: AndroBetel <44546836+AndroBetel@users.noreply.github.com> Date: Wed, 12 Jun 2024 02:06:43 +0300 Subject: [PATCH] ports shockwaves (#286) --- code/__DEFINES/layers.dm | 3 + code/_onclick/hud/rendering/plane_master.dm | 7 ++ code/_onclick/hud/rendering/render_plate.dm | 4 ++ code/datums/autocells/explosion.dm | 3 + .../game/objects/effects/temporary_visuals.dm | 22 +++++++ .../mob/living/carbon/xenomorph/Abilities.dm | 2 +- .../abilities/predalien/predalien_powers.dm | 2 +- .../living/carbon/xenomorph/update_icons.dm | 65 ++++++++++++------- 8 files changed, 81 insertions(+), 27 deletions(-) diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm index c0ccd5164b..598cfcdfec 100644 --- a/code/__DEFINES/layers.dm +++ b/code/__DEFINES/layers.dm @@ -11,6 +11,9 @@ //#define AREA_LAYER 1 +#define DISPLACEMENT_PLATE_RENDER_LAYER 1 +#define DISPLACEMENT_PLATE_RENDER_TARGET "*DISPLACEMENT_PLATE_RENDER_TARGET" + #define UNDER_TURF_LAYER 1.99 #define TURF_LAYER 2 diff --git a/code/_onclick/hud/rendering/plane_master.dm b/code/_onclick/hud/rendering/plane_master.dm index 91c0e24fae..c337ee198e 100644 --- a/code/_onclick/hud/rendering/plane_master.dm +++ b/code/_onclick/hud/rendering/plane_master.dm @@ -175,3 +175,10 @@ plane = ESCAPE_MENU_PLANE appearance_flags = PLANE_MASTER|NO_CLIENT_COLOR render_relay_plane = RENDER_PLANE_MASTER + +/atom/movable/screen/plane_master/displacement + name = "displacement plane" + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + plane = DISPLACEMENT_PLATE_RENDER_LAYER + render_target = DISPLACEMENT_PLATE_RENDER_TARGET + render_relay_plane = null diff --git a/code/_onclick/hud/rendering/render_plate.dm b/code/_onclick/hud/rendering/render_plate.dm index 18236c6ee7..cb579eb4ff 100644 --- a/code/_onclick/hud/rendering/render_plate.dm +++ b/code/_onclick/hud/rendering/render_plate.dm @@ -39,6 +39,10 @@ plane = RENDER_PLANE_GAME render_relay_plane = RENDER_PLANE_MASTER +/atom/movable/screen/plane_master/rendering_plate/game_world/Initialize(mapload, datum/hud/hud_owner) + . = ..() + add_filter("displacer", 1, displacement_map_filter(render_source = DISPLACEMENT_PLATE_RENDER_TARGET, size = 10)) + ///render plate for OOC stuff like ghosts, hud-screen effects, etc /atom/movable/screen/plane_master/rendering_plate/non_game name = "non-game rendering plate" diff --git a/code/datums/autocells/explosion.dm b/code/datums/autocells/explosion.dm index 0b54a53a57..2efc7a8a3e 100644 --- a/code/datums/autocells/explosion.dm +++ b/code/datums/autocells/explosion.dm @@ -282,6 +282,9 @@ as having entered the turf. if(QDELETED(E)) return + if(power >= 150) //shockwave for anything over 150 power + new /obj/effect/shockwave(epicenter, power/60) + E.power = power E.power_falloff = falloff E.falloff_shape = falloff_shape diff --git a/code/game/objects/effects/temporary_visuals.dm b/code/game/objects/effects/temporary_visuals.dm index 4dc07b76f3..1f3800fa01 100644 --- a/code/game/objects/effects/temporary_visuals.dm +++ b/code/game/objects/effects/temporary_visuals.dm @@ -96,3 +96,25 @@ splatter_type = "csplatter" color = BLOOD_COLOR_SYNTHETIC +//------------------------------------------ +//Shockwaves +//------------------------------------------ + +/obj/effect/shockwave + icon = 'icons/effects/light_overlays/shockwave.dmi' + icon_state = "shockwave" + plane = DISPLACEMENT_PLATE_RENDER_LAYER + pixel_x = -496 + pixel_y = -496 + +/obj/effect/shockwave/Initialize(mapload, radius, speed, easing_type = LINEAR_EASING, y_offset, x_offset) + . = ..() + if(!speed) + speed = 1 + if(y_offset) + pixel_y += y_offset + if(x_offset) + pixel_x += x_offset + QDEL_IN(src, 0.5 * radius * speed) + transform = matrix().Scale(32 / 1024, 32 / 1024) + animate(src, time = 0.5 * radius * speed, transform=matrix().Scale((32 / 1024) * radius * 1.5, (32 / 1024) * radius * 1.5), easing = easing_type) diff --git a/code/modules/mob/living/carbon/xenomorph/Abilities.dm b/code/modules/mob/living/carbon/xenomorph/Abilities.dm index 0a6e0ff2ca..2b254fdba9 100644 --- a/code/modules/mob/living/carbon/xenomorph/Abilities.dm +++ b/code/modules/mob/living/carbon/xenomorph/Abilities.dm @@ -141,7 +141,7 @@ playsound(xeno.loc, pick(xeno.screech_sound_effect_list), 75, 0, status = 0) xeno.visible_message(SPAN_XENOHIGHDANGER("[xeno] emits an ear-splitting guttural roar!")) - xeno.create_shriekwave() //Adds the visual effect. Wom wom wom + xeno.create_shriekwave(14) //Adds the visual effect. Wom wom wom, 14 shriekwaves for(var/mob/mob in view()) if(mob && mob.client) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm index 3c475743c0..73d5ace965 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm @@ -15,7 +15,7 @@ playsound(xeno.loc, pick(predalien_roar), 75, 0, status = 0) xeno.visible_message(SPAN_XENOHIGHDANGER("[xeno] emits a guttural roar!")) - xeno.create_shriekwave(color = "#FF0000") + xeno.create_shriekwave(7) for(var/mob/living/carbon/carbon in view(7, xeno)) if(ishuman(carbon)) diff --git a/code/modules/mob/living/carbon/xenomorph/update_icons.dm b/code/modules/mob/living/carbon/xenomorph/update_icons.dm index 880f23f2d8..0fbe71192a 100644 --- a/code/modules/mob/living/carbon/xenomorph/update_icons.dm +++ b/code/modules/mob/living/carbon/xenomorph/update_icons.dm @@ -190,31 +190,46 @@ overlays_standing[X_LEGCUFF_LAYER] = image("icon" = 'icons/mob/xenos/effects.dmi', "icon_state" = "legcuff", "layer" =-X_LEGCUFF_LAYER) apply_overlay(X_LEGCUFF_LAYER) -/mob/living/carbon/xenomorph/proc/create_shriekwave(color = null) - var/image/screech_image - - var/offset_x = 0 - var/offset_y = 0 - if(mob_size <= MOB_SIZE_XENO) - offset_x = -7 - offset_y = -10 - - if (color) - screech_image = image("icon"='icons/mob/xenos/overlay_effects64x64.dmi', "icon_state" = "shriek_waves_greyscale") // For Praetorian screech - screech_image.color = color - else - screech_image = image("icon"='icons/mob/xenos/overlay_effects64x64.dmi', "icon_state" = "shriek_waves") //Ehh, suit layer's not being used. - - screech_image.pixel_x = offset_x - screech_image.pixel_y = offset_y - - screech_image.appearance_flags |= RESET_COLOR - - remove_suit_layer() - - overlays_standing[X_SUIT_LAYER] = screech_image - apply_overlay(X_SUIT_LAYER) - addtimer(CALLBACK(src, PROC_REF(remove_overlay), X_SUIT_LAYER), 30) +/mob/living/carbon/xenomorph/proc/create_shriekwave(shriekwaves_left) + var/offset_y = 8 + if(mob_size == MOB_SIZE_XENO) + offset_y = 24 + if(mob_size == MOB_SIZE_IMMOBILE) + offset_y = 28 + + //the shockwave center is updated eachtime shockwave is called and offset relative to the mob_size. + //due to the speed of the shockwaves, it isn't required to be tied to the exact mob movements + var/epicenter = loc //center of the shockwave, set at the center of the tile that the mob is currently standing on + var/easing = QUAD_EASING | EASE_OUT + var/stage1_radius = rand(11, 12) + var/stage2_radius = rand(9, 11) + var/stage3_radius = rand(8, 10) + var/stage4_radius = 7.5 + + //shockwaves are iterated, counting down once per shriekwave, with the total amount being determined on the respective xeno ability tile + if(shriekwaves_left > 12) + shriekwaves_left-- + new /obj/effect/shockwave(epicenter, stage1_radius, 0.5, easing, offset_y) + addtimer(CALLBACK(src, PROC_REF(create_shriekwave), shriekwaves_left), 2) + return + if(shriekwaves_left > 8) + shriekwaves_left-- + new /obj/effect/shockwave(epicenter, stage2_radius, 0.5, easing, offset_y) + addtimer(CALLBACK(src, PROC_REF(create_shriekwave), shriekwaves_left), 3) + return + if(shriekwaves_left > 4) + shriekwaves_left-- + new /obj/effect/shockwave(epicenter, stage3_radius, 0.5, easing, offset_y) + addtimer(CALLBACK(src, PROC_REF(create_shriekwave), shriekwaves_left), 3) + return + if(shriekwaves_left > 1) + shriekwaves_left-- + new /obj/effect/shockwave(epicenter, stage4_radius, 0.5, easing, offset_y) + addtimer(CALLBACK(src, PROC_REF(create_shriekwave), shriekwaves_left), 3) + return + if(shriekwaves_left == 1) + shriekwaves_left-- + new /obj/effect/shockwave(epicenter, 10.5, 0.6, easing, offset_y) /mob/living/carbon/xenomorph/proc/create_stomp() remove_suit_layer()