From 1c11332fa4b77d556e7f3db17f391dbd2664cda5 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Wed, 3 Jan 2024 01:16:02 -0500 Subject: [PATCH] Flatpacks and the Flatpacker 1001 (#23338) * Flatpacker and flatpacks * ok that's good enough * convert solars/AME to flatpacks * mats, mats, we are the mats * basic mechanics are DONE * thing * final UI * sloth * rped jumpscare * rename --- Content.Client/Construction/FlatpackSystem.cs | 48 ++++++ .../UI/FlatpackCreatorBoundUserInterface.cs | 40 +++++ .../Construction/UI/FlatpackCreatorMenu.xaml | 43 +++++ .../UI/FlatpackCreatorMenu.xaml.cs | 147 +++++++++++++++++ .../Materials/UI/MaterialDisplay.xaml | 1 - .../UI/MaterialStorageControl.xaml.cs | 4 +- .../Ame/Components/AmePartComponent.cs | 24 --- .../Ame/EntitySystems/AmePartSystem.cs | 53 ------- Content.Server/Construction/FlatpackSystem.cs | 98 ++++++++++++ .../Components/FlatpackComponent.cs | 51 ++++++ .../Components/FlatpackCreatorComponent.cs | 69 ++++++++ .../Construction/MachinePartSystem.cs | 87 ++++++++++ .../Construction/SharedFlatpackSystem.cs | 150 ++++++++++++++++++ Content.Shared/Lathe/SharedLatheSystem.cs | 30 ++++ .../Materials/SharedMaterialStorageSystem.cs | 73 +++++++-- .../construction/components/flatpack.ftl | 11 ++ .../Locale/en-US/research/technologies.ftl | 1 + Resources/Locale/en-US/wires/wire-names.ftl | 1 + .../Circuitboards/Machine/production.yml | 13 ++ .../Entities/Objects/Devices/flatpack.yml | 33 ++++ .../Objects/Devices/station_beacon.yml | 2 +- .../Objects/Power/antimatter_part.yml | 7 +- .../Entities/Objects/Power/solar_parts.yml | 8 +- .../Structures/Machines/flatpacker.yml | 82 ++++++++++ .../Entities/Structures/Machines/lathe.yml | 1 + .../Structures/Power/Generation/solar.yml | 3 +- .../Prototypes/Recipes/Lathes/electronics.yml | 9 ++ Resources/Prototypes/Research/industrial.yml | 12 ++ Resources/Prototypes/tags.yml | 3 - .../Objects/Devices/flatpack.rsi/base.png | Bin 0 -> 331 bytes .../Devices/flatpack.rsi/icon-default.png | Bin 0 -> 175 bytes .../Objects/Devices/flatpack.rsi/meta.json | 20 +++ .../Objects/Devices/flatpack.rsi/overlay.png | Bin 0 -> 144 bytes .../Machines/flatpacker.rsi/base.png | Bin 0 -> 1046 bytes .../Machines/flatpacker.rsi/inserting.png | Bin 0 -> 235 bytes .../Machines/flatpacker.rsi/meta.json | 42 +++++ .../Machines/flatpacker.rsi/packing.png | Bin 0 -> 1161 bytes .../Machines/flatpacker.rsi/panel.png | Bin 0 -> 292 bytes .../Machines/flatpacker.rsi/screen.png | Bin 0 -> 155 bytes SpaceStation14.sln.DotSettings | 1 + 40 files changed, 1066 insertions(+), 101 deletions(-) create mode 100644 Content.Client/Construction/FlatpackSystem.cs create mode 100644 Content.Client/Construction/UI/FlatpackCreatorBoundUserInterface.cs create mode 100644 Content.Client/Construction/UI/FlatpackCreatorMenu.xaml create mode 100644 Content.Client/Construction/UI/FlatpackCreatorMenu.xaml.cs delete mode 100644 Content.Server/Ame/Components/AmePartComponent.cs delete mode 100644 Content.Server/Ame/EntitySystems/AmePartSystem.cs create mode 100644 Content.Server/Construction/FlatpackSystem.cs create mode 100644 Content.Shared/Construction/Components/FlatpackComponent.cs create mode 100644 Content.Shared/Construction/Components/FlatpackCreatorComponent.cs create mode 100644 Content.Shared/Construction/SharedFlatpackSystem.cs create mode 100644 Resources/Locale/en-US/construction/components/flatpack.ftl create mode 100644 Resources/Prototypes/Entities/Objects/Devices/flatpack.yml create mode 100644 Resources/Prototypes/Entities/Structures/Machines/flatpacker.yml create mode 100644 Resources/Textures/Objects/Devices/flatpack.rsi/base.png create mode 100644 Resources/Textures/Objects/Devices/flatpack.rsi/icon-default.png create mode 100644 Resources/Textures/Objects/Devices/flatpack.rsi/meta.json create mode 100644 Resources/Textures/Objects/Devices/flatpack.rsi/overlay.png create mode 100644 Resources/Textures/Structures/Machines/flatpacker.rsi/base.png create mode 100644 Resources/Textures/Structures/Machines/flatpacker.rsi/inserting.png create mode 100644 Resources/Textures/Structures/Machines/flatpacker.rsi/meta.json create mode 100644 Resources/Textures/Structures/Machines/flatpacker.rsi/packing.png create mode 100644 Resources/Textures/Structures/Machines/flatpacker.rsi/panel.png create mode 100644 Resources/Textures/Structures/Machines/flatpacker.rsi/screen.png diff --git a/Content.Client/Construction/FlatpackSystem.cs b/Content.Client/Construction/FlatpackSystem.cs new file mode 100644 index 0000000000..911ff1279c --- /dev/null +++ b/Content.Client/Construction/FlatpackSystem.cs @@ -0,0 +1,48 @@ +using Content.Shared.Construction; +using Content.Shared.Construction.Components; +using Robust.Client.GameObjects; +using Robust.Shared.Prototypes; + +namespace Content.Client.Construction; + +/// +public sealed class FlatpackSystem : SharedFlatpackSystem +{ + [Dependency] private readonly AppearanceSystem _appearance = default!; + + /// + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnAppearanceChange); + } + + private void OnAppearanceChange(Entity ent, ref AppearanceChangeEvent args) + { + var (_, comp) = ent; + if (!_appearance.TryGetData(ent, FlatpackVisuals.Machine, out var machineBoardId) || args.Sprite == null) + return; + + if (!PrototypeManager.TryIndex(machineBoardId, out var machineBoardPrototype)) + return; + + if (!machineBoardPrototype.TryGetComponent(out var sprite)) + return; + + Color? color = null; + foreach (var layer in sprite.AllLayers) + { + if (layer.RsiState.Name is not { } spriteState) + continue; + + if (!comp.BoardColors.TryGetValue(spriteState, out var c)) + continue; + color = c; + break; + } + + if (color != null) + args.Sprite.LayerSetColor(FlatpackVisualLayers.Overlay, color.Value); + } +} diff --git a/Content.Client/Construction/UI/FlatpackCreatorBoundUserInterface.cs b/Content.Client/Construction/UI/FlatpackCreatorBoundUserInterface.cs new file mode 100644 index 0000000000..86f1b8b83c --- /dev/null +++ b/Content.Client/Construction/UI/FlatpackCreatorBoundUserInterface.cs @@ -0,0 +1,40 @@ +using Content.Shared.Construction.Components; +using JetBrains.Annotations; + +namespace Content.Client.Construction.UI +{ + [UsedImplicitly] + public sealed class FlatpackCreatorBoundUserInterface : BoundUserInterface + { + [ViewVariables] + private FlatpackCreatorMenu? _menu; + + public FlatpackCreatorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + _menu = new FlatpackCreatorMenu(Owner); + _menu.OnClose += Close; + + _menu.PackButtonPressed += () => + { + SendMessage(new FlatpackCreatorStartPackBuiMessage()); + }; + + _menu.OpenCentered(); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) + return; + + _menu?.Dispose(); + } + } +} diff --git a/Content.Client/Construction/UI/FlatpackCreatorMenu.xaml b/Content.Client/Construction/UI/FlatpackCreatorMenu.xaml new file mode 100644 index 0000000000..5dffc5aa7f --- /dev/null +++ b/Content.Client/Construction/UI/FlatpackCreatorMenu.xaml @@ -0,0 +1,43 @@ + + + + + + + + +