From 1c33073af435a2285e8594cc9c1505af15a73640 Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Tue, 24 Dec 2024 03:24:19 +0300 Subject: [PATCH] Multiple items in loadouts (#33193) * loadouts update * Update loadout_groups.yml * darts to candles * Update Resources/Prototypes/Loadouts/dummy_entities.yml --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --- .../UI/Loadouts/LoadoutContainer.xaml.cs | 19 +++++++++--------- Content.Shared/Clothing/LoadoutSystem.cs | 3 +++ .../Preferences/Loadouts/LoadoutPrototype.cs | 6 ++++++ .../Loadouts/Miscellaneous/trinkets.yml | 11 +++++++++- .../Prototypes/Loadouts/dummy_entities.yml | 9 +++++++++ .../Prototypes/Loadouts/loadout_groups.yml | 1 + .../Objects/Misc/candles.rsi/loadout.png | Bin 0 -> 406 bytes .../Objects/Misc/candles.rsi/meta.json | 3 +++ 8 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 Resources/Prototypes/Loadouts/dummy_entities.yml create mode 100644 Resources/Textures/Objects/Misc/candles.rsi/loadout.png diff --git a/Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs b/Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs index 36f0772d784..2ab40fb37d4 100644 --- a/Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs +++ b/Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs @@ -36,17 +36,18 @@ public LoadoutContainer(ProtoId proto, bool disabled, Formatte if (_protoManager.TryIndex(proto, out var loadProto)) { - var ent = _entManager.System().GetFirstOrNull(loadProto); + var ent = loadProto.DummyEntity ?? _entManager.System().GetFirstOrNull(loadProto); - if (ent != null) - { - _entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace); - Sprite.SetEntity(_entity); + if (ent == null) + return; - var spriteTooltip = new Tooltip(); - spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent(_entity.Value).EntityDescription)); - TooltipSupplier = _ => spriteTooltip; - } + _entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace); + Sprite.SetEntity(_entity); + + var spriteTooltip = new Tooltip(); + spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent(_entity.Value).EntityDescription)); + + TooltipSupplier = _ => spriteTooltip; } } diff --git a/Content.Shared/Clothing/LoadoutSystem.cs b/Content.Shared/Clothing/LoadoutSystem.cs index 2a686efd4ff..93b0abfd820 100644 --- a/Content.Shared/Clothing/LoadoutSystem.cs +++ b/Content.Shared/Clothing/LoadoutSystem.cs @@ -90,6 +90,9 @@ public static string GetJobPrototype(string? loadout) public string GetName(LoadoutPrototype loadout) { + if (loadout.DummyEntity is not null && _protoMan.TryIndex(loadout.DummyEntity, out var proto)) + return proto.Name; + if (_protoMan.TryIndex(loadout.StartingGear, out var gear)) { return GetName(gear); diff --git a/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs b/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs index a570b61d89e..1533b605ac9 100644 --- a/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs +++ b/Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs @@ -17,6 +17,12 @@ public sealed partial class LoadoutPrototype : IPrototype, IEquipmentLoadout * You can either use an existing StartingGearPrototype or specify it inline to avoid bloating yaml. */ + /// + /// An entity whose sprite, name and description is used for display in the interface. If null, tries to get the proto of the item from gear (if it is a single item). + /// + [DataField] + public EntProtoId? DummyEntity; + [DataField] public ProtoId? StartingGear; diff --git a/Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml b/Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml index 79fee8bf0df..b4e2cecf8b1 100644 --- a/Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml +++ b/Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml @@ -28,7 +28,7 @@ back: - ClothingNeckHeadphones -# Plushies +# Toys - type: loadout id: PlushieLizard storage: @@ -41,6 +41,15 @@ back: - PlushieSpaceLizard +- type: loadout + id: ThreeCandles + dummyEntity: LoadoutDummyCandles + storage: + back: + - CandleRed + - CandleBlue + - CandleGreenSmall + # Smokeables - type: loadout id: Lighter diff --git a/Resources/Prototypes/Loadouts/dummy_entities.yml b/Resources/Prototypes/Loadouts/dummy_entities.yml new file mode 100644 index 00000000000..69b54bd0b59 --- /dev/null +++ b/Resources/Prototypes/Loadouts/dummy_entities.yml @@ -0,0 +1,9 @@ +- type: entity + id: LoadoutDummyCandles + categories: [ HideSpawnMenu ] + name: three candles + description: A set of three colorful candles for secret rituals! + components: + - type: Sprite + sprite: Objects/Misc/candles.rsi + state: loadout \ No newline at end of file diff --git a/Resources/Prototypes/Loadouts/loadout_groups.yml b/Resources/Prototypes/Loadouts/loadout_groups.yml index 89bf38fef5f..990c6f41bb1 100644 --- a/Resources/Prototypes/Loadouts/loadout_groups.yml +++ b/Resources/Prototypes/Loadouts/loadout_groups.yml @@ -10,6 +10,7 @@ - Headphones - PlushieLizard - PlushieSpaceLizard + - ThreeCandles - Lighter - CigPackGreen - CigPackRed diff --git a/Resources/Textures/Objects/Misc/candles.rsi/loadout.png b/Resources/Textures/Objects/Misc/candles.rsi/loadout.png new file mode 100644 index 0000000000000000000000000000000000000000..daa98a3fcec49120f723b617e9173f9dff6d0a32 GIT binary patch literal 406 zcmV;H0crk;P)Px$P)S5VR9J=Wl`%>KK@^7nStMRS#7e}xZAB3TPoR|-@Bq1hjfGg)so16P0O?_!l+e%+`8k@_R z`tkgfEx_(Tt?i+5vW{9i>r6yydTrMzRL5ut^Wk?ZvkCyJHyc*rMgsTIL}pFG6Lg9A z_KYoHG=xbw09?ru7W^KL%Y(Fz1wYtWz;AXS7pLGiI|u;;LIARqo(JO7pTnI%BBAqD zXiz_3+ZbujRkl=kxFY~y)t^`8L7bjFc;l$cYvVT9_3c9-zh@)h>@~E-THyKhWoXT1 zq{qlMROiR9z