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
|
||||
conditions:
|
||||
- DieCondition
|
||||
- !type:NotRoleRequirement
|
||||
roleId: Captain
|
||||
conditions:
|
||||
- !type:StealCondition
|
||||
prototype: CaptainIDCard
|
||||
@@ -71,6 +73,8 @@
|
||||
- !type:IncompatibleConditionsRequirement
|
||||
conditions:
|
||||
- DieCondition
|
||||
- !type:NotRoleRequirement
|
||||
roleId: ChiefMedicalOfficer
|
||||
conditions:
|
||||
- !type:StealCondition
|
||||
prototype: Hypospray
|
||||
@@ -86,6 +90,8 @@
|
||||
- !type:IncompatibleConditionsRequirement
|
||||
conditions:
|
||||
- DieCondition
|
||||
- !type:NotRoleRequirement
|
||||
roleId: ResearchDirector
|
||||
conditions:
|
||||
- !type:StealCondition
|
||||
prototype: ClothingOuterHardsuitRd
|
||||
@@ -100,11 +106,24 @@
|
||||
- !type:IncompatibleConditionsRequirement
|
||||
conditions:
|
||||
- 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:
|
||||
- !type:StealCondition
|
||||
prototype: NukeDisk
|
||||
owner: objective-condition-steal-station
|
||||
|
||||
|
||||
- type: objective
|
||||
id: IDComputerBoardStealObjective
|
||||
issuer: syndicate
|
||||
@@ -114,6 +133,8 @@
|
||||
- !type:IncompatibleConditionsRequirement
|
||||
conditions:
|
||||
- DieCondition
|
||||
- !type:NotRoleRequirement
|
||||
roleId: HeadOfPersonnel
|
||||
conditions:
|
||||
- !type:StealCondition
|
||||
prototype: IDComputerCircuitboard
|
||||
@@ -129,6 +150,8 @@
|
||||
- !type:IncompatibleConditionsRequirement
|
||||
conditions:
|
||||
- DieCondition
|
||||
- !type:NotRoleRequirement
|
||||
roleId: ChiefEngineer
|
||||
conditions:
|
||||
- !type:StealCondition
|
||||
prototype: ClothingShoesBootsMagAdv
|
||||
@@ -143,6 +166,8 @@
|
||||
- !type:IncompatibleConditionsRequirement
|
||||
conditions:
|
||||
- DieCondition
|
||||
- !type:NotRoleRequirement
|
||||
roleId: Quartermaster
|
||||
conditions:
|
||||
- !type:StealCondition
|
||||
prototype: SupplyComputerCircuitboard
|
||||
@@ -157,6 +182,8 @@
|
||||
- !type:IncompatibleConditionsRequirement
|
||||
conditions:
|
||||
- DieCondition
|
||||
- !type:NotRoleRequirement
|
||||
roleId: HeadOfPersonnel
|
||||
conditions:
|
||||
- !type:StealCondition
|
||||
prototype: FoodMeatCorgi
|
||||
@@ -172,6 +199,8 @@
|
||||
- !type:IncompatibleConditionsRequirement
|
||||
conditions:
|
||||
- DieCondition
|
||||
- !type:NotRoleRequirement
|
||||
roleId: Captain
|
||||
conditions:
|
||||
- !type:StealCondition
|
||||
prototype: WeaponAntiqueLaser
|
||||
@@ -187,6 +216,8 @@
|
||||
- !type:IncompatibleConditionsRequirement
|
||||
conditions:
|
||||
- DieCondition
|
||||
- !type:NotRoleRequirement
|
||||
roleId: Captain
|
||||
conditions:
|
||||
- !type:StealCondition
|
||||
prototype: JetpackCaptainFilled
|
||||
|
||||
Reference in New Issue
Block a user