Add multi-job exclusion support to objectives, and add more appropriate job restrictions to certain thief objectives. (#40065)

* multi exclusion!

* quick correction

* migrate all job: fields to jobs fields to avoid test fails. breaking change!!!
This commit is contained in:
Super 2025-10-31 09:26:25 +00:00 committed by Vanessa
parent 407256a93c
commit 0880b80bd1
4 changed files with 83 additions and 43 deletions

View File

@ -2,6 +2,7 @@ using Content.Server.Objectives.Systems;
using Content.Shared.Roles;
using Content.Shared.Roles.Jobs;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Prototypes;
/// <summary>
/// Requires that the player not have a certain job to have this objective.
@ -9,9 +10,10 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
[RegisterComponent, Access(typeof(NotJobRequirementSystem))]
public sealed partial class NotJobRequirementComponent : Component
{
/// <summary>
/// ID of the job to ban from having this objective.
/// List of job prototype IDs to ban from having this objective.
/// </summary>
[DataField(required: true, customTypeSerializer: typeof(PrototypeIdSerializer<JobPrototype>))]
public string Job = string.Empty;
[DataField]
public List<ProtoId<JobPrototype>> Jobs = new List<ProtoId<JobPrototype>>();
}

View File

@ -25,7 +25,7 @@ public sealed class NotJobRequirementSystem : EntitySystem
_jobs.MindTryGetJob(args.MindId, out var proto);
// if player has no job then don't care
if (proto is not null && proto.ID == comp.Job)
if (proto is not null && comp.Jobs.Contains(proto.ID))
args.Cancelled = true;
}
}

View File

@ -101,7 +101,7 @@
id: TechnologyDiskStealCollectionObjective
components:
- type: NotJobRequirement
job: Scientist
jobs: [ Scientist ]
- type: StealCondition
stealGroup: TechnologyDisk
minCollectionSize: 5
@ -115,7 +115,7 @@
id: MailStealCollectionObjective
components:
- type: NotJobRequirement
job: Courier # DeltaV - couriers deliver mail
jobs: [ Courier, CargoTechnician, SalvageSpecialist ] # DeltaV - couriers deliver mail
- type: StealCondition
stealGroup: Mail
minCollectionSize: 4
@ -128,6 +128,8 @@
parent: BaseThiefStealCollectionObjective
id: IDCardsStealCollectionObjective
components:
- type: NotJobRequirement #Here cause you can buy a personnel crate from cargo which is 8 ID cards. Meaning the ID you start with is number nine and you only need to steal one.
jobs: [ CargoTechnician, SalvageSpecialist ]
- type: StealCondition
stealGroup: IDCard
minCollectionSize: 5
@ -136,6 +138,20 @@
- type: Objective
difficulty: 0.7
- type: entity
parent: BaseThiefStealCollectionObjective
id: OfficerHandgunsStealCollectionObjective
components:
- type: NotJobRequirement
jobs: [ SecurityOfficer, HeadOfSecurity, Detective, Warden ]
- type: StealCondition
stealGroup: OfficerHandgun
minCollectionSize: 2
maxCollectionSize: 5
verifyMapExistence: false
- type: Objective
difficulty: 1.2
- type: entity
parent: BaseThiefStealCollectionObjective
id: LAMPStealCollectionObjective
@ -158,7 +174,7 @@
id: ForensicScannerStealObjective
components:
- type: NotJobRequirement
job: Detective
jobs: [ Detective ]
- type: StealCondition
stealGroup: ForensicScanner
- type: Objective
@ -169,7 +185,7 @@
id: FlippoEngravedLighterStealObjective
components:
- type: NotJobRequirement
job: Detective
jobs: [ Detective ]
- type: StealCondition
stealGroup: FlippoEngravedLighter
- type: Objective
@ -189,7 +205,7 @@
id: ClothingOuterHardsuitVoidParamedStealObjective
components:
- type: NotJobRequirement
job: Paramedic
jobs: [ MedicalDoctor, Paramedic, Chemist, Psychologist ]
- type: StealCondition
stealGroup: ClothingOuterHardsuitVoidParamed
- type: Objective
@ -200,7 +216,7 @@
id: MedicalTechFabCircuitboardStealObjective
components:
- type: NotJobRequirement
job: MedicalDoctor
jobs: [ MedicalDoctor, Paramedic, Chemist, Psychologist ]
- type: StealCondition
stealGroup: MedicalTechFabCircuitboard
- type: Objective
@ -211,7 +227,7 @@
id: ClothingHeadsetAltMedicalStealObjective
components:
- type: NotJobRequirement
job: ChiefMedicalOfficer
jobs: [ ChiefMedicalOfficer ]
- type: StealCondition
stealGroup: ClothingHeadsetAltMedical
- type: Objective
@ -222,7 +238,7 @@
id: FireAxeStealObjective
components:
- type: NotJobRequirement
job: AtmosphericTechnician
jobs: [ AtmosphericTechnician ]
- type: StealCondition
stealGroup: FireAxe
- type: Objective
@ -233,18 +249,29 @@
id: AmePartFlatpackStealObjective
components:
- type: NotJobRequirement
job: StationEngineer
jobs: [ StationEngineer, AtmosphericTechnician ]
- type: StealCondition
stealGroup: AmePartFlatpack
- type: Objective
difficulty: 1
- type: entity
parent: BaseThiefStealObjective
id: ChiefEngineerToolbeltStealObjective
components:
#- type: NotJobRequirement Is this really necessary? it's a pickpocket objective. Only thing is that it would be easier to get to CE
# jobs: [ StationEngineer, AtmosphericTechnician ]
- type: StealCondition
stealGroup: ChiefEngineerToolBelt
- type: Objective
difficulty: .7
- type: entity #Cargo subgroup
parent: BaseThiefStealObjective
id: ExpeditionsCircuitboardStealObjective
components:
- type: NotJobRequirement
job: SalvageSpecialist
jobs: [ SalvageSpecialist ]
- type: StealCondition
stealGroup: SalvageExpeditionsComputerCircuitboard
- type: Objective
@ -255,7 +282,7 @@
id: CargoShuttleCircuitboardStealObjective
components:
- type: NotJobRequirement
job: CargoTechnician
jobs: [ CargoTechnician, SalvageSpecialist ]
- type: StealCondition
stealGroup: CargoShuttleConsoleCircuitboard
- type: Objective
@ -266,7 +293,7 @@
id: ClothingEyesHudBeerStealObjective
components:
- type: NotJobRequirement
job: Bartender
jobs: [ Bartender, ServiceWorker ]
- type: StealCondition
stealGroup: ClothingEyesHudBeer
- type: Objective
@ -277,7 +304,7 @@
id: BibleStealObjective
components:
- type: NotJobRequirement
job: Chaplain
jobs: [ Chaplain ]
- type: StealCondition
stealGroup: Bible
- type: Objective
@ -288,7 +315,7 @@
id: ClothingNeckGoldmedalStealObjective
components:
- type: NotJobRequirement
job: HeadOfPersonnel
jobs: [ HeadOfPersonnel ]
- type: StealCondition
stealGroup: ClothingNeckGoldmedal
- type: Objective
@ -299,12 +326,23 @@
# id: ClothingNeckClownmedalStealObjective
# components:
# - type: NotJobRequirement
# job: Captain
# jobs: [ Captain ]
# - type: StealCondition
# stealGroup: ClothingNeckClownmedal
# - type: Objective
# difficulty: 1
- type: entity
parent: BaseThiefStealObjective
id: CaptainSwordStealObjective
components:
- type: NotJobRequirement
jobs: [ Captain ]
- type: StealCondition
stealGroup: CaptainSword
- type: Objective
difficulty: 1.5
# Structures
- type: entity
@ -312,7 +350,7 @@
id: NuclearBombStealObjective
components:
- type: NotJobRequirement
job: Captain
jobs: [ Captain ]
- type: StealCondition
stealGroup: NuclearBomb
- type: Objective
@ -323,7 +361,7 @@
id: FaxMachineCaptainStealObjective
components:
- type: NotJobRequirement
job: Captain
jobs: [ Captain ]
- type: StealCondition
stealGroup: FaxMachineCaptain
- type: Objective
@ -334,7 +372,7 @@
id: ChemDispenserStealObjective
components:
- type: NotJobRequirement
job: Chemist
jobs: [ Chemist, Scientist ]
- type: StealCondition
stealGroup: ChemDispenser
- type: Objective
@ -345,7 +383,7 @@
id: XenoArtifactStealObjective
components:
- type: NotJobRequirement
job: Scientist
jobs: [ Scientist ]
- type: StealCondition
stealGroup: XenoArtifact
- type: Objective
@ -356,7 +394,7 @@
id: FreezerHeaterStealObjective
components:
- type: NotJobRequirement
job: AtmosphericTechnician
jobs: [ AtmosphericTechnician, MedicalDoctor, Chemist, Paramedic, Psychologist, Scientist, Chef ]
- type: StealCondition
stealGroup: FreezerHeater
- type: Objective
@ -367,7 +405,7 @@
id: TegStealObjective
components:
- type: NotJobRequirement
job: AtmosphericTechnician
jobs: [ AtmosphericTechnician, StationEngineer ]
- type: StealCondition
stealGroup: Teg
- type: Objective
@ -378,7 +416,7 @@
id: BoozeDispenserStealObjective
components:
- type: NotJobRequirement
job: Bartender
jobs: [ Bartender, ServiceWorker ]
- type: StealCondition
stealGroup: BoozeDispenser
- type: Objective
@ -389,7 +427,7 @@
id: AltarNanotrasenStealObjective
components:
- type: NotJobRequirement
job: Chaplain
jobs: [ Chaplain ]
- type: StealCondition
stealGroup: AltarNanotrasen
- type: Objective
@ -400,7 +438,7 @@
id: PlantRDStealObjective
components:
- type: NotJobRequirement
job: Scientist
jobs: [ Scientist ]
- type: StealCondition
stealGroup: PlantRD
- type: Objective
@ -411,7 +449,7 @@
id: ToiletGoldenStealObjective
components:
- type: NotJobRequirement
job: Captain
jobs: [ Captain ]
- type: StealCondition
stealGroup: ToiletGoldenDirtyWater
- type: Objective
@ -424,7 +462,7 @@
id: IanStealObjective
components:
- type: NotJobRequirement
job: HeadOfPersonnel
jobs: [ HeadOfPersonnel ]
- type: StealCondition
stealGroup: AnimalIan
- type: Objective
@ -444,7 +482,7 @@
id: McGriffStealObjective
components:
- type: NotJobRequirement
job: Detective
jobs: [ Detective ]
- type: StealCondition
stealGroup: AnimalMcGriff
- type: Objective
@ -455,7 +493,7 @@
id: WalterStealObjective
components:
- type: NotJobRequirement
job: Chemist
jobs: [ Chemist ]
- type: StealCondition
stealGroup: AnimalWalter
- type: Objective
@ -475,7 +513,7 @@
id: RenaultStealObjective
components:
- type: NotJobRequirement
job: Captain
jobs: [ Captain ]
- type: StealCondition
stealGroup: AnimalRenault
- type: Objective
@ -486,7 +524,7 @@
id: ShivaStealObjective
components:
- type: NotJobRequirement
job: SecurityOfficer
jobs: [ SecurityOfficer ]
- type: StealCondition
stealGroup: AnimalSecurity # DeltaV - Adjusts because we have multiple possible sec animals
- type: Objective
@ -497,7 +535,7 @@
id: TropicoStealObjective
components:
- type: NotJobRequirement
job: AtmosphericTechnician
jobs: [ AtmosphericTechnician ]
- type: StealCondition
stealGroup: AnimalTropico
- type: Objective

View File

@ -196,7 +196,7 @@
id: BaseCMOStealObjective
components:
- type: NotJobRequirement
job: ChiefMedicalOfficer
jobs: [ ChiefMedicalOfficer ]
- type: StealCondition
owner: job-name-cmo
@ -222,7 +222,7 @@
id: BaseRDStealObjective
components:
- type: NotJobRequirement
job: ResearchDirector
jobs: [ ResearchDirector ]
- type: StealCondition
owner: job-name-rd
@ -253,7 +253,7 @@
# HoS will have this on them a lot of the time so..
difficulty: 3
- type: NotJobRequirement
job: HeadOfSecurity
jobs: [ HeadOfSecurity ]
- type: StealCondition
stealGroup: WeaponEnergyMagnum
owner: job-name-hos
@ -265,7 +265,7 @@
id: MagbootsStealObjective
components:
- type: NotJobRequirement
job: ChiefEngineer
jobs: [ ChiefEngineer ]
- type: StealCondition
stealGroup: ClothingShoesBootsMagAdv
owner: job-name-ce
@ -277,7 +277,7 @@
id: ClipboardStealObjective
components:
- type: NotJobRequirement
job: Quartermaster
jobs: [ Quartermaster ]
- type: StealCondition
stealGroup: BoxFolderQmClipboard
owner: job-name-qm
@ -287,7 +287,7 @@
id: KnuckleDustersStealObjective
components:
- type: NotJobRequirement
job: Quartermaster
jobs: [ Quartermaster ]
- type: StealCondition
stealGroup: ClothingHandsKnuckleDustersQM
owner: job-name-qm
@ -299,7 +299,7 @@
id: CorgiMeatStealObjective
components:
- type: NotJobRequirement
job: HeadOfPersonnel
jobs: [ HeadOfPersonnel ]
- type: ObjectiveLimit
limit: 3 # ian only has 2 slices, 3 obj for drama
- type: StealCondition
@ -317,7 +317,7 @@
# sorry ce but your jordans are not as high security as the caps gear
difficulty: 3.5
- type: NotJobRequirement
job: Captain
jobs: [ Captain ]
- type: entity
parent: BaseCaptainObjective