Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 0ef5818

Browse files
there that's all (#22672)
1 parent 28b7093 commit 0ef5818

File tree

3 files changed

+51
-28
lines changed

3 files changed

+51
-28
lines changed

code/__DEFINES/layers.dm

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
#define PLANE_SPACE -21
1414
#define PLANE_SPACE_PARALLAX -20
1515

16-
#define GRAVITY_PULSE_PLANE -19
16+
#define GRAVITY_PULSE_PLANE -12
1717
#define GRAVITY_PULSE_RENDER_TARGET "*GRAVPULSE_RENDER_TARGET"
1818

19-
#define RENDER_PLANE_TRANSPARENT -18 //Transparent plane that shows openspace underneath the floor
20-
#define TRANSPARENT_FLOOR_PLANE -13
19+
#define RENDER_PLANE_TRANSPARENT -11 //Transparent plane that shows openspace underneath the floor
2120

22-
#define FLOOR_PLANE -12
23-
#define FLOOR_PLANE_RENDER_TARGET "*FLOOR_PLANE"
24-
#define WALL_PLANE -11
25-
#define GAME_PLANE -10
26-
#define ABOVE_GAME_PLANE -9
21+
#define TRANSPARENT_FLOOR_PLANE -10
2722

23+
#define FLOOR_PLANE -6
24+
25+
#define WALL_PLANE -5
26+
#define GAME_PLANE -4
27+
#define ABOVE_GAME_PLANE -3
2828
///Slightly above the game plane but does not catch mouse clicks. Useful for certain visuals that should be clicked through, like seethrough trees
2929
#define SEETHROUGH_PLANE -2
3030

@@ -34,10 +34,9 @@
3434

3535
#define WEATHER_PLANE 1
3636
#define AREA_PLANE 2
37-
38-
#define MASSIVE_OBJ_PLANE 6
39-
#define GHOST_PLANE 7
40-
#define POINT_PLANE 8
37+
#define MASSIVE_OBJ_PLANE 3
38+
#define GHOST_PLANE 4
39+
#define POINT_PLANE 5
4140

4241
//---------- LIGHTING -------------
4342
///Normal 1 per turf dynamic lighting underlays
@@ -66,6 +65,7 @@
6665

6766
///Things that should render ignoring lighting
6867
#define ABOVE_LIGHTING_PLANE 17
68+
6969
#define WEATHER_GLOW_PLANE 18
7070

7171
///---------------- MISC -----------------------

code/_onclick/hud/rendering/plane_masters/plane_master_subtypes.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@
256256
name = "Weather"
257257
documentation = "Holds the main tiling 32x32 sprites of weather. We mask against walls that are on the edge of weather effects."
258258
plane = WEATHER_PLANE
259+
start_hidden = TRUE
259260

260261
/atom/movable/screen/plane_master/weather/set_home(datum/plane_master_group/home)
261262
. = ..()
@@ -309,12 +310,14 @@
309310
name = "Weather Glow"
310311
documentation = "Holds the glowing parts of the main tiling 32x32 sprites of weather."
311312
plane = WEATHER_GLOW_PLANE
313+
start_hidden = TRUE
312314

313315
/atom/movable/screen/plane_master/weather_glow/set_home(datum/plane_master_group/home)
314316
. = ..()
315317
if(!.)
316318
return
317319
home.AddComponent(/datum/component/hide_weather_planes, src)
320+
318321
/**
319322
* Handles emissive overlays and emissive blockers.
320323
*/

code/datums/components/hide_weather_planes.dm

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
/// Component that manages a list of plane masters that are dependent on weather
2-
/// Force hides/shows them depending on the weather activity of their z stack
3-
/// Applied to the plane master group that owns them
1+
/**
2+
* Component that manages a list of plane masters that are dependent on weather
3+
* Force hides/shows them depending on the weather activity of their z stack
4+
* Transparency is achieved by manipulating the alpha of the planes that are visible
5+
* Applied to the plane master group that owns them
6+
*/
47
/datum/component/hide_weather_planes
58
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
69
var/list/datum/weather/active_weather = list()
@@ -36,17 +39,25 @@
3639
/datum/component/hide_weather_planes/InheritComponent(datum/component/new_comp, i_am_original, atom/movable/screen/plane_master/care_about)
3740
if(!i_am_original)
3841
return
42+
var/datum/plane_master_group/home = parent
43+
var/mob/our_lad = home.our_hud?.mymob
44+
var/our_offset = GET_TURF_PLANE_OFFSET(our_lad)
3945
plane_masters += care_about
4046
RegisterSignal(care_about, COMSIG_QDELETING, PROC_REF(plane_master_deleted))
4147
if(length(active_weather))
42-
care_about.enable_alpha()
48+
//If there's weather to care about we unhide our new plane and adjust its alpha
49+
care_about.unhide_plane(our_lad)
50+
51+
if(care_about.offset >= our_offset)
52+
care_about.enable_alpha()
53+
else
54+
care_about.disable_alpha()
4355
else
44-
care_about.disable_alpha()
56+
care_about.hide_plane(our_lad)
4557

4658
/datum/component/hide_weather_planes/proc/new_hud_attached(datum/source, datum/hud/new_hud)
4759
SIGNAL_HANDLER
48-
if(new_hud)
49-
attach_hud(new_hud)
60+
attach_hud(new_hud)
5061

5162
/datum/component/hide_weather_planes/proc/attach_hud(datum/hud/new_hud)
5263
RegisterSignal(new_hud, COMSIG_HUD_Z_CHANGED, PROC_REF(z_changed))
@@ -58,27 +69,34 @@
5869
SIGNAL_HANDLER
5970
plane_masters -= source
6071

72+
/**
73+
* Unhides the relevant planes for the weather to be visible and manipulated.
74+
* Also updates the alpha of the planes so enabled planes are either fully opaque or fully transparent
75+
*/
6176
/datum/component/hide_weather_planes/proc/display_planes()
6277
var/datum/plane_master_group/home = parent
6378
var/mob/our_lad = home.our_hud?.mymob
6479
var/our_offset = GET_TURF_PLANE_OFFSET(our_lad)
6580
for(var/atom/movable/screen/plane_master/weather_concious as anything in plane_masters)
66-
//We need to make sure that planes above us are hidden, but below us are visible
67-
if(!weather_concious.alpha_enabled && weather_concious.offset >= our_offset)
81+
//If the plane is hidden, unhide it
82+
if(weather_concious.force_hidden)
83+
weather_concious.unhide_plane(our_lad)
84+
85+
//Now we update the alpha of the plane based on our offset. Weather above us (lower offset) are transparent, weather at or below us (higher offset) are opaque.
86+
if(weather_concious.offset >= our_offset)
6887
weather_concious.enable_alpha()
88+
else
89+
weather_concious.disable_alpha()
6990

91+
///Hides the planes from the mob when no weather is occuring
7092
/datum/component/hide_weather_planes/proc/hide_planes()
93+
var/datum/plane_master_group/home = parent
94+
var/mob/our_lad = home.our_hud?.mymob
7195
for(var/atom/movable/screen/plane_master/weather_concious as anything in plane_masters)
72-
weather_concious.disable_alpha()
96+
weather_concious.hide_plane(our_lad)
7397

7498
/datum/component/hide_weather_planes/proc/z_changed(datum/source, new_z)
7599
SIGNAL_HANDLER
76-
/**
77-
* We hide all impacted planes on z change first because weather planes on lower offsets will show through the game world
78-
* so we can't count on them just not being visible like turfs above you. This is a result of attaching weather effects to areas,
79-
* which aren't beholden to z-levels and planes like atoms we're used to
80-
*/
81-
hide_planes()
82100
active_weather = list()
83101
if(!SSmapping.initialized)
84102
return
@@ -90,6 +108,8 @@
90108

91109
if(length(active_weather))
92110
display_planes()
111+
else
112+
hide_planes()
93113

94114
/datum/component/hide_weather_planes/proc/weather_started(datum/source, datum/weather/starting)
95115
SIGNAL_HANDLER

0 commit comments

Comments
 (0)