From 507b0bce58d3abc8dfbad96e1ce1d5424b3fc005 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 13 Dec 2018 13:17:45 -0600 Subject: [PATCH] Update fnc_handleFired.sqf --- addons/pike/functions/fnc_handleFired.sqf | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/addons/pike/functions/fnc_handleFired.sqf b/addons/pike/functions/fnc_handleFired.sqf index 283f6d93df..40d5b07f3d 100644 --- a/addons/pike/functions/fnc_handleFired.sqf +++ b/addons/pike/functions/fnc_handleFired.sqf @@ -26,28 +26,24 @@ if (_ammo != QGVAR(ammo_gl)) exitWith {}; //If null (deleted or hit water) exit: if (isNull _projectile) exitWith {}; + // Save grenade state private _posASL = getPosASL _projectile; private _vel = velocity _projectile; - - systemChat format ["gl %1 %2",_vel, round vectorMagnitude _vel]; - + TRACE_2("",_posASL,_vel); + + // Swap fired GL to a missile type deleteVehicle _projectile; - private _rocket = QGVAR(ammo_rocket) createVehicle (getPosATL _projectile); - - _rocket setPosASL _posASL; + [QEGVAR(common,setShotParents), [_rocket, _unit, _unit]] call CBA_fnc_serverEvent; - // Set correct velocity and direction (must set velocity before changeMissileDirection) + // Set correct position, velocity and direction (must set velocity before changeMissileDirection) + _rocket setPosASL _posASL; _rocket setVelocity _vel; [_rocket, vectorNormalized _vel] call EFUNC(missileguidance,changeMissileDirection); - - - private _vel = velocity _rocket; - systemChat format ["rocket %1 %2",_vel, round vectorMagnitude _vel]; // Start missile guidance [_unit, _weapon, _muzzle, _mode, QGVAR(ammo_rocket), _magazine, _rocket] call EFUNC(missileguidance,onFired); - + #ifdef DEBUG_MODE_FULL [{ params ["_args", "_pfID"]; @@ -57,5 +53,5 @@ if (_ammo != QGVAR(ammo_gl)) exitWith {}; hintSilent format ["vel %1\n%2 mps\n%3dist %3\ntof %4",velocity _rocket, round vectorMagnitude velocity _rocket, _rocket distance player, time - _startTime]; }, 0.0, [_rocket, time]] call CBA_fnc_addPerFrameHandler; #endif - + }, _this, 0.1] call CBA_fnc_waitAndExecute;