Crafting obstruction check. (#7198)

* Crafting obstruction check.

* and container check
This commit is contained in:
Leon Friedrich
2022-03-20 14:46:07 +13:00
committed by GitHub
parent ec30027ddb
commit 0cc6c4c555

View File

@@ -27,6 +27,7 @@ namespace Content.Server.Construction
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly EntityLookupSystem _lookupSystem = default!;
// --- WARNING! LEGACY CODE AHEAD! ---
// This entire file contains the legacy code for initial construction.
@@ -75,9 +76,12 @@ namespace Content.Server.Construction
}
}
foreach (var near in EntitySystem.Get<EntityLookupSystem>().GetEntitiesInRange(user!, 2f, LookupFlags.Approximate))
var pos = Transform(user).MapPosition;
foreach (var near in _lookupSystem.GetEntitiesInRange(user!, 2f, LookupFlags.Approximate))
{
yield return near;
if (_interactionSystem.InRangeUnobstructed(pos, near, 2f) && _containerSystem.IsInSameOrParentContainer(user, near))
yield return near;
}
}