introduce requirement to prevent from being tasked to steal your own item (#11139)
This commit is contained in:
25
Content.Server/Objectives/Requirements/NotRoleRequirement.cs
Normal file
25
Content.Server/Objectives/Requirements/NotRoleRequirement.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using Content.Shared.Roles;
|
||||||
|
using Content.Server.Objectives.Interfaces;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Server.Objectives.Requirements
|
||||||
|
{
|
||||||
|
|
||||||
|
[DataDefinition]
|
||||||
|
public sealed class NotRoleRequirement : IObjectiveRequirement
|
||||||
|
{
|
||||||
|
[DataField("roleId", customTypeSerializer:typeof(PrototypeIdSerializer<JobPrototype>))]
|
||||||
|
private string roleId = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This requirement is met if the traitor is NOT the roleId, and fails if they are.
|
||||||
|
/// </summary>
|
||||||
|
public bool CanBeAssigned(Mind.Mind mind)
|
||||||
|
{
|
||||||
|
if (mind.CurrentJob == null) // no job no problems
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return (mind.CurrentJob.Prototype.ID != roleId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: Captain
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: CaptainIDCard
|
prototype: CaptainIDCard
|
||||||
@@ -71,6 +73,8 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: ChiefMedicalOfficer
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: Hypospray
|
prototype: Hypospray
|
||||||
@@ -86,6 +90,8 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: ResearchDirector
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: ClothingOuterHardsuitRd
|
prototype: ClothingOuterHardsuitRd
|
||||||
@@ -100,11 +106,24 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: Captain
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: HeadOfSecurity
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: HeadOfPersonnel
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: ChiefEngineer
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: ChiefMedicalOfficer
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: ResearchDirector
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: NukeDisk
|
prototype: NukeDisk
|
||||||
owner: objective-condition-steal-station
|
owner: objective-condition-steal-station
|
||||||
|
|
||||||
|
|
||||||
- type: objective
|
- type: objective
|
||||||
id: IDComputerBoardStealObjective
|
id: IDComputerBoardStealObjective
|
||||||
issuer: syndicate
|
issuer: syndicate
|
||||||
@@ -114,6 +133,8 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: HeadOfPersonnel
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: IDComputerCircuitboard
|
prototype: IDComputerCircuitboard
|
||||||
@@ -129,6 +150,8 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: ChiefEngineer
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: ClothingShoesBootsMagAdv
|
prototype: ClothingShoesBootsMagAdv
|
||||||
@@ -143,6 +166,8 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: Quartermaster
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: SupplyComputerCircuitboard
|
prototype: SupplyComputerCircuitboard
|
||||||
@@ -157,6 +182,8 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: HeadOfPersonnel
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: FoodMeatCorgi
|
prototype: FoodMeatCorgi
|
||||||
@@ -172,6 +199,8 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: Captain
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: WeaponAntiqueLaser
|
prototype: WeaponAntiqueLaser
|
||||||
@@ -187,6 +216,8 @@
|
|||||||
- !type:IncompatibleConditionsRequirement
|
- !type:IncompatibleConditionsRequirement
|
||||||
conditions:
|
conditions:
|
||||||
- DieCondition
|
- DieCondition
|
||||||
|
- !type:NotRoleRequirement
|
||||||
|
roleId: Captain
|
||||||
conditions:
|
conditions:
|
||||||
- !type:StealCondition
|
- !type:StealCondition
|
||||||
prototype: JetpackCaptainFilled
|
prototype: JetpackCaptainFilled
|
||||||
|
|||||||
Reference in New Issue
Block a user