From 1bbd25c2861e4a6982c336b066073eb48295e32c Mon Sep 17 00:00:00 2001 From: GrrrKitten Date: Wed, 13 Mar 2024 19:40:42 -0400 Subject: [PATCH 1/6] 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)) From 85d466cf6bb74efb570c097a441458666cac54ee Mon Sep 17 00:00:00 2001 From: GrrrKitten <158611449+GrrrKitten@users.noreply.github.com> Date: Mon, 25 Mar 2024 22:25:18 -0400 Subject: [PATCH 2/6] Update code/datums/autocells/explosion.dm Co-authored-by: harryob --- code/datums/autocells/explosion.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/autocells/explosion.dm b/code/datums/autocells/explosion.dm index a449dbdc843c..ecc6f9925800 100644 --- a/code/datums/autocells/explosion.dm +++ b/code/datums/autocells/explosion.dm @@ -283,7 +283,7 @@ as having entered the turf. return if(power >= 150) //shockwave for anything over 150 power - new /obj/effect/temp_visual/shockwave(epicenter, power/60) + new /obj/effect/shockwave(epicenter, power/60) E.power = power E.power_falloff = falloff From bfa87657038bdbdc952f47b86bd7d7bb68283041 Mon Sep 17 00:00:00 2001 From: GrrrKitten <158611449+GrrrKitten@users.noreply.github.com> Date: Mon, 25 Mar 2024 22:25:29 -0400 Subject: [PATCH 3/6] Update code/game/objects/effects/temporary_visuals.dm Co-authored-by: harryob --- code/game/objects/effects/temporary_visuals.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/effects/temporary_visuals.dm b/code/game/objects/effects/temporary_visuals.dm index 6aca5453e6fa..f08b8ba436d7 100644 --- a/code/game/objects/effects/temporary_visuals.dm +++ b/code/game/objects/effects/temporary_visuals.dm @@ -110,6 +110,6 @@ /obj/effect/temp_visual/shockwave/Initialize(mapload, radius) . = ..() deltimer(timerid) - timerid = QDEL_IN_STOPPABLE(src, 0.5 * radius) + QDEL_IN(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)) From d5bd4f349392712e706802d2d2562a2ef395dd99 Mon Sep 17 00:00:00 2001 From: GrrrKitten <158611449+GrrrKitten@users.noreply.github.com> Date: Mon, 25 Mar 2024 22:26:05 -0400 Subject: [PATCH 4/6] Update code/game/objects/effects/temporary_visuals.dm Co-authored-by: harryob --- code/game/objects/effects/temporary_visuals.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/objects/effects/temporary_visuals.dm b/code/game/objects/effects/temporary_visuals.dm index f08b8ba436d7..45a48a6f01af 100644 --- a/code/game/objects/effects/temporary_visuals.dm +++ b/code/game/objects/effects/temporary_visuals.dm @@ -100,14 +100,14 @@ //Shockwaves //------------------------------------------ -/obj/effect/temp_visual/shockwave +/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/temp_visual/shockwave/Initialize(mapload, radius) +/obj/effect/shockwave/Initialize(mapload, radius) . = ..() deltimer(timerid) QDEL_IN(src, 0.5 * radius) From f7eb8e6dc0a3548a5c7c1b6529c9f7d0fff4d1fb Mon Sep 17 00:00:00 2001 From: GrrrKitten Date: Mon, 25 Mar 2024 22:26:39 -0400 Subject: [PATCH 5/6] removes qdel in stoppable --- code/__DEFINES/qdel.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/__DEFINES/qdel.dm b/code/__DEFINES/qdel.dm index 624602307b9f..2093f80be50e 100644 --- a/code/__DEFINES/qdel.dm +++ b/code/__DEFINES/qdel.dm @@ -54,7 +54,6 @@ #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. From 8dba9adaa4ad24e2d9a8c502da970c856149faa1 Mon Sep 17 00:00:00 2001 From: GrrrKitten Date: Mon, 25 Mar 2024 22:55:17 -0400 Subject: [PATCH 6/6] whoopsies forgot to commit --- code/game/objects/effects/temporary_visuals.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/game/objects/effects/temporary_visuals.dm b/code/game/objects/effects/temporary_visuals.dm index 45a48a6f01af..af3f3692587f 100644 --- a/code/game/objects/effects/temporary_visuals.dm +++ b/code/game/objects/effects/temporary_visuals.dm @@ -109,7 +109,6 @@ /obj/effect/shockwave/Initialize(mapload, radius) . = ..() - deltimer(timerid) QDEL_IN(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))