Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Robust.Shared.Prototypes;

namespace Content.Shared._ES.Masks.Components;

/// <summary>
/// This is used for blacklisting certain masks from targeted objectives.
/// </summary>
[RegisterComponent]
public sealed partial class ESTargetMaskBlacklistComponent : Component
{
/// <summary>
/// A blacklist of masks that cannot be targeted.
/// </summary>
[DataField]
public HashSet<ProtoId<ESMaskPrototype>> MaskBlacklist;
}
21 changes: 21 additions & 0 deletions Content.Shared/_ES/Masks/ESTargetMaskSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Content.Shared._ES.Masks.Components;
using Content.Shared._ES.Objectives.Target.Components;

namespace Content.Shared._ES.Masks;

public sealed class ESTargetMaskSystem : EntitySystem
{
[Dependency] private readonly ESSharedMaskSystem _mask = default!;

/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<ESTargetMaskBlacklistComponent, ESValidateObjectiveTargetCandidates>(Handler);
}

private void Handler(Entity<ESTargetMaskBlacklistComponent> ent, ref ESValidateObjectiveTargetCandidates args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

{
if (_mask.GetMaskOrNull(args.Candidate) is {} mask && ent.Comp.MaskBlacklist.Contains(mask))
args.Invalidate();
}
}
13 changes: 13 additions & 0 deletions Content.Shared/_ES/Masks/MaskCycle/ESActionChangeMaskEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Content.Shared.Actions;
using Robust.Shared.Prototypes;

namespace Content.Shared._ES.Masks.MaskCycle;

/// <summary>
/// An action event for changing to another mask.
/// </summary>
public sealed partial class ESActionChangeMaskEvent : InstantActionEvent
{
[DataField(required: true)]
public ProtoId<ESMaskPrototype> Mask;
}
32 changes: 32 additions & 0 deletions Content.Shared/_ES/Masks/MaskCycle/ESActionChangeMaskSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Content.Shared.Mind;

namespace Content.Shared._ES.Masks.MaskCycle;

/// <summary>
/// This handles the mask change action.
/// </summary>
public sealed class ESActionChangeMaskSystem : EntitySystem
{
[Dependency] private readonly ESSharedMaskSystem _mask = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;

/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<ESActionChangeMaskEvent>(Handler);
}

private void Handler(ESActionChangeMaskEvent args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calling this "handler" instead of OnX is a little bit crazy

{
if (args.Handled)
return;

if (!_mind.TryGetMind(args.Performer, out var mind, out var mindComp))
return;

_mask.RemoveMask((mind, mindComp));
_mask.ApplyMask((mind, mindComp), args.Mask);

args.Handled = true;
}
}
5 changes: 5 additions & 0 deletions Resources/Locale/en-US/_ES/masks/masks.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ es-mask-subverter-desc = As a Subverter, you have received two brain-altering ch
es-mask-demolitionist-name = Demolitionist
es-mask-demolitionist-desc = As a Demolitionist, you have been trained by the Syndicate for both controlled and uncontrolled "demolitions"--including in the use of explosive implants, should things turn out that way.

# Oddballs

es-mask-turncoat-name = Turncoat
es-mask-turncoat-desc = As a Turncoat, you play to both sides, switching teams at will in an effort to win with either the crew or the traitors. Do so carefully, as you can only switch sides so often.

# Meta
es-objective-issuer-mask = Mask

Expand Down
35 changes: 35 additions & 0 deletions Resources/Prototypes/_ES/Actions/Masks/turncoat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
- type: entity
parent: BaseMentalAction
id: ESActionMaskTurncoatSwapTeamsBase
name: Turn your coat
description: Switch to the enemy's side, and try to win with them instead.
abstract: true
components:
- type: Action
checkCanInteract: false
icon:
sprite: _ES/Actions/masks/aura.rsi
state: aura
iconOn:
sprite: _ES/Actions/masks/aura.rsi
state: aura-on
useDelay: 10m
startDelay: true

- type: entity
parent: ESActionMaskTurncoatSwapTeamsBase
id: ESActionMaskTurncoatSwapTeamsCrew
description: Switch to the crew's side, and try to win with them instead.
components:
- type: InstantAction
event: !type:ESActionChangeMaskEvent
mask: ESTurncoatCrew

- type: entity
parent: ESActionMaskTurncoatSwapTeamsBase
id: ESActionMaskTurncoatSwapTeamsTraitors
description: Switch to the traitors' side, and try to win with them instead.
components:
- type: InstantAction
event: !type:ESActionChangeMaskEvent
mask: ESTurncoatTraitor
25 changes: 25 additions & 0 deletions Resources/Prototypes/_ES/Masks/masks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,28 @@
- type: ESMaskCacheSpawner
cacheProto:
id: ESCrateCacheTraitorDemolitionist

# Neutral/oddball masks
- type: esMask
id: ESTurncoatCrew
name: es-mask-turncoat-name
troupe: ESCrew
description: es-mask-turncoat-desc
color: gray
weight: 0.1
components:
- type: ActionGrant
actions:
- ESActionMaskTurncoatSwapTeamsTraitors

- type: esMask
parent: ESBaseTraitor
id: ESTurncoatTraitor
name: es-mask-turncoat-name
description: es-mask-turncoat-desc
color: gray
weight: 0
components:
- type: ActionGrant
actions:
- ESActionMaskTurncoatSwapTeamsCrew
2 changes: 1 addition & 1 deletion Resources/Prototypes/_ES/Masquerades/redcarpet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
13: ["ESAssassin"] # 0 generic crew, 3 traitors.
14: ["ESEmpath"]
16: ["ESAvenger"] # 1 generic crew, 3 traitors.
17: ["#Reaped"]
17: ["ESTurncoatCrew"]
18: ["ESArmsDealer"]
19: ["ESMarauder"] # 1 generic crew, 4 traitors.
20: ["ESVIP"]
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/_ES/Masquerades/traitors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
13: ["ESAssassin"] # 0 generic crew, 3 traitors.
14: ["ESEmpath"]
16: ["#Firmsafes"] # 1 generic crew, 3 traitors.
17: ["#Reaped"]
17: ["ESTurncoatCrew"]
18: ["ESArmsDealer"]
19: ["ESMarauder"] # 1 generic crew, 4 traitors.
20: ["#Softsafes"]
Expand Down
4 changes: 4 additions & 0 deletions Resources/Prototypes/_ES/Objectives/traitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
- type: ESTargetTroupeObjective
troupe: ESTraitor
invert: true
- type: ESTargetMaskBlacklist
maskBlacklist:
- ESTurncoatCrew
- ESTurncoatTraitor
- type: ESKillTargetObjective

### Sabotage objectives
Expand Down
Loading