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

Ballistics - Improve arsenal muzzle velocity stat #10594

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

LinkIsGrim
Copy link
Contributor

When merged this pull request will:

  • Show actual muzzle velocity if adding a magazine that fits onto primary or handgun when adding mags to a container. Launchers and secondary muzzles not affected.

IMPORTANT

  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.
  • Development Guidelines are read, understood and applied.
  • Title of this PR uses our standard template Component - Add|Fix|Improve|Change|Make|Remove {changes}.

@LinkIsGrim LinkIsGrim added the kind/enhancement Release Notes: **IMPROVED:** label Dec 22, 2024
private _muzzleVelocity = getNumber (_configMagazine >> "initSpeed");

private _abAdjustText = "";
private _useAB = missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && {EGVAR(advanced_ballistics,barrelLengthInfluenceEnabled)};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boolean checks are too fast for lazy eval. If anything, the order should be flipped:

Suggested change
private _useAB = missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && {EGVAR(advanced_ballistics,barrelLengthInfluenceEnabled)};
private _useAB = EGVAR(advanced_ballistics,barrelLengthInfluenceEnabled) && {missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]};

Copy link
Contributor Author

@LinkIsGrim LinkIsGrim Dec 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need the lazy eval. Second variable might be nil (but shouldn't be nil if first variable is true). This was done on purpose.

} params ["_weapon", "_magazine"];
private _magClass = configName _configMagazine;
private _weapons = [primaryWeapon EGVAR(arsenal,center), handgunWeapon EGVAR(arsenal,center)];
private _weaponIndex = _weapons findIf {_x canAdd [_magClass, _x]};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't know about weapon canAdd item syntax, neat

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New-ish. Was added around the same time as compatibleItems/Magazines weapon

@LinkIsGrim LinkIsGrim added this to the 3.18.2 milestone Dec 23, 2024
@LinkIsGrim LinkIsGrim merged commit 671aa51 into master Dec 23, 2024
3 checks passed
@LinkIsGrim LinkIsGrim deleted the ballistics-improve-mv-stat branch December 23, 2024 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants