Skip to content

Commit

Permalink
Ignore intern roles for traitor kill objective
Browse files Browse the repository at this point in the history
  • Loading branch information
lzk228 committed Sep 18, 2024
1 parent 697f4f5 commit 31747a0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
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, ViewVariables(VVAccess.ReadWrite)]
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,12 @@ 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 = allHumans
.Where(human => !_job.MindTryGetJobId(human, out var jobId) || !comp.IgnoredJobs.Contains(jobId))
.ToList();

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

0 comments on commit 31747a0

Please sign in to comment.