Skip to content

Check loadout XP eligibility before creating weapon entities - #3

Open
sunmachine wants to merge 2 commits into
xp-override-debugging-cvarfrom
loadout-eligibility-ordering
Open

Check loadout XP eligibility before creating weapon entities#3
sunmachine wants to merge 2 commits into
xp-override-debugging-cvarfrom
loadout-eligibility-ordering

Conversation

@sunmachine

Copy link
Copy Markdown
Owner

Description

Stacked on NeotokyoRebuild#2082 (first three commits are that PR; review the last two here).

Both remaining loadout grant paths checked XP eligibility after CreateEntityByName, even though the check only compares against static loadout table data. Every above-tier pick paid a weapon entity create/destroy cycle for a weapon that was never granted. This hoists the check above entity creation in both paths, matching the eligibility-first ordering the detpack grant got in NeotokyoRebuild#2082:

  1. GiveLoadoutWeapon: eligibility now checked before the inventory check and entity creation. Also folds the duplicate dev-loadout class selection into the iLoadoutClass local computed at the top of the function.
  2. RequestSetLoadout: ineligible requests now fall back to slot 0 directly, without creating the validation probe entity. The probe is still created for eligible requests since type validation (IsNeoPrimary) genuinely needs the weapon instance. The slot-0 recursion terminates: every playable class has an XP_ANY weapon in slot 0, and classes without loadouts bail at the empty-name check before recursing.

No behavior change for eligible picks. same weapons granted, same fallbacks.

Testing

sv_cheats 1; sv_neo_wep_xp_override -1 above-tier picks fall back to slot 0 as before; with a positive override all tiers unlock. Verified in-game.

Toolchain

  • Linux GCC 10 Sniper 3.0

Linked Issues

The XP check compared against static loadout table data but ran after
CreateEntityByName, so every spawn with an above-tier loadout choice
paid a create/destroy cycle for a weapon that was never granted.
Hoist the check above the inventory check and entity creation,
matching the eligibility-first ordering of the detpack grant.

Also folds the duplicate dev-loadout class selection into the
iLoadoutClass local computed at the top of the function.
The XP check compared against static loadout table data but ran after
CreateEntityByName, so every above-tier request created and destroyed
a probe weapon entity before falling back to the default slot. Hoist
the check above entity creation and return the fallback directly,
matching the eligibility-first ordering of the other grant paths.

The probe entity is still created for eligible requests, since type
validation (IsNeoPrimary) genuinely needs the weapon instance.
Recursion into slot 0 stays terminating: every playable class has an
XP_ANY weapon in slot 0, and classes without loadouts bail out at the
empty-name check before recursing.
@sunmachine
sunmachine force-pushed the xp-override-debugging-cvar branch from b268a1d to f601aa6 Compare August 21, 2026 06:01
@sunmachine
sunmachine force-pushed the loadout-eligibility-ordering branch from f856dc8 to dc853b0 Compare August 21, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant