From 7487b29a7cdab0cb0bd1abe8090073e53a54f670 Mon Sep 17 00:00:00 2001 From: Schrodinger71 Date: Sun, 19 Nov 2023 02:07:29 +0300 Subject: [PATCH] Loadout --- .../Lobby/UI/LobbyCharacterPreviewPanel.cs | 13 + .../Preferences/UI/CharacterSetupGui.xaml.cs | 1 + .../Preferences/UI/HumanoidProfileEditor.xaml | 13 + .../UI/HumanoidProfileEditor.xaml.cs | 225 ++- .../Tests/Preferences/ServerDbSqliteTests.cs | 1 + .../20230202141221_Loadouts.Designer.cs | 1066 +++++++++++ .../Postgres/20230202141221_Loadouts.cs | 44 + .../PostgresServerDbContextModelSnapshot.cs | 36 +- .../20230202141221_Loadouts.Designer.cs | 1061 +++++++++++ .../Sqlite/20230202141221_Loadouts.cs | 43 + .../SqliteServerDbContextModelSnapshot.cs | 35 +- Content.Server.Database/Model.cs | 12 + Content.Server/Database/ServerDbBase.cs | 12 +- .../GameTicking/GameTicker.Spawning.cs | 23 + Content.Shared/CCVar/CCVars.cs | 12 + Content.Shared/Clothing/LoadoutSystem.cs | 200 +- .../Loadouts/LoadoutCategoryPrototype.cs | 10 + Content.Shared/Loadouts/LoadoutPrototype.cs | 75 + .../Preferences/HumanoidCharacterProfile.cs | 83 +- .../Locale/en-US/loadouts/categories.ftl | 7 + Resources/Locale/en-US/loadouts/eyes.ftl | 2 + Resources/Locale/en-US/loadouts/head.ftl | 18 + Resources/Locale/en-US/loadouts/items.ftl | 13 + .../en-US/loadouts/jobs/engineering.ftl | 5 + .../en-US/loadouts/jobs/heads/captain.ftl | 11 + .../loadouts/jobs/heads/chiefEngineer.ftl | 3 + .../jobs/heads/chiefMedicalOfficer.ftl | 5 + .../loadouts/jobs/heads/headOfPersonnel.ftl | 4 + .../loadouts/jobs/heads/headOfSecurity.ftl | 10 + .../loadouts/jobs/heads/quarterMaster.ftl | 3 + .../loadouts/jobs/heads/researchDirector.ftl | 3 + .../Locale/en-US/loadouts/jobs/medical.ftl | 0 .../Locale/en-US/loadouts/jobs/science.ftl | 0 .../Locale/en-US/loadouts/jobs/security.ftl | 1 + .../Locale/en-US/loadouts/jobs/service.ftl | 15 + Resources/Locale/en-US/loadouts/neck.ftl | 4 + .../Locale/en-US/loadouts/outerClothing.ftl | 5 + Resources/Locale/en-US/loadouts/shoes.ftl | 10 + Resources/Locale/en-US/loadouts/uniform.ftl | 33 + Resources/Prototypes/Loadouts/loadouts.yml | 1607 +++++++++++++++++ 40 files changed, 4695 insertions(+), 29 deletions(-) create mode 100644 Content.Server.Database/Migrations/Postgres/20230202141221_Loadouts.Designer.cs create mode 100644 Content.Server.Database/Migrations/Postgres/20230202141221_Loadouts.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20230202141221_Loadouts.Designer.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20230202141221_Loadouts.cs create mode 100644 Content.Shared/Loadouts/LoadoutCategoryPrototype.cs create mode 100644 Content.Shared/Loadouts/LoadoutPrototype.cs create mode 100644 Resources/Locale/en-US/loadouts/categories.ftl create mode 100644 Resources/Locale/en-US/loadouts/eyes.ftl create mode 100644 Resources/Locale/en-US/loadouts/head.ftl create mode 100644 Resources/Locale/en-US/loadouts/items.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/engineering.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/heads/captain.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/heads/chiefEngineer.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/heads/chiefMedicalOfficer.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/heads/headOfPersonnel.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/heads/headOfSecurity.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/heads/quarterMaster.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/heads/researchDirector.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/medical.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/science.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/security.ftl create mode 100644 Resources/Locale/en-US/loadouts/jobs/service.ftl create mode 100644 Resources/Locale/en-US/loadouts/neck.ftl create mode 100644 Resources/Locale/en-US/loadouts/outerClothing.ftl create mode 100644 Resources/Locale/en-US/loadouts/shoes.ftl create mode 100644 Resources/Locale/en-US/loadouts/uniform.ftl create mode 100644 Resources/Prototypes/Loadouts/loadouts.yml diff --git a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs index 31db2c9c536..b76864e957d 100644 --- a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs +++ b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs @@ -1,13 +1,17 @@ using System.Linq; using System.Numerics; using Content.Client.Alerts; +using Content.Client.Hands.Systems; using Content.Client.Humanoid; using Content.Client.Inventory; using Content.Client.Preferences; using Content.Client.UserInterface.Controls; +using Content.Shared.Clothing; +using Content.Shared.Clothing.Components; using Content.Shared.GameTicking; using Content.Shared.Humanoid.Prototypes; using Content.Shared.Inventory; +using Content.Shared.Loadouts; using Content.Shared.Preferences; using Content.Shared.Roles; using Robust.Client.GameObjects; @@ -126,6 +130,7 @@ public void UpdateUI() _summaryLabel.Text = selectedCharacter.Summary; _entityManager.System().LoadProfile(_previewDummy.Value, selectedCharacter); GiveDummyJobClothes(_previewDummy.Value, selectedCharacter); + GiveDummyLoadoutItems(_previewDummy.Value, selectedCharacter); } } } @@ -161,5 +166,13 @@ public static void GiveDummyJobClothes(EntityUid dummy, HumanoidCharacterProfile } } } + public static void GiveDummyLoadoutItems(EntityUid dummy, HumanoidCharacterProfile profile) + { + var highPriorityJobId = profile.JobPriorities.FirstOrDefault(j => j.Value == JobPriority.High).Key; + var highPriorityJob = IoCManager.Resolve().Index(highPriorityJobId ?? SharedGameTicker.FallbackOverflowJob); + + EntitySystem.Get().ApplyCharacterLoadout(dummy, highPriorityJob, profile); + } + } } diff --git a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs index bc19bb2a36d..86d2f86f39b 100644 --- a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs +++ b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs @@ -185,6 +185,7 @@ public CharacterPickerButton( if (humanoid != null) { LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy, humanoid); + LobbyCharacterPreviewPanel.GiveDummyLoadoutItems(_previewDummy, humanoid); } var isSelectedCharacter = profile == preferencesManager.Preferences?.SelectedCharacter; diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml index 8a10f17e590..4a55796825b 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml @@ -60,6 +60,12 @@