Update fnc_handleFired.sqf

This commit is contained in:
PabstMirror 2018-12-13 13:17:45 -06:00
parent f11ed762e3
commit 507b0bce58

View File

@ -26,25 +26,21 @@ if (_ammo != QGVAR(ammo_gl)) exitWith {};
//If null (deleted or hit water) exit: //If null (deleted or hit water) exit:
if (isNull _projectile) exitWith {}; if (isNull _projectile) exitWith {};
// Save grenade state
private _posASL = getPosASL _projectile; private _posASL = getPosASL _projectile;
private _vel = velocity _projectile; private _vel = velocity _projectile;
TRACE_2("",_posASL,_vel);
systemChat format ["gl %1 %2",_vel, round vectorMagnitude _vel]; // Swap fired GL to a missile type
deleteVehicle _projectile; deleteVehicle _projectile;
private _rocket = QGVAR(ammo_rocket) createVehicle (getPosATL _projectile); private _rocket = QGVAR(ammo_rocket) createVehicle (getPosATL _projectile);
[QEGVAR(common,setShotParents), [_rocket, _unit, _unit]] call CBA_fnc_serverEvent;
// Set correct position, velocity and direction (must set velocity before changeMissileDirection)
_rocket setPosASL _posASL; _rocket setPosASL _posASL;
// Set correct velocity and direction (must set velocity before changeMissileDirection)
_rocket setVelocity _vel; _rocket setVelocity _vel;
[_rocket, vectorNormalized _vel] call EFUNC(missileguidance,changeMissileDirection); [_rocket, vectorNormalized _vel] call EFUNC(missileguidance,changeMissileDirection);
private _vel = velocity _rocket;
systemChat format ["rocket %1 %2",_vel, round vectorMagnitude _vel];
// Start missile guidance // Start missile guidance
[_unit, _weapon, _muzzle, _mode, QGVAR(ammo_rocket), _magazine, _rocket] call EFUNC(missileguidance,onFired); [_unit, _weapon, _muzzle, _mode, QGVAR(ammo_rocket), _magazine, _rocket] call EFUNC(missileguidance,onFired);