Skip to content

Conversation

@EladNLG
Copy link
Member

@EladNLG EladNLG commented May 6, 2024

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.

@GeckoEidechse GeckoEidechse added needs testing Changes from the PR still need to be tested needs code review Changes from PR still need to be reviewed in code feedback wanted Feedback is wanted whether the changes by this PR are desired labels Jul 6, 2024
@github-actions github-actions bot added the merge conflicts Blocked by merge conflicts, waiting on the author to resolve label Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feedback wanted Feedback is wanted whether the changes by this PR are desired merge conflicts Blocked by merge conflicts, waiting on the author to resolve needs code review Changes from PR still need to be reviewed in code needs testing Changes from the PR still need to be tested

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants