Refactors immerse element to use alpha filters instead of static overlays (#93038)

## About The Pull Request
Immerse element now uses an alpha filter rather than a vis_contents
object, which allows them to be much more smooth and seamless. There's
no longer a visible contour on fully opaque liquids, nor a janky effect
when you move in a liquid. This also fixes the broken fluid animation,
so now it actually has a bit of a wave to it.

<img width="179" height="183" alt="dreamseeker_PDjP1zyMRl"
src="https://github.com/user-attachments/assets/7c1bbefe-0e97-456e-a303-c34e6a1a238a"
/>
<img width="177" height="180" alt="dreamseeker_hGjKOyBL8f"
src="https://github.com/user-attachments/assets/6c3bc33f-a22c-452a-beb0-9dd44b080a7c"
/>

<img width="152" height="162" alt="dreamseeker_Et3eRd3NF6"
src="https://github.com/user-attachments/assets/1478aaba-d345-44de-8baa-9d0da0bc9d1c"
/>
<img width="185" height="182" alt="dreamseeker_5Iok1lUni2"
src="https://github.com/user-attachments/assets/4ac5fea4-24a7-46c2-b475-4445a43493b4"
/>

The code is immensely cursed in some places, ideally this should not
have to use vis_contents whatsoever but BYOND seems to be intent on
causing memory leaks whenever you try to set mutable's render_target to
an interpolated string, so I'm using a VIS_HIDE object as a relay for
the filter for the time being.
I've ended up changing some mob pixel_y offsets to pixel_z (as they
should've been from the start) to account for this (the logic is being
that pixel_y is "physical" position on the turf, while pixel_z is how
high above the turf something is)

## Why It's Good For The Game

The effect is less jank and looks cool.

## Changelog
🆑
refactor: Refactors immerse element to use alpha filters instead of
static overlays. It should look much prettier now.
/🆑
This commit is contained in:
SmArtKar
2025-09-21 15:01:40 +02:00
committed by GitHub
parent ff6d141d9e
commit 7601d66a96
18 changed files with 189 additions and 319 deletions
@@ -22,8 +22,8 @@
speed = 5
pixel_x = -16
base_pixel_x = -16
pixel_y = -16
base_pixel_y = -16
pixel_z = -16
base_pixel_z = -16
///the state of combat we are in
var/attack_state = MOOK_ATTACK_NEUTRAL
@@ -134,8 +134,8 @@
layer = BELOW_MOB_LAYER
plane = GAME_PLANE
pixel_x = -16
pixel_y = -16
base_pixel_y = -16
pixel_z = -16
base_pixel_z = -16
base_pixel_x = -16
duration = 1 SECONDS
@@ -18,6 +18,9 @@ GLOBAL_LIST_EMPTY(raptor_population)
#define HAPPINESS_BOOST_DAMPENER 0.3
/// Innate raptor offsets
#define RAPTOR_INNATE_SOURCE "raptor_innate"
/mob/living/basic/raptor
name = "raptor"
desc = "A trusty, powerful steed. Taming it might prove difficult..."
@@ -151,17 +154,13 @@ GLOBAL_LIST_EMPTY(raptor_population)
switch (direction)
if (NORTH)
pixel_x = -8
pixel_y = -5
add_offsets(RAPTOR_INNATE_SOURCE, w_add = -8, animate = FALSE)
if (SOUTH)
pixel_x = 0
pixel_y = 0
add_offsets(RAPTOR_INNATE_SOURCE, w_add = 0, animate = FALSE)
if (EAST, SOUTHEAST, NORTHEAST)
pixel_x = -20
pixel_y = 0
add_offsets(RAPTOR_INNATE_SOURCE, w_add = -20, animate = FALSE)
if (WEST, SOUTHWEST, NORTHWEST)
pixel_x = -5
pixel_y = 0
add_offsets(RAPTOR_INNATE_SOURCE, w_add = -5, animate = FALSE)
/mob/living/basic/raptor/early_melee_attack(atom/target, list/modifiers, ignore_cooldown)
. = ..()
@@ -344,3 +343,4 @@ GLOBAL_LIST_EMPTY(raptor_population)
return NONE
#undef HAPPINESS_BOOST_DAMPENER
#undef RAPTOR_INNATE_SOURCE