Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Thief beacon doubled steal targets #33750

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Content.Server/Objectives/Systems/StealConditionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -104,6 +105,8 @@ private float GetProgress(MindComponent mind, StealConditionComponent condition)
var containerStack = new Stack<ContainerManagerComponent>();
var count = 0;

_countedItems.Clear();

//check stealAreas
if (condition.CheckStealAreas)
{
Expand Down Expand Up @@ -174,6 +177,9 @@ private void CheckEntity(EntityUid entity, StealConditionComponent condition, re

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;
Expand All @@ -196,6 +202,8 @@ private int CheckStealTarget(EntityUid entity, StealConditionComponent condition
}
}

_countedItems.Add(entity);

return TryComp<StackComponent>(entity, out var stack) ? stack.Count : 1;
}
}
Loading