mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 00:58:26 +01:00
Starlight Control (Aurora works now, space gas doesn't touch starlight, narsie ending effects) (#78877)
## About The Pull Request [Implements a setter for starlight variables](https://github.com/tgstation/tgstation/commit/af34f06b418b039b2ead90b29112b30adea4bc68) I want to start to modify starlight more, and that means I need a way to hook into everything that uses it and update it, so we can modify it on the fly. This does that, alongside removing space overlays from nearspace (too many false positives) and making the aurora modify all turfs projecting starlight, rather then all turfs in an area. Do still need to figure out handling for the starlight color usage in turf underlays tho (I gave up, we just keep it static. I'll fix it someday but the render_relay strategy just doesn't work with its masking setup) [Reworks how starlight overlays work](https://github.com/tgstation/tgstation/commit/9da4bc38e223e0ce2d91b0c8beddf1ebba968b9c) Instead of setting color on the overlays directly, we instead store an object with our current settings in every mob's screen, and render_target it down onto our overlays. This lets us update overlay colors VERY trivially. Just need to set color on the overlay var. Makes modifying starlight a lot cheaper. It doesn't work on area overlays, because suffering, and it MIGHT induce extra cost on clients. if it does we can do something about that, we'll play it by ear [Removes parallax starlight coloring.](https://github.com/tgstation/tgstation/commit/5f701a1b137c7d4c333929e4cbfdd9d4aa8656d6) I'm sorta iffy on the color, the effect can be real oppressive in some cases, and I'd like to use starlight color for more events in world, and having it vary can make that looking nice hard. [Adds some visual effects to narsie being summoned](https://github.com/tgstation/tgstation/pull/78877/commits/a423cfcb2ba9c0d729b06c36dd7d38ff68c967c2) As the rune drawing progresses space (starlight and parallax) go from normal to greyscale. Then, right about when narsie shows up, starlight becomes vibrant red. It's a nice effect. I wanna do more shit like this, I think it'll improve vibes significantly. ## Why It's Good For The Game Can't embed it because of github's upload limit, can show a [link](https://cdn.discordapp.com/attachments/458452245256601615/1160821856358645860/2023-10-08_22-31-22.mp4?ex=65360e99&is=65239999&hm=680e33e4e0026b89e132afc50c04a648a24f869eb662f274a381a5de5c5a36f2&) for the narsie stuff Here's [one](https://cdn.discordapp.com/attachments/326831214667235328/1160813747196141568/2023-10-08_22-34-10.mp4?ex=6536070c&is=6523920c&hm=f8d571d1013da89887f49f3fec99f632251eeeac83085aa7dde97009aee3922f&) for the aurora too. This gives us more pretty starlight shit, and the ABILITY to do more pretty starlight shit. I'm pretty jazzed, and I hope people use this proc more (keeping in mind that it's pretty hard on the lighting system, and needs significant delay between changes) ## Changelog 🆑 add: Narsie summoning has had some effects added to space and starlight del: Removes the link between spacegas color and starlight. It was a slight bit too vibrant and I think impacted the vibe too wildly to be incidental. fix: The aurora event actually... works now. Space lights up and all that /🆑
This commit is contained in:
@@ -48,33 +48,78 @@
|
||||
add_base_lighting()
|
||||
|
||||
/area/proc/remove_base_lighting()
|
||||
UnregisterSignal(SSdcs, COMSIG_STARLIGHT_COLOR_CHANGED)
|
||||
var/list/z_offsets = SSmapping.z_level_to_plane_offset
|
||||
for(var/turf/T as anything in get_contained_turfs())
|
||||
if(z_offsets[T.z])
|
||||
T.cut_overlay(lighting_effects[z_offsets[T.z] + 1])
|
||||
if(length(lighting_effects) > 1)
|
||||
for(var/turf/T as anything in get_contained_turfs())
|
||||
if(z_offsets[T.z])
|
||||
T.cut_overlay(lighting_effects[z_offsets[T.z] + 1])
|
||||
cut_overlay(lighting_effects[1])
|
||||
QDEL_LIST(lighting_effects)
|
||||
lighting_effects = null
|
||||
area_has_base_lighting = FALSE
|
||||
|
||||
/area/proc/add_base_lighting()
|
||||
lighting_effects = list()
|
||||
for(var/offset in 0 to SSmapping.max_plane_offset)
|
||||
var/mutable_appearance/lighting_effect = mutable_appearance('icons/effects/alphacolors.dmi', "white")
|
||||
SET_PLANE_W_SCALAR(lighting_effect, LIGHTING_PLANE, offset)
|
||||
lighting_effect.layer = LIGHTING_PRIMARY_LAYER
|
||||
lighting_effect.blend_mode = BLEND_ADD
|
||||
lighting_effect.alpha = base_lighting_alpha
|
||||
lighting_effect.color = (base_lighting_color == COLOR_STARLIGHT ? GLOB.starlight_color : base_lighting_color)
|
||||
lighting_effect.appearance_flags = RESET_TRANSFORM | RESET_ALPHA | RESET_COLOR
|
||||
lighting_effects += lighting_effect
|
||||
var/mutable_appearance/light
|
||||
if(base_lighting_color == COLOR_STARLIGHT)
|
||||
light = new(GLOB.starlight_overlays[offset + 1])
|
||||
else
|
||||
light = mutable_appearance('icons/effects/alphacolors.dmi', "white")
|
||||
light.color = base_lighting_color
|
||||
light.layer = LIGHTING_PRIMARY_LAYER
|
||||
light.blend_mode = BLEND_ADD
|
||||
light.appearance_flags = RESET_TRANSFORM | RESET_ALPHA | RESET_COLOR
|
||||
light.alpha = base_lighting_alpha
|
||||
SET_PLANE_W_SCALAR(light, LIGHTING_PLANE, offset)
|
||||
lighting_effects += light
|
||||
|
||||
if(base_lighting_color == COLOR_STARLIGHT)
|
||||
// Ok this is gonna be dumb
|
||||
// We rely on render_source working, and it DOES NOT APPEAR TO in area rendering
|
||||
// So we're gonna have to update the area's overlay manually. everything else can be automatic tho
|
||||
// Fortunately the first overlay is only ever used by the area, soooo
|
||||
var/mutable_appearance/light = mutable_appearance('icons/effects/alphacolors.dmi', "white")
|
||||
light.layer = LIGHTING_PRIMARY_LAYER
|
||||
light.blend_mode = BLEND_ADD
|
||||
light.appearance_flags = RESET_TRANSFORM | RESET_ALPHA | RESET_COLOR
|
||||
light.color = GLOB.starlight_color
|
||||
light.alpha = base_lighting_alpha
|
||||
SET_PLANE_W_SCALAR(light, LIGHTING_PLANE, 0)
|
||||
lighting_effects[1] = light
|
||||
RegisterSignal(SSdcs, COMSIG_STARLIGHT_COLOR_CHANGED, PROC_REF(starlight_changed))
|
||||
|
||||
add_overlay(lighting_effects[1])
|
||||
var/list/z_offsets = SSmapping.z_level_to_plane_offset
|
||||
for(var/turf/T as anything in get_contained_turfs())
|
||||
T.luminosity = 1
|
||||
// This outside loop is EXTREMELY hot because it's run by space tiles. Don't want no part in that
|
||||
// We will only add overlays to turfs not on the first z layer, because that's a significantly lesser portion
|
||||
// And we need to do them separate, or lighting will go fuckey
|
||||
if(z_offsets[T.z])
|
||||
T.add_overlay(lighting_effects[z_offsets[T.z] + 1])
|
||||
if(length(lighting_effects) > 1)
|
||||
// This inside loop is EXTREMELY hot because it's run by space tiles. Don't want no part in that
|
||||
for(var/turf/T as anything in get_contained_turfs())
|
||||
T.luminosity = 1
|
||||
// We will only add overlays to turfs not on the first z layer, because that's a significantly lesser portion
|
||||
// And we need to do them separate, or lighting will go fuckey
|
||||
if(z_offsets[T.z])
|
||||
T.add_overlay(lighting_effects[z_offsets[T.z] + 1])
|
||||
else
|
||||
for(var/turf/T as anything in get_contained_turfs())
|
||||
T.luminosity = 1
|
||||
|
||||
area_has_base_lighting = TRUE
|
||||
|
||||
/area/proc/starlight_changed(datum/source, old_star, new_star)
|
||||
var/mutable_appearance/old_star_effect = mutable_appearance('icons/effects/alphacolors.dmi', "white")
|
||||
old_star_effect.layer = LIGHTING_PRIMARY_LAYER
|
||||
old_star_effect.blend_mode = BLEND_ADD
|
||||
old_star_effect.appearance_flags = RESET_TRANSFORM | RESET_ALPHA | RESET_COLOR
|
||||
old_star_effect.color = old_star
|
||||
old_star_effect.alpha = base_lighting_alpha
|
||||
SET_PLANE_W_SCALAR(old_star_effect, LIGHTING_PLANE, 0)
|
||||
cut_overlay(old_star_effect)
|
||||
var/mutable_appearance/new_star_effect = mutable_appearance('icons/effects/alphacolors.dmi', "white")
|
||||
new_star_effect.layer = LIGHTING_PRIMARY_LAYER
|
||||
new_star_effect.blend_mode = BLEND_ADD
|
||||
new_star_effect.appearance_flags = RESET_TRANSFORM | RESET_ALPHA | RESET_COLOR
|
||||
new_star_effect.color = new_star
|
||||
new_star_effect.alpha = base_lighting_alpha
|
||||
SET_PLANE_W_SCALAR(new_star_effect, LIGHTING_PLANE, 0)
|
||||
add_overlay(new_star_effect)
|
||||
lighting_effects[1] = new_star_effect
|
||||
|
||||
@@ -77,7 +77,8 @@
|
||||
|
||||
if (needs_update)
|
||||
SSlighting.sources_queue -= src
|
||||
|
||||
SSlighting.current_sources -= src
|
||||
|
||||
top_atom = null
|
||||
source_atom = null
|
||||
source_turf = null
|
||||
|
||||
@@ -110,6 +110,9 @@
|
||||
if(new_area.lighting_effects)
|
||||
add_overlay(new_area.lighting_effects[index])
|
||||
|
||||
// If we're changing into an area with no lighting, and we're lit, light ourselves
|
||||
if(!new_area.lighting_effects && old_area.lighting_effects && space_lit)
|
||||
overlays += GLOB.fullbright_overlays[GET_TURF_PLANE_OFFSET(src) + 1]
|
||||
// Manage removing/adding starlight overlays, we'll inherit from the area so we can drop it if the area has it already
|
||||
if(space_lit)
|
||||
if(!new_area.lighting_effects && old_area.lighting_effects)
|
||||
overlays += GLOB.starlight_overlays[GET_TURF_PLANE_OFFSET(src) + 1]
|
||||
else if (new_area.lighting_effects && !old_area.lighting_effects)
|
||||
overlays -= GLOB.starlight_overlays[GET_TURF_PLANE_OFFSET(src) + 1]
|
||||
|
||||
@@ -1,14 +1,38 @@
|
||||
/// List of plane offset + 1 -> object to display to use
|
||||
/// Fills with offsets as they are generated
|
||||
/// Holds a list of objects that represent starlight. The idea is to render_source them
|
||||
/// So modifying starlight requires touching only one place (NOTE: this doesn't work for the area overlays)
|
||||
/// In order to modify them you need to use set_starlight. Areas don't work with render sources it looks like
|
||||
GLOBAL_LIST_INIT_TYPED(starlight_objects, /obj, list(starlight_object(0)))
|
||||
/obj/starlight_appearance
|
||||
icon = 'icons/effects/alphacolors.dmi'
|
||||
icon_state = "white"
|
||||
layer = LIGHTING_PRIMARY_LAYER
|
||||
blend_mode = BLEND_ADD
|
||||
screen_loc = "1,1"
|
||||
|
||||
/proc/starlight_object(offset)
|
||||
var/obj/starlight_appearance/glow = new()
|
||||
SET_PLANE_W_SCALAR(glow, LIGHTING_PLANE, offset)
|
||||
glow.layer = LIGHTING_PRIMARY_LAYER
|
||||
glow.blend_mode = BLEND_ADD
|
||||
glow.color = GLOB.starlight_color
|
||||
glow.render_target = SPACE_OVERLAY_RENDER_TARGET(offset)
|
||||
return glow
|
||||
|
||||
/// List of plane offset + 1 -> mutable appearance to use
|
||||
/// Fills with offsets as they are generated
|
||||
GLOBAL_LIST_INIT_TYPED(fullbright_overlays, /mutable_appearance, list(create_fullbright_overlay(0)))
|
||||
/// They mirror their appearance from the starlight objects, which lets us save
|
||||
/// time updating them
|
||||
GLOBAL_LIST_INIT_TYPED(starlight_overlays, /obj, list(starlight_overlay(0)))
|
||||
|
||||
/proc/create_fullbright_overlay(offset)
|
||||
var/mutable_appearance/lighting_effect = mutable_appearance('icons/effects/alphacolors.dmi', "white")
|
||||
SET_PLANE_W_SCALAR(lighting_effect, LIGHTING_PLANE, offset)
|
||||
lighting_effect.layer = LIGHTING_PRIMARY_LAYER
|
||||
lighting_effect.blend_mode = BLEND_ADD
|
||||
lighting_effect.color = GLOB.starlight_color
|
||||
return lighting_effect
|
||||
/proc/starlight_overlay(offset)
|
||||
var/mutable_appearance/glow = new /mutable_appearance()
|
||||
SET_PLANE_W_SCALAR(glow, LIGHTING_PLANE, offset)
|
||||
glow.layer = LIGHTING_PRIMARY_LAYER
|
||||
glow.blend_mode = BLEND_ADD
|
||||
glow.render_source = SPACE_OVERLAY_RENDER_TARGET(offset)
|
||||
return glow
|
||||
|
||||
/area
|
||||
///Whether this area allows static lighting and thus loads the lighting objects
|
||||
|
||||
Reference in New Issue
Block a user