[MIRROR] Starlight Polish (Space is blue!) [MDB IGNORE] (#19059)

* Starlight Polish (Space is blue!) (#72886)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

Adds support to underlays to realize_overlays
Ensures decals properly handle plane offsets
Fixes space lighting double applying if it's changeturf'd into. this
will be important later
Makes solar vis_contents block emissives as expected
Moves transit tube overlays to update_overlays, adds emissive blockers
to them

#### Adds render steps

An expansion on render_target based emissive blockers. 
They allow us to hijack an object's appearance and draw it somewhere
else, or even modify it, THEN draw it somewhere else.
They chain quite nicely

Fixes shuttles deleting z holder objects

#### Makes space emissive, makes walls and floors block emissives
The core idea here goes like this:
We make space glow, and give its overlays some color

This way, the tile and space parallax remain fullbright, along with
anything that doesn't block emissives, but anything that does block
emissives will instead get shaded the color of starlight

This requires a bit of extra work, see later

This is done automatically with render relays, which now support
specifiying layer and color (Need to make an editor for these one of
these days)

The emissive blocking floor stuff requires making a second render plate
to prevent double scaling

Also adds some new layering defines for lighting, and ensures all turf
lights have a layer. We'll get to this soon

#### Makes things in space blue

We color them the same as starlight, by taking advantage of space being
emissive
This means that things in space that block emissive will block it
correctly and be colored blue by the light overlay, but space itself
will remain fullbright

This does require redefining what always_lit means, but nothing but
cordons use that so it's fineee


#### Makes glass above space glow, and some other stuff

Glass tiles that sit above space will now shine light with matching
color to the glasses color. This includes mat tiles.

Glass tiles (not mat because they have no alpha) also only partially
block emissives.
Adds a new proc that uses render steps to acomplish this, essentially
we're cutting out bits below X alpha and drawing what remains as an
emissive.

#### Modifies partial space showing to support glow

Essentially, alongside displaying space as an underlay, we also display
a light overlay colored like starlight.
That starlight overlay gets masked to only be visible in bits that do
not contain any alpha.

We also mask the turf lighting to not go into bits that have no alpha,
to ensure we get the effect we want.
This is done with that lighting layer thing I mentioned earlier.

#### Makes appearance realization's list output ordered

I want it output in order of overlay, sub overlay suboverlay, next
overlay
Need to use insert for that

## Why It's Good For The Game

Pretty!
Also having space be emissive is a very very good way to test for fucked
emissive blockers (If it's broken why are we even drawing the overlay)
I know for a fact mob blockers on lizards and socks are kinda yorked, I
think there's more

<details>
<summary>
Old
</summary>


![image](https://user-images.githubusercontent.com/58055496/213916157-d4b38aa7-3ab6-42a4-989f-7bfba2dc2cba.png)

![image](https://user-images.githubusercontent.com/58055496/213916077-637fa288-bbee-477d-aded-730d9683477e.png)

![image](https://user-images.githubusercontent.com/58055496/213916088-0657a8a2-5627-48e2-8c4b-870c90ef2072.png)

</details>


<details>
<summary>
New
</summary>


![image](https://user-images.githubusercontent.com/58055496/213916107-2af74e64-1817-4a44-b528-180a9160cb9e.png)

![image](https://user-images.githubusercontent.com/58055496/213916115-5fa36fcc-b988-4ccf-850e-21c26ed463d0.png)

![image](https://user-images.githubusercontent.com/58055496/213916120-6833187d-b12e-42a7-ac4b-63c56deb71e5.png)

</details>

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

🆑
add: Space now makes things in it starlight faintly blue
fix: Glass floors that display space now properly let space shine
through them, rather then hiding it in the dark
add: Glass floors above space now glow faintly depending on their glass
type
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

---------

Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>

* update modular

* Update _decal.dm

* Update _decal.dm

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-02-12 00:42:28 -08:00
committed by GitHub
co-authored by Zephyr LemonInTheDark Tom lessthanthree
parent 288982afb1
commit 5f9f60713b
35 changed files with 384 additions and 167 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
density = TRUE
blocks_air = TRUE
init_air = FALSE
always_lit = TRUE
space_lit = TRUE
bullet_bounce_sound = null
turf_flags = NOJAUNT
baseturfs = /turf/cordon
-43
View File
@@ -1,43 +0,0 @@
/**
* Internal atom that copies an appearance on to the blocker plane
*
* Copies an appearance vis render_target and render_source on to the emissive blocking plane.
* This means that the atom in question will block any emissive sprites.
* This should only be used internally. If you are directly creating more of these, you're
* almost guaranteed to be doing something wrong.
*/
/atom/movable/emissive_blocker
name = "emissive blocker"
plane = EMISSIVE_PLANE
layer = FLOAT_LAYER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
//Why?
//render_targets copy the transform of the target as well, but vis_contents also applies the transform
//to what's in it. Applying RESET_TRANSFORM here makes vis_contents not apply the transform.
//Since only render_target handles transform we don't get any applied transform "stacking"
appearance_flags = EMISSIVE_APPEARANCE_FLAGS
/atom/movable/emissive_blocker/Initialize(mapload, source)
. = ..()
verbs.Cut() //Cargo culting from lighting object, this maybe affects memory usage?
render_source = source
color = GLOB.em_block_color
/atom/movable/emissive_blocker/ex_act(severity)
return FALSE
/atom/movable/emissive_blocker/singularity_act()
return
/atom/movable/emissive_blocker/singularity_pull()
return
/atom/movable/emissive_blocker/blob_act()
return
//Prevents people from moving these after creation, because they shouldn't be.
/atom/movable/emissive_blocker/forceMove(atom/destination, no_tp=FALSE, harderforce = FALSE)
if(harderforce)
return ..()
+1 -1
View File
@@ -5,7 +5,7 @@
continue
for(var/turf/T as anything in A.get_contained_turfs())
if(T.always_lit)
if(T.space_lit)
continue
new/datum/lighting_object(T)
CHECK_TICK
@@ -7,6 +7,7 @@ GLOBAL_LIST_INIT_TYPED(fullbright_overlays, /mutable_appearance, list(create_ful
SET_PLANE_W_SCALAR(lighting_effect, LIGHTING_PLANE, offset)
lighting_effect.layer = LIGHTING_PRIMARY_LAYER
lighting_effect.blend_mode = BLEND_ADD
lighting_effect.color = COLOR_STARLIGHT
return lighting_effect
/area
@@ -20,7 +21,7 @@ GLOBAL_LIST_INIT_TYPED(fullbright_overlays, /mutable_appearance, list(create_ful
///regenerates lighting objects for turfs in this area, primary use is VV changes
/area/proc/create_area_lighting_objects()
for(var/turf/T in src)
if(T.always_lit)
if(T.space_lit)
continue
T.lighting_build_overlay()
CHECK_TICK
@@ -28,7 +29,7 @@ GLOBAL_LIST_INIT_TYPED(fullbright_overlays, /mutable_appearance, list(create_ful
///Removes lighting objects from turfs in this area if we have them, primary use is VV changes
/area/proc/remove_area_lighting_objects()
for(var/turf/T in src)
if(T.always_lit)
if(T.space_lit)
continue
T.lighting_clear_overlay()
CHECK_TICK
+1 -1
View File
@@ -99,7 +99,7 @@
SSatoms.InitializeAtoms(areas + turfs + movables, returns_created_atoms ? created_atoms : null)
for(var/turf/unlit as anything in turfs)
if(unlit.always_lit)
if(unlit.space_lit)
continue
var/area/loc_area = unlit.loc
if(!loc_area.static_lighting)
@@ -59,6 +59,7 @@
icon_state = "solar_beam"
icon = 'icons/effects/beam.dmi'
plane = LIGHTING_PLANE
layer = LIGHTING_PRIMARY_LAYER
duration = 5
randomdir = FALSE
+6 -3
View File
@@ -51,10 +51,13 @@
SET_PLANE(panel_edge, PLANE_TO_TRUE(panel_edge.plane), new_turf)
SET_PLANE(panel, PLANE_TO_TRUE(panel.plane), new_turf)
/obj/effect/overlay/solar_panel
vis_flags = VIS_INHERIT_ID | VIS_INHERIT_ICON
appearance_flags = TILE_BOUND
blocks_emissive = EMISSIVE_BLOCK_UNIQUE
/obj/machinery/power/solar/proc/add_panel_overlay(icon_state, z_offset)
var/obj/effect/overlay/overlay = new()
overlay.vis_flags = VIS_INHERIT_ID | VIS_INHERIT_ICON
overlay.appearance_flags = TILE_BOUND
var/obj/effect/overlay/solar_panel/overlay = new()
overlay.icon_state = icon_state
SET_PLANE_EXPLICIT(overlay, ABOVE_GAME_PLANE, src)
overlay.pixel_z = z_offset
+6 -3
View File
@@ -43,12 +43,15 @@
SET_PLANE(tracker_dish_edge, PLANE_TO_TRUE(tracker_dish_edge.plane), new_turf)
SET_PLANE(tracker_dish, PLANE_TO_TRUE(tracker_dish.plane), new_turf)
/obj/effect/overlay/tracker
vis_flags = VIS_INHERIT_ID | VIS_INHERIT_ICON
appearance_flags = TILE_BOUND
blocks_emissive = EMISSIVE_BLOCK_UNIQUE
layer = FLY_LAYER
/obj/machinery/power/tracker/proc/add_panel_overlay(icon_state, z_offset)
var/obj/effect/overlay/overlay = new()
overlay.vis_flags = VIS_INHERIT_ID | VIS_INHERIT_ICON
overlay.appearance_flags = TILE_BOUND
overlay.icon_state = icon_state
overlay.layer = FLY_LAYER
SET_PLANE_EXPLICIT(overlay, ABOVE_GAME_PLANE, src)
overlay.pixel_z = z_offset
vis_contents += overlay
+1 -1
View File
@@ -39,7 +39,7 @@ All ShuttleMove procs go here
else //non-living mobs shouldn't be affected by shuttles, which is why this is an else
if(istype(thing, /obj/singularity) || istype(thing, /obj/energy_ball))
if(istype(thing, /obj/effect/abstract) || istype(thing, /obj/singularity) || istype(thing, /obj/energy_ball))
continue
if(!thing.anchored)
step(thing, shuttle_dir)
+71
View File
@@ -0,0 +1,71 @@
/**
* Internal atom that uses render relays to apply "appearance things" to a render source
* Branch, subtypes have behavior
*/
/atom/movable/render_step
name = "render step"
plane = DEFAULT_PLANE
layer = FLOAT_LAYER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
//Why?
//render_targets copy the transform of the target as well, but vis_contents also applies the transform
//we'll display using that, so we gotta reset
appearance_flags = KEEP_APART|KEEP_TOGETHER|RESET_TRANSFORM
/atom/movable/render_step/Initialize(mapload, source)
. = ..()
verbs.Cut() //Cargo cultttttt
render_source = source
/atom/movable/render_step/ex_act(severity)
return FALSE
/atom/movable/render_step/singularity_act()
return
/atom/movable/render_step/singularity_pull()
return
/atom/movable/render_step/blob_act()
return
//Prevents people from moving these after creation, because they shouldn't be.
/atom/movable/render_step/forceMove(atom/destination, no_tp=FALSE, harderforce = FALSE)
if(harderforce)
return ..()
/**
* Render step that modfies an atom's color
* Useful for creating coherent emissive blockers out of things like glass floors by lowering alpha statically using matrixes
* Other stuff too I'm sure
*/
/atom/movable/render_step/color
name = "color step"
//RESET_COLOR is obvious I hope
appearance_flags = KEEP_APART|KEEP_TOGETHER|RESET_COLOR|RESET_TRANSFORM
/atom/movable/render_step/color/Initialize(mapload, source, color)
. = ..()
src.color = color
/**
* Render step that makes the passed in render source block emissives
*
* Copies an appearance vis render_target and render_source on to the emissive blocking plane.
* This means that the atom in question will block any emissive sprites.
* This should only be used internally. If you are directly creating more of these, you're
* almost guaranteed to be doing something wrong.
*/
/**
* Render step that modfies an atom's color
* Useful for creating coherent emissive blockers out of things like glass floors by lowering alpha statically using matrixes
* Other stuff too I'm sure
*/
/atom/movable/render_step/emissive_blocker
name = "emissive blocker"
plane = EMISSIVE_PLANE
appearance_flags = EMISSIVE_APPEARANCE_FLAGS|RESET_TRANSFORM
/atom/movable/render_step/emissive_blocker/Initialize(mapload, source)
. = ..()
src.color = GLOB.em_block_color