No atmos stacking (attempt 2) (#16687)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Content.Shared.Tag;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Shared.Construction.Conditions
|
||||
{
|
||||
@@ -11,11 +12,20 @@ namespace Content.Shared.Construction.Conditions
|
||||
{
|
||||
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
||||
{
|
||||
var tagSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TagSystem>();
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var gridUid = location.GetGridUid(entManager);
|
||||
|
||||
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.Static))
|
||||
if (!entManager.TryGetComponent<MapGridComponent>(gridUid, out var grid))
|
||||
return true;
|
||||
|
||||
var tagQuery = entManager.GetEntityQuery<TagComponent>();
|
||||
var sysMan = entManager.EntitySysManager;
|
||||
var tagSystem = sysMan.GetEntitySystem<TagSystem>();
|
||||
var lookup = sysMan.GetEntitySystem<EntityLookupSystem>();
|
||||
|
||||
foreach (var entity in lookup.GetEntitiesIntersecting(gridUid.Value, grid.LocalToTile(location)))
|
||||
{
|
||||
if (tagSystem.HasTag(entity, "Window"))
|
||||
if (tagSystem.HasTag(entity, "Window", tagQuery))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user