diff --git a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs index ce652a75e4..a3cf67282e 100644 --- a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs @@ -47,7 +47,7 @@ namespace Content.Server.Atmos.EntitySystems /// /// How far away do we update gas overlays (minimum; due to chunking further away tiles may also be updated). /// - private float _updateRange; + private Vector2 _updateRange; // Because the gas overlay updates aren't run every tick we need to avoid the pop-in that might occur with // the regular PVS range. @@ -70,7 +70,7 @@ namespace Content.Server.Atmos.EntitySystems _playerManager.PlayerStatusChanged += OnPlayerStatusChanged; var configManager = IoCManager.Resolve(); configManager.OnValueChanged(CCVars.NetGasOverlayTickRate, value => _updateCooldown = value > 0.0f ? 1 / value : float.MaxValue, true); - configManager.OnValueChanged(CVars.NetMaxUpdateRange, value => _updateRange = value + RangeOffset, true); + configManager.OnValueChanged(CVars.NetDefaultUpdateRange, value => _updateRange = value + RangeOffset, true); configManager.OnValueChanged(CCVars.GasOverlayThresholds, value => _thresholds = value, true); } @@ -193,10 +193,10 @@ namespace Content.Server.Atmos.EntitySystems var inRange = new List(); // This is the max in any direction that we can get a chunk (e.g. max 2 chunks away of data). - var (maxXDiff, maxYDiff) = ((int) (_updateRange / ChunkSize) + 1, (int) (_updateRange / ChunkSize) + 1); + var (maxXDiff, maxYDiff) = ((int) (_updateRange.X / ChunkSize) + 1, (int) (_updateRange.Y / ChunkSize) + 1); var worldBounds = Box2.CenteredAround(EntityManager.GetComponent(entity).WorldPosition, - new Vector2(_updateRange, _updateRange)); + _updateRange); foreach (var grid in _mapManager.FindGridsIntersecting(EntityManager.GetComponent(entity).MapID, worldBounds)) { @@ -219,10 +219,10 @@ namespace Content.Server.Atmos.EntitySystems // (e.g. if we're on the very edge of a chunk we may need more chunks). var (xDiff, yDiff) = (chunkIndices.X - entityTile.X, chunkIndices.Y - entityTile.Y); - if (xDiff > 0 && xDiff > _updateRange || - yDiff > 0 && yDiff > _updateRange || - xDiff < 0 && Math.Abs(xDiff + ChunkSize) > _updateRange || - yDiff < 0 && Math.Abs(yDiff + ChunkSize) > _updateRange) continue; + if (xDiff > 0 && xDiff > _updateRange.X || + yDiff > 0 && yDiff > _updateRange.Y || + xDiff < 0 && Math.Abs(xDiff + ChunkSize) > _updateRange.X || + yDiff < 0 && Math.Abs(yDiff + ChunkSize) > _updateRange.Y) continue; inRange.Add(chunk); } diff --git a/Content.Shared/Decals/SharedDecalSystem.cs b/Content.Shared/Decals/SharedDecalSystem.cs index 4d8b805686..c6bf05aa54 100644 --- a/Content.Shared/Decals/SharedDecalSystem.cs +++ b/Content.Shared/Decals/SharedDecalSystem.cs @@ -18,23 +18,23 @@ namespace Content.Shared.Decals public const int ChunkSize = 32; public static Vector2i GetChunkIndices(Vector2 coordinates) => new ((int) Math.Floor(coordinates.X / ChunkSize), (int) Math.Floor(coordinates.Y / ChunkSize)); - private float _viewSize; + private Vector2 _viewSize; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnGridInitialize); - _configurationManager.OnValueChanged(CVars.NetMaxUpdateRange, OnPvsRangeChanged, true); + _configurationManager.OnValueChanged(CVars.NetDefaultUpdateRange, OnPvsRangeChanged, true); } public override void Shutdown() { base.Shutdown(); - _configurationManager.UnsubValueChanged(CVars.NetMaxUpdateRange, OnPvsRangeChanged); + _configurationManager.UnsubValueChanged(CVars.NetDefaultUpdateRange, OnPvsRangeChanged); } - private void OnPvsRangeChanged(float obj) + private void OnPvsRangeChanged(Vector2 obj) { _viewSize = obj * 2f; }