diff --git a/Content.Server/Mind/Filters/TargetObjectiveMindFilter.cs b/Content.Server/Mind/Filters/TargetObjectiveMindFilter.cs
new file mode 100644
index 0000000000..dae8079ac1
--- /dev/null
+++ b/Content.Server/Mind/Filters/TargetObjectiveMindFilter.cs
@@ -0,0 +1,43 @@
+using Content.Server.Objectives.Components;
+using Content.Shared.Mind;
+using Content.Shared.Mind.Filters;
+using Content.Shared.Whitelist;
+
+namespace Content.Server.Mind.Filters;
+
+///
+/// A mind filter that removes minds if you have an objective targeting them matching a blacklist.
+///
+///
+/// Used to prevent assigning multiple kill objectives for the same person.
+///
+public sealed partial class TargetObjectiveMindFilter : MindFilter
+{
+ ///
+ /// A blacklist to check objectives against, for removing a mind.
+ /// If null then any objective targeting it will remove minds.
+ ///
+ [DataField]
+ public EntityWhitelist? Blacklist;
+
+ protected override bool ShouldRemove(Entity mind, EntityUid? excluded, IEntityManager entMan, SharedMindSystem mindSys)
+ {
+ // ignore this filter if there is no user to check
+ if (!entMan.TryGetComponent(excluded, out var excludedMind))
+ return false;
+
+ var whitelistSys = entMan.System();
+ foreach (var objective in excludedMind.Objectives)
+ {
+ // if the player has an objective targeting this mind
+ if (entMan.TryGetComponent(objective, out var kill) && kill.Target == mind.Owner)
+ {
+ // remove the mind if this objective is blacklisted
+ if (whitelistSys.IsBlacklistPassOrNull(Blacklist, objective))
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/Content.Server/Objectives/Components/PickRandomHeadComponent.cs b/Content.Server/Objectives/Components/PickRandomHeadComponent.cs
deleted file mode 100644
index 38ed252264..0000000000
--- a/Content.Server/Objectives/Components/PickRandomHeadComponent.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Content.Server.Objectives.Components;
-
-///
-/// Sets the target for to a random head.
-/// If there are no heads it will fallback to any person.
-///
-[RegisterComponent]
-public sealed partial class PickRandomHeadComponent : Component;
diff --git a/Content.Server/Objectives/Components/PickRandomPersonComponent.cs b/Content.Server/Objectives/Components/PickRandomPersonComponent.cs
index bf4135e2a9..2c864a80d4 100644
--- a/Content.Server/Objectives/Components/PickRandomPersonComponent.cs
+++ b/Content.Server/Objectives/Components/PickRandomPersonComponent.cs
@@ -1,7 +1,26 @@
+using Content.Server.Objectives.Systems;
+using Content.Shared.Mind.Filters;
+
namespace Content.Server.Objectives.Components;
///
-/// Sets the target for to a random person.
+/// Sets the target for to a random person from a pool and filters.
///
-[RegisterComponent]
-public sealed partial class PickRandomPersonComponent : Component;
+///
+/// Don't copy paste this for a new objective, if you need a new filter just make a new filter and set it in YAML.
+///
+[RegisterComponent, Access(typeof(PickObjectiveTargetSystem))]
+public sealed partial class PickRandomPersonComponent : Component
+{
+ ///
+ /// A pool to pick potential targets from.
+ ///
+ [DataField]
+ public IMindPool Pool = new AliveHumansPool();
+
+ ///
+ /// Filters to apply to .
+ ///
+ [DataField]
+ public List Filters = new();
+}
diff --git a/Content.Server/Objectives/Components/RandomTraitorAliveComponent.cs b/Content.Server/Objectives/Components/RandomTraitorAliveComponent.cs
deleted file mode 100644
index 1c45cb45d5..0000000000
--- a/Content.Server/Objectives/Components/RandomTraitorAliveComponent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Content.Server.Objectives.Components;
-
-///
-/// Sets the target for to a random traitor.
-///
-[RegisterComponent]
-public sealed partial class RandomTraitorAliveComponent : Component;
diff --git a/Content.Server/Objectives/Components/RandomTraitorProgressComponent.cs b/Content.Server/Objectives/Components/RandomTraitorProgressComponent.cs
deleted file mode 100644
index f2da9778eb..0000000000
--- a/Content.Server/Objectives/Components/RandomTraitorProgressComponent.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Content.Server.Objectives.Components;
-
-///
-/// Sets the target for to a random traitor.
-///
-[RegisterComponent]
-public sealed partial class RandomTraitorProgressComponent : Component;
diff --git a/Content.Server/Objectives/Systems/PickObjectiveTargetSystem.cs b/Content.Server/Objectives/Systems/PickObjectiveTargetSystem.cs
index 2977e10569..0fa20c27e5 100644
--- a/Content.Server/Objectives/Systems/PickObjectiveTargetSystem.cs
+++ b/Content.Server/Objectives/Systems/PickObjectiveTargetSystem.cs
@@ -25,10 +25,6 @@ public sealed class PickObjectiveTargetSystem : EntitySystem
SubscribeLocalEvent(OnSpecificPersonAssigned);
SubscribeLocalEvent(OnRandomPersonAssigned);
- SubscribeLocalEvent(OnRandomHeadAssigned);
-
- SubscribeLocalEvent(OnRandomTraitorProgressAssigned);
- SubscribeLocalEvent(OnRandomTraitorAliveAssigned);
}
private void OnSpecificPersonAssigned(Entity ent, ref ObjectiveAssignedEvent args)
@@ -63,7 +59,7 @@ public sealed class PickObjectiveTargetSystem : EntitySystem
private void OnRandomPersonAssigned(Entity ent, ref ObjectiveAssignedEvent args)
{
// invalid objective prototype
- if (!TryComp(ent.Owner, out var target))
+ if (!TryComp(ent, out var target))
{
args.Cancelled = true;
return;
@@ -73,140 +69,13 @@ public sealed class PickObjectiveTargetSystem : EntitySystem
if (target.Target != null)
return;
- var allHumans = _mind.GetAliveHumans(args.MindId);
-
- // Can't have multiple objectives to kill the same person
- foreach (var objective in args.Mind.Objectives)
- {
- if (HasComp(objective) && TryComp(objective, out var kill))
- {
- allHumans.RemoveWhere(x => x.Owner == kill.Target);
- }
- }
-
- // no other humans to kill
- if (allHumans.Count == 0)
+ // couldn't find a target :(
+ if (_mind.PickFromPool(ent.Comp.Pool, ent.Comp.Filters, args.MindId) is not {} picked)
{
args.Cancelled = true;
return;
}
- _target.SetTarget(ent.Owner, _random.Pick(allHumans), target);
- }
-
- private void OnRandomHeadAssigned(Entity ent, ref ObjectiveAssignedEvent args)
- {
- // invalid prototype
- if (!TryComp(ent.Owner, out var target))
- {
- args.Cancelled = true;
- return;
- }
-
- // target already assigned
- if (target.Target != null)
- return;
-
- // no other humans to kill
- var allHumans = _mind.GetAliveHumans(args.MindId);
- if (allHumans.Count == 0)
- {
- args.Cancelled = true;
- return;
- }
-
- var allHeads = new HashSet>();
- foreach (var person in allHumans)
- {
- if (TryComp(person, out var mind) && mind.OwnedEntity is { } owned && HasComp(owned))
- allHeads.Add(person);
- }
-
- if (allHeads.Count == 0)
- allHeads = allHumans; // fallback to non-head target
-
- _target.SetTarget(ent.Owner, _random.Pick(allHeads), target);
- }
-
- private void OnRandomTraitorProgressAssigned(Entity ent, ref ObjectiveAssignedEvent args)
- {
- // invalid prototype
- if (!TryComp(ent.Owner, out var target))
- {
- args.Cancelled = true;
- return;
- }
-
- var traitors = _traitorRule.GetOtherTraitorMindsAliveAndConnected(args.Mind).ToHashSet();
-
- // cant help anyone who is tasked with helping:
- // 1. thats boring
- // 2. no cyclic progress dependencies!!!
- foreach (var traitor in traitors)
- {
- // TODO: replace this with TryComp(traitor) or something when objectives are moved out of mind
- if (!TryComp(traitor.Id, out var mind))
- continue;
-
- foreach (var objective in mind.Objectives)
- {
- if (HasComp(objective))
- traitors.RemoveWhere(x => x.Mind == mind);
- }
- }
-
- // Can't have multiple objectives to help/save the same person
- foreach (var objective in args.Mind.Objectives)
- {
- if (HasComp(objective) || HasComp(objective))
- {
- if (TryComp(objective, out var help))
- {
- traitors.RemoveWhere(x => x.Id == help.Target);
- }
- }
- }
-
- // no more helpable traitors
- if (traitors.Count == 0)
- {
- args.Cancelled = true;
- return;
- }
-
- _target.SetTarget(ent.Owner, _random.Pick(traitors).Id, target);
- }
-
- private void OnRandomTraitorAliveAssigned(Entity ent, ref ObjectiveAssignedEvent args)
- {
- // invalid prototype
- if (!TryComp(ent.Owner, out var target))
- {
- args.Cancelled = true;
- return;
- }
-
- var traitors = _traitorRule.GetOtherTraitorMindsAliveAndConnected(args.Mind).ToHashSet();
-
- // Can't have multiple objectives to help/save the same person
- foreach (var objective in args.Mind.Objectives)
- {
- if (HasComp(objective) || HasComp(objective))
- {
- if (TryComp(objective, out var help))
- {
- traitors.RemoveWhere(x => x.Id == help.Target);
- }
- }
- }
-
- // You are the first/only traitor.
- if (traitors.Count == 0)
- {
- args.Cancelled = true;
- return;
- }
-
- _target.SetTarget(ent.Owner, _random.Pick(traitors).Id, target);
+ _target.SetTarget(ent, picked, target);
}
}
diff --git a/Content.Shared/Mind/Filters/AliveHumansPool.cs b/Content.Shared/Mind/Filters/AliveHumansPool.cs
new file mode 100644
index 0000000000..c8e5c55bae
--- /dev/null
+++ b/Content.Shared/Mind/Filters/AliveHumansPool.cs
@@ -0,0 +1,12 @@
+namespace Content.Shared.Mind.Filters;
+
+///
+/// A mind pool that uses .
+///
+public sealed partial class AliveHumansPool : IMindPool
+{
+ void IMindPool.FindMinds(HashSet> minds, EntityUid? exclude, IEntityManager entMan, SharedMindSystem mindSys)
+ {
+ mindSys.AddAliveHumans(minds, exclude);
+ }
+}
diff --git a/Content.Shared/Mind/Filters/AntagonistMindFilter.cs b/Content.Shared/Mind/Filters/AntagonistMindFilter.cs
new file mode 100644
index 0000000000..d805138ac3
--- /dev/null
+++ b/Content.Shared/Mind/Filters/AntagonistMindFilter.cs
@@ -0,0 +1,15 @@
+using Content.Shared.Roles;
+
+namespace Content.Shared.Mind.Filters;
+
+///
+/// A mind filter that requires minds to have an antagonist role.
+///
+public sealed partial class AntagonistMindFilter : MindFilter
+{
+ protected override bool ShouldRemove(Entity mind, EntityUid? exclude, IEntityManager entMan, SharedMindSystem mindSys)
+ {
+ var roleSys = entMan.System();
+ return !roleSys.MindIsAntagonist(mind);
+ }
+}
diff --git a/Content.Shared/Mind/Filters/BodyMindFilter.cs b/Content.Shared/Mind/Filters/BodyMindFilter.cs
new file mode 100644
index 0000000000..334539634f
--- /dev/null
+++ b/Content.Shared/Mind/Filters/BodyMindFilter.cs
@@ -0,0 +1,21 @@
+using Content.Shared.Whitelist;
+
+namespace Content.Shared.Mind.Filters;
+
+///
+/// A mind filter that checks the mind's owned entity against a whitelist.
+///
+public sealed partial class BodyMindFilter : MindFilter
+{
+ [DataField(required: true)]
+ public EntityWhitelist Whitelist = new();
+
+ protected override bool ShouldRemove(Entity ent, EntityUid? exclude, IEntityManager entMan, SharedMindSystem mindSys)
+ {
+ if (ent.Comp.OwnedEntity is not {} mob)
+ return true;
+
+ var sys = entMan.System();
+ return sys.IsWhitelistFail(Whitelist, mob);
+ }
+}
diff --git a/Content.Shared/Mind/Filters/HasRoleMindFilter.cs b/Content.Shared/Mind/Filters/HasRoleMindFilter.cs
new file mode 100644
index 0000000000..22f250dd29
--- /dev/null
+++ b/Content.Shared/Mind/Filters/HasRoleMindFilter.cs
@@ -0,0 +1,22 @@
+using Content.Shared.Roles;
+using Content.Shared.Whitelist;
+
+namespace Content.Shared.Mind.Filters;
+
+///
+/// A mind filter that requires minds to have a role matching a whitelist.
+///
+public sealed partial class HasRoleMindFilter : MindFilter
+{
+ ///
+ /// The whitelist a role must match for the mind to pass the filter.
+ ///
+ [DataField(required: true)]
+ public EntityWhitelist Whitelist;
+
+ protected override bool ShouldRemove(Entity mind, EntityUid? exclude, IEntityManager entMan, SharedMindSystem mindSys)
+ {
+ var roleSys = entMan.System();
+ return roleSys.MindHasRole(mind, Whitelist);
+ }
+}
diff --git a/Content.Shared/Mind/Filters/IMindPool.cs b/Content.Shared/Mind/Filters/IMindPool.cs
new file mode 100644
index 0000000000..263d15d812
--- /dev/null
+++ b/Content.Shared/Mind/Filters/IMindPool.cs
@@ -0,0 +1,19 @@
+using Robust.Shared.Serialization.Manager.Attributes;
+
+namespace Content.Shared.Mind.Filters;
+
+///
+/// A mind pool that can find minds to use for objectives etc.
+/// Further filtered by .
+///
+[ImplicitDataDefinitionForInheritors]
+public partial interface IMindPool
+{
+ ///
+ /// Add minds for this pool to a hashset.
+ /// The hashset gets reused and is cleared before this is called.
+ ///
+ /// The hashset to add to
+ /// A mind entity that must not be returned
+ void FindMinds(HashSet> minds, EntityUid? exclude, IEntityManager entMan, SharedMindSystem mindSys);
+}
diff --git a/Content.Shared/Mind/Filters/JobMindFilter.cs b/Content.Shared/Mind/Filters/JobMindFilter.cs
new file mode 100644
index 0000000000..a6565e4d33
--- /dev/null
+++ b/Content.Shared/Mind/Filters/JobMindFilter.cs
@@ -0,0 +1,21 @@
+using Content.Shared.Roles;
+using Content.Shared.Roles.Jobs;
+using Robust.Shared.Prototypes;
+
+namespace Content.Shared.Mind.Filters;
+
+///
+/// A mind filter that requires minds to have a specific job.
+/// This uses mind roles, not ID cards.
+///
+public sealed partial class JobMindFilter : MindFilter
+{
+ [DataField(required: true)]
+ public ProtoId Job;
+
+ protected override bool ShouldRemove(Entity mind, EntityUid? exclude, IEntityManager entMan, SharedMindSystem mindSys)
+ {
+ var jobSys = entMan.System();
+ return jobSys.MindHasJobWithId(mind, Job);
+ }
+}
diff --git a/Content.Shared/Mind/Filters/MindFilter.cs b/Content.Shared/Mind/Filters/MindFilter.cs
new file mode 100644
index 0000000000..c2daf3e361
--- /dev/null
+++ b/Content.Shared/Mind/Filters/MindFilter.cs
@@ -0,0 +1,32 @@
+using Robust.Shared.Serialization.Manager.Attributes;
+
+namespace Content.Shared.Mind.Filters;
+
+///
+/// A mind filter that can be used to filter out minds from a .
+///
+[ImplicitDataDefinitionForInheritors]
+public abstract partial class MindFilter
+{
+ ///
+ /// The actual filter function, this has to return false for minds that get removed from the pool.
+ /// An excluded mind will be the same one passed to .
+ ///
+ /// The mind to check
+ /// The same mind passed to FindMinds
+ protected abstract bool ShouldRemove(Entity mind, EntityUid? exclude, IEntityManager entMan, SharedMindSystem mindSys);
+
+ ///
+ /// The high-level filter function to be used by the mind system.
+ ///
+ public bool Filter(Entity mind, EntityUid? exclude, EntityManager entMan, SharedMindSystem mindSys)
+ {
+ return ShouldRemove(mind, exclude, entMan, mindSys) ^ Inverted;
+ }
+
+ ///
+ /// Whether to invert functionality, only keeping minds that would otherwise be removed.
+ ///
+ [DataField]
+ public bool Inverted;
+}
diff --git a/Content.Shared/Mind/Filters/ObjectiveMindFilter.cs b/Content.Shared/Mind/Filters/ObjectiveMindFilter.cs
new file mode 100644
index 0000000000..2d3cf6a263
--- /dev/null
+++ b/Content.Shared/Mind/Filters/ObjectiveMindFilter.cs
@@ -0,0 +1,25 @@
+using Content.Shared.Whitelist;
+
+namespace Content.Shared.Mind.Filters;
+
+///
+/// A mind filter that removes minds with a blacklist objective.
+///
+public sealed partial class ObjectiveMindFilter : MindFilter
+{
+ [DataField(required: true)]
+ public EntityWhitelist Blacklist = new();
+
+ protected override bool ShouldRemove(Entity mind, EntityUid? exclude, IEntityManager entMan, SharedMindSystem mindSys)
+ {
+ var whitelistSys = entMan.System();
+ foreach (var obj in mind.Comp.Objectives)
+ {
+ // mind has a blacklisted objective, remove it from the pool
+ if (whitelistSys.IsBlacklistPass(Blacklist, obj))
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/Content.Shared/Mind/SharedMindSystem.cs b/Content.Shared/Mind/SharedMindSystem.cs
index 271639725f..98ff77810c 100644
--- a/Content.Shared/Mind/SharedMindSystem.cs
+++ b/Content.Shared/Mind/SharedMindSystem.cs
@@ -9,6 +9,7 @@ using Content.Shared.Humanoid;
using Content.Shared.Interaction.Events;
using Content.Shared.Movement.Components;
using Content.Shared.Mind.Components;
+using Content.Shared.Mind.Filters;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Objectives.Systems;
@@ -19,6 +20,7 @@ using Content.Shared.Whitelist;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Player;
+using Robust.Shared.Random;
using Robust.Shared.Utility;
namespace Content.Shared.Mind;
@@ -27,6 +29,7 @@ public abstract partial class SharedMindSystem : EntitySystem
{
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly INetManager _net = default!;
+ [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
[Dependency] private readonly SharedPlayerSystem _player = default!;
@@ -37,6 +40,8 @@ public abstract partial class SharedMindSystem : EntitySystem
[ViewVariables]
protected readonly Dictionary UserMinds = new();
+ private HashSet> _pickingMinds = new();
+
public override void Initialize()
{
base.Initialize();
@@ -618,23 +623,70 @@ public abstract partial class SharedMindSystem : EntitySystem
///
/// Returns a list of every living humanoid player's minds, except for a single one which is exluded.
+ /// A new hashset is allocated for every call, consider using instead.
///
public HashSet> GetAliveHumans(EntityUid? exclude = null)
{
var allHumans = new HashSet>();
+ AddAliveHumans(allHumans, exclude);
+ return allHumans;
+ }
+
+ ///
+ /// Adds to a hashset every living humanoid player's minds, except for a single one which is exluded.
+ ///
+ public void AddAliveHumans(HashSet> allHumans, EntityUid? exclude = null)
+ {
// HumanoidAppearanceComponent is used to prevent mice, pAIs, etc from being chosen
- var query = EntityQueryEnumerator();
- while (query.MoveNext(out var uid, out var mobState, out _))
+ var query = EntityQueryEnumerator();
+ while (query.MoveNext(out var uid, out _, out var mobState))
{
// the player needs to have a mind and not be the excluded one +
// the player has to be alive
if (!TryGetMind(uid, out var mind, out var mindComp) || mind == exclude || !_mobState.IsAlive(uid, mobState))
continue;
- allHumans.Add(new Entity(mind, mindComp));
+ allHumans.Add((mind, mindComp));
}
+ }
- return allHumans;
+ ///
+ /// Picks a random mind from a pool after applying a list of filters.
+ /// Returns null if no valid mind could be found.
+ ///
+ public Entity? PickFromPool(IMindPool pool, List filters, EntityUid? exclude = null)
+ {
+ _pickingMinds.Clear();
+ pool.FindMinds(_pickingMinds, exclude, EntityManager, this);
+ FilterMinds(_pickingMinds, filters, exclude);
+
+ if (_pickingMinds.Count == 0)
+ return null;
+
+ return _random.Pick(_pickingMinds);
+ }
+
+ ///
+ /// Filters minds from a hashset using a single .
+ ///
+ public void FilterMinds(HashSet> minds, MindFilter filter, EntityUid? exclude = null)
+ {
+ minds.RemoveWhere(mind => filter.Filter(mind, exclude, EntityManager, this));
+ }
+
+ ///
+ /// Filters minds from a hashset using a list of s to apply sequentially.
+ ///
+ public void FilterMinds(HashSet> minds, List filters, EntityUid? exclude = null)
+ {
+ foreach (var filter in filters)
+ {
+ // no point calling it if there are none left
+ if (minds.Count == 0)
+ break;
+
+ FilterMinds(minds, filter, exclude);
+ }
}
///
diff --git a/Content.Shared/Roles/SharedRoleSystem.cs b/Content.Shared/Roles/SharedRoleSystem.cs
index e45c5792bd..4f307d8b31 100644
--- a/Content.Shared/Roles/SharedRoleSystem.cs
+++ b/Content.Shared/Roles/SharedRoleSystem.cs
@@ -6,6 +6,7 @@ using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Mind;
using Content.Shared.Roles.Jobs;
+using Content.Shared.Whitelist;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
@@ -19,13 +20,14 @@ namespace Content.Shared.Roles;
public abstract class SharedRoleSystem : EntitySystem
{
- [Dependency] private readonly IConfigurationManager _cfg = default!;
- [Dependency] private readonly IEntityManager _entityManager = default!;
- [Dependency] private readonly IPrototypeManager _prototypes = default!;
- [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
+ [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
+ [Dependency] private readonly SharedAudioSystem _audio = default!;
+ [Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] protected readonly ISharedPlayerManager Player = default!;
- [Dependency] private readonly SharedAudioSystem _audio = default!;
- [Dependency] private readonly SharedMindSystem _minds = default!;
+ [Dependency] private readonly IEntityManager _entityManager = default!;
+ [Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
+ [Dependency] private readonly SharedMindSystem _minds = default!;
+ [Dependency] private readonly IPrototypeManager _prototypes = default!;
private JobRequirementOverridePrototype? _requirementOverride;
@@ -504,6 +506,20 @@ public abstract class SharedRoleSystem : EntitySystem
return found;
}
+ ///
+ /// Returns true if a mind has a role that matches a whitelist.
+ ///
+ public bool MindHasRole(Entity mind, EntityWhitelist whitelist)
+ {
+ foreach (var roleEnt in mind.Comp.MindRoles)
+ {
+ if (_whitelist.IsWhitelistPass(whitelist, roleEnt))
+ return true;
+ }
+
+ return false;
+ }
+
///
/// Finds the first mind role of a specific type on a mind entity.
///
diff --git a/Resources/Prototypes/Objectives/traitor.yml b/Resources/Prototypes/Objectives/traitor.yml
index 98c6b9789f..411a457961 100644
--- a/Resources/Prototypes/Objectives/traitor.yml
+++ b/Resources/Prototypes/Objectives/traitor.yml
@@ -91,6 +91,12 @@
- type: TargetObjective
title: objective-condition-maroon-person-title
- type: PickRandomPerson
+ filters:
+ # Can't have multiple objectives to kill the same person.
+ - !type:TargetObjectiveMindFilter
+ blacklist:
+ components:
+ - KillPersonCondition
- type: KillPersonCondition
requireMaroon: true
@@ -106,7 +112,17 @@
unique: true
- type: TargetObjective
title: objective-condition-kill-maroon-title
- - type: PickRandomHead
+ - type: PickRandomPerson
+ filters:
+ - !type:BodyMindFilter
+ whitelist:
+ components:
+ - CommandStaff
+ # Can't have multiple objectives to kill the same person.
+ - !type:TargetObjectiveMindFilter
+ blacklist:
+ components:
+ - KillPersonCondition
- type: KillPersonCondition
# don't count missing evac as killing as heads are higher profile, so you really need to do the dirty work
# if ce flies a shittle to centcom you better find a way onto it
@@ -124,7 +140,18 @@
difficulty: 1.75
- type: TargetObjective
title: objective-condition-other-traitor-alive-title
- - type: RandomTraitorAlive
+ - type: PickRandomPerson
+ filters:
+ - !type:HasRoleMindFilter
+ whitelist:
+ components:
+ - TraitorRole
+ # Can't have multiple objectives to help/save the same person
+ - !type:TargetObjectiveMindFilter
+ blacklist:
+ components:
+ - RandomTraitorAlive
+ - RandomTraitorProgress
- type: entity
parent: [BaseTraitorSocialObjective, BaseHelpProgressObjective]
@@ -135,7 +162,25 @@
difficulty: 2.5
- type: TargetObjective
title: objective-condition-other-traitor-progress-title
- - type: RandomTraitorProgress
+ - type: PickRandomPerson
+ filters:
+ - !type:HasRoleMindFilter
+ whitelist:
+ components:
+ - TraitorRole
+ # Can't help anyone who is tasked with helping:
+ # 1. thats boring
+ # 2. no cyclic progress dependencies!!!
+ - !type:ObjectiveMindFilter
+ blacklist:
+ components:
+ - HelpProgressCondition
+ # Can't have multiple objectives to help/save the same person
+ - !type:TargetObjectiveMindFilter
+ blacklist:
+ components:
+ - RandomTraitorAlive
+ - RandomTraitorProgress
# steal