Skip to content

Conversation

@rekterakathom
Copy link
Contributor

@rekterakathom rekterakathom commented Jan 2, 2026

When merged this pull request will:

  • Add support for multiple muzzles into AB
  • Change relevant function calls to include muzzle

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

  • 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}.

_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
Copy link
Member

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

Copy link
Contributor

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.

Copy link
Contributor

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>
Copy link
Contributor

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 {
Copy link
Contributor

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 {}
Suggested change
if (isNull _weaponConfig) then {
if (_muzzle != _weapon) then {

Copy link
Contributor

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];
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants