mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2718 from acemod/rangeCards-scriptError
RangeCard / AB fixes
This commit is contained in:
commit
99852f2071
@ -18,7 +18,8 @@ private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
|
|||||||
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
|
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
|
||||||
params["_muzzleVelocityShiftTable", "_temperature"];
|
params["_muzzleVelocityShiftTable", "_temperature"];
|
||||||
|
|
||||||
// Check if muzzleVelocityShiftTable is Larger Than 11 Entrys
|
// Check if muzzleVelocityShiftTable is Less Than 11 Entrys
|
||||||
|
if ((count _muzzleVelocityShiftTable) < 11) exitWith {0};
|
||||||
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
|
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
|
||||||
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
|
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
|
||||||
|
|
||||||
|
@ -24,12 +24,12 @@ if (!hasInterface) exitWith {};
|
|||||||
if (!GVAR(enabled)) exitWith {};
|
if (!GVAR(enabled)) exitWith {};
|
||||||
|
|
||||||
// Parameterization
|
// Parameterization
|
||||||
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletSpeed", "_bulletLength", "_barrelTwist", "_stabilityFactor"];
|
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletLength", "_barrelTwist", "_stabilityFactor", "_aceTimeSecond", "_barrelVelocityShift", "_ammoTemperatureVelocityShift"];
|
||||||
|
|
||||||
params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"];
|
params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"];
|
||||||
|
|
||||||
_abort = false;
|
_abort = false;
|
||||||
|
|
||||||
|
|
||||||
if (!(_ammo isKindOf "BulletBase")) exitWith {};
|
if (!(_ammo isKindOf "BulletBase")) exitWith {};
|
||||||
if (!alive _bullet) exitWith {};
|
if (!alive _bullet) exitWith {};
|
||||||
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
|
||||||
@ -75,22 +75,22 @@ _WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
|
|||||||
_bulletVelocity = velocity _bullet;
|
_bulletVelocity = velocity _bullet;
|
||||||
_muzzleVelocity = vectorMagnitude _bulletVelocity;
|
_muzzleVelocity = vectorMagnitude _bulletVelocity;
|
||||||
|
|
||||||
|
_barrelVelocityShift = 0;
|
||||||
if (GVAR(barrelLengthInfluenceEnabled)) then {
|
if (GVAR(barrelLengthInfluenceEnabled)) then {
|
||||||
_barrelVelocityShift = uiNamespace getVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],nil];
|
_barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
|
||||||
if (isNil "_barrelVelocityShift") then {
|
|
||||||
_barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
|
|
||||||
uiNamespace setVariable [format [QGVAR(%1_muzzleVelocityShift),_weapon],_muzzleVelocityShift];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_ammoTemperatureVelocityShift = 0;
|
||||||
if (GVAR(ammoTemperatureEnabled)) then {
|
if (GVAR(ammoTemperatureEnabled)) then {
|
||||||
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
|
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
|
||||||
_temperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
|
_ammoTemperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
|
if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
|
||||||
|
_muzzleVelocityShift = _barrelVelocityShift + _ammoTemperatureVelocityShift;
|
||||||
|
TRACE_4("shift",_muzzleVelocity,_muzzleVelocityShift, _barrelVelocityShift, _ammoTemperatureVelocityShift);
|
||||||
if (_muzzleVelocityShift != 0) then {
|
if (_muzzleVelocityShift != 0) then {
|
||||||
_muzzleVelocity = _muzzleVelocity + (_barrelVelocityShift + _ammoTemperatureVelocityShift);
|
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
|
||||||
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
|
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
|
||||||
_bullet setVelocity _bulletVelocity;
|
_bullet setVelocity _bulletVelocity;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user