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 GitHub
parent c30321d886
commit dd61991b1c
4 changed files with 49 additions and 47 deletions

View File

@@ -2,6 +2,7 @@ using Content.Server.Objectives.Systems;
using Content.Shared.Roles; using Content.Shared.Roles;
using Content.Shared.Roles.Jobs; using Content.Shared.Roles.Jobs;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Prototypes;
/// <summary> /// <summary>
/// Requires that the player not have a certain job to have this objective. /// 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))] [RegisterComponent, Access(typeof(NotJobRequirementSystem))]
public sealed partial class NotJobRequirementComponent : Component public sealed partial class NotJobRequirementComponent : Component
{ {
/// <summary> /// <summary>
/// ID of the job to ban from having this objective. /// List of job prototype IDs to ban from having this objective.
/// </summary> /// </summary>
[DataField(required: true, customTypeSerializer: typeof(PrototypeIdSerializer<JobPrototype>))] [DataField]
public string Job = string.Empty; 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); _jobs.MindTryGetJob(args.MindId, out var proto);
// if player has no job then don't care // 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; args.Cancelled = true;
} }
} }

View File

@@ -101,7 +101,7 @@
id: TechnologyDiskStealCollectionObjective id: TechnologyDiskStealCollectionObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Scientist jobs: [ Scientist ]
- type: StealCondition - type: StealCondition
stealGroup: TechnologyDisk stealGroup: TechnologyDisk
minCollectionSize: 5 minCollectionSize: 5
@@ -115,7 +115,7 @@
id: MailStealCollectionObjective id: MailStealCollectionObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: CargoTechnician jobs: [ CargoTechnician, SalvageSpecialist ]
- type: StealCondition - type: StealCondition
stealGroup: Mail stealGroup: Mail
minCollectionSize: 4 minCollectionSize: 4
@@ -129,7 +129,7 @@
id: IDCardsStealCollectionObjective id: IDCardsStealCollectionObjective
components: 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. - 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.
job: CargoTechnician #TODO: add salvage specialist jobs: [ CargoTechnician, SalvageSpecialist ]
- type: StealCondition - type: StealCondition
stealGroup: IDCard stealGroup: IDCard
minCollectionSize: 5 minCollectionSize: 5
@@ -143,7 +143,7 @@
id: OfficerHandgunsStealCollectionObjective id: OfficerHandgunsStealCollectionObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: SecurityOfficer #TODO: Add HoS, Detective, and Warden jobs: [ SecurityOfficer, HeadOfSecurity, Detective, Warden ]
- type: StealCondition - type: StealCondition
stealGroup: OfficerHandgun stealGroup: OfficerHandgun
minCollectionSize: 2 minCollectionSize: 2
@@ -174,7 +174,7 @@
id: ForensicScannerStealObjective id: ForensicScannerStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Detective jobs: [ Detective ]
- type: StealCondition - type: StealCondition
stealGroup: ForensicScanner stealGroup: ForensicScanner
- type: Objective - type: Objective
@@ -185,7 +185,7 @@
id: FlippoEngravedLighterStealObjective id: FlippoEngravedLighterStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Detective jobs: [ Detective ]
- type: StealCondition - type: StealCondition
stealGroup: FlippoEngravedLighter stealGroup: FlippoEngravedLighter
- type: Objective - type: Objective
@@ -214,7 +214,7 @@
id: ClothingOuterHardsuitVoidParamedStealObjective id: ClothingOuterHardsuitVoidParamedStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Paramedic #TODO: make it so this also includes Medical Doctor, Chemist and Psychologist jobs: [ MedicalDoctor, Paramedic, Chemist, Psychologist ]
- type: StealCondition - type: StealCondition
stealGroup: ClothingOuterHardsuitVoidParamed stealGroup: ClothingOuterHardsuitVoidParamed
- type: Objective - type: Objective
@@ -225,7 +225,7 @@
id: MedicalTechFabCircuitboardStealObjective id: MedicalTechFabCircuitboardStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: MedicalDoctor #TODO: make it so this also includes Chemist, Paramedic and Psychologist jobs: [ MedicalDoctor, Paramedic, Chemist, Psychologist ]
- type: StealCondition - type: StealCondition
stealGroup: MedicalTechFabCircuitboard stealGroup: MedicalTechFabCircuitboard
- type: Objective - type: Objective
@@ -236,7 +236,7 @@
id: ClothingHeadsetAltMedicalStealObjective id: ClothingHeadsetAltMedicalStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: ChiefMedicalOfficer jobs: [ ChiefMedicalOfficer ]
- type: StealCondition - type: StealCondition
stealGroup: ClothingHeadsetAltMedical stealGroup: ClothingHeadsetAltMedical
- type: Objective - type: Objective
@@ -247,7 +247,7 @@
id: FireAxeStealObjective id: FireAxeStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: AtmosphericTechnician jobs: [ AtmosphericTechnician ]
- type: StealCondition - type: StealCondition
stealGroup: FireAxe stealGroup: FireAxe
- type: Objective - type: Objective
@@ -258,7 +258,7 @@
id: AmePartFlatpackStealObjective id: AmePartFlatpackStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: StationEngineer #TODO: make it so this also includes Atmos technician jobs: [ StationEngineer, AtmosphericTechnician ]
- type: StealCondition - type: StealCondition
stealGroup: AmePartFlatpack stealGroup: AmePartFlatpack
- type: Objective - type: Objective
@@ -269,7 +269,7 @@
id: ChiefEngineerToolbeltStealObjective id: ChiefEngineerToolbeltStealObjective
components: components:
#- type: NotJobRequirement Is this really necessary? it's a pickpocket objective. Only thing is that it would be easier to get to CE #- type: NotJobRequirement Is this really necessary? it's a pickpocket objective. Only thing is that it would be easier to get to CE
# Job: StationEngineer, AtmosphericTechnician # jobs: [ StationEngineer, AtmosphericTechnician ]
- type: StealCondition - type: StealCondition
stealGroup: ChiefEngineerToolBelt stealGroup: ChiefEngineerToolBelt
- type: Objective - type: Objective
@@ -280,7 +280,7 @@
id: ExpeditionsCircuitboardStealObjective id: ExpeditionsCircuitboardStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: SalvageSpecialist jobs: [ SalvageSpecialist ]
- type: StealCondition - type: StealCondition
stealGroup: SalvageExpeditionsComputerCircuitboard stealGroup: SalvageExpeditionsComputerCircuitboard
- type: Objective - type: Objective
@@ -291,7 +291,7 @@
id: CargoShuttleCircuitboardStealObjective id: CargoShuttleCircuitboardStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: CargoTechnician #TODO: make it so this also includes Salvage Specialist jobs: [ CargoTechnician, SalvageSpecialist ]
- type: StealCondition - type: StealCondition
stealGroup: CargoShuttleConsoleCircuitboard stealGroup: CargoShuttleConsoleCircuitboard
- type: Objective - type: Objective
@@ -302,7 +302,7 @@
id: ClothingEyesHudBeerStealObjective id: ClothingEyesHudBeerStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Bartender #TODO: make it so this also includes Service worker jobs: [ Bartender, ServiceWorker ]
- type: StealCondition - type: StealCondition
stealGroup: ClothingEyesHudBeer stealGroup: ClothingEyesHudBeer
- type: Objective - type: Objective
@@ -313,7 +313,7 @@
id: BibleStealObjective id: BibleStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Chaplain jobs: [ Chaplain ]
- type: StealCondition - type: StealCondition
stealGroup: Bible stealGroup: Bible
- type: Objective - type: Objective
@@ -324,7 +324,7 @@
id: ClothingNeckGoldmedalStealObjective id: ClothingNeckGoldmedalStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: HeadOfPersonnel jobs: [ HeadOfPersonnel ]
- type: StealCondition - type: StealCondition
stealGroup: ClothingNeckGoldmedal stealGroup: ClothingNeckGoldmedal
- type: Objective - type: Objective
@@ -335,7 +335,7 @@
id: ClothingNeckClownmedalStealObjective id: ClothingNeckClownmedalStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Captain jobs: [ Captain ]
- type: StealCondition - type: StealCondition
stealGroup: ClothingNeckClownmedal stealGroup: ClothingNeckClownmedal
- type: Objective - type: Objective
@@ -346,7 +346,7 @@
id: CaptainSwordStealObjective id: CaptainSwordStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Captain jobs: [ Captain ]
- type: StealCondition - type: StealCondition
stealGroup: CaptainSword stealGroup: CaptainSword
- type: Objective - type: Objective
@@ -359,7 +359,7 @@
id: NuclearBombStealObjective id: NuclearBombStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Captain jobs: [ Captain ]
- type: StealCondition - type: StealCondition
stealGroup: NuclearBomb stealGroup: NuclearBomb
- type: Objective - type: Objective
@@ -370,7 +370,7 @@
id: FaxMachineCaptainStealObjective id: FaxMachineCaptainStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Captain jobs: [ Captain ]
- type: StealCondition - type: StealCondition
stealGroup: FaxMachineCaptain stealGroup: FaxMachineCaptain
- type: Objective - type: Objective
@@ -381,7 +381,7 @@
id: ChemDispenserStealObjective id: ChemDispenserStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Chemist #TODO: make it so this also includes Scientist. It's a roundstart circuit they can construct. jobs: [ Chemist, Scientist ]
- type: StealCondition - type: StealCondition
stealGroup: ChemDispenser stealGroup: ChemDispenser
- type: Objective - type: Objective
@@ -392,7 +392,7 @@
id: XenoArtifactStealObjective id: XenoArtifactStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Scientist jobs: [ Scientist ]
- type: StealCondition - type: StealCondition
stealGroup: XenoArtifact stealGroup: XenoArtifact
- type: Objective - type: Objective
@@ -403,7 +403,7 @@
id: FreezerHeaterStealObjective id: FreezerHeaterStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: AtmosphericTechnician #TODO: make it so this also includes Engineer, Medical doctor, chemist and maybe also scientist. Medical doc and chemist cause cryogenics, scientist cause it can be built and is sometimes mapped in artisci jobs: [ AtmosphericTechnician, MedicalDoctor, Chemist, Paramedic, Psychologist, Scientist, Chef ]
- type: StealCondition - type: StealCondition
stealGroup: FreezerHeater stealGroup: FreezerHeater
- type: Objective - type: Objective
@@ -414,7 +414,7 @@
id: TegStealObjective id: TegStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: AtmosphericTechnician #TODO: make it so this also includes Engineer, Several TEG only maps have TEG accessible by standard Engineers jobs: [ AtmosphericTechnician, StationEngineer ]
- type: StealCondition - type: StealCondition
stealGroup: Teg stealGroup: Teg
- type: Objective - type: Objective
@@ -425,7 +425,7 @@
id: BoozeDispenserStealObjective id: BoozeDispenserStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Bartender #TODO: make it so this also includes Service worker jobs: [ Bartender, ServiceWorker ]
- type: StealCondition - type: StealCondition
stealGroup: BoozeDispenser stealGroup: BoozeDispenser
- type: Objective - type: Objective
@@ -436,7 +436,7 @@
id: AltarNanotrasenStealObjective id: AltarNanotrasenStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Chaplain jobs: [ Chaplain ]
- type: StealCondition - type: StealCondition
stealGroup: AltarNanotrasen stealGroup: AltarNanotrasen
- type: Objective - type: Objective
@@ -447,7 +447,7 @@
id: PlantRDStealObjective id: PlantRDStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Scientist jobs: [ Scientist ]
- type: StealCondition - type: StealCondition
stealGroup: PlantRD stealGroup: PlantRD
- type: Objective - type: Objective
@@ -458,7 +458,7 @@
id: ToiletGoldenStealObjective id: ToiletGoldenStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Captain jobs: [ Captain ]
- type: StealCondition - type: StealCondition
stealGroup: ToiletGoldenDirtyWater stealGroup: ToiletGoldenDirtyWater
- type: Objective - type: Objective
@@ -471,7 +471,7 @@
id: IanStealObjective id: IanStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: HeadOfPersonnel jobs: [ HeadOfPersonnel ]
- type: StealCondition - type: StealCondition
stealGroup: AnimalIan stealGroup: AnimalIan
- type: Objective - type: Objective
@@ -491,7 +491,7 @@
id: McGriffStealObjective id: McGriffStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Detective jobs: [ Detective ]
- type: StealCondition - type: StealCondition
stealGroup: AnimalMcGriff stealGroup: AnimalMcGriff
- type: Objective - type: Objective
@@ -502,7 +502,7 @@
id: WalterStealObjective id: WalterStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Chemist jobs: [ Chemist ]
- type: StealCondition - type: StealCondition
stealGroup: AnimalWalter stealGroup: AnimalWalter
- type: Objective - type: Objective
@@ -522,7 +522,7 @@
id: RenaultStealObjective id: RenaultStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: Captain jobs: [ Captain ]
- type: StealCondition - type: StealCondition
stealGroup: AnimalRenault stealGroup: AnimalRenault
- type: Objective - type: Objective
@@ -533,7 +533,7 @@
id: ShivaStealObjective id: ShivaStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: SecurityOfficer jobs: [ SecurityOfficer ]
- type: StealCondition - type: StealCondition
stealGroup: AnimalShiva stealGroup: AnimalShiva
- type: Objective - type: Objective
@@ -544,7 +544,7 @@
id: TropicoStealObjective id: TropicoStealObjective
components: components:
- type: NotJobRequirement - type: NotJobRequirement
job: AtmosphericTechnician jobs: [ AtmosphericTechnician ]
- type: StealCondition - type: StealCondition
stealGroup: AnimalTropico stealGroup: AnimalTropico
- type: Objective - type: Objective

View File

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