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.
The script part of the ModWeaponVars feature. Relies on Launcher#691
Usage
AddCallback_ApplyModWeaponVars( int priority, void functionref( entity ) callback )
adds a callback whenever we want to calculate weaponvars.Then, you use
ModWeaponVar_Set[type]( entity weapon, int weaponVar, [type] value )
We need a priority parameter because some operations override existing weapon variables (as in, setting a new value, and ignoring the current value), some add (as in, newValue = prevValue + modifier) and others multiply (as in, newValue = prevValue * modifier).
We generally want to go in the order of Overrides > Additives > Multipliers to avoid as many conflicts as possible (additives come before multipliers because multipliers are generally intended to multiply the entire result, and not have additions after them), and that's reflected in the
WEAPON_VAR_PRIORITY_XXX
constants.