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

Ignore intern roles for traitor kill objective #32288

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Content.Server.Objectives.Systems;
using Content.Shared.Roles;
using Robust.Shared.Prototypes;

namespace Content.Server.Objectives.Components;

Expand All @@ -8,4 +10,9 @@ namespace Content.Server.Objectives.Components;
[RegisterComponent, Access(typeof(KillPersonConditionSystem))]
public sealed partial class PickRandomPersonComponent : Component
{
/// <summary>
/// List of jobs, that won't be kill objectives
/// </summary>
[DataField]
public List<ProtoId<JobPrototype>?> IgnoredJobs = new();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Roles.Jobs;
using Robust.Shared.Configuration;
using Robust.Shared.Random;
using System.Linq;

namespace Content.Server.Objectives.Systems;

Expand Down Expand Up @@ -55,6 +56,10 @@ private void OnPersonAssigned(EntityUid uid, PickRandomPersonComponent comp, ref

// no other humans to kill
var allHumans = _mind.GetAliveHumansExcept(args.MindId);

// filter jobs that we don't want to be kill objectives
allHumans.RemoveAll(human => !_job.MindTryGetJobId(human, out var jobId) || !comp.IgnoredJobs.Contains(jobId));

if (allHumans.Count == 0)
{
args.Cancelled = true;
Expand Down
4 changes: 4 additions & 0 deletions Resources/Prototypes/Objectives/traitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
- type: TargetObjective
title: objective-condition-kill-person-title
- type: PickRandomPerson
ignoredJobs:
- TechnicalAssistant
- MedicalIntern
- ResearchAssistant

- type: entity
parent: [BaseTraitorObjective, BaseKillObjective]
Expand Down
Loading