whoops
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Server.Atmos.Reactions;
|
|||||||
using Content.Server.GameObjects.Components.Atmos;
|
using Content.Server.GameObjects.Components.Atmos;
|
||||||
using Content.Server.GameObjects.EntitySystems.Atmos;
|
using Content.Server.GameObjects.EntitySystems.Atmos;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
@@ -1090,7 +1091,7 @@ namespace Content.Server.Atmos
|
|||||||
// TODO ATMOS firelocks!
|
// TODO ATMOS firelocks!
|
||||||
var reconsiderAdjacent = false;
|
var reconsiderAdjacent = false;
|
||||||
|
|
||||||
foreach (var entity in GridIndices.GetEntitiesInTile(GridIndex))
|
foreach (var entity in GridIndices.GetEntitiesInTileFast(GridIndex))
|
||||||
{
|
{
|
||||||
if (!entity.TryGetComponent(out FirelockComponent firelock)) continue;
|
if (!entity.TryGetComponent(out FirelockComponent firelock)) continue;
|
||||||
reconsiderAdjacent |= firelock.EmergencyPressureStop();
|
reconsiderAdjacent |= firelock.EmergencyPressureStop();
|
||||||
|
|||||||
39
Content.Server/Utility/GridTileLookupHelpers.cs
Normal file
39
Content.Server/Utility/GridTileLookupHelpers.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Content.Shared.Maps;
|
||||||
|
using Robust.Server.GameObjects.EntitySystems.TileLookup;
|
||||||
|
using Robust.Shared.GameObjects.Systems;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
|
namespace Content.Server.Utility
|
||||||
|
{
|
||||||
|
public static class GridTileLookupHelpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Helper that returns all entities in a turf very fast.
|
||||||
|
/// </summary>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static IEnumerable<IEntity> GetEntitiesInTileFast(this TileRef turf)
|
||||||
|
{
|
||||||
|
var gridTileLookup = EntitySystem.Get<GridTileLookupSystem>();
|
||||||
|
|
||||||
|
return gridTileLookup.GetEntitiesIntersecting(turf.GridIndex, turf.GridIndices);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper that returns all entities in a turf.
|
||||||
|
/// </summary>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static IEnumerable<IEntity> GetEntitiesInTileFast(this MapIndices indices, GridId gridId)
|
||||||
|
{
|
||||||
|
var turf = indices.GetTileRef(gridId);
|
||||||
|
|
||||||
|
if (turf == null)
|
||||||
|
return Enumerable.Empty<IEntity>();
|
||||||
|
|
||||||
|
return GetEntitiesInTileFast(turf.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using Robust.Server.GameObjects.EntitySystems.TileLookup;
|
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
@@ -127,9 +126,9 @@ namespace Content.Shared.Maps
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static IEnumerable<IEntity> GetEntitiesInTile(this TileRef turf, bool approximate = false)
|
public static IEnumerable<IEntity> GetEntitiesInTile(this TileRef turf, bool approximate = false)
|
||||||
{
|
{
|
||||||
var gridTileLookup = EntitySystem.Get<GridTileLookupSystem>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
return gridTileLookup.GetEntitiesIntersecting(turf.GridIndex, turf.GridIndices);
|
return entityManager.GetEntitiesIntersecting(turf.MapIndex, GetWorldTileBox(turf), approximate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user