-
Notifications
You must be signed in to change notification settings - Fork 43
Add Turncoat #1030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
moonheart08
wants to merge
3
commits into
EphemeralSpace:master
Choose a base branch
from
moonheart08:25-01-2026-turncoat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add Turncoat #1030
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
Content.Shared/_ES/Masks/Components/ESTargetMaskBlacklistComponent.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| { | ||
| if (_mask.GetMaskOrNull(args.Candidate) is {} mask && ent.Comp.MaskBlacklist.Contains(mask)) | ||
| args.Invalidate(); | ||
| } | ||
| } | ||
13 changes: 13 additions & 0 deletions
13
Content.Shared/_ES/Masks/MaskCycle/ESActionChangeMaskEvent.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
32
Content.Shared/_ES/Masks/MaskCycle/ESActionChangeMaskSystem.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto