Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backpack Loadout Category #957

Merged
merged 8 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
12 changes: 0 additions & 12 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,6 @@
<Control HorizontalExpand="True"/>
<Button Name="ShowLoadouts" Pressed="True" ToggleMode="True" Text="{Loc 'Show'}" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Clothing -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-clothing-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CClothingButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Backpack -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-backpack-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CBackpackButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Spawn Priority -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-spawn-priority-label'}" />
Expand Down
71 changes: 0 additions & 71 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,21 @@
using Content.Client.Lobby;
using Content.Client.Message;
using Content.Client.Players.PlayTimeTracking;
using Content.Client.Roles;
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.Guidebook;
using Content.Shared.CCVar;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.Loadouts.Prototypes;
using Content.Shared.Clothing.Loadouts.Systems;
using Content.Shared.Customization.Systems;
using Content.Shared.GameTicking;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.Roles.Jobs;
using Content.Shared.Traits;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
Expand All @@ -33,10 +29,8 @@
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using static Content.Client.Stylesheets.StyleBase;
using Direction = Robust.Shared.Maths.Direction;

namespace Content.Client.Preferences.UI
Expand All @@ -63,8 +57,6 @@ public sealed partial class HumanoidProfileEditor : BoxContainer
private OptionButton _sexButton => CSexButton;
private OptionButton _genderButton => CPronounsButton;
private Slider _skinColor => CSkin;
private OptionButton _clothingButton => CClothingButton;
private OptionButton _backpackButton => CBackpackButton;
private OptionButton _spawnPriorityButton => CSpawnPriorityButton;
private SingleMarkingPicker _hairPicker => CHairStylePicker;
private SingleMarkingPicker _facialHairPicker => CFacialHairPicker;
Expand Down Expand Up @@ -408,33 +400,6 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt

#endregion Hair

#region Clothing

_clothingButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-jumpsuit"), (int) ClothingPreference.Jumpsuit);
_clothingButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-jumpskirt"), (int) ClothingPreference.Jumpskirt);

_clothingButton.OnItemSelected += args =>
{
_clothingButton.SelectId(args.Id);
SetClothing((ClothingPreference) args.Id);
};

#endregion Clothing

#region Backpack

_backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-backpack"), (int) BackpackPreference.Backpack);
_backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-satchel"), (int) BackpackPreference.Satchel);
_backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-duffelbag"), (int) BackpackPreference.Duffelbag);

_backpackButton.OnItemSelected += args =>
{
_backpackButton.SelectId(args.Id);
SetBackpack((BackpackPreference) args.Id);
};

#endregion Backpack

#region SpawnPriority

foreach (var value in Enum.GetValues<SpawnPriorityPreference>())
Expand Down Expand Up @@ -975,24 +940,6 @@ private void SetName(string newName)
IsDirty = true;
}

private void SetClothing(ClothingPreference newClothing)
{
Profile = Profile?.WithClothingPreference(newClothing);
UpdateCharacterRequired();
IsDirty = true;
_controller.UpdateClothes = true;
UpdatePreview();
}

private void SetBackpack(BackpackPreference newBackpack)
{
Profile = Profile?.WithBackpackPreference(newBackpack);
UpdateCharacterRequired();
IsDirty = true;
_controller.UpdateClothes = true;
UpdatePreview();
}

private void SetSpawnPriority(SpawnPriorityPreference newSpawnPriority)
{
Profile = Profile?.WithSpawnPriorityPreference(newSpawnPriority);
Expand Down Expand Up @@ -1162,22 +1109,6 @@ private void UpdateGenderControls()
_genderButton.SelectId((int) Profile.Gender);
}

private void UpdateClothingControls()
{
if (Profile == null)
return;

_clothingButton.SelectId((int) Profile.Clothing);
}

private void UpdateBackpackControls()
{
if (Profile == null)
return;

_backpackButton.SelectId((int) Profile.Backpack);
}

private void UpdateSpawnPriorityControls()
{
if (Profile == null)
Expand Down Expand Up @@ -1344,8 +1275,6 @@ public void UpdateControls()
UpdateGenderControls();
UpdateSkinColor();
UpdateSpecies();
UpdateClothingControls();
UpdateBackpackControls();
UpdateSpawnPriorityControls();
UpdateAgeEdit();
UpdateEyePickers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,50 +41,6 @@ public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile,
}
}

/// <summary>
/// Requires the profile to use either a Backpack, Satchel, or Duffelbag
/// </summary>
[UsedImplicitly]
[Serializable, NetSerializable]
public sealed partial class CharacterBackpackTypeRequirement : CharacterRequirement
{
[DataField(required: true)]
public BackpackPreference Preference;

public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile,
Dictionary<string, TimeSpan> playTimes, bool whitelisted, IPrototype prototype,
IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager,
out FormattedMessage? reason, int depth = 0)
{
reason = FormattedMessage.FromMarkup(Loc.GetString("character-backpack-type-requirement",
("inverted", Inverted),
("type", Loc.GetString($"humanoid-profile-editor-preference-{Preference.ToString().ToLower()}"))));
return profile.Backpack == Preference;
}
}

/// <summary>
/// Requires the profile to use either Jumpsuits or Jumpskirts
/// </summary>
[UsedImplicitly]
[Serializable, NetSerializable]
public sealed partial class CharacterClothingPreferenceRequirement : CharacterRequirement
{
[DataField(required: true)]
public ClothingPreference Preference;

public override bool IsValid(JobPrototype job, HumanoidCharacterProfile profile,
Dictionary<string, TimeSpan> playTimes, bool whitelisted, IPrototype prototype,
IEntityManager entityManager, IPrototypeManager prototypeManager, IConfigurationManager configManager,
out FormattedMessage? reason, int depth = 0)
{
reason = FormattedMessage.FromMarkup(Loc.GetString("character-clothing-preference-requirement",
("inverted", Inverted),
("preference", Loc.GetString($"humanoid-profile-editor-preference-{Preference.ToString().ToLower()}"))));
return profile.Clothing == Preference;
}
}

/// <summary>
/// Requires the profile to be a certain gender
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/loadouts/categories.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

loadout-category-Uncategorized = Uncategorized
loadout-category-Accessories = Accessories
loadout-category-Backpacks = Backpacks
loadout-category-Eyes = Eyes
loadout-category-Hands = Hands
loadout-category-Head = Head
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/loadouts/itemgroups.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This list is sorted Mixed Alphabetically with Generic always being placed first, Departments alphabetically, Items Groups Alphabetically, and Jobs Alphabetically after all Department items
# Generic - Clothing
character-item-group-LoadoutBackpacks = Civilian Backpacks
character-item-group-LoadoutEyes = Civilian Eyewear
character-item-group-LoadoutGloves = Civilian Gloves
character-item-group-LoadoutHead = Civilian Headgear
Expand Down
11 changes: 11 additions & 0 deletions Resources/Prototypes/CharacterItemGroups/backpackGroups.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- type: characterItemGroup
id: LoadoutBackpacks
items:
- type: loadout
id: LoadoutBackpack
- type: loadout
id: LoadoutBackpackDuffel
- type: loadout
id: LoadoutBackpackSatchel
- type: loadout
id: LoadoutBackpackClown
6 changes: 5 additions & 1 deletion Resources/Prototypes/Loadouts/Categories/categories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
id: Uncategorized
root: true

- type: loadoutCategory
id: Backpacks
root: true

- type: loadoutCategory
id: Eyes
root: true
Expand Down Expand Up @@ -85,7 +89,7 @@

- type: loadoutCategory
id: JobsScience

- type: loadoutCategory
id: JobsSecurity

Expand Down
Loading
Loading