From 03b9098c33b58693b3f3a01fddd8d4bfb8af6d26 Mon Sep 17 00:00:00 2001 From: William Lemon Date: Wed, 15 Oct 2025 20:37:16 +1100 Subject: [PATCH] Held Lights Hotfix (#4525) --- .../_DV/Light/LightReactiveSystem.cs | 29 ++++++++++++++----- .../Entities/Mobs/Species/diona.yml | 4 +-- Resources/ServerInfo/Guidebook/Mobs/Diona.xml | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Content.Server/_DV/Light/LightReactiveSystem.cs b/Content.Server/_DV/Light/LightReactiveSystem.cs index 18469bd5fe..e4735f361c 100644 --- a/Content.Server/_DV/Light/LightReactiveSystem.cs +++ b/Content.Server/_DV/Light/LightReactiveSystem.cs @@ -6,21 +6,34 @@ namespace Content.Server._DV.Light; public sealed partial class LightReactiveSystem : SharedLightReactiveSystem { [Dependency] private readonly EntityLookupSystem _lookup = default!; + private EntityQuery _lightQuery = default!; - private readonly HashSet> _lightsInRange = new(); - private readonly HashSet> _validLightsInRange = new(); + public override void Initialize() + { + base.Initialize(); + _lightQuery = EntityManager.GetEntityQuery(); + } + + private readonly HashSet> _validLightsInRange = []; public override HashSet> 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; } diff --git a/Resources/Prototypes/Entities/Mobs/Species/diona.yml b/Resources/Prototypes/Entities/Mobs/Species/diona.yml index 4d801e7456..31464e57fc 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/diona.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/diona.yml @@ -126,8 +126,8 @@ darkThreshold: 0.4 lightThreshold: 1.2 darkDamage: - groups: - Burn: 1.0 + types: + Heat: 1.0 lightDamage: groups: Brute: -0.1 diff --git a/Resources/ServerInfo/Guidebook/Mobs/Diona.xml b/Resources/ServerInfo/Guidebook/Mobs/Diona.xml index 4e9947a14e..20e0a2f913 100644 --- a/Resources/ServerInfo/Guidebook/Mobs/Diona.xml +++ b/Resources/ServerInfo/Guidebook/Mobs/Diona.xml @@ -39,6 +39,6 @@ - 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].