Add planet lighting (#32522)

* Implements a Dynamic Lighting System on maps.

* Edit: the night should be a little bit brighter and blue now.

* Major edit: everything must be done on the client side now, with certain datafield replicated.
Changes were outlined in the salvage to accommodate the new lighting system.

* Edit: The offset is now serverside, this makes the time accurate in all situations.

* Removing ununsed import

* Minor tweaks

* Tweak in time precision

* Minor tweak + Unused import removed

* Edit: apparently RealTime is better for what I'm looking for

* Fix: Now the time is calculated correctly.

* Minor tweaks

* Adds condition for when the light should be updated

* Add planet lighting

* she

* close-ish

* c

* bittersweat

* Fixes

* Revert "Merge branch '22719' into 2024-09-29-planet-lighting"

This reverts commit 9f2785bb16aee47d794aa3eed8ae15004f97fc35, reversing
changes made to 19649c07a5fb625423e08fc18d91c9cb101daa86.

* Europa and day-night

* weh

* rooves working

* Clean

* Remove Europa

* Fixes

* fix

* Update

* Fix caves

* Update for engine

* Add sun shadows (planet lighting v2)

For now mostly targeting walls and having the shadows change over time. Got the basic proof-of-concept working just needs a hell of a lot of polish.

* Documentation

* a

* Fixes

* Move blur to an overlay

* Slughands

* Fixes

* Remove v2 work

* Finalise

---------

Co-authored-by: DoutorWhite <thedoctorwhite@gmail.com>
This commit is contained in:
metalgearsloth
2025-02-16 19:35:32 +11:00
committed by GitHub
parent 19dee8a029
commit b6ee183dc6
26 changed files with 819 additions and 16 deletions

View File

@@ -12,6 +12,7 @@ using Content.Shared.Atmos;
using Content.Shared.Decals;
using Content.Shared.Ghost;
using Content.Shared.Gravity;
using Content.Shared.Light.Components;
using Content.Shared.Parallax.Biomes;
using Content.Shared.Parallax.Biomes.Layers;
using Content.Shared.Parallax.Biomes.Markers;
@@ -330,6 +331,9 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
while (biomes.MoveNext(out var biome))
{
if (biome.LifeStage < ComponentLifeStage.Running)
continue;
_activeChunks.Add(biome, _tilePool.Get());
_markerChunks.GetOrNew(biome);
}
@@ -379,6 +383,10 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
while (loadBiomes.MoveNext(out var gridUid, out var biome, out var grid))
{
// If not MapInit don't run it.
if (biome.LifeStage < ComponentLifeStage.Running)
continue;
if (!biome.Enabled)
continue;
@@ -745,7 +753,10 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
}
if (modified.Count == 0)
{
component.ModifiedTiles.Remove(chunk);
_tilePool.Return(modified);
}
component.PendingMarkers.Remove(chunk);
}
@@ -1014,11 +1025,14 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
// Midday: #E6CB8B
// Moonlight: #2b3143
// Lava: #A34931
var light = EnsureComp<MapLightComponent>(mapUid);
light.AmbientLightColor = mapLight ?? Color.FromHex("#D8B059");
Dirty(mapUid, light, metadata);
EnsureComp<RoofComponent>(mapUid);
EnsureComp<LightCycleComponent>(mapUid);
var moles = new float[Atmospherics.AdjustedNumberOfGases];
moles[(int) Gas.Oxygen] = 21.824779f;
moles[(int) Gas.Nitrogen] = 82.10312f;