Check loadout XP eligibility before creating weapon entities - #3
Open
sunmachine wants to merge 2 commits into
Open
Check loadout XP eligibility before creating weapon entities#3sunmachine wants to merge 2 commits into
sunmachine wants to merge 2 commits into
Conversation
sunmachine
force-pushed
the
xp-override-debugging-cvar
branch
from
August 20, 2026 04:19
7f0e608 to
b268a1d
Compare
sunmachine
force-pushed
the
loadout-eligibility-ordering
branch
from
August 20, 2026 04:19
a7e071f to
f856dc8
Compare
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
force-pushed
the
xp-override-debugging-cvar
branch
from
August 21, 2026 06:01
b268a1d to
f601aa6
Compare
sunmachine
force-pushed
the
loadout-eligibility-ordering
branch
from
August 21, 2026 06:01
f856dc8 to
dc853b0
Compare
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.
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:GiveLoadoutWeapon: eligibility now checked before the inventory check and entity creation. Also folds the duplicate dev-loadout class selection into theiLoadoutClasslocal computed at the top of the function.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 anXP_ANYweapon 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 -1above-tier picks fall back to slot 0 as before; with a positive override all tiers unlock. Verified in-game.Toolchain
Linked Issues
sv_neo_wep_xp_overridecheat, includes fix for detpack loadout grant NeotokyoRebuild/neo#2082