Implemented parenting and minimum default for loadout groups (#40861)

* Implemented parenting and minimum default for loadouts

* Fix a mistake

* Apply suggestion from @iaada

Co-authored-by: āda <ss.adasts@gmail.com>

* Implement @iaada's suggestion to rename MinDefault to DefaultSelected

* happy little accidents

* Moved Parents and Abstract fields to under ID, added inheritdoc

---------

Co-authored-by: āda <ss.adasts@gmail.com>
This commit is contained in:
Atakku
2025-10-27 23:33:56 +01:00
committed by GitHub
parent ce6daea5fb
commit abd9aec8bd
2 changed files with 20 additions and 3 deletions

View File

@@ -228,13 +228,13 @@ public sealed partial class RoleLoadout : IEquatable<RoleLoadout>
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))