Skip to content

Add custom loadout groups#4626

Open
truemogician wants to merge 5 commits into
CombatExtended-Continued:Developmentfrom
truemogician:custom-loadout-groups
Open

Add custom loadout groups#4626
truemogician wants to merge 5 commits into
CombatExtended-Continued:Developmentfrom
truemogician:custom-loadout-groups

Conversation

@truemogician

@truemogician truemogician commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Additions

  • Custom loadout groups: player-defined, reusable loadout generics built from selected items, usable as a loadout slot just like a built-in generic.
  • Groups can nest other generics and custom groups, with cycle detection.
  • A new Custom Groups tab in Manage Loadouts holds the whole feature: create, edit, copy, export, and delete groups, plus load a group from file.
  • In-editor member list with drag-to-reorder (items and nested groups in one interleaved order) and live Mass/Bulk readouts.
  • Export / import groups to standalone files (reuses the existing loadout save/load file dialogs, loadoutgroup storage type).
  • Per-save storage, groups are scribed into the save.
  • Multiplayer support: group create/edit/delete are synced; a group used as a loadout slot already syncs as a normal generic def.
  • Utility_ReferenceGraph: a small generic lazy-edge cycle-detection helper (IsReachable / WouldCreateCycle), reused by group nesting.
  • New UI/Icons/export icon.

Changes

  • LoadoutGenericDef: _lambda made protected, added a stat-cache invalidation hook and an empty-members guard in updateVars, so the predicate can be driven by a subclass. No change to built-in generics' behavior.
  • LoadoutManager.ExposeData now scribes custom groups before the loadouts, so group defs are registered in time for loadout slots to resolve them by defName.

References

Reasoning

  • Defining reusable item families is a large ergonomic gap in CE loadouts; custom groups fill it without touching rearm/drop logic.
  • A group is a LoadoutGenericDef subclass, so loadout slot save/load and JobGiver_UpdateLoadout work unchanged — a group is a generic.
  • Stored per-save so groups travel with the save, which is also what makes multiplayer sync possible.

Alternatives

  • Global config file for groups: rejected — hard to be synced in multiplayer.

Testing

  • Compiles without warnings (net48, warnings-as-errors)
  • Game runs without errors
  • Playtested in my own save with more than 300 active mods for several hours

@github-actions

Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-27819212851.zip

@github-actions github-actions Bot added the Download in Comments This PR has a zipfile download available. label Jun 19, 2026
@truemogician truemogician force-pushed the custom-loadout-groups branch from bf405b5 to 20fdd09 Compare June 19, 2026 11:44
@github-actions

Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-27823707303.zip

@truemogician

truemogician commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Here's what the custom loadout groups look like in the loadout UI:

Custom group selection for loadout:
image

Custom group edit / creation:
image

Let players define their own nestable loadout generics ("custom groups")
and use them as loadout slots, alongside CE's built-in generics.
Persist custom groups inside the save instead of a shared global config file.

Hold a group's members in a single ordered list, so any member can be
drag-reordered to any position in the editor.

Add export/import of groups to standalone files, and move the whole feature
into the Custom Groups tab.
@truemogician truemogician force-pushed the custom-loadout-groups branch from 20fdd09 to 58bd1db Compare June 19, 2026 12:14
@github-actions

Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-27825072002.zip

@github-actions

Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-27850223808.zip

When enabled, rearmament will acquire members following the list order
@truemogician truemogician force-pushed the custom-loadout-groups branch from 99c3e54 to 20f1e4c Compare June 19, 2026 22:07
@github-actions

Copy link
Copy Markdown

You can download the rebuilt assembly for this PR here: https://combatextended.lp-programming.com/CombatExtended-27850593372.zip

@truemogician truemogician marked this pull request as ready for review June 20, 2026 09:42
@truemogician truemogician requested review from a team as code owners June 20, 2026 09:42

@Safairette Safairette left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defs are not an appropriate medium to store this kind of custom player-created data, for various compatibility reasons.

}
}

private static ListLoadoutGenericDef GetOrCreateDef(CustomGroupConfig cfg, HashSet<ushort> takenHashes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not be using defs to store this data, as they were never meant for temporary player-created content in game. They should be stored independently and only merged into the defined generic defs when building the loadout options.

If you need a pointer to how the base game handles custom player-created content like that, you should look at how the custom scenarios and xenotypes are created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Download in Comments This PR has a zipfile download available.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants