Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ModWeaponVars #803

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: ModWeaponVars #803

wants to merge 1 commit into from

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

1 participant