From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Fri, 1 Nov 2024 03:18:06 +0000 (+1100) Subject: Add CanLoad for biomes (#33050) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=d7a1753c7dcd2606f9345c072456781736b3061f;p=space-station-14.git Add CanLoad for biomes (#33050) CPUJob to come later. --- diff --git a/Content.Server/Parallax/BiomeSystem.cs b/Content.Server/Parallax/BiomeSystem.cs index 22b531eb7c..109aa0f6e4 100644 --- a/Content.Server/Parallax/BiomeSystem.cs +++ b/Content.Server/Parallax/BiomeSystem.cs @@ -10,6 +10,7 @@ using Content.Server.Shuttles.Events; using Content.Server.Shuttles.Systems; using Content.Shared.Atmos; using Content.Shared.Decals; +using Content.Shared.Ghost; using Content.Shared.Gravity; using Content.Shared.Parallax.Biomes; using Content.Shared.Parallax.Biomes.Layers; @@ -51,6 +52,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem private EntityQuery _biomeQuery; private EntityQuery _fixturesQuery; + private EntityQuery _ghostQuery; private EntityQuery _xformQuery; private readonly HashSet _handledEntities = new(); @@ -81,6 +83,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem Log.Level = LogLevel.Debug; _biomeQuery = GetEntityQuery(); _fixturesQuery = GetEntityQuery(); + _ghostQuery = GetEntityQuery(); _xformQuery = GetEntityQuery(); SubscribeLocalEvent(OnBiomeMapInit); SubscribeLocalEvent(OnFTLStarted); @@ -315,6 +318,11 @@ public sealed partial class BiomeSystem : SharedBiomeSystem } } + private bool CanLoad(EntityUid uid) + { + return !_ghostQuery.HasComp(uid); + } + public override void Update(float frameTime) { base.Update(frameTime); @@ -332,7 +340,8 @@ public sealed partial class BiomeSystem : SharedBiomeSystem if (_xformQuery.TryGetComponent(pSession.AttachedEntity, out var xform) && _handledEntities.Add(pSession.AttachedEntity.Value) && _biomeQuery.TryGetComponent(xform.MapUid, out var biome) && - biome.Enabled) + biome.Enabled && + CanLoad(pSession.AttachedEntity.Value)) { var worldPos = _transform.GetWorldPosition(xform); AddChunksInRange(biome, worldPos); @@ -349,7 +358,8 @@ public sealed partial class BiomeSystem : SharedBiomeSystem if (!_handledEntities.Add(viewer) || !_xformQuery.TryGetComponent(viewer, out xform) || !_biomeQuery.TryGetComponent(xform.MapUid, out biome) || - !biome.Enabled) + !biome.Enabled || + !CanLoad(viewer)) { continue; }