using Robust.Shared.Prototypes;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
namespace Content.Shared.Preferences.Loadouts;
/// Corresponds to a set of loadouts for a particular slot.
/// </summary>
[Prototype]
-public sealed partial class LoadoutGroupPrototype : IPrototype
+public sealed partial class LoadoutGroupPrototype : IPrototype, IInheritingPrototype
{
[IdDataField]
public string ID { get; private set; } = string.Empty;
+ /// <inheritdoc />
+ [ParentDataFieldAttribute(typeof(AbstractPrototypeIdArraySerializer<LoadoutGroupPrototype>))]
+ public string[]? Parents { get; }
+
+ /// <inheritdoc />
+ [NeverPushInheritance]
+ [AbstractDataField]
+ public bool Abstract { get; }
+
/// <summary>
/// User-friendly name for the group.
/// </summary>
/// </summary>
[DataField]
public int MinLimit = 1;
+
+ /// <summary>
+ /// Number of loadouts that are selected by default.
+ /// </summary>
+ [DataField]
+ public int DefaultSelected = 0;
/// <summary>
/// Maximum limit for the category.
[DataField]
public bool Hidden;
+ [AlwaysPushInheritance]
[DataField(required: true)]
public List<ProtoId<LoadoutPrototype>> Loadouts = new();
}
var loadouts = new List<Loadout>();
SelectedLoadouts[group] = loadouts;
- if (groupProto.MinLimit > 0)
+ if (groupProto.MinLimit > 0 || loadouts.Count < groupProto.DefaultSelected)
{
// Apply any loadouts we can.
foreach (var protoId in groupProto.Loadouts)
{
// Reached the limit, time to stop
- if (loadouts.Count >= groupProto.MinLimit)
+ if (loadouts.Count >= Math.Max(groupProto.MinLimit, groupProto.DefaultSelected))
break;
if (!protoManager.TryIndex(protoId, out var loadoutProto))