Cleans up tag system (#28272)
* Updated tag system * Added params methods * Fixed tag integration tests * Fixed params methods recursion * Revert has All/Any tag one argument realisation * Updated tag integration tests * Shit happens * Added individual List/HashSet methods, docs, tests
This commit is contained in:
@@ -15,6 +15,7 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem;
|
||||
@@ -32,16 +33,14 @@ public sealed partial class AnchorableSystem : EntitySystem
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
|
||||
private EntityQuery<PhysicsComponent> _physicsQuery;
|
||||
private EntityQuery<TagComponent> _tagQuery;
|
||||
|
||||
public const string Unstackable = "Unstackable";
|
||||
public readonly ProtoId<TagPrototype> Unstackable = "Unstackable";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
||||
_tagQuery = GetEntityQuery<TagComponent>();
|
||||
|
||||
SubscribeLocalEvent<AnchorableComponent, InteractUsingEvent>(OnInteractUsing,
|
||||
before: new[] { typeof(ItemSlotsSystem) }, after: new[] { typeof(SharedConstructionSystem) });
|
||||
@@ -312,7 +311,7 @@ public sealed partial class AnchorableSystem : EntitySystem
|
||||
DebugTools.Assert(!Transform(uid).Anchored);
|
||||
|
||||
// If we are unstackable, iterate through any other entities anchored on the current square
|
||||
return _tagSystem.HasTag(uid, Unstackable, _tagQuery) && AnyUnstackablesAnchoredAt(location);
|
||||
return _tagSystem.HasTag(uid, Unstackable) && AnyUnstackablesAnchoredAt(location);
|
||||
}
|
||||
|
||||
public bool AnyUnstackablesAnchoredAt(EntityCoordinates location)
|
||||
@@ -327,10 +326,8 @@ public sealed partial class AnchorableSystem : EntitySystem
|
||||
while (enumerator.MoveNext(out var entity))
|
||||
{
|
||||
// If we find another unstackable here, return true.
|
||||
if (_tagSystem.HasTag(entity.Value, Unstackable, _tagQuery))
|
||||
{
|
||||
if (_tagSystem.HasTag(entity.Value, Unstackable))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user