Skip to content

Commit b8c8db4

Browse files
committed
Merge branch 'master' into markerQuikcNumbering
2 parents 408821c + d43bb25 commit b8c8db4

File tree

222 files changed

+4214
-1416
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+4214
-1416
lines changed

.github/workflows/arma.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout the source code
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v6
1515
- name: Validate Config
1616
run: python3 tools/config_style_checker.py
1717
- name: Validate Stringtables
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Checkout the source code
32-
uses: actions/checkout@v4
32+
uses: actions/checkout@v6
3333
- name: Setup HEMTT
3434
uses: arma-actions/hemtt@v1
3535
with:
@@ -39,7 +39,7 @@ jobs:
3939
- name: Rename build folder
4040
run: mv .hemttout/build .hemttout/@ace
4141
- name: Upload Artifact
42-
uses: actions/upload-artifact@v4
42+
uses: actions/upload-artifact@v6
4343
with:
4444
name: ace3-${{ github.sha }}-nobin
4545
path: .hemttout/@*

.github/workflows/documentation.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout the source code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
- name: Install Python packages
2020
run: |
2121
pip3 install wheel
@@ -33,7 +33,7 @@ jobs:
3333

3434
steps:
3535
- name: Checkout
36-
uses: actions/checkout@v4
36+
uses: actions/checkout@v6
3737

3838
- name: Extract Dependencies
3939
run: python3 tools/extract_dependencies.py --markdown
@@ -47,7 +47,7 @@ jobs:
4747
destination: docs/_site/
4848

4949
- name: Upload Artifact
50-
uses: actions/upload-artifact@v4
50+
uses: actions/upload-artifact@v6
5151
with:
5252
name: jekyll-site
5353
path: docs/_site/
@@ -63,7 +63,7 @@ jobs:
6363

6464
steps:
6565
- name: Download Artifacts
66-
uses: actions/download-artifact@v4
66+
uses: actions/download-artifact@v6
6767
with:
6868
name: jekyll-site
6969
path: _site/

.github/workflows/extensions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
runs-on: ${{ matrix.arrays.os.tag }}
4646
steps:
4747
- name: Checkout the source code
48-
uses: actions/checkout@v4
48+
uses: actions/checkout@v6
4949
- name: Install stable Rust
5050
uses: actions-rs/toolchain@v1
5151
with:
@@ -57,7 +57,7 @@ jobs:
5757
- name: Build
5858
run: cargo build --verbose
5959
- name: Upload
60-
uses: actions/upload-artifact@v4
60+
uses: actions/upload-artifact@v6
6161
with:
6262
name: ${{ matrix.arrays.os.target }}
6363
path: target/debug/ace.dll

.github/workflows/hemtt.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
with:
1616
toolsUrl: ${{ secrets.ARMA3_TOOLS_URL }}
1717
- name: Checkout the source code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
- name: Setup HEMTT
2020
uses: arma-actions/hemtt@v1
2121
- name: Checkout pull request
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6
2323
if: ${{ github.event_name == 'pull_request_target' }}
2424
with:
2525
path: pullrequest
@@ -40,7 +40,7 @@ jobs:
4040
- name: Rename build folder
4141
run: mv .hemttout/build .hemttout/@ace
4242
- name: Upload Artifact
43-
uses: actions/upload-artifact@v4
43+
uses: actions/upload-artifact@v6
4444
with:
4545
name: ace3-${{ github.sha }}
4646
path: .hemttout/@*

addons/advanced_ballistics/XEH_preInit.sqf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
ADDON = false;
44

5+
GVAR(ammoData) = createHashMap;
6+
GVAR(weaponData) = createHashMap;
7+
GVAR(maxRange) = createHashMap;
8+
59
PREP_RECOMPILE_START;
610
#include "XEH_PREP.hpp"
711
PREP_RECOMPILE_END;

addons/advanced_ballistics/functions/fnc_diagnoseWeapons.sqf

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,8 @@ for "_i" from 0 to (count _cfgWeapons)-1 do {
5353

5454
// AB initial speed --------------------------------
5555
// Get Weapon and Ammo Configurations
56-
private _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo];
57-
if (isNil "_AmmoCacheEntry") then {
58-
_AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig);
59-
};
60-
private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon];
61-
if (isNil "_WeaponCacheEntry") then {
62-
_WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig);
63-
};
64-
_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocityVariationSD"];
65-
_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
56+
(_ammo call FUNC(readAmmoDataFromConfig)) params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocityVariationSD"];
57+
(_weapon call FUNC(readWeaponDataFromConfig)) params ["_barrelTwist", "_twistDirection", "_barrelLength"];
6658

6759
private _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _vanillaInitialSpeed] call FUNC(calculateBarrelLengthVelocityShift);
6860
if (_barrelLength > 0) then {

addons/advanced_ballistics/functions/fnc_handleFired.sqf

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,21 @@ if (_abort) then {
2828
private _bulletVelocity = velocity _projectile;
2929
private _muzzleVelocity = vectorMagnitude _bulletVelocity;
3030

31-
private _maxRange = uiNamespace getVariable format[QGVAR(maxRange_%1), _ammo];
32-
if (isNil "_maxRange") then {
33-
private _airFriction = getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction");
31+
private _maxRange = GVAR(maxRange) getOrDefaultCall [_ammo, {
32+
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
33+
private _airFriction = getNumber(_ammoConfig >> "airFriction");
3434
private _vanillaInitialSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
35-
_maxRange = if (_airFriction < 0) then {
36-
private _maxTime = ((_vanillaInitialSpeed - BULLET_TRACE_MIN_VELOCITY) / (BULLET_TRACE_MIN_VELOCITY * -_airFriction * _vanillaInitialSpeed)) max getNumber(configFile >> "CfgAmmo" >> _ammo >> "tracerEndTime");
35+
36+
private _maxRange = if (_airFriction < 0) then {
37+
private _maxTime = ((_vanillaInitialSpeed - BULLET_TRACE_MIN_VELOCITY) / (BULLET_TRACE_MIN_VELOCITY * -_airFriction * _vanillaInitialSpeed)) max getNumber(_ammoConfig >> "tracerEndTime");
3738
-ln(1 - _airFriction * _vanillaInitialSpeed * _maxTime) / _airFriction
3839
} else {
39-
_vanillaInitialSpeed * getNumber(configFile >> "CfgAmmo" >> _ammo >> "tracerEndTime")
40+
_vanillaInitialSpeed * getNumber(_ammoConfig >> "tracerEndTime")
4041
};
41-
_maxRange = _maxRange * 1.3; // Adding 30% more to range just to be safe
42-
uiNamespace setVariable [format[QGVAR(maxRange_%1), _ammo], _maxRange];
43-
};
42+
43+
_maxRange * 1.3 // Adding 30% more to range just to be safe
44+
}, true];
45+
4446
if (ACE_player distance _unit > _maxRange && {ACE_player distance ((getPosASL _unit) vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply _maxRange)) > _maxRange}) exitWith {};
4547

4648
if (_projectile getShotInfo 4) exitWith { _abort = false }; // 4=shownTracer
@@ -57,17 +59,8 @@ if (_abort) then {
5759
if (_abort) exitWith {};
5860

5961
// Get Weapon and Ammo Configurations
60-
private _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo];
61-
if (isNil "_AmmoCacheEntry") then {
62-
_AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig);
63-
};
64-
private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon];
65-
if (isNil "_WeaponCacheEntry") then {
66-
_WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig);
67-
};
68-
69-
_AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocityVariationSD"];
70-
_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
62+
(_ammo call FUNC(readAmmoDataFromConfig)) params ["_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocityVariationSD"];
63+
([_weapon, _muzzle] call FUNC(readWeaponDataFromConfig)) params ["_barrelTwist", "_twistDirection", "_barrelLength"];
7164

7265
private _temperature = nil; // We need the variable in this scope. So we need to init it here.
7366

addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -27,77 +27,77 @@
2727
* Public: No
2828
*/
2929

30-
TRACE_1("Reading Ammo Config",_this);
30+
params ["_ammo"]
3131

32-
private _ammoConfig = configFile >> "CfgAmmo" >> _this;
32+
TRACE_1("Reading Ammo Config",_ammo);
3333

34-
private _airFriction = getNumber(_ammoConfig >> "airFriction");
35-
private _caliber = 0 max getNumber(_ammoConfig >> "ACE_caliber");
36-
private _bulletLength = 0 max getNumber(_ammoConfig >> "ACE_bulletLength");
37-
private _bulletMass = 0 max getNumber(_ammoConfig >> "ACE_bulletMass");
38-
private _transonicStabilityCoef = 0 max getNumber(_ammoConfig >> "ACE_transonicStabilityCoef") min 1;
39-
if (_transonicStabilityCoef == 0) then {
40-
_transonicStabilityCoef = 0.5;
41-
};
42-
private _dragModel = getNumber(_ammoConfig >> "ACE_dragModel");
43-
if !(_dragModel in [1, 2, 5, 6, 7, 8]) then {
44-
_dragModel = 1;
45-
};
46-
private _ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients");
47-
if (_ballisticCoefficients isEqualTo []) then {
48-
_ballisticCoefficients = [0.5];
49-
};
50-
private _velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries");
51-
private _atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere");
52-
if (_atmosphereModel isEqualTo "") then {
53-
_atmosphereModel = "ICAO";
54-
};
55-
private _muzzleVelocityVariationSD = DEFAULT_MUZZLE_VELOCITY_VARIATION_SD;
56-
if (isNumber (_ammoConfig >> "ACE_muzzleVelocityVariationSD")) then {
57-
_muzzleVelocityVariationSD = getNumber(_ammoConfig >> "ACE_muzzleVelocityVariationSD") / 100;
58-
};
59-
private _ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVelocityShifts");
60-
private _muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities");
61-
private _barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths");
34+
GVAR(ammoData) getOrDefaultCall [_ammo, {
35+
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
6236

63-
//Handle subsonic ammo that would have a huge muzzle velocity shift (when ballistic configs not explicitly defined)
64-
private _typicalSpeed = getNumber (_ammoConfig >> "typicalSpeed");
65-
if ((_typicalSpeed > 0) && {_typicalSpeed < 360}) then {
66-
private _inheritedBarrelConfig = (_muzzleVelocityTable isNotEqualTo []) && {(configProperties [_ammoConfig, "(configName _x) == 'ACE_muzzleVelocities'", false]) isEqualTo []};
67-
private _inheritedTempConfig = (_ammoTempMuzzleVelocityShifts isNotEqualTo []) && {(configProperties [_ammoConfig, "(configName _x) == 'ACE_ammoTempMuzzleVelocityShifts'", false]) isEqualTo []};
68-
TRACE_3("subsonic",_typicalSpeed,_inheritedBarrelConfig,_inheritedTempConfig);
69-
if (_inheritedBarrelConfig || _inheritedTempConfig) then {
70-
private _parentConfig = inheritsFrom _ammoConfig;
71-
private _parentSpeed = getNumber (_parentConfig >> "typicalSpeed");
72-
WARNING_4("Subsonic Ammo %1 (%2 m/s) missing `ACE_muzzleVelocities` or `ACE_ammoTempMuzzleVelocityShifts` configs, attempting to use parent %3 (%4m/s)",_this,_typicalSpeed,configName _parentConfig,_parentSpeed);
73-
if (_parentSpeed <= 0) exitWith {//Handle weird or null parent
74-
_muzzleVelocityTable = [];
75-
_ammoTempMuzzleVelocityShifts = [];
76-
};
77-
private _linearMuliplier = _typicalSpeed / _parentSpeed;
78-
if (_inheritedBarrelConfig) then {
79-
if ((configProperties [_parentConfig, "(configName _x) == 'ACE_muzzleVelocities'", false]) isNotEqualTo []) then {
80-
TRACE_2("Parent Has Defined Barrel MV",_linearMuliplier,_muzzleVelocityTable);
81-
{ _muzzleVelocityTable set [_forEachIndex, (_x * _linearMuliplier)]; } forEach _muzzleVelocityTable;
82-
} else {
83-
TRACE_2("Parent DOES NOT Have Defined Barrel MV",_linearMuliplier,_muzzleVelocityTable);
37+
private _airFriction = getNumber(_ammoConfig >> "airFriction");
38+
private _caliber = 0 max getNumber(_ammoConfig >> "ACE_caliber");
39+
private _bulletLength = 0 max getNumber(_ammoConfig >> "ACE_bulletLength");
40+
private _bulletMass = 0 max getNumber(_ammoConfig >> "ACE_bulletMass");
41+
private _transonicStabilityCoef = 0 max getNumber(_ammoConfig >> "ACE_transonicStabilityCoef") min 1;
42+
if (_transonicStabilityCoef == 0) then {
43+
_transonicStabilityCoef = 0.5;
44+
};
45+
private _dragModel = getNumber(_ammoConfig >> "ACE_dragModel");
46+
if !(_dragModel in [1, 2, 5, 6, 7, 8]) then {
47+
_dragModel = 1;
48+
};
49+
private _ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients");
50+
if (_ballisticCoefficients isEqualTo []) then {
51+
_ballisticCoefficients = [0.5];
52+
};
53+
private _velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries");
54+
private _atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere");
55+
if (_atmosphereModel isEqualTo "") then {
56+
_atmosphereModel = "ICAO";
57+
};
58+
private _muzzleVelocityVariationSD = DEFAULT_MUZZLE_VELOCITY_VARIATION_SD;
59+
if (isNumber (_ammoConfig >> "ACE_muzzleVelocityVariationSD")) then {
60+
_muzzleVelocityVariationSD = getNumber(_ammoConfig >> "ACE_muzzleVelocityVariationSD") / 100;
61+
};
62+
private _ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVelocityShifts");
63+
private _muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities");
64+
private _barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths");
65+
66+
//Handle subsonic ammo that would have a huge muzzle velocity shift (when ballistic configs not explicitly defined)
67+
private _typicalSpeed = getNumber (_ammoConfig >> "typicalSpeed");
68+
if ((_typicalSpeed > 0) && {_typicalSpeed < 360}) then {
69+
private _inheritedBarrelConfig = (_muzzleVelocityTable isNotEqualTo []) && {(configProperties [_ammoConfig, "(configName _x) == 'ACE_muzzleVelocities'", false]) isEqualTo []};
70+
private _inheritedTempConfig = (_ammoTempMuzzleVelocityShifts isNotEqualTo []) && {(configProperties [_ammoConfig, "(configName _x) == 'ACE_ammoTempMuzzleVelocityShifts'", false]) isEqualTo []};
71+
TRACE_3("subsonic",_typicalSpeed,_inheritedBarrelConfig,_inheritedTempConfig);
72+
if (_inheritedBarrelConfig || _inheritedTempConfig) then {
73+
private _parentConfig = inheritsFrom _ammoConfig;
74+
private _parentSpeed = getNumber (_parentConfig >> "typicalSpeed");
75+
WARNING_4("Subsonic Ammo %1 (%2 m/s) missing `ACE_muzzleVelocities` or `ACE_ammoTempMuzzleVelocityShifts` configs, attempting to use parent %3 (%4m/s)",_ammo,_typicalSpeed,configName _parentConfig,_parentSpeed);
76+
if (_parentSpeed <= 0) exitWith {//Handle weird or null parent
8477
_muzzleVelocityTable = [];
85-
};
86-
};
87-
if (_inheritedTempConfig) then {
88-
if ((configProperties [_parentConfig, "(configName _x) == 'ACE_ammoTempMuzzleVelocityShifts'", false]) isNotEqualTo []) then {
89-
TRACE_2("Parent Has Defined Ammo Temp Shifts",_linearMuliplier,_muzzleVelocityTable);
90-
{ _ammoTempMuzzleVelocityShifts set [_forEachIndex, (_x * _linearMuliplier)]; } forEach _ammoTempMuzzleVelocityShifts;
91-
} else {
92-
TRACE_2("Parent DOES NOT Have Defined Ammo Temp Shifts",_linearMuliplier,_muzzleVelocityTable);
9378
_ammoTempMuzzleVelocityShifts = [];
9479
};
80+
private _linearMuliplier = _typicalSpeed / _parentSpeed;
81+
if (_inheritedBarrelConfig) then {
82+
if ((configProperties [_parentConfig, "(configName _x) == 'ACE_muzzleVelocities'", false]) isNotEqualTo []) then {
83+
TRACE_2("Parent Has Defined Barrel MV",_linearMuliplier,_muzzleVelocityTable);
84+
{ _muzzleVelocityTable set [_forEachIndex, (_x * _linearMuliplier)]; } forEach _muzzleVelocityTable;
85+
} else {
86+
TRACE_2("Parent DOES NOT Have Defined Barrel MV",_linearMuliplier,_muzzleVelocityTable);
87+
_muzzleVelocityTable = [];
88+
};
89+
};
90+
if (_inheritedTempConfig) then {
91+
if ((configProperties [_parentConfig, "(configName _x) == 'ACE_ammoTempMuzzleVelocityShifts'", false]) isNotEqualTo []) then {
92+
TRACE_2("Parent Has Defined Ammo Temp Shifts",_linearMuliplier,_muzzleVelocityTable);
93+
{ _ammoTempMuzzleVelocityShifts set [_forEachIndex, (_x * _linearMuliplier)]; } forEach _ammoTempMuzzleVelocityShifts;
94+
} else {
95+
TRACE_2("Parent DOES NOT Have Defined Ammo Temp Shifts",_linearMuliplier,_muzzleVelocityTable);
96+
_ammoTempMuzzleVelocityShifts = [];
97+
};
98+
};
9599
};
96100
};
97-
};
98-
99-
private _result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocityVariationSD];
100-
101-
uiNamespace setVariable [format[QGVAR(%1), _this], _result];
102101

103-
_result
102+
[_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocityVariationSD]
103+
}, true] // return

addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,42 @@
55
* Reads the weapon class config and updates the config cache
66
*
77
* Arguments:
8-
* weapon - classname <STRING>
8+
* 0: Weapon <STRING>
9+
* 1: Muzzle <STRING> (optional)
910
*
1011
* Return Value:
1112
* 0: _barrelTwist <NUMBER>
1213
* 1: _twistDirection <NUMBER>
1314
* 2: _barrelLength <NUMBER>
1415
*
1516
* Example:
16-
* ["weapon"] call ace_advanced_ballistics_fnc_readWeaponDataFromConfig
17+
* [currentWeapon player, currentMuzzle player] call ace_advanced_ballistics_fnc_readWeaponDataFromConfig
1718
*
1819
* Public: No
1920
*/
2021

21-
private _weaponConfig = (configFile >> "CfgWeapons" >> _this);
22+
params ["_weapon"];
2223

23-
private _barrelTwist = 0 max getNumber(_weaponConfig >> "ACE_barrelTwist");
24-
private _twistDirection = parseNumber (_barrelTwist != 0);
25-
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
26-
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
27-
if !(_twistDirection in [-1, 0, 1]) then {
28-
_twistDirection = 1;
29-
};
30-
};
24+
private _muzzle = param [1, _weapon];
3125

32-
private _barrelLength = 0 max getNumber(_weaponConfig >> "ACE_barrelLength");
26+
GVAR(weaponData) getOrDefaultCall [[_weapon, _muzzle], {
27+
// For most weapons muzzle == weapon (config value of "this" for muzzle)
28+
private _weaponConfig = if (_muzzle == _weapon) then {
29+
configFile >> "CfgWeapons" >> _weapon
30+
} else {
31+
configFile >> "CfgWeapons" >> _weapon >> _muzzle
32+
};
3333

34-
private _result = [_barrelTwist, _twistDirection, _barrelLength];
34+
private _barrelTwist = 0 max getNumber(_weaponConfig >> "ACE_barrelTwist");
35+
private _twistDirection = parseNumber (_barrelTwist != 0);
36+
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
37+
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
38+
if !(_twistDirection in [-1, 0, 1]) then {
39+
_twistDirection = 1;
40+
};
41+
};
3542

36-
uiNamespace setVariable [format[QGVAR(%1), _this], _result];
43+
private _barrelLength = 0 max getNumber(_weaponConfig >> "ACE_barrelLength");
3744

38-
_result
45+
[_barrelTwist, _twistDirection, _barrelLength]
46+
}, true] // return

0 commit comments

Comments
 (0)