Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Content.Client/Humanoid/MarkingPicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ private void SetupCategoryButtons()
private List<string> GetMarkingStateNames(MarkingPrototype marking)
{
List<string> result = new();
// WWDP EDIT START
if (marking.Sprites.Count == 1)
{
result.Add(GetMarkingName(marking));
return result;
}
// WWDP EDIT END
foreach (var markingState in marking.Sprites)
{
switch (markingState)
Expand Down Expand Up @@ -238,7 +245,7 @@ public void Populate(string filter)
};
var customize = new Button
{
Text = "Customize",
Text = Loc.GetString("humanoid-profile-editor-loadouts-customize"), // WWDP EDIT
StyleClasses = { StyleBase.ButtonOpenLeft, },
Disabled = !item.Pressed,
};
Expand Down Expand Up @@ -341,7 +348,7 @@ private void OnColorChangePressed(MarkingPrototype prototype)

var colorSelector = new ColorSelectorSliders();

colorContainer.AddChild(new Label { Text = $"{stateNames[i]} color:" });
colorContainer.AddChild(new Label { Text = Loc.GetString("marking-color-label", ("name", stateNames[i])) }); // WWDP EDIT
colorContainer.AddChild(colorSelector);

var listing = _currentMarkings.Markings[_selectedMarkingCategory];
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Humanoid/SingleMarkingPicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private void PopulateSlotSelector()

for (var i = 0; i < PointsUsed; i++)
{
SlotSelector.AddItem($"Slot {i + 1}", i);
SlotSelector.AddItem(Loc.GetString("marking-slot-number", ("number", i + 1)), i);

if (i == _slot)
{
Expand Down
21 changes: 20 additions & 1 deletion Content.Client/Lobby/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-loadouts'}" />
<Control HorizontalExpand="True"/>
<Button Name="ShowLoadouts" Pressed="True" ToggleMode="True" Text="{Loc 'Show'}" HorizontalAlignment="Right" />
<!-- WD EDIT START -->
<Button Name="ShowLoadouts" Pressed="True" ToggleMode="True" Text="{Loc 'humanoid-profile-editor-clothing-show'}" HorizontalAlignment="Right" />
<!-- WD EDIT END -->
</BoxContainer>
<!-- Spawn Priority -->
<BoxContainer HorizontalExpand="True">
Expand Down Expand Up @@ -196,6 +198,23 @@
<Label Text="{Loc 'humanoid-profile-editor-loadouts-tab'}" />
<Control Margin="5"/>
<loadouts:LoadoutPicker Name="Loadouts" HorizontalExpand="True" HorizontalAlignment="Stretch" Access="Public"/>
<BoxContainer HorizontalExpand="True" Margin="0 0 0 5">
<Button
Name="LoadoutsShowUnusableButton"
Text="{Loc 'humanoid-profile-editor-loadouts-show-unusable-button'}"
ToolTip="{Loc 'humanoid-profile-editor-loadouts-show-unusable-button-tooltip'}"
ToggleMode="True"
HorizontalAlignment="Stretch"
HorizontalExpand="True"
StyleClasses="OpenRight" />
<Button
Name="LoadoutsRemoveUnusableButton"
Text="You shouldn't see this"
ToolTip="{Loc 'humanoid-profile-editor-loadouts-remove-unusable-button-tooltip'}"
HorizontalAlignment="Stretch"
HorizontalExpand="True"
StyleClasses="OpenLeft" />
</BoxContainer>
</BoxContainer>
</BoxContainer>
<Control Margin="5"/>
Expand Down
102 changes: 101 additions & 1 deletion Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public sealed partial class HumanoidProfileEditor : BoxContainer
// EE - Contractor System Changes End

private Dictionary<Button, ConfirmationData> _confirmationData = new();
private Dictionary<LoadoutPrototype, bool> _loadouts = new(); // WD EDIT
private List<TraitPreferenceSelector> _traitPreferences = new();
private int _traitCount;

Expand Down Expand Up @@ -593,6 +594,14 @@ IRobustRandom random

TraitsShowUnusableButton.OnToggled += args => UpdateTraits(args.Pressed);
TraitsRemoveUnusableButton.OnPressed += _ => TryRemoveUnusableTraits();
// WWDP EDIT START
LoadoutsShowUnusableButton.OnToggled += args =>
{
Loadouts.ShowUnusable = args.Pressed;
UpdateLoadouts();
};
LoadoutsRemoveUnusableButton.OnPressed += _ => TryRemoveUnusableLoadouts();
// WWDP EDIT END

UpdateTraits(false);

Expand Down Expand Up @@ -2391,10 +2400,48 @@ private Dictionary<string, object> CreateTree(List<TraitCategoryPrototype> cats)
return tree;
}

// WWDP EDIT START
private void HideEmptyTabs(List<TraitCategoryPrototype> cats)
{
// TODO: HIDE LOGIC LATER
void CheckAndHideTabs(NeoTabContainer container)
{
foreach (var tabId in container.TakenIds.ToList())
{
var tabControl = container.GetControl<Control>(tabId);
if (tabControl == null) continue;

container.SetTabVisible(tabId, true);

var shouldHide = tabControl switch
{
NeoTabContainer nested => CheckNestedContainer(nested),
BoxContainer box => !HasVisibleTraits(box),
_ => false
};

if (shouldHide)
container.SetTabVisible(tabId, false);
}
}

bool CheckNestedContainer(NeoTabContainer nested)
{
CheckAndHideTabs(nested);
return !nested.TakenIds.Any(id => nested.GetControl<Control>(id)?.Visible ?? false);
}

bool HasVisibleTraits(BoxContainer box)
{
return box.Children
.OfType<ScrollContainer>()
.SelectMany(scroll => scroll.Children.OfType<BoxContainer>())
.SelectMany(inner => inner.Children.OfType<TraitPreferenceSelector>())
.Any(selector => selector.Visible);
}

CheckAndHideTabs(TraitsTabs);
}
// WWDP EDIT END

private void TryRemoveUnusableTraits()
{
Expand All @@ -2408,6 +2455,59 @@ private void TryRemoveUnusableTraits()
UpdateCharacterRequired();
}

// WWDP EDIT START
private void TryRemoveUnusableLoadouts()
{
if (!AdminUIHelpers.TryConfirm(LoadoutsRemoveUnusableButton, _confirmationData))
return;

if (Profile == null)
return;

var unusableLoadouts = _loadouts.Where(l => !l.Value).Select(l => l.Key.ID).ToList();

var currentProfile = Profile;
foreach (var loadoutId in unusableLoadouts)
{
var loadout = currentProfile.LoadoutPreferencesList.FirstOrDefault(l => l.LoadoutName == loadoutId);
if (loadout != null)
{
var newList = currentProfile.LoadoutPreferencesList.Where(l => l.LoadoutName != loadoutId).ToList();
currentProfile = currentProfile.WithLoadoutPreference(newList);
}
}

Profile = currentProfile;
ReloadProfilePreview();
ReloadClothes();
UpdateLoadouts();
}

private void UpdateLoadoutsRemoveButton()
{
var unusableCount = _loadouts.Count(l => !l.Value);

if (unusableCount > 0)
{
LoadoutsRemoveUnusableButton.Text = Loc.GetString(
"humanoid-profile-editor-loadouts-remove-unusable-button",
("count", unusableCount));
LoadoutsRemoveUnusableButton.RemoveStyleClass(StyleBase.ButtonOpenLeft);
LoadoutsRemoveUnusableButton.AddStyleClass(StyleBase.ButtonDanger);
LoadoutsRemoveUnusableButton.Disabled = false;
}
else
{
LoadoutsRemoveUnusableButton.Text = Loc.GetString(
"humanoid-profile-editor-loadouts-remove-unusable-button",
("count", 0));
LoadoutsRemoveUnusableButton.RemoveStyleClass(StyleBase.ButtonDanger);
LoadoutsRemoveUnusableButton.AddStyleClass(StyleBase.ButtonOpenLeft);
LoadoutsRemoveUnusableButton.Disabled = true;
}
}
// WWDP EDIT END

#endregion

#endregion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Clothing.Loadouts.Systems;
using Content.Shared.Clothing.Loadouts.Prototypes;


namespace Content.Client.Lobby.UI;
Expand All @@ -18,15 +19,36 @@ private void UpdateLoadouts()

var highJob = _controller.GetPreferredJob(Profile);

Loadouts.SetData(
Profile.LoadoutPreferencesList,
new(
_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()
)
_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()
Expand Down
1 change: 1 addition & 0 deletions Content.Client/_White/Loadouts/LoadoutCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public sealed class LoadoutCategoryShowMenuEntry : ILoadoutMenuEntry
private readonly ProtoId<LoadoutCategoryPrototype> _loadoutCategory;
public ILoadoutMenuEntry? Parent { get; set; }
public string Label { get; }
public ProtoId<LoadoutCategoryPrototype> CategoryId => _loadoutCategory;

public LoadoutCategoryShowMenuEntry(ProtoId<LoadoutCategoryPrototype> loadoutCategory)
{
Expand Down
34 changes: 30 additions & 4 deletions Content.Client/_White/Loadouts/LoadoutEntry.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ public string LoadoutName
private set => LoadoutNameLabel.Text = value;
}

private bool _showUnusable;
public bool ShowUnusable
{
get => _showUnusable;
set
{
_showUnusable = value;
Visible = CanWear || _showUnusable;

PreferenceButton.RemoveStyleClass(StyleBase.ButtonDanger);
if (!CanWear)
PreferenceButton.AddStyleClass(StyleBase.ButtonDanger);
}
}

public string LoadoutDescription { get; private set; } = string.Empty;

private Tooltip _reasonTooltip = new();
Expand All @@ -73,6 +88,7 @@ public LoadoutEntry()
HeadingButton.OnPressed += HeadingButtonPressed;
PreferenceButton.OnPressed += PreferenceButtonPressed;
TooltipSupplier = OnTooltipSupplierRequired;
IoCManager.InjectDependencies(this);
}

private Control? OnTooltipSupplierRequired(Control sender) => CanWear ? null : _reasonTooltip;
Expand Down Expand Up @@ -104,16 +120,26 @@ public bool EnsureIsWearable(CharacterRequirementsArgs args, int loadoutPoint)

PreferenceButton.AddStyleClass(StyleBase.ButtonDanger);
CanWear = false;
PreferenceButton.Disabled = true;

if (Selected)
{
PreferenceButton.Disabled = false;
PreferenceButton.MouseFilter = MouseFilterMode.Pass;
}
else
{
PreferenceButton.Disabled = true;
PreferenceButton.MouseFilter = MouseFilterMode.Ignore;
}

HeirloomButton.Visible = false;
HeadingButton.Visible = false;
PreferenceButton.MouseFilter = MouseFilterMode.Ignore;
_reasonTooltip.SetMessage(FormattedMessage.FromMarkupPermissive(reason));

return false;
}

public bool CheckIsWearable(CharacterRequirementsArgs characterRequirementsArgs, int loadoutPoint,[NotNullWhen(false)] out string? reason)
public bool CheckIsWearable(CharacterRequirementsArgs characterRequirementsArgs, int loadoutPoint, [NotNullWhen(false)] out string? reason)
{
ProtoId<LoadoutPrototype> loadoutPrototype = Loadout.LoadoutName;
reason = null;
Expand All @@ -124,7 +150,7 @@ public bool CheckIsWearable(CharacterRequirementsArgs characterRequirementsArgs,
return false;
}

if(prototype.Cost > loadoutPoint)
if (!Selected && prototype.Cost > loadoutPoint)
{
reason = Loc.GetString("loadout-error-too-expensive");
return false;
Expand Down
Loading