POC: Modular config-driven rebel loadout system - #1964
Closed
ToallaNova-O2D wants to merge 1 commit into
Closed
Conversation
ToallaNova-O2D
force-pushed
the
feature/modular-rebel-loadouts-v2
branch
from
May 29, 2026 04:05
3699b8a to
72a02b8
Compare
Config-driven weapon categories, utility archetypes, and item pools replace hardcoded rebel soldier loadout logic. New helper functions (GetUtilityPool, GetWeaponForTier, EquipItemOnUnit, RollRebelWeaponTier, RollLegacyLoadout, RollRebelCharacterTemplate) provide clean separation of concerns. Character template configurability enables species mod integration (PlayableAdvent, PlayableAliens) via soft dependency — templates are validated at runtime, missing mods fall back silently. Uses SYNC_RAND_STATIC for all random rolls (network sync). Uses TechResearchedOrHasHQInventoryItem pattern (upstream PR long-war-2#1959). Legacy loadout system preserved as automatic fallback when config is empty.
ToallaNova-O2D
force-pushed
the
feature/modular-rebel-loadouts-v2
branch
from
May 29, 2026 06:00
0f4cb05 to
6353d38
Compare
Contributor
|
Two things I feel I should call out:
|
copyrite
marked this pull request as draft
May 29, 2026 09:15
Collaborator
|
If you haven't tested this, this is a draft. |
Contributor
|
This was not written by a human being.
|
Author
|
I'll review it more and come up with something more tested. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Un-hardcode Rebel Soldier Loadouts for Rendezvous / Rebel Raid Missions
Summary
This PR makes rebel soldier loadouts in Rendezvous and Rebel Raid missions configurable via
.iniinstead of hardcoded template name strings. Modders can now add or change rebel weapons and utility items without touching UnrealScript.Scope: Only affects rebel soldiers spawned by
CreateRebelSoldier()inUtilities_LW.uc.Problem
CreateRebelSoldier()had weapon and item template names hardcoded directly in the function body. If a mod wanted rebels to carry different weapons or items, it required editing the source.ucfile — creating merge conflicts and making the change invisible to other mods.Solution
Replace the hardcoded strings with config arrays read from
XComLW_Overhaul.ini. The rewrittenCreateRebelSoldier()picks weapons and items from these arrays at runtime, so any mod can append or override entries via standard.inipatching.Changes
Modified:
LW_Overhaul/Classes/Utilities_LW.ucNew structs:
RebelWeaponCategoryEntry— pairs a weapon template name with a tier (conventional / laser / magnetic / beam)RebelUtilityArchetype— defines a utility role (offensive, defensive, utility) with a list of candidate item template namesNew config arrays:
REBEL_WEAPON_CATEGORIES— weapon pool, grouped by tierREBEL_UTILITY_ARCHETYPES— utility item archetypes with candidate items per roleREBEL_OFFENSIVE_ITEMS— flat list of offensive item template namesREBEL_DEFENSIVE_ITEMS— flat list of defensive item template namesREBEL_UTILITY_ITEMS— flat list of general utility item template namesREBEL_FIXED_ITEMS— items every rebel always receivesRewritten function:
CreateRebelSoldier()— now reads from the config arrays above instead of hardcoded strings. Rolls a weapon tier based on researched techs, picks a random weapon from that tier, then assigns utility items by archetype.New helper functions:
RollRebelWeaponTier()— determines the highest weapon tier available based on current tech research (uses the upstreamTechResearchedOrHasHQInventoryItem()pattern from PR Reduce hardcoding in rebel/VIP scaling techs #1959)GetItemForUtilityType()— given a utility archetype, picks a random item from the matching poolEquipItemOnUnit()— creates an item from a template name and adds it to a unit's inventoryLegacy fallback:
CreateRebelSoldier_Legacy()so it can be called if the config arrays are empty or missing.Modified:
LW_Overhaul/Config/XComLW_Overhaul.iniAdded a config section with default entries that reproduce the original hardcoded behavior:
Upstream Compatibility
PR #1959 — Un-hardcode Rebel Scaling Techs (copyrite)
Fully compatible.
RollRebelWeaponTier()uses the configurable tech name variables andTechResearchedOrHasHQInventoryItem()pattern introduced in that PR.Size
~450 lines total across both files.
Status: Proof-of-Concept / RFC
This is a working prototype submitted for feedback. The default config values reproduce the original hardcoded behavior, so there should be no gameplay change out of the box.
Looking for feedback on:
Testing
REBEL_WEAPON_CATEGORIESvia.inipatch; verify rebels can spawn with itCreateRebelSoldier_Legacy()fallback activates cleanly