From 4604122e910daccaa29cf33a287702fae0ebc71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Sat, 12 Sep 2020 20:15:13 +0200 Subject: [PATCH] cache GridTileLookupSystem reference --- Content.Server/Atmos/TileAtmosphere.cs | 4 ++-- .../GameObjects/Components/Atmos/GridAtmosphereComponent.cs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Server/Atmos/TileAtmosphere.cs index db1b89ee45..6361574211 100644 --- a/Content.Server/Atmos/TileAtmosphere.cs +++ b/Content.Server/Atmos/TileAtmosphere.cs @@ -1095,13 +1095,13 @@ namespace Content.Server.Atmos { var reconsiderAdjacent = false; - foreach (var entity in GridIndices.GetEntitiesInTileFast(GridIndex)) + foreach (var entity in GridIndices.GetEntitiesInTileFast(GridIndex, _gridAtmosphereComponent.GridTileLookupSystem)) { if (!entity.TryGetComponent(out FirelockComponent firelock)) continue; reconsiderAdjacent |= firelock.EmergencyPressureStop(); } - foreach (var entity in other.GridIndices.GetEntitiesInTileFast(other.GridIndex)) + foreach (var entity in other.GridIndices.GetEntitiesInTileFast(other.GridIndex, _gridAtmosphereComponent.GridTileLookupSystem)) { if (!entity.TryGetComponent(out FirelockComponent firelock)) continue; reconsiderAdjacent |= firelock.EmergencyPressureStop(); diff --git a/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs b/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs index b8a02bd904..f33e03fd64 100644 --- a/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs @@ -35,6 +35,7 @@ namespace Content.Server.GameObjects.Components.Atmos [Robust.Shared.IoC.Dependency] private ITileDefinitionManager _tileDefinitionManager = default!; [Robust.Shared.IoC.Dependency] private IServerEntityManager _serverEntityManager = default!; + public GridTileLookupSystem GridTileLookupSystem { get; private set; } = default!; /// /// Check current execution time every n instances processed. @@ -169,6 +170,8 @@ namespace Content.Server.GameObjects.Components.Atmos { base.Initialize(); RepopulateTiles(); + + GridTileLookupSystem = EntitySystem.Get(); } public override void OnAdd()