Skip to content

Commit

Permalink
Multiple items in loadouts (#33193)
Browse files Browse the repository at this point in the history
* loadouts update

* Update loadout_groups.yml

* darts to candles

* Update Resources/Prototypes/Loadouts/dummy_entities.yml

---------

Co-authored-by: slarticodefast <[email protected]>
  • Loading branch information
TheShuEd and slarticodefast authored Dec 24, 2024
1 parent 39b2ce8 commit 1c33073
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 10 deletions.
19 changes: 10 additions & 9 deletions Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ public LoadoutContainer(ProtoId<LoadoutPrototype> proto, bool disabled, Formatte

if (_protoManager.TryIndex(proto, out var loadProto))
{
var ent = _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);
var ent = loadProto.DummyEntity ?? _entManager.System<LoadoutSystem>().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<MetaDataComponent>(_entity.Value).EntityDescription));
TooltipSupplier = _ => spriteTooltip;
}
_entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
Sprite.SetEntity(_entity);

var spriteTooltip = new Tooltip();
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));

TooltipSupplier = _ => spriteTooltip;
}
}

Expand Down
3 changes: 3 additions & 0 deletions Content.Shared/Clothing/LoadoutSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public static string GetJobPrototype(string? loadout)

public string GetName(LoadoutPrototype loadout)
{
if (loadout.DummyEntity is not null && _protoMan.TryIndex<EntityPrototype>(loadout.DummyEntity, out var proto))
return proto.Name;

if (_protoMan.TryIndex(loadout.StartingGear, out var gear))
{
return GetName(gear);
Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/

/// <summary>
/// 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).
/// </summary>
[DataField]
public EntProtoId? DummyEntity;

[DataField]
public ProtoId<StartingGearPrototype>? StartingGear;

Expand Down
11 changes: 10 additions & 1 deletion Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
back:
- ClothingNeckHeadphones

# Plushies
# Toys
- type: loadout
id: PlushieLizard
storage:
Expand All @@ -41,6 +41,15 @@
back:
- PlushieSpaceLizard

- type: loadout
id: ThreeCandles
dummyEntity: LoadoutDummyCandles
storage:
back:
- CandleRed
- CandleBlue
- CandleGreenSmall

# Smokeables
- type: loadout
id: Lighter
Expand Down
9 changes: 9 additions & 0 deletions Resources/Prototypes/Loadouts/dummy_entities.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Resources/Prototypes/Loadouts/loadout_groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Headphones
- PlushieLizard
- PlushieSpaceLizard
- ThreeCandles
- Lighter
- CigPackGreen
- CigPackRed
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Resources/Textures/Objects/Misc/candles.rsi/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
{
"name": "stand-small"
},
{
"name": "loadout"
},
{
"name": "stand-big"
},
Expand Down

0 comments on commit 1c33073

Please sign in to comment.