From 3e1cf734696ca09e602170ffe8111187e94a2035 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sat, 13 Aug 2022 09:49:41 -0400 Subject: [PATCH] Revs (the spooky ones) (#9842) --- Content.Client/Ghost/GhostSystem.cs | 15 +- Content.Client/Revenant/RevenantComponent.cs | 16 + Content.Client/Revenant/RevenantSystem.cs | 36 ++ .../Revenant/Ui/RevenantBoundUserInterface.cs | 56 ++++ .../Revenant/Ui/RevenantListingControl.xaml | 21 ++ .../Ui/RevenantListingControl.xaml.cs | 26 ++ Content.Client/Revenant/Ui/RevenantMenu.xaml | 41 +++ .../Revenant/Ui/RevenantMenu.xaml.cs | 62 ++++ .../Traitor/Uplink/UplinkMenu.xaml.cs | 1 - Content.Server/Emag/EmagSystem.cs | 15 +- Content.Server/Ghost/GhostSystem.cs | 13 +- Content.Server/Revenant/CorporealComponent.cs | 15 + .../Revenant/EntitySystems/CorporealSystem.cs | 79 +++++ .../Revenant/EntitySystems/EssenceSystem.cs | 71 ++++ .../EntitySystems/RevenantSystem.Abilities.cs | 311 ++++++++++++++++++ .../EntitySystems/RevenantSystem.Shop.cs | 69 ++++ .../Revenant/EntitySystems/RevenantSystem.cs | 184 +++++++++++ Content.Server/Revenant/EssenceComponent.cs | 25 ++ Content.Server/Revenant/RevenantComponent.cs | 220 +++++++++++++ .../EntitySystems/EntityStorageSystem.cs | 4 +- Content.Shared/Alert/AlertType.cs | 4 +- Content.Shared/Interaction/InteractHand.cs | 19 ++ .../Interaction/SharedInteractionSystem.cs | 7 + .../Revenant/RevenantStoreListingPrototype.cs | 30 ++ Content.Shared/Revenant/SharedRevenant.cs | 49 +++ .../Revenant/SharedRevenantComponent.cs | 9 + .../StatusEffect/StatusEffectsSystem.cs | 50 ++- Resources/Locale/en-US/revenant/revenant.ftl | 23 ++ Resources/Prototypes/Actions/revenant.yml | 38 +++ Resources/Prototypes/Alerts/alerts.yml | 1 + Resources/Prototypes/Alerts/revenant.yml | 48 +++ .../Prototypes/Catalog/revenant_catalog.yml | 32 ++ .../Prototypes/Diseases/noninfectious.yml | 27 ++ .../Entities/Mobs/NPCs/revenant.yml | 100 ++++++ Resources/Prototypes/Polymorphs/polymorph.yml | 9 + Resources/Prototypes/explosion.yml | 12 + Resources/Prototypes/status_effects.yml | 5 + .../Textures/Interface/Actions/blight.png | Bin 0 -> 1107 bytes .../Textures/Interface/Actions/defile.png | Bin 0 -> 2686 bytes .../Interface/Actions/malfunction.png | Bin 0 -> 1075 bytes .../Textures/Interface/Actions/meta.json | 15 + .../Interface/Actions/overloadlight.png | Bin 0 -> 1390 bytes Resources/Textures/Interface/Actions/shop.png | Bin 0 -> 408 bytes .../Alerts/essence_counter.rsi/essence0.png | Bin 0 -> 319 bytes .../Alerts/essence_counter.rsi/essence1.png | Bin 0 -> 298 bytes .../Alerts/essence_counter.rsi/essence10.png | Bin 0 -> 308 bytes .../Alerts/essence_counter.rsi/essence11.png | Bin 0 -> 304 bytes .../Alerts/essence_counter.rsi/essence12.png | Bin 0 -> 311 bytes .../Alerts/essence_counter.rsi/essence13.png | Bin 0 -> 311 bytes .../Alerts/essence_counter.rsi/essence14.png | Bin 0 -> 321 bytes .../Alerts/essence_counter.rsi/essence15.png | Bin 0 -> 307 bytes .../Alerts/essence_counter.rsi/essence16.png | Bin 0 -> 313 bytes .../Alerts/essence_counter.rsi/essence2.png | Bin 0 -> 297 bytes .../Alerts/essence_counter.rsi/essence3.png | Bin 0 -> 299 bytes .../Alerts/essence_counter.rsi/essence4.png | Bin 0 -> 321 bytes .../Alerts/essence_counter.rsi/essence5.png | Bin 0 -> 302 bytes .../Alerts/essence_counter.rsi/essence6.png | Bin 0 -> 297 bytes .../Alerts/essence_counter.rsi/essence7.png | Bin 0 -> 317 bytes .../Alerts/essence_counter.rsi/essence8.png | Bin 0 -> 295 bytes .../Alerts/essence_counter.rsi/essence9.png | Bin 0 -> 292 bytes .../Alerts/essence_counter.rsi/meta.json | 62 ++++ .../Mobs/Ghosts/revenant.rsi/active.png | Bin 0 -> 2815 bytes .../Mobs/Ghosts/revenant.rsi/ectoplasm.png | Bin 0 -> 223 bytes .../Mobs/Ghosts/revenant.rsi/harvesting.png | Bin 0 -> 14279 bytes .../Mobs/Ghosts/revenant.rsi/icon.png | Bin 0 -> 526 bytes .../Mobs/Ghosts/revenant.rsi/idle.png | Bin 0 -> 1022 bytes .../Mobs/Ghosts/revenant.rsi/meta.json | 190 +++++++++++ .../Mobs/Ghosts/revenant.rsi/stunned.png | Bin 0 -> 6147 bytes 68 files changed, 1976 insertions(+), 34 deletions(-) create mode 100644 Content.Client/Revenant/RevenantComponent.cs create mode 100644 Content.Client/Revenant/RevenantSystem.cs create mode 100644 Content.Client/Revenant/Ui/RevenantBoundUserInterface.cs create mode 100644 Content.Client/Revenant/Ui/RevenantListingControl.xaml create mode 100644 Content.Client/Revenant/Ui/RevenantListingControl.xaml.cs create mode 100644 Content.Client/Revenant/Ui/RevenantMenu.xaml create mode 100644 Content.Client/Revenant/Ui/RevenantMenu.xaml.cs create mode 100644 Content.Server/Revenant/CorporealComponent.cs create mode 100644 Content.Server/Revenant/EntitySystems/CorporealSystem.cs create mode 100644 Content.Server/Revenant/EntitySystems/EssenceSystem.cs create mode 100644 Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs create mode 100644 Content.Server/Revenant/EntitySystems/RevenantSystem.Shop.cs create mode 100644 Content.Server/Revenant/EntitySystems/RevenantSystem.cs create mode 100644 Content.Server/Revenant/EssenceComponent.cs create mode 100644 Content.Server/Revenant/RevenantComponent.cs create mode 100644 Content.Shared/Revenant/RevenantStoreListingPrototype.cs create mode 100644 Content.Shared/Revenant/SharedRevenant.cs create mode 100644 Content.Shared/Revenant/SharedRevenantComponent.cs create mode 100644 Resources/Locale/en-US/revenant/revenant.ftl create mode 100644 Resources/Prototypes/Actions/revenant.yml create mode 100644 Resources/Prototypes/Alerts/revenant.yml create mode 100644 Resources/Prototypes/Catalog/revenant_catalog.yml create mode 100644 Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml create mode 100644 Resources/Textures/Interface/Actions/blight.png create mode 100644 Resources/Textures/Interface/Actions/defile.png create mode 100644 Resources/Textures/Interface/Actions/malfunction.png create mode 100644 Resources/Textures/Interface/Actions/overloadlight.png create mode 100644 Resources/Textures/Interface/Actions/shop.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence0.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence1.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence10.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence11.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence12.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence13.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence14.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence15.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence16.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence2.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence3.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence4.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence5.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence6.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence7.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence8.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/essence9.png create mode 100644 Resources/Textures/Interface/Alerts/essence_counter.rsi/meta.json create mode 100644 Resources/Textures/Mobs/Ghosts/revenant.rsi/active.png create mode 100644 Resources/Textures/Mobs/Ghosts/revenant.rsi/ectoplasm.png create mode 100644 Resources/Textures/Mobs/Ghosts/revenant.rsi/harvesting.png create mode 100644 Resources/Textures/Mobs/Ghosts/revenant.rsi/icon.png create mode 100644 Resources/Textures/Mobs/Ghosts/revenant.rsi/idle.png create mode 100644 Resources/Textures/Mobs/Ghosts/revenant.rsi/meta.json create mode 100644 Resources/Textures/Mobs/Ghosts/revenant.rsi/stunned.png diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index 0d6b3934cd..2ff040ecae 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -19,7 +19,7 @@ namespace Content.Client.Ghost // No good way to get an event into the UI. public int AvailableGhostRoleCount { get; private set; } = 0; - private bool _ghostVisibility; + private bool _ghostVisibility = true; private bool GhostVisibility { @@ -33,12 +33,9 @@ namespace Content.Client.Ghost _ghostVisibility = value; - foreach (var ghost in EntityManager.GetAllComponents(typeof(GhostComponent), true)) + foreach (var ghost in EntityQuery(true)) { - if (EntityManager.TryGetComponent(ghost.Owner, out SpriteComponent? sprite)) - { - sprite.Visible = value; - } + ghost.Item2.Visible = true; } } } @@ -69,12 +66,6 @@ namespace Content.Client.Ghost { component.Gui?.Dispose(); component.Gui = null; - - // PlayerDetachedMsg might not fire due to deletion order so... - if (component.IsAttached) - { - GhostVisibility = false; - } } private void OnGhostPlayerAttach(EntityUid uid, GhostComponent component, PlayerAttachedEvent playerAttachedEvent) diff --git a/Content.Client/Revenant/RevenantComponent.cs b/Content.Client/Revenant/RevenantComponent.cs new file mode 100644 index 0000000000..a99b744554 --- /dev/null +++ b/Content.Client/Revenant/RevenantComponent.cs @@ -0,0 +1,16 @@ +using Content.Shared.Revenant; + +namespace Content.Client.Revenant; + +[RegisterComponent] +public sealed class RevenantComponent : SharedRevenantComponent +{ + [DataField("state")] + public string State = "idle"; + [DataField("corporealState")] + public string CorporealState = "active"; + [DataField("stunnedState")] + public string StunnedState = "stunned"; + [DataField("harvestingState")] + public string HarvestingState = "harvesting"; +} diff --git a/Content.Client/Revenant/RevenantSystem.cs b/Content.Client/Revenant/RevenantSystem.cs new file mode 100644 index 0000000000..f942911ee9 --- /dev/null +++ b/Content.Client/Revenant/RevenantSystem.cs @@ -0,0 +1,36 @@ +using Content.Shared.Revenant; +using Robust.Client.GameObjects; + +namespace Content.Client.Revenant; + +public sealed class RevenantSystem : EntitySystem +{ + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnAppearanceChange); + } + + private void OnAppearanceChange(EntityUid uid, RevenantComponent component, ref AppearanceChangeEvent args) + { + if (args.Sprite == null) + return; + + if (args.Component.TryGetData(RevenantVisuals.Harvesting, out bool harvesting) && harvesting) + { + args.Sprite.LayerSetState(0, component.HarvestingState); + } + else if (args.Component.TryGetData(RevenantVisuals.Stunned, out bool stunned) && stunned) + { + args.Sprite.LayerSetState(0, component.StunnedState); + } + else if (args.Component.TryGetData(RevenantVisuals.Corporeal, out bool corporeal)) + { + if (corporeal) + args.Sprite.LayerSetState(0, component.CorporealState); + else + args.Sprite.LayerSetState(0, component.State); + } + } +} diff --git a/Content.Client/Revenant/Ui/RevenantBoundUserInterface.cs b/Content.Client/Revenant/Ui/RevenantBoundUserInterface.cs new file mode 100644 index 0000000000..9fc45e3aff --- /dev/null +++ b/Content.Client/Revenant/Ui/RevenantBoundUserInterface.cs @@ -0,0 +1,56 @@ +using Content.Client.Traitor.Uplink; +using Content.Shared.Revenant; +using Content.Shared.Traitor.Uplink; +using JetBrains.Annotations; +using Robust.Client.GameObjects; + +namespace Content.Client.Revenant.Ui; + +[UsedImplicitly] +public sealed class RevenantBoundUserInterface : BoundUserInterface +{ + private RevenantMenu? _menu; + + public RevenantBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) + { + + } + + protected override void Open() + { + _menu = new(); + _menu.OpenCentered(); + _menu.OnClose += Close; + + _menu.OnListingButtonPressed += (_, listing) => + { + SendMessage(new RevenantBuyListingMessage(listing)); + }; + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (_menu == null) + return; + + switch (state) + { + case RevenantUpdateState msg: + _menu.UpdateEssence(msg.Essence); + _menu.UpdateListing(msg.Listings); + break; + } + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) + return; + + _menu?.Close(); + _menu?.Dispose(); + } +} diff --git a/Content.Client/Revenant/Ui/RevenantListingControl.xaml b/Content.Client/Revenant/Ui/RevenantListingControl.xaml new file mode 100644 index 0000000000..6adcfdc896 --- /dev/null +++ b/Content.Client/Revenant/Ui/RevenantListingControl.xaml @@ -0,0 +1,21 @@ + + + +