ACE3/addons/parachute/functions/fnc_onEachFrame.sqf
Dedmen Miller 81e02a7336 Refactor private ARRAY to private keyword (#5598)
* Everything

* Fixed missing ;

* Fix missing ; and double private

* Fixed cannot isNull on number

* Turn _temparture back to isNil

* Fix error from merge
2017-10-10 09:39:59 -05:00

32 lines
1.1 KiB
Plaintext

/*
* Author: Garth 'L-H' de Wet
* Checks whether the unit should preform landing.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ACE_Parachute_fnc_onEachFrame;
*
* Public: No
*/
#include "script_component.hpp"
private _player = ACE_player;
if (!GVAR(PFH)) exitWith {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);};
if (isNull _player) exitWith {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);GVAR(PFH) = false;};
if !((vehicle _player) isKindOf "ParachuteBase") exitWith {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);GVAR(PFH) = false;};
if (isTouchingGround _player) exitWith {[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);GVAR(PFH) = false;};
private _pos = getPosASL (vehicle _player);
if ((lineIntersects [_pos, _pos vectorAdd [0,0,-0.5], vehicle _player, _player]) || {((ASLtoATL _pos) select 2) < 0.75}) then {
[(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler);
GVAR(PFH) = false;
// I believe this will not work for Zeus units.
deleteVehicle (vehicle _player);
[_player] call FUNC(doLanding);
};