Different trigger height for laser guided

This commit is contained in:
Sotirios Pupakis
2024-05-31 04:18:03 +02:00
parent 95ae949b98
commit 2cd4218ecc

View File

@@ -45,31 +45,35 @@ _arty animateSource ["magazine_load_source", 0, true];
if (!isServer) exitWith {}; if (!isServer) exitWith {};
// "Temp" fix for cluster and laser guided because BI? // "Temp" fix for cluster and laser guided because BI?
if (_ammo in ["tbd_mortars_105mm_shell_ammo_dpicm" /*"tbd_mortars_105mm_shell_ammo_laser"*/]) then { if (_ammo in ["tbd_mortars_105mm_shell_ammo_dpicm", "tbd_mortars_105mm_shell_ammo_laser"]) then {
private _alt = [200, 600] select (_ammo isEqualTo "tbd_mortars_105mm_shell_ammo_laser");
systemChat format ["%1", _alt];
// wait 5 seconds to let the ammo get high enough // wait 5 seconds to let the ammo get high enough
[{ [{
params ["_projectile"]; params ["_projectile", "_alt"];
if (isNull _projectile) exitWith {}; if (isNull _projectile) exitWith {};
// Check the height of the projectile // Check the height of the projectile
private _pos = getPosATL _projectile; private _pos = getPosATL _projectile;
if (_pos select 2 < 200) exitWith {}; if (_pos select 2 < _alt) exitWith {};
// Start a PFH that will // Start a PFH that will
[{ [{
params ["_projectile", "_handle"]; params ["_args", "_handle"];
_args params ["_projectile", "_alt"];
if (isNull _projectile) exitWith { if (isNull _projectile) exitWith {
[_handle] call CBA_fnc_removePerFrameHandler; [_handle] call CBA_fnc_removePerFrameHandler;
}; };
// Check the height of the projectile // Check the height of the projectile
private _pos = getPosATL _projectile; private _pos = getPosATL _projectile;
if (_pos select 2 < 200) exitWith { systemChat format ["%1", _pos select 2];
if (_pos select 2 < _alt) exitWith {
// Trigger the ammo // Trigger the ammo
triggerAmmo _projectile; triggerAmmo _projectile;
[_handle] call CBA_fnc_removePerFrameHandler; [_handle] call CBA_fnc_removePerFrameHandler;
}; };
}, },
0, 0,
_projectile] call CBA_fnc_addPerFrameHandler; [_projectile, _alt]] call CBA_fnc_addPerFrameHandler;
}, [_projectile], 5] call CBA_fnc_waitAndExecute; }, [_projectile, _alt], 5] call CBA_fnc_waitAndExecute;
}; };