Held Lights Hotfix (#4525)

This commit is contained in:
William Lemon 2025-10-15 20:37:16 +11:00 committed by GitHub
parent f4b13622de
commit 03b9098c33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 11 deletions

View File

@ -6,21 +6,34 @@ namespace Content.Server._DV.Light;
public sealed partial class LightReactiveSystem : SharedLightReactiveSystem
{
[Dependency] private readonly EntityLookupSystem _lookup = default!;
private EntityQuery<PointLightComponent> _lightQuery = default!;
private readonly HashSet<Entity<PointLightComponent>> _lightsInRange = new();
private readonly HashSet<Entity<SharedPointLightComponent>> _validLightsInRange = new();
public override void Initialize()
{
base.Initialize();
_lightQuery = EntityManager.GetEntityQuery<PointLightComponent>();
}
private readonly HashSet<Entity<SharedPointLightComponent>> _validLightsInRange = [];
public override HashSet<Entity<SharedPointLightComponent>> GetLights(EntityUid targetEntity)
{
_lightsInRange.Clear();
_lookup.GetEntitiesInRange(Transform(targetEntity).Coordinates, 10f, _lightsInRange);
var entitiesInRange = _lookup.GetEntitiesInRange(targetEntity, 10f);
_validLightsInRange.Clear();
foreach (var light in _lightsInRange)
foreach (var ent in entitiesInRange)
{
// On the server, we check if it's Enabled OR if netSyncEnabled is false
if (!_lightQuery.TryComp(ent, out var comp))
continue;
// On the server, we check if it's Enabled OR if netSyncEnabled i s false
// Because sometimes the server doesn't actually know if it should be enabled or not.
// The Client however, can be assumed to always be right.
if ((light.Comp.Enabled || !light.Comp.NetSyncEnabled) && !light.Comp.Deleted)
_validLightsInRange.Add(new(light.Owner, light.Comp));
if (!comp.Enabled && comp.NetSyncEnabled)
continue;
if (comp.Deleted)
continue;
_validLightsInRange.Add((ent, comp));
}
return _validLightsInRange;
}

View File

@ -126,8 +126,8 @@
darkThreshold: 0.4
lightThreshold: 1.2
darkDamage:
groups:
Burn: 1.0
types:
Heat: 1.0
lightDamage:
groups:
Brute: -0.1

View File

@ -39,6 +39,6 @@
<Box>
<GuideEntityEmbed Entity="BarSignTheSunFake" Caption=""/>
</Box>
Diona are photosynthetic, and will slowly [color=#1e90ff]heal 6% brute, burn, toxin, and airloss damage per minute[/color] when in direct sunlight. However, in pitch darkness they'll suffer [color=#ffa500]1% burn damage per second and a 30% movement speed penalty[/color].
Diona are photosynthetic, and will slowly [color=#1e90ff]heal 6% brute, burn, toxin, and airloss damage per minute[/color] when in direct sunlight. However, in pitch darkness they'll suffer [color=#ffa500]1% heat damage per second and a 30% movement speed penalty[/color].
</Document>