mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
there that's all (#22672)
This commit is contained in:
@@ -13,18 +13,18 @@
|
||||
#define PLANE_SPACE -21
|
||||
#define PLANE_SPACE_PARALLAX -20
|
||||
|
||||
#define GRAVITY_PULSE_PLANE -19
|
||||
#define GRAVITY_PULSE_PLANE -12
|
||||
#define GRAVITY_PULSE_RENDER_TARGET "*GRAVPULSE_RENDER_TARGET"
|
||||
|
||||
#define RENDER_PLANE_TRANSPARENT -18 //Transparent plane that shows openspace underneath the floor
|
||||
#define TRANSPARENT_FLOOR_PLANE -13
|
||||
#define RENDER_PLANE_TRANSPARENT -11 //Transparent plane that shows openspace underneath the floor
|
||||
|
||||
#define FLOOR_PLANE -12
|
||||
#define FLOOR_PLANE_RENDER_TARGET "*FLOOR_PLANE"
|
||||
#define WALL_PLANE -11
|
||||
#define GAME_PLANE -10
|
||||
#define ABOVE_GAME_PLANE -9
|
||||
#define TRANSPARENT_FLOOR_PLANE -10
|
||||
|
||||
#define FLOOR_PLANE -6
|
||||
|
||||
#define WALL_PLANE -5
|
||||
#define GAME_PLANE -4
|
||||
#define ABOVE_GAME_PLANE -3
|
||||
///Slightly above the game plane but does not catch mouse clicks. Useful for certain visuals that should be clicked through, like seethrough trees
|
||||
#define SEETHROUGH_PLANE -2
|
||||
|
||||
@@ -34,10 +34,9 @@
|
||||
|
||||
#define WEATHER_PLANE 1
|
||||
#define AREA_PLANE 2
|
||||
|
||||
#define MASSIVE_OBJ_PLANE 6
|
||||
#define GHOST_PLANE 7
|
||||
#define POINT_PLANE 8
|
||||
#define MASSIVE_OBJ_PLANE 3
|
||||
#define GHOST_PLANE 4
|
||||
#define POINT_PLANE 5
|
||||
|
||||
//---------- LIGHTING -------------
|
||||
///Normal 1 per turf dynamic lighting underlays
|
||||
@@ -66,6 +65,7 @@
|
||||
|
||||
///Things that should render ignoring lighting
|
||||
#define ABOVE_LIGHTING_PLANE 17
|
||||
|
||||
#define WEATHER_GLOW_PLANE 18
|
||||
|
||||
///---------------- MISC -----------------------
|
||||
|
||||
@@ -256,6 +256,7 @@
|
||||
name = "Weather"
|
||||
documentation = "Holds the main tiling 32x32 sprites of weather. We mask against walls that are on the edge of weather effects."
|
||||
plane = WEATHER_PLANE
|
||||
start_hidden = TRUE
|
||||
|
||||
/atom/movable/screen/plane_master/weather/set_home(datum/plane_master_group/home)
|
||||
. = ..()
|
||||
@@ -309,12 +310,14 @@
|
||||
name = "Weather Glow"
|
||||
documentation = "Holds the glowing parts of the main tiling 32x32 sprites of weather."
|
||||
plane = WEATHER_GLOW_PLANE
|
||||
start_hidden = TRUE
|
||||
|
||||
/atom/movable/screen/plane_master/weather_glow/set_home(datum/plane_master_group/home)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
home.AddComponent(/datum/component/hide_weather_planes, src)
|
||||
|
||||
/**
|
||||
* Handles emissive overlays and emissive blockers.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/// Component that manages a list of plane masters that are dependent on weather
|
||||
/// Force hides/shows them depending on the weather activity of their z stack
|
||||
/// Applied to the plane master group that owns them
|
||||
/**
|
||||
* Component that manages a list of plane masters that are dependent on weather
|
||||
* Force hides/shows them depending on the weather activity of their z stack
|
||||
* Transparency is achieved by manipulating the alpha of the planes that are visible
|
||||
* Applied to the plane master group that owns them
|
||||
*/
|
||||
/datum/component/hide_weather_planes
|
||||
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
|
||||
var/list/datum/weather/active_weather = list()
|
||||
@@ -36,17 +39,25 @@
|
||||
/datum/component/hide_weather_planes/InheritComponent(datum/component/new_comp, i_am_original, atom/movable/screen/plane_master/care_about)
|
||||
if(!i_am_original)
|
||||
return
|
||||
var/datum/plane_master_group/home = parent
|
||||
var/mob/our_lad = home.our_hud?.mymob
|
||||
var/our_offset = GET_TURF_PLANE_OFFSET(our_lad)
|
||||
plane_masters += care_about
|
||||
RegisterSignal(care_about, COMSIG_QDELETING, PROC_REF(plane_master_deleted))
|
||||
if(length(active_weather))
|
||||
care_about.enable_alpha()
|
||||
//If there's weather to care about we unhide our new plane and adjust its alpha
|
||||
care_about.unhide_plane(our_lad)
|
||||
|
||||
if(care_about.offset >= our_offset)
|
||||
care_about.enable_alpha()
|
||||
else
|
||||
care_about.disable_alpha()
|
||||
else
|
||||
care_about.disable_alpha()
|
||||
care_about.hide_plane(our_lad)
|
||||
|
||||
/datum/component/hide_weather_planes/proc/new_hud_attached(datum/source, datum/hud/new_hud)
|
||||
SIGNAL_HANDLER
|
||||
if(new_hud)
|
||||
attach_hud(new_hud)
|
||||
attach_hud(new_hud)
|
||||
|
||||
/datum/component/hide_weather_planes/proc/attach_hud(datum/hud/new_hud)
|
||||
RegisterSignal(new_hud, COMSIG_HUD_Z_CHANGED, PROC_REF(z_changed))
|
||||
@@ -58,27 +69,34 @@
|
||||
SIGNAL_HANDLER
|
||||
plane_masters -= source
|
||||
|
||||
/**
|
||||
* Unhides the relevant planes for the weather to be visible and manipulated.
|
||||
* Also updates the alpha of the planes so enabled planes are either fully opaque or fully transparent
|
||||
*/
|
||||
/datum/component/hide_weather_planes/proc/display_planes()
|
||||
var/datum/plane_master_group/home = parent
|
||||
var/mob/our_lad = home.our_hud?.mymob
|
||||
var/our_offset = GET_TURF_PLANE_OFFSET(our_lad)
|
||||
for(var/atom/movable/screen/plane_master/weather_concious as anything in plane_masters)
|
||||
//We need to make sure that planes above us are hidden, but below us are visible
|
||||
if(!weather_concious.alpha_enabled && weather_concious.offset >= our_offset)
|
||||
weather_concious.enable_alpha()
|
||||
//If the plane is hidden, unhide it
|
||||
if(weather_concious.force_hidden)
|
||||
weather_concious.unhide_plane(our_lad)
|
||||
|
||||
//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.
|
||||
if(weather_concious.offset >= our_offset)
|
||||
weather_concious.enable_alpha()
|
||||
else
|
||||
weather_concious.disable_alpha()
|
||||
|
||||
///Hides the planes from the mob when no weather is occuring
|
||||
/datum/component/hide_weather_planes/proc/hide_planes()
|
||||
var/datum/plane_master_group/home = parent
|
||||
var/mob/our_lad = home.our_hud?.mymob
|
||||
for(var/atom/movable/screen/plane_master/weather_concious as anything in plane_masters)
|
||||
weather_concious.disable_alpha()
|
||||
weather_concious.hide_plane(our_lad)
|
||||
|
||||
/datum/component/hide_weather_planes/proc/z_changed(datum/source, new_z)
|
||||
SIGNAL_HANDLER
|
||||
/**
|
||||
* We hide all impacted planes on z change first because weather planes on lower offsets will show through the game world
|
||||
* 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,
|
||||
* which aren't beholden to z-levels and planes like atoms we're used to
|
||||
*/
|
||||
hide_planes()
|
||||
active_weather = list()
|
||||
if(!SSmapping.initialized)
|
||||
return
|
||||
@@ -90,6 +108,8 @@
|
||||
|
||||
if(length(active_weather))
|
||||
display_planes()
|
||||
else
|
||||
hide_planes()
|
||||
|
||||
/datum/component/hide_weather_planes/proc/weather_started(datum/source, datum/weather/starting)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
Reference in New Issue
Block a user