2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-08-22 11:34:24 +00:00
|
|
|
/*
|
|
|
|
* Author: GitHawk
|
|
|
|
* Detaches the fuel nozzle, drops it and removes player variables.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT> (optional)
|
|
|
|
* 1: Nozzle <OBJECT>
|
|
|
|
* 2: Disconnect Only <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, nozzle, false] call ace_refuel_fnc_dropNozzle
|
|
|
|
* [objNull, nozzle, false] call ace_refuel_fnc_dropNozzle
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2016-02-02 14:03:06 +00:00
|
|
|
params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_disconnectOnly", false, [false]]];
|
2017-05-01 23:06:34 +00:00
|
|
|
TRACE_3("dropNozzle",_unit,_nozzle,_disconnectOnly);
|
2015-08-22 11:34:24 +00:00
|
|
|
|
|
|
|
detach _nozzle;
|
|
|
|
_nozzle setVariable [QGVAR(isRefueling), false, true];
|
|
|
|
|
|
|
|
if (_disconnectOnly) exitWith {};
|
|
|
|
_nozzle setVelocity [0, 0, 0];
|
2017-05-01 23:06:34 +00:00
|
|
|
|
|
|
|
private _groundPosition = getPosASL _nozzle;
|
|
|
|
private _posA = (getPosASL _nozzle) vectorAdd [0,0,0.05];
|
|
|
|
private _posB = (getPosASL _nozzle) vectorAdd [0,0,-1000];
|
|
|
|
private _intersections = lineIntersectsSurfaces [_posA, _posB, _unit, _nozzle, true, 1, "GEOM"];
|
|
|
|
TRACE_1("",_intersections);
|
|
|
|
if (_intersections isEqualTo []) then {
|
2017-05-14 19:48:05 +00:00
|
|
|
_groundPosition set [2, (getTerrainHeightASL _groundPosition) + 0.005];
|
2017-05-01 23:06:34 +00:00
|
|
|
} else {
|
|
|
|
_groundPosition = ((_intersections select 0) select 0) vectorAdd [0,0,0.005];
|
|
|
|
};
|
|
|
|
_nozzle setPosASL _groundPosition;
|
|
|
|
TRACE_1("finalPos",getPosATL _nozzle);
|
2015-08-22 11:34:24 +00:00
|
|
|
|
|
|
|
if (isNull _unit) exitWith {};
|
2017-09-10 19:43:03 +00:00
|
|
|
_unit setVariable [QGVAR(isRefueling), false];
|
2015-08-22 11:34:24 +00:00
|
|
|
_unit setVariable [QGVAR(nozzle), objNull, true];
|