]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
FIX: Thief beacon doubled steal targets (#33750)
authorReeZer2 <63300653+ReeZer2@users.noreply.github.com>
Wed, 1 Jan 2025 16:25:48 +0000 (18:25 +0200)
committerGitHub <noreply@github.com>
Wed, 1 Jan 2025 16:25:48 +0000 (17:25 +0100)
Content.Server/Objectives/Systems/StealConditionSystem.cs

index 48814e7ba3c10f3aae33c5ee9ba96120aaf7f3e0..d61b796e42e431285eff552c9ba5111ef56939e7 100644 (file)
@@ -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;
     }
 }