-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Changeling Biodegrade #43671
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
Open
ScarKy0
wants to merge
8
commits into
space-wizards:master
Choose a base branch
from
ScarKy0:changeling-biodegrade
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.
Open
Changeling Biodegrade #43671
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0db6a38
initial
ScarKy0 e99053f
jesus fucking christ
ScarKy0 a2a26bf
fuck
ScarKy0 f45e87c
Update changeling.yml
ScarKy0 61bb028
oh my god
ScarKy0 34863f4
yay
ScarKy0 22b51b9
Merge remote-tracking branch 'upstream/master' into changeling-biodeg…
ScarKy0 58153a6
vomit acid
ScarKy0 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
44 changes: 44 additions & 0 deletions
44
Content.Shared/Changeling/Components/ChangelingBiodegradeAbilityComponent.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,44 @@ | ||
| using Content.Shared.Actions; | ||
| using Robust.Shared.Audio; | ||
| using Robust.Shared.GameStates; | ||
|
|
||
| namespace Content.Shared.Changeling.Components; | ||
|
|
||
| /// <summary> | ||
| /// Allows the changeling to spawn dummy chameleon clothing items that will transform with them, | ||
| /// mimicing the equipment of the stored disguise. | ||
| /// </summary> | ||
| [RegisterComponent, NetworkedComponent] | ||
| public sealed partial class ChangelingBiodegradeAbilityComponent : Component | ||
| { | ||
| /// <summary> | ||
| /// How long to stun the puller of the changeling when this action is activated. | ||
| /// </summary> | ||
| [DataField] | ||
| public TimeSpan PullerStunDuration = TimeSpan.FromSeconds(3f); | ||
|
|
||
| /// <summary> | ||
| /// The popup to display over the user when the action is used. | ||
| /// Only visible to other players. | ||
| /// </summary> | ||
| [DataField] | ||
| public LocId ActivatedPopup = "changeling-biodegrade-used-popup"; | ||
|
|
||
| /// <summary> | ||
| /// The popup to display over the user when the action is used. | ||
| /// Only visible to the user | ||
| /// </summary> | ||
| [DataField] | ||
| public LocId ActivatedPopupSelf = "changeling-biodegrade-used-popup-self"; | ||
|
|
||
| /// <summary> | ||
| /// The sound to play when the ability is successfully used. | ||
| /// </summary> | ||
| [DataField] | ||
| public SoundSpecifier ActivatedSound = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg"); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Action event for Biodegrade, raised on the ability when used. | ||
| /// </summary> | ||
| public sealed partial class ChangelingBiodegradeActionEvent : InstantActionEvent; | ||
71 changes: 71 additions & 0 deletions
71
Content.Shared/Changeling/Systems/ChangelingAbilitySystem.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,71 @@ | ||
| using System.Linq; | ||
| using Content.Shared.Changeling.Components; | ||
| using Content.Shared.Cuffs; | ||
| using Content.Shared.Ensnaring; | ||
| using Content.Shared.IdentityManagement; | ||
| using Content.Shared.Movement.Pulling.Systems; | ||
| using Content.Shared.Popups; | ||
| using Content.Shared.Stunnable; | ||
| using Robust.Shared.Audio.Systems; | ||
|
|
||
| namespace Content.Shared.Changeling.Systems; | ||
|
|
||
| public sealed partial class ChangelingAbilitySystem : EntitySystem | ||
| { | ||
|
|
||
| [Dependency] private readonly SharedAudioSystem _audio = default!; | ||
| [Dependency] private readonly SharedPopupSystem _popup = default!; | ||
| [Dependency] private readonly SharedCuffableSystem _cuffable = default!; | ||
| [Dependency] private readonly SharedEnsnareableSystem _snare = default!; | ||
| [Dependency] private readonly PullingSystem _pulling = default!; | ||
| [Dependency] private readonly SharedStunSystem _stun = default!; | ||
|
|
||
| public override void Initialize() | ||
| { | ||
| base.Initialize(); | ||
|
|
||
| SubscribeLocalEvent<ChangelingBiodegradeAbilityComponent, ChangelingBiodegradeActionEvent>(OnBiodegradeAction); | ||
| } | ||
|
|
||
| private void OnBiodegradeAction(Entity<ChangelingBiodegradeAbilityComponent> ent, ref ChangelingBiodegradeActionEvent args) | ||
| { | ||
| // Nothing can be done :( | ||
| if (!_cuffable.IsCuffed(args.Performer) && !_snare.IsEnsnared(args.Performer)) | ||
| return; | ||
|
|
||
| if (_pulling.GetPuller(args.Performer) is { } puller) | ||
| { | ||
| _stun.TryAddParalyzeDuration(puller, ent.Comp.PullerStunDuration); | ||
| } | ||
|
|
||
| List<EntityUid> toDelete = new List<EntityUid>(); | ||
|
|
||
| _cuffable.TryGetAllCuffs(args.Performer, out var cuffs); | ||
| foreach (var cuff in cuffs.ToList()) | ||
| { | ||
| _cuffable.Uncuff(args.Performer, args.Performer, cuff); | ||
| toDelete.Add(cuff); | ||
| } | ||
|
|
||
| toDelete.AddRange(_snare.ForceFreeAll(args.Performer)); | ||
|
|
||
| args.Handled = true; | ||
|
|
||
| // How can you be ensnared/cuffed and have nothing detected?? | ||
| if (toDelete.Count == 0) | ||
| return; | ||
|
Comment on lines
+56
to
+58
Contributor
Author
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. In theory impossible but client crashes without it. Checking for ApplyingState doesn't help. |
||
|
|
||
| var selfPopup = Loc.TryGetString(ent.Comp.ActivatedPopupSelf, out var self, ("user", Identity.Entity(args.Performer, EntityManager)), ("cuffs", toDelete.First())) ? self : null; | ||
| var othersPopup = Loc.TryGetString(ent.Comp.ActivatedPopup, out var others, ("user", Identity.Entity(args.Performer, EntityManager)), ("cuffs", toDelete.First())) ? others : null; | ||
|
|
||
| _popup.PopupPredicted(othersPopup, selfPopup, args.Performer, args.Performer, PopupType.LargeCaution); | ||
| _audio.PlayPredicted(ent.Comp.ActivatedSound, args.Performer, args.Performer); | ||
|
|
||
| foreach (var deleted in toDelete) | ||
| { | ||
| PredictedQueueDel(deleted); | ||
| } | ||
|
|
||
| // TODO: Should probably spawn a puddle of acid. But solutions are frozen due to an upcoming refactor. | ||
| } | ||
| } | ||
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Uh oh!
There was an error while loading. Please reload this page.