FIX: Thief beacon doubled steal targets (#33750)

This commit is contained in:
ReeZer2 2025-01-01 18:25:48 +02:00 committed by deltanedas
parent dfeea3b19f
commit 115f8e68c8
1 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,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()
{
@ -103,6 +104,8 @@ public sealed class StealConditionSystem : EntitySystem
var containerStack = new Stack<ContainerManagerComponent>();
var count = 0;
_countedItems.Clear();
//check stealAreas
if (condition.CheckStealAreas)
{
@ -173,6 +176,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;
@ -190,6 +196,8 @@ public sealed class StealConditionSystem : EntitySystem
}
}
_countedItems.Add(entity);
return TryComp<StackComponent>(entity, out var stack) ? stack.Count : 1;
}
}