Files
Bubberstation/code/datums/components/hide_highest_offset.dm
SmArtKar 0712d9870c Planecube Optimizations and Job Security: Part One (#91696)
## About The Pull Request

This is an atomized revival of #82419, with this part containing the
simplest of its features:
- Fixes AO pref refreshing the wrong plane, thus not updating until you
swap bodies
- Removes supermatter's copypasted warp effect
- Culls distortion effects when they're not in use because its a chonky
filter
- Hides the escape menu when its, well, hidden
- Fixes hide_highest_offset not working upon parent's creation (we're so
good at our jobs hell yeah)
- Replaces runechat's AO dropshadow with an outline, because its barely
visible due to low opacity.

## Why It's Good For The Game

Our rendering performance is shit and we need to improve it, and the
first step in this task is optimizing planecube's simplest parts. The
next step is conditional culling, better non-multiz handling and
parallax rework/removal, but all of those need to be atomized as to
prevent the PR from sharing the fate of the original.

## Changelog
🆑
fix: Ambient Occlusion pref should now update immediately upon being
changed, instead of having to swap bodies or waiting for server restart
to get it updated.
code: Slightly improved rendering code/performance just a tiny bit.
/🆑
2025-06-21 22:21:57 -04:00

25 lines
1.0 KiB
Plaintext

/// Component that takes a plane master, and will hide it if it's the highest offset of its kind
/// This allows us to not show PMs to clients if they're not actively doing anything
/datum/component/plane_hide_highest_offset
/datum/component/plane_hide_highest_offset/Initialize()
if(!istype(parent, /atom/movable/screen/plane_master))
return
RegisterSignal(SSmapping, COMSIG_PLANE_OFFSET_INCREASE, PROC_REF(on_offset_increase))
offset_increase(-1, SSmapping.max_plane_offset)
/datum/component/plane_hide_highest_offset/proc/on_offset_increase(datum/source, old_offset, new_offset)
SIGNAL_HANDLER
offset_increase(old_offset, new_offset)
/datum/component/plane_hide_highest_offset/proc/offset_increase(old_offset, new_offset)
var/atom/movable/screen/plane_master/plane_parent = parent
var/mob/our_mob = plane_parent.home?.our_hud?.mymob
var/our_offset = plane_parent.offset
if(!our_mob)
return
if(our_offset == new_offset)
plane_parent.hide_plane(our_mob)
else if(our_offset == old_offset && plane_parent.force_hidden)
plane_parent.unhide_plane(our_mob)