diff --git a/Content.Shared/Preferences/Loadouts/LoadoutGroupPrototype.cs b/Content.Shared/Preferences/Loadouts/LoadoutGroupPrototype.cs index 990f1b74a2..b65f332885 100644 --- a/Content.Shared/Preferences/Loadouts/LoadoutGroupPrototype.cs +++ b/Content.Shared/Preferences/Loadouts/LoadoutGroupPrototype.cs @@ -1,4 +1,5 @@ using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array; namespace Content.Shared.Preferences.Loadouts; @@ -6,11 +7,20 @@ namespace Content.Shared.Preferences.Loadouts; /// Corresponds to a set of loadouts for a particular slot. /// [Prototype] -public sealed partial class LoadoutGroupPrototype : IPrototype +public sealed partial class LoadoutGroupPrototype : IPrototype, IInheritingPrototype { [IdDataField] public string ID { get; private set; } = string.Empty; + /// + [ParentDataFieldAttribute(typeof(AbstractPrototypeIdArraySerializer))] + public string[]? Parents { get; } + + /// + [NeverPushInheritance] + [AbstractDataField] + public bool Abstract { get; } + /// /// User-friendly name for the group. /// @@ -22,6 +32,12 @@ public sealed partial class LoadoutGroupPrototype : IPrototype /// [DataField] public int MinLimit = 1; + + /// + /// Number of loadouts that are selected by default. + /// + [DataField] + public int DefaultSelected = 0; /// /// Maximum limit for the category. @@ -35,6 +51,7 @@ public sealed partial class LoadoutGroupPrototype : IPrototype [DataField] public bool Hidden; + [AlwaysPushInheritance] [DataField(required: true)] public List> Loadouts = new(); } diff --git a/Content.Shared/Preferences/Loadouts/RoleLoadout.cs b/Content.Shared/Preferences/Loadouts/RoleLoadout.cs index 9b7f4ae05e..d9f79f543a 100644 --- a/Content.Shared/Preferences/Loadouts/RoleLoadout.cs +++ b/Content.Shared/Preferences/Loadouts/RoleLoadout.cs @@ -228,13 +228,13 @@ public sealed partial class RoleLoadout : IEquatable var loadouts = new List(); 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))