Files
wwdpublic/Content.Client/Lobby/UI/ProfileEditor/HumanoidProfileEditor.CharacterEditor.cs
Myaflic 2a79352e2d Fix UI lobby profile editor (#1056)
* Fix hide categories logic (it works!)

* Optimization code

* Fix for new loadouts

* Rabbit + my ltl fix

* Full translation loadouts, traits & hub menu

* Auto-hide categories for new loadouts (incomplete)

* Search fix done

* Now fix definitely done

* Format

* System of hide categories

* Add flavour fill warning

* Old save characters now can be import!!

* Add placeholders in 'Customize'

* 'Weight update on change' fix

* Markings fix

* New translate pack

* IPC markings screen fix

* Fix tests

* Rabbit fix

* Fix characters export & zero weight

* Translate

* Fix tests mb

* Rabbit fix 2

* Rabbit fix 3
2026-03-08 00:22:19 +03:00

72 lines
1.8 KiB
C#

using Content.Shared.Clothing.Loadouts.Systems;
using Content.Shared.Clothing.Loadouts.Prototypes;
namespace Content.Client.Lobby.UI;
// WWDP PARTIAL CLASS
public sealed partial class HumanoidProfileEditor
{
private void InitializeCharacterMenu()
{
Loadouts.OnLoadoutsChanged += OnLoadoutsChange;
}
private void UpdateLoadouts()
{
if (Profile == null)
return;
var highJob = _controller.GetPreferredJob(Profile);
_loadouts.Clear();
foreach (var loadout in Profile.LoadoutPreferencesList)
{
if (!_prototypeManager.TryIndex<LoadoutPrototype>(loadout.LoadoutName, out var loadoutProto))
continue;
var usable = _characterRequirementsSystem.CheckRequirementsValid(
loadoutProto.Requirements,
highJob,
Profile,
_requirements.GetRawPlayTimeTrackers(),
_requirements.IsWhitelisted(),
loadoutProto,
_entManager,
_prototypeManager,
_cfgManager,
out _
);
_loadouts.Add(loadoutProto, usable);
}
UpdateLoadoutsRemoveButton();
Loadouts.SetData(
Profile.LoadoutPreferencesList,
new(highJob, Profile, _requirements.GetRawPlayTimeTrackers(), _requirements.IsWhitelisted()));
Loadouts.ShowUnusable = LoadoutsShowUnusableButton.Pressed;
}
private void CheckpointLoadouts()
{
if (Profile == null)
return;
Loadouts.SetCheckpoint();
}
private void OnLoadoutsChange(List<Loadout> loadouts)
{
if (Profile is null)
return;
Profile = Profile.WithLoadoutPreference(loadouts);
ReloadProfilePreview();
ReloadClothes();
UpdateLoadouts();
}
}