FIX: Thief beacon doubled steal targets (#33750)
This commit is contained in:
@@ -29,6 +29,7 @@ public sealed class StealConditionSystem : EntitySystem
|
||||
private EntityQuery<ContainerManagerComponent> _containerQuery;
|
||||
|
||||
private HashSet<Entity<TransformComponent>> _nearestEnts = new();
|
||||
private HashSet<EntityUid> _countedItems = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -104,6 +105,8 @@ public sealed class StealConditionSystem : EntitySystem
|
||||
var containerStack = new Stack<ContainerManagerComponent>();
|
||||
var count = 0;
|
||||
|
||||
_countedItems.Clear();
|
||||
|
||||
//check stealAreas
|
||||
if (condition.CheckStealAreas)
|
||||
{
|
||||
@@ -174,6 +177,9 @@ public sealed class StealConditionSystem : EntitySystem
|
||||
|
||||
private int CheckStealTarget(EntityUid entity, StealConditionComponent condition)
|
||||
{
|
||||
if (_countedItems.Contains(entity))
|
||||
return 0;
|
||||
|
||||
// check if this is the target
|
||||
if (!TryComp<StealTargetComponent>(entity, out var target))
|
||||
return 0;
|
||||
@@ -196,6 +202,8 @@ public sealed class StealConditionSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
_countedItems.Add(entity);
|
||||
|
||||
return TryComp<StackComponent>(entity, out var stack) ? stack.Count : 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user