From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Tue, 24 Dec 2024 00:24:19 +0000 (+0300) Subject: Multiple items in loadouts (#33193) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=1c33073af435a2285e8594cc9c1505af15a73640;p=space-station-14.git 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> --- diff --git a/Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs b/Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs index 36f0772d78..2ab40fb37d 100644 --- a/Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs +++ b/Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs @@ -36,17 +36,18 @@ public sealed partial class LoadoutContainer : BoxContainer 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 2a686efd4f..93b0abfd82 100644 --- a/Content.Shared/Clothing/LoadoutSystem.cs +++ b/Content.Shared/Clothing/LoadoutSystem.cs @@ -90,6 +90,9 @@ public sealed class LoadoutSystem : EntitySystem 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 a570b61d89..1533b605ac 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 79fee8bf0d..b4e2cecf8b 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 0000000000..69b54bd0b5 --- /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 89bf38fef5..990c6f41bb 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 0000000000..daa98a3fce Binary files /dev/null and b/Resources/Textures/Objects/Misc/candles.rsi/loadout.png differ diff --git a/Resources/Textures/Objects/Misc/candles.rsi/meta.json b/Resources/Textures/Objects/Misc/candles.rsi/meta.json index 9432ffae8b..f5fa5b10fd 100644 --- a/Resources/Textures/Objects/Misc/candles.rsi/meta.json +++ b/Resources/Textures/Objects/Misc/candles.rsi/meta.json @@ -10,6 +10,9 @@ { "name": "stand-small" }, + { + "name": "loadout" + }, { "name": "stand-big" },