Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
beck-thompson committed Dec 20, 2024
1 parent b069602 commit ebed680
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ namespace Content.Server.DeltaV.Objectives.Components;
/// <summary>
/// Sets the target for <see cref="TargetObjectiveComponent"/> to a random traitor.
/// </summary>
[RegisterComponent, Access(typeof(KillPersonConditionSystem))]
public sealed partial class PickRandomTraitorComponent : Component
{
}
[RegisterComponent]
public sealed partial class PickRandomTraitorComponent : Component;
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,19 @@ private void OnTraitorKillAssigned(EntityUid uid, PickRandomTraitorComponent com
// Going through each OTHER traitor
foreach (var traitor in traitors)
{
// Assume it will be a valid traitor.
validTraitorMinds.Add(traitor.Id);

var valid = true;
// Going through each of OUR objectives.
foreach (var objective in args.Mind.Objectives)
{
// If one of OUR objectives already targets a traitor, remove them from the vaild list.
// If one of OUR objectives already targets a traitor, don't add it to the list.
if (TryComp<TargetObjectiveComponent>(objective, out var targetComp) && targetComp.Target == traitor.Id)
validTraitorMinds.RemoveAt(validTraitorMinds.Count - 1);
{
valid = false;
break;
}
}
if (valid)
validTraitorMinds.Add(traitor.Id);
}

// No other traitors
Expand Down

0 comments on commit ebed680

Please sign in to comment.