From fa1d3d36cd65f379eba053062718564a486f181c Mon Sep 17 00:00:00 2001 From: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:59:51 -0700 Subject: [PATCH] Loadouts V3 (#736) # Description Resolves #723 Resolves #708 Resolves #691 Resolves #671 Resolves #643 Adding/removing loadouts and categories (and trait stuff) will require disconnecting and reconnecting to the server (or anything that will reload the lobby UI) due to how I've done my caching. --- # TODO - [x] Test entity IDs from loadouts - [x] Better Tab Container - [x] Scroll props - [x] Margin props - [x] Make vertical work - [x] Merge buttons - [x] Subcategories - [x] Allow the same for traits (their tab is completely broken) - [x] Give the Job Picker tab a BoxContainer - [x] Different selected unusable color - [x] Deselect unusable button - Sort menu/Reverse sort direction button - [x] Fix scroll resetting on updating - [x] Cache loadouts - [x] Ensure everything that can affect reqs updates everything that checks reqs - [x] More Requirements - [x] Height - [x] Width - [x] Weight - [x] Gender - [x] Sex - Markings - [x] Logic - [x] And - [x] Or - [x] Xor - [x] Item groups - [x] #643 - Something better than `Exclusive` - Allow picking slots for things to go in (hands and inventories too) - [x] Add a background to the loadout spriteView - [x] Get better style colors --- - [ ] More PRs - [ ] Remove duplicate command loadouts that are outside the command folders/categories - [ ] Categorize job loadouts (By dept?) - [ ] Fix [every loadout](https://discord.com/channels/1218698320155906090/1218698321053356060/1279260210208440361)'s IDs (who reviewed them??) - [ ] Make loadout ID migrations? ---

Media

## New loadouts/traits UI ![image](https://github.com/user-attachments/assets/9a9c3f64-6ba4-40ea-a89e-d5f57efcf7c0) ![image](https://github.com/user-attachments/assets/3b6f0a36-a474-4ca6-a7c8-90c13e3faa0b) ## NeoTabContainer allows changing the tab orientation ### https://youtu.be/krg8TJoQG3I ![image](https://github.com/user-attachments/assets/81491ad9-45bd-41ed-833e-7295a2216a04) ![image](https://github.com/user-attachments/assets/deb72919-7efe-4be9-a661-b12aa7dc6976)

--- # Changelog :cl: - fix: The loadout/trait editors' performance has been improved by 100~1000x - tweak: The character editor's tabs look, feel, and function much better - fix: Unusable loadouts/traits have an orange color when selected - tweak: Loadout previews are now inside the button - add: Added a button to remove any unusable loadouts (or traits) you have selected - add: Loadouts and traits can have subcategories, though only Command loadouts use them at the moment - fix: Fixed empty loadout categories not hiding - fix: Fixed spacing on some loadout requirements' reason text - fix: Fixed traits not updating after saving --- .../Administration/UI/AdminUIHelpers.cs | 2 +- Content.Client/Changelog/ChangelogButton.cs | 4 +- Content.Client/FlavorText/FlavorText.xaml | 2 +- .../Gateway/UI/GatewayWindow.xaml.cs | 2 +- Content.Client/LateJoin/LateJoinGui.cs | 3 +- .../Options/UI/Tabs/KeyRebindTab.xaml.cs | 2 +- .../Preferences/UI/AntagPreferenceSelector.cs | 1 + .../Preferences/UI/CharacterSetupGui.xaml.cs | 2 +- .../Preferences/UI/HumanoidProfileEditor.xaml | 79 +- .../UI/HumanoidProfileEditor.xaml.cs | 805 ++++++++------ .../UI/LoadoutPreferenceSelector.cs | 99 +- .../Preferences/UI/TraitPreferenceSelector.cs | 43 +- .../Salvage/UI/OfferingWindowOption.xaml.cs | 4 +- Content.Client/Stylesheets/StyleBase.cs | 1 + Content.Client/Stylesheets/StyleNano.cs | 48 +- Content.Client/Stylesheets/StyleSpace.cs | 8 +- .../Controls/NeoTabContainer.Props.xaml.cs | 163 +++ .../Controls/NeoTabContainer.xaml | 30 + .../Controls/NeoTabContainer.xaml.cs | 299 ++++++ .../Ghost/Controls/Roles/GhostRolesEui.cs | 20 +- .../Systems/Ghost/Widgets/GhostGui.xaml.cs | 4 +- .../PlayTimeTrackingSystem.cs | 21 +- Content.Server/Traits/TraitSystem.cs | 5 +- .../Prototypes/LoadoutCategoryPrototype.cs | 8 +- .../Loadouts/Prototypes/LoadoutPrototype.cs | 19 +- .../Loadouts/Systems/LoadoutSystem.cs | 10 +- .../Systems/CharacterRequirements.Job.cs | 20 +- .../Systems/CharacterRequirements.Logic.cs | 147 +++ .../Systems/CharacterRequirements.Profile.cs | 224 +++- .../CharacterRequirements.Whitelist.cs | 4 +- .../Systems/CharacterRequirements.cs | 6 +- .../Systems/CharacterRequirementsSystem.cs | 31 +- .../Prototypes/CharacterItemGroupPrototype.cs | 55 + .../Prototypes/TraitCategoryPrototype.cs | 6 + .../Traits/Prototypes/TraitPrototype.cs | 4 +- .../customization/character-requirements.ftl | 152 ++- .../Locale/en-US/loadouts/categories.ftl | 10 + .../ui/humanoid-profile-editor.ftl | 22 +- .../CharacterItemGroups/itemGroups.yml | 67 ++ .../Loadouts/Categories/categories.yml | 95 ++ .../Loadouts/Jobs/Heads/captain.yml | 31 +- .../Loadouts/Jobs/Heads/chiefEngineer.yml | 13 +- .../Jobs/Heads/chiefMedicalOfficer.yml | 17 +- .../Loadouts/Jobs/Heads/command.yml | 2 +- .../Loadouts/Jobs/Heads/headOfPersonnel.yml | 25 +- .../Loadouts/Jobs/Heads/headOfSecurity.yml | 35 +- .../Loadouts/Jobs/Heads/quarterMaster.yml | 17 +- .../Loadouts/Jobs/Heads/researchDirector.yml | 15 +- Resources/Prototypes/Loadouts/Jobs/cargo.yml | 13 +- .../Prototypes/Loadouts/Jobs/engineering.yml | 32 +- .../Prototypes/Loadouts/Jobs/medical.yml | 121 +-- .../Prototypes/Loadouts/Jobs/science.yml | 22 +- .../Prototypes/Loadouts/Jobs/security.yml | 142 +-- .../Prototypes/Loadouts/Jobs/service.yml | 128 +-- Resources/Prototypes/Loadouts/categories.yml | 37 - Resources/Prototypes/Loadouts/shoes.yml | 149 --- Resources/Prototypes/Loadouts/uniform.yml | 989 ++++++++---------- Resources/Prototypes/Traits/categories.yml | 6 + 58 files changed, 2691 insertions(+), 1630 deletions(-) create mode 100644 Content.Client/UserInterface/Controls/NeoTabContainer.Props.xaml.cs create mode 100644 Content.Client/UserInterface/Controls/NeoTabContainer.xaml create mode 100644 Content.Client/UserInterface/Controls/NeoTabContainer.xaml.cs create mode 100644 Content.Shared/Customization/Systems/CharacterRequirements.Logic.cs create mode 100644 Content.Shared/Prototypes/CharacterItemGroupPrototype.cs create mode 100644 Resources/Prototypes/CharacterItemGroups/itemGroups.yml create mode 100644 Resources/Prototypes/Loadouts/Categories/categories.yml delete mode 100644 Resources/Prototypes/Loadouts/categories.yml diff --git a/Content.Client/Administration/UI/AdminUIHelpers.cs b/Content.Client/Administration/UI/AdminUIHelpers.cs index 89ab33e931d..7fa81728910 100644 --- a/Content.Client/Administration/UI/AdminUIHelpers.cs +++ b/Content.Client/Administration/UI/AdminUIHelpers.cs @@ -50,7 +50,7 @@ public static bool TryConfirm(Button button, Dictionary + diff --git a/Content.Client/Gateway/UI/GatewayWindow.xaml.cs b/Content.Client/Gateway/UI/GatewayWindow.xaml.cs index 889dd6e1759..b3e1333a7a9 100644 --- a/Content.Client/Gateway/UI/GatewayWindow.xaml.cs +++ b/Content.Client/Gateway/UI/GatewayWindow.xaml.cs @@ -155,7 +155,7 @@ public void UpdateState(GatewayBoundUserInterfaceState state) if (Pressable()) { - openButton.AddStyleClass(StyleBase.ButtonCaution); + openButton.AddStyleClass(StyleBase.ButtonDanger); } var buttonContainer = new BoxContainer() diff --git a/Content.Client/LateJoin/LateJoinGui.cs b/Content.Client/LateJoin/LateJoinGui.cs index 92e1ee2aaf1..1351aa9e86a 100644 --- a/Content.Client/LateJoin/LateJoinGui.cs +++ b/Content.Client/LateJoin/LateJoinGui.cs @@ -266,9 +266,10 @@ private void RebuildUI() prototype.Requirements ?? new(), prototype, (HumanoidCharacterProfile) (_prefs.Preferences?.SelectedCharacter - ?? HumanoidCharacterProfile.DefaultWithSpecies()), + ?? HumanoidCharacterProfile.DefaultWithSpecies()), _jobRequirements.GetRawPlayTimeTrackers(), _jobRequirements.IsWhitelisted(), + prototype, _entityManager, _prototypeManager, _configManager, diff --git a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs index 13e456985a7..3d8ae50748c 100644 --- a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs @@ -478,7 +478,7 @@ public KeyControl(KeyRebindTab parent, BoundKeyFunction function) BindButton1 = new BindButton(parent, this, StyleBase.ButtonOpenRight); BindButton2 = new BindButton(parent, this, StyleBase.ButtonOpenLeft); - ResetButton = new Button { Text = Loc.GetString("ui-options-bind-reset"), StyleClasses = { StyleBase.ButtonCaution } }; + ResetButton = new Button { Text = Loc.GetString("ui-options-bind-reset"), StyleClasses = { StyleBase.ButtonDanger } }; var hBox = new BoxContainer { diff --git a/Content.Client/Preferences/UI/AntagPreferenceSelector.cs b/Content.Client/Preferences/UI/AntagPreferenceSelector.cs index 4a339d3f659..f4975a6090c 100644 --- a/Content.Client/Preferences/UI/AntagPreferenceSelector.cs +++ b/Content.Client/Preferences/UI/AntagPreferenceSelector.cs @@ -47,6 +47,7 @@ public AntagPreferenceSelector(AntagPrototype proto, JobPrototype highJob) : bas (HumanoidCharacterProfile) (prefs.Preferences?.SelectedCharacter ?? HumanoidCharacterProfile.DefaultWithSpecies()), requirements.GetRawPlayTimeTrackers(), requirements.IsWhitelisted(), + proto, entMan, protoMan, configMan, diff --git a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs index 5165db54799..3ac13f96e7a 100644 --- a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs +++ b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs @@ -213,7 +213,7 @@ public CharacterPickerButton( Text = Loc.GetString("character-setup-gui-character-picker-button-confirm-delete-button"), Visible = false, }; - confirmDeleteButton.ModulateSelfOverride = StyleNano.ButtonColorCautionDefault; + confirmDeleteButton.ModulateSelfOverride = StyleNano.ButtonColorDangerDefault; confirmDeleteButton.OnPressed += _ => { Parent?.RemoveChild(this); diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml index ebf794954e3..e7fecf81f43 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml @@ -3,6 +3,7 @@ xmlns:prefUi="clr-namespace:Content.Client.Preferences.UI" xmlns:humanoid="clr-namespace:Content.Client.Humanoid" xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls" + xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls" HorizontalExpand="True"> @@ -45,12 +46,12 @@ - - - - - - + + + + + + @@ -108,7 +109,7 @@ - + - + - - - + + + + + - - + + - + - +