diff --git a/Content.Client/Lobby/LobbyUIController.cs b/Content.Client/Lobby/LobbyUIController.cs index f321fc31efd..d5f37f6916e 100644 --- a/Content.Client/Lobby/LobbyUIController.cs +++ b/Content.Client/Lobby/LobbyUIController.cs @@ -159,7 +159,7 @@ private void RefreshLobbyPreview() return; } - var dummy = LoadProfileEntity(humanoid, true); + var dummy = LoadProfileEntity(humanoid, true, true); PreviewPanel.SetSprite(dummy); PreviewPanel.SetSummaryText(humanoid.Summary); } @@ -262,14 +262,6 @@ public void RemoveDummyClothes(EntityUid dummy) EntityManager.DeleteEntity(unequippedItem.Value); } - /// Applies the highest priority job's clothes and loadouts to the dummy. - public void GiveDummyJobClothesLoadout(EntityUid dummy, HumanoidCharacterProfile profile) - { - var job = GetPreferredJob(profile); - GiveDummyJobClothes(dummy, job, profile); - _loadouts.ApplyCharacterLoadout(dummy, job, profile, _jobRequirements.GetRawPlayTimeTrackers(), _jobRequirements.IsWhitelisted()); - } - /// Applies the specified job's clothes to the dummy. public void GiveDummyJobClothes(EntityUid dummy, JobPrototype job, HumanoidCharacterProfile profile) { @@ -295,7 +287,7 @@ public void GiveDummyJobClothes(EntityUid dummy, JobPrototype job, HumanoidChara } /// Loads the profile onto a dummy entity - public EntityUid LoadProfileEntity(HumanoidCharacterProfile? humanoid, bool jobClothes) + public EntityUid LoadProfileEntity(HumanoidCharacterProfile? humanoid, bool jobClothes, bool loadouts) { EntityUid dummyEnt; @@ -311,8 +303,14 @@ public EntityUid LoadProfileEntity(HumanoidCharacterProfile? humanoid, bool jobC _humanoid.LoadProfile(dummyEnt, humanoid); - if (humanoid != null && jobClothes) - GiveDummyJobClothesLoadout(dummyEnt, humanoid); + if (humanoid != null) + { + var job = GetPreferredJob(humanoid); + if (jobClothes) + GiveDummyJobClothes(dummyEnt, job, humanoid); + if (loadouts) + _loadouts.ApplyCharacterLoadout(dummyEnt, job, humanoid, _jobRequirements.GetRawPlayTimeTrackers(), _jobRequirements.IsWhitelisted()); + } return dummyEnt; } diff --git a/Content.Client/Lobby/UI/CharacterPickerButton.xaml.cs b/Content.Client/Lobby/UI/CharacterPickerButton.xaml.cs index 68833e13ea2..8b81da06932 100644 --- a/Content.Client/Lobby/UI/CharacterPickerButton.xaml.cs +++ b/Content.Client/Lobby/UI/CharacterPickerButton.xaml.cs @@ -46,7 +46,7 @@ public CharacterPickerButton( else { _previewDummy = UserInterfaceManager.GetUIController() - .LoadProfileEntity(humanoid, true); + .LoadProfileEntity(humanoid, true, true); var highPriorityJob = humanoid.JobPriorities.SingleOrDefault(p => p.Value == JobPriority.High).Key; if (highPriorityJob != null) diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs index 319881a48a3..41c66d5fc7e 100644 --- a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs @@ -615,7 +615,7 @@ private void ReloadPreview() if (Profile == null || !_prototypeManager.HasIndex(Profile.Species)) return; - PreviewDummy = _controller.LoadProfileEntity(Profile, ShowClothes.Pressed); + PreviewDummy = _controller.LoadProfileEntity(Profile, ShowClothes.Pressed, ShowLoadouts.Pressed); SpriteView.SetEntity(PreviewDummy); } @@ -824,20 +824,6 @@ public void RefreshJobs() UpdateJobPriorities(); } - private void ToggleClothes(BaseButton.ButtonEventArgs _) - { - //TODO: Optimization - // _controller.ShowClothes = ShowClothes.Pressed; - // _controller.UpdateCharacterUI(); - } - - private void ToggleLoadouts(BaseButton.ButtonEventArgs _) - { - //TODO: Optimization - // _controller.ShowLoadouts = ShowLoadouts.Pressed; - // _controller.UpdateCharacterUI(); - } - private void UpdateRoleRequirements() { JobList.DisposeAllChildren(); @@ -1970,8 +1956,13 @@ private void UpdateLoadoutPreferences() foreach (var preferenceSelector in _loadoutPreferences) { var loadoutId = preferenceSelector.Loadout.ID; - var d = Profile?.LoadoutPreferences.FirstOrDefault(l => l.LoadoutName == loadoutId) ?? preferenceSelector.Preference; - var preference = new LoadoutPreference(d.LoadoutName, d.CustomName, d.CustomDescription, d.CustomColorTint) { Selected = d.Selected }; + var loadoutPreference = Profile?.LoadoutPreferences.FirstOrDefault(l => l.LoadoutName == loadoutId) ?? preferenceSelector.Preference; + var preference = new LoadoutPreference( + loadoutPreference.LoadoutName, + loadoutPreference.CustomName, + loadoutPreference.CustomDescription, + loadoutPreference.CustomColorTint) + { Selected = loadoutPreference.Selected }; preferenceSelector.Preference = preference; @@ -1993,8 +1984,6 @@ private void UpdateLoadoutPreferences() AdminUIHelpers.RemoveConfirm(LoadoutsRemoveUnusableButton, _confirmationData); IsDirty = true; - //TODO: Optimization - // _controller.UpdateClothes = true; ReloadProfilePreview(); }