From 1bbd25c2861e4a6982c336b066073eb48295e32c Mon Sep 17 00:00:00 2001 From: GrrrKitten Date: Wed, 13 Mar 2024 19:40:42 -0400 Subject: [PATCH] adds shockwaves to explosions via Tivi+Ivanmixo --- code/__DEFINES/layers.dm | 3 +++ code/__DEFINES/qdel.dm | 1 + code/_onclick/hud/rendering/plane_master.dm | 7 +++++++ code/_onclick/hud/rendering/render_plate.dm | 4 ++++ code/datums/autocells/explosion.dm | 3 +++ code/game/objects/effects/temporary_visuals.dm | 17 +++++++++++++++++ 6 files changed, 35 insertions(+) diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm index 63e79cdf676d..ee958d87f580 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/__DEFINES/qdel.dm b/code/__DEFINES/qdel.dm index 2093f80be50e..624602307b9f 100644 --- a/code/__DEFINES/qdel.dm +++ b/code/__DEFINES/qdel.dm @@ -54,6 +54,7 @@ #define QDESTROYING(X) (!X || X.gc_destroyed == GC_CURRENTLY_BEING_QDELETED) #define QDEL_IN(item, time) addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), (time) > GC_FILTER_QUEUE ? WEAKREF(item) : item), time, TIMER_STOPPABLE) +#define QDEL_IN_STOPPABLE(item, time) addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), (time) > GC_FILTER_QUEUE ? WEAKREF(item) : item), time, TIMER_STOPPABLE) #define QDEL_IN_CLIENT_TIME(item, time) addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), item), time, TIMER_STOPPABLE | TIMER_CLIENT_TIME) #define QDEL_NULL(item) qdel(item); item = null #define QDEL_NULL_LIST(x) if(x) { for(var/y in x) { qdel(y) }}; if(x) {x.Cut(); x = null } // Second x check to handle items that LAZYREMOVE on qdel. diff --git a/code/_onclick/hud/rendering/plane_master.dm b/code/_onclick/hud/rendering/plane_master.dm index 6625120d1514..c4f070bdd842 100644 --- a/code/_onclick/hud/rendering/plane_master.dm +++ b/code/_onclick/hud/rendering/plane_master.dm @@ -189,3 +189,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 18236c6ee759..cb579eb4ff6a 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 367567a6d40d..a449dbdc843c 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/temp_visual/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 4dc07b76f3cb..6aca5453e6fa 100644 --- a/code/game/objects/effects/temporary_visuals.dm +++ b/code/game/objects/effects/temporary_visuals.dm @@ -96,3 +96,20 @@ splatter_type = "csplatter" color = BLOOD_COLOR_SYNTHETIC +//------------------------------------------ +//Shockwaves +//------------------------------------------ + +/obj/effect/temp_visual/shockwave + icon = 'icons/effects/light_overlays/shockwave.dmi' + icon_state = "shockwave" + plane = DISPLACEMENT_PLATE_RENDER_LAYER + pixel_x = -496 + pixel_y = -496 + +/obj/effect/temp_visual/shockwave/Initialize(mapload, radius) + . = ..() + deltimer(timerid) + timerid = QDEL_IN_STOPPABLE(src, 0.5 * radius) + transform = matrix().Scale(32 / 1024, 32 / 1024) + animate(src, time = 1/2 * radius, transform=matrix().Scale((32 / 1024) * radius * 1.5, (32 / 1024) * radius * 1.5))