mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
air burst ammo PFH
This commit is contained in:
parent
ec29bf37a8
commit
983b44c02a
@ -9,6 +9,7 @@ PREP(canUseRangefinder);
|
||||
PREP(firedEH);
|
||||
PREP(getAngle);
|
||||
PREP(getRange);
|
||||
PREP(handleAirBurstAmmunitionPFH);
|
||||
PREP(keyDown);
|
||||
PREP(keyUp);
|
||||
PREP(reset);
|
||||
|
@ -45,26 +45,16 @@ _offset = 0;
|
||||
[_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection);
|
||||
|
||||
// Air burst missile
|
||||
// may need to get rewritten
|
||||
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_Airburst") == 1) then {
|
||||
_this spawn {
|
||||
_vehicle = _this select 0;
|
||||
_projectile = _this select 6;
|
||||
|
||||
_distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle];
|
||||
// handle locally only
|
||||
if (!local _gunner) exitWith {};
|
||||
|
||||
if (_distance < 50) exitWith {};
|
||||
if (_distance > 1500) exitWith {};
|
||||
if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(Airburst)) == 1) then {
|
||||
private "_zeroing";
|
||||
_zeroing = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle];
|
||||
|
||||
waitUntil {_projectile distance _vehicle > _distance || {!alive _projectile}};
|
||||
if (!alive _projectile) exitWith {};
|
||||
if (_zeroing < 50) exitWith {};
|
||||
if (_zeroing > 1500) exitWith {};
|
||||
|
||||
_position = getPosATL _projectile;
|
||||
|
||||
_subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"];
|
||||
_subMunition setPosATL _position;
|
||||
_subMunition setVelocity [0, 0, -10];
|
||||
|
||||
deleteVehicle _projectile;
|
||||
};
|
||||
[FUNC(handleAirBurstAmmunitionPFH), 0, [_vehicle, _projectile, _zeroing]] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
21
addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf
Normal file
21
addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
// by commy2
|
||||
|
||||
_vehicle = _this select 0 select 0;
|
||||
_projectile = _this select 0 select 1;
|
||||
_zeroing = _this select 0 select 2;
|
||||
|
||||
if (isNull _projectile || {!alive _projectile}) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
if (_projectile distance _vehicle < _zeroing) exitWith {};
|
||||
|
||||
_position = getPosATL _projectile;
|
||||
|
||||
_subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"];
|
||||
_subMunition setPosATL _position;
|
||||
_subMunition setVelocity [0, 0, -10];
|
||||
|
||||
deleteVehicle _projectile;
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
Loading…
Reference in New Issue
Block a user