@@ -10,6 +10,7 @@ using Content.Server.Shuttles.Events;
|
|||||||
using Content.Server.Shuttles.Systems;
|
using Content.Server.Shuttles.Systems;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Decals;
|
using Content.Shared.Decals;
|
||||||
|
using Content.Shared.Ghost;
|
||||||
using Content.Shared.Gravity;
|
using Content.Shared.Gravity;
|
||||||
using Content.Shared.Parallax.Biomes;
|
using Content.Shared.Parallax.Biomes;
|
||||||
using Content.Shared.Parallax.Biomes.Layers;
|
using Content.Shared.Parallax.Biomes.Layers;
|
||||||
@@ -51,6 +52,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
|||||||
|
|
||||||
private EntityQuery<BiomeComponent> _biomeQuery;
|
private EntityQuery<BiomeComponent> _biomeQuery;
|
||||||
private EntityQuery<FixturesComponent> _fixturesQuery;
|
private EntityQuery<FixturesComponent> _fixturesQuery;
|
||||||
|
private EntityQuery<GhostComponent> _ghostQuery;
|
||||||
private EntityQuery<TransformComponent> _xformQuery;
|
private EntityQuery<TransformComponent> _xformQuery;
|
||||||
|
|
||||||
private readonly HashSet<EntityUid> _handledEntities = new();
|
private readonly HashSet<EntityUid> _handledEntities = new();
|
||||||
@@ -81,6 +83,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
|||||||
Log.Level = LogLevel.Debug;
|
Log.Level = LogLevel.Debug;
|
||||||
_biomeQuery = GetEntityQuery<BiomeComponent>();
|
_biomeQuery = GetEntityQuery<BiomeComponent>();
|
||||||
_fixturesQuery = GetEntityQuery<FixturesComponent>();
|
_fixturesQuery = GetEntityQuery<FixturesComponent>();
|
||||||
|
_ghostQuery = GetEntityQuery<GhostComponent>();
|
||||||
_xformQuery = GetEntityQuery<TransformComponent>();
|
_xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
SubscribeLocalEvent<BiomeComponent, MapInitEvent>(OnBiomeMapInit);
|
SubscribeLocalEvent<BiomeComponent, MapInitEvent>(OnBiomeMapInit);
|
||||||
SubscribeLocalEvent<FTLStartedEvent>(OnFTLStarted);
|
SubscribeLocalEvent<FTLStartedEvent>(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)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
base.Update(frameTime);
|
base.Update(frameTime);
|
||||||
@@ -332,7 +340,8 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
|||||||
if (_xformQuery.TryGetComponent(pSession.AttachedEntity, out var xform) &&
|
if (_xformQuery.TryGetComponent(pSession.AttachedEntity, out var xform) &&
|
||||||
_handledEntities.Add(pSession.AttachedEntity.Value) &&
|
_handledEntities.Add(pSession.AttachedEntity.Value) &&
|
||||||
_biomeQuery.TryGetComponent(xform.MapUid, out var biome) &&
|
_biomeQuery.TryGetComponent(xform.MapUid, out var biome) &&
|
||||||
biome.Enabled)
|
biome.Enabled &&
|
||||||
|
CanLoad(pSession.AttachedEntity.Value))
|
||||||
{
|
{
|
||||||
var worldPos = _transform.GetWorldPosition(xform);
|
var worldPos = _transform.GetWorldPosition(xform);
|
||||||
AddChunksInRange(biome, worldPos);
|
AddChunksInRange(biome, worldPos);
|
||||||
@@ -349,7 +358,8 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
|||||||
if (!_handledEntities.Add(viewer) ||
|
if (!_handledEntities.Add(viewer) ||
|
||||||
!_xformQuery.TryGetComponent(viewer, out xform) ||
|
!_xformQuery.TryGetComponent(viewer, out xform) ||
|
||||||
!_biomeQuery.TryGetComponent(xform.MapUid, out biome) ||
|
!_biomeQuery.TryGetComponent(xform.MapUid, out biome) ||
|
||||||
!biome.Enabled)
|
!biome.Enabled ||
|
||||||
|
!CanLoad(viewer))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user