-
Notifications
You must be signed in to change notification settings - Fork 748
Advanced Ballistics - Add support for multiple muzzles #11215
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
base: master
Are you sure you want to change the base?
Conversation
| _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig); | ||
| }; | ||
| private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon]; | ||
| private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1_%2), _weapon, _weapon]; // Get primary muzzle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel like the caching logic should be in the function it self and also maybe should use a native hash. same should also be done for readAmmoDataFromConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but not within the scope of this PR. I've been meaning to optimise FUNC(readAmmoDataFromConfig) (both using hashmap and tweaking some code), but currently doing something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't like this uinamespace caching, I'm happy to make the change
| * 1: New Zero range <NUMBER> | ||
| * 2: Bore height <NUMBER> | ||
| * 3: Weapon <STRING> | ||
| * 4: Ammo <STRING> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update header
| // For most weapons muzzle == weapon (config value of "this" for muzzle) | ||
| private _weaponConfig = (configFile >> "CfgWeapons" >> _muzzle); | ||
|
|
||
| if (isNull _weaponConfig) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if any mods do this, but it could be possible for a muzzle to be defined in cfgWeapons but not what we actually want
e.g.
class cfgWeapons {
class someGL {};
class someRifle {
class someGL: someGL {}
| if (isNull _weaponConfig) then { | |
| if (_muzzle != _weapon) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've definitely seen that before
| private _boreHeight = (_unit getVariable [QGVAR(boreHeight), [0,0,0]]) select _weaponIndex; | ||
| private _oldZeroRange = currentZeroing _unit; | ||
| private _newZeroRange = [_unit] call FUNC(getCurrentZeroRange); | ||
| private _zeroCorrection = missionNamespace getVariable format[QGVAR(%1_%2_%3_%4_%5_%6_%7), _oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll have to change this hashKey as well
When merged this pull request will:
The function should be fully backwards compatible, e.g function calls that don't include the muzzle parameter should get similar return values as before. The cache is not backwards compatible however, because the name in the cache now includes the muzzle as well.
Without this PR, barrel data will always be fetched from the "main" muzzle (aka the weapon config).
In vanilla, this affects the Type 115 and the MSBS Grot UBS (with #11213).
IMPORTANT
Component - Add|Fix|Improve|Change|Make|Remove {changes}.