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>
This commit is contained in:
@@ -36,17 +36,18 @@ public sealed partial class LoadoutContainer : BoxContainer
|
|||||||
|
|
||||||
if (_protoManager.TryIndex(proto, out var loadProto))
|
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)
|
if (ent == null)
|
||||||
{
|
return;
|
||||||
_entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
|
|
||||||
Sprite.SetEntity(_entity);
|
|
||||||
|
|
||||||
var spriteTooltip = new Tooltip();
|
_entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
|
||||||
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));
|
Sprite.SetEntity(_entity);
|
||||||
TooltipSupplier = _ => spriteTooltip;
|
|
||||||
}
|
var spriteTooltip = new Tooltip();
|
||||||
|
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));
|
||||||
|
|
||||||
|
TooltipSupplier = _ => spriteTooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ public sealed class LoadoutSystem : EntitySystem
|
|||||||
|
|
||||||
public string GetName(LoadoutPrototype 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))
|
if (_protoMan.TryIndex(loadout.StartingGear, out var gear))
|
||||||
{
|
{
|
||||||
return GetName(gear);
|
return GetName(gear);
|
||||||
|
|||||||
@@ -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.
|
* 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]
|
[DataField]
|
||||||
public ProtoId<StartingGearPrototype>? StartingGear;
|
public ProtoId<StartingGearPrototype>? StartingGear;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
back:
|
back:
|
||||||
- ClothingNeckHeadphones
|
- ClothingNeckHeadphones
|
||||||
|
|
||||||
# Plushies
|
# Toys
|
||||||
- type: loadout
|
- type: loadout
|
||||||
id: PlushieLizard
|
id: PlushieLizard
|
||||||
storage:
|
storage:
|
||||||
@@ -41,6 +41,15 @@
|
|||||||
back:
|
back:
|
||||||
- PlushieSpaceLizard
|
- PlushieSpaceLizard
|
||||||
|
|
||||||
|
- type: loadout
|
||||||
|
id: ThreeCandles
|
||||||
|
dummyEntity: LoadoutDummyCandles
|
||||||
|
storage:
|
||||||
|
back:
|
||||||
|
- CandleRed
|
||||||
|
- CandleBlue
|
||||||
|
- CandleGreenSmall
|
||||||
|
|
||||||
# Smokeables
|
# Smokeables
|
||||||
- type: loadout
|
- type: loadout
|
||||||
id: Lighter
|
id: Lighter
|
||||||
|
|||||||
9
Resources/Prototypes/Loadouts/dummy_entities.yml
Normal file
9
Resources/Prototypes/Loadouts/dummy_entities.yml
Normal file
@@ -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
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
- Headphones
|
- Headphones
|
||||||
- PlushieLizard
|
- PlushieLizard
|
||||||
- PlushieSpaceLizard
|
- PlushieSpaceLizard
|
||||||
|
- ThreeCandles
|
||||||
- Lighter
|
- Lighter
|
||||||
- CigPackGreen
|
- CigPackGreen
|
||||||
- CigPackRed
|
- CigPackRed
|
||||||
|
|||||||
BIN
Resources/Textures/Objects/Misc/candles.rsi/loadout.png
Normal file
BIN
Resources/Textures/Objects/Misc/candles.rsi/loadout.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 406 B |
@@ -10,6 +10,9 @@
|
|||||||
{
|
{
|
||||||
"name": "stand-small"
|
"name": "stand-small"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "loadout"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "stand-big"
|
"name": "stand-big"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user