ACE3/addons/parachute/functions/fnc_onEachFrame.sqf

34 lines
1.1 KiB
Plaintext
Raw Normal View History

/*
* 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";
_player = ACE_player;
2015-02-02 21:58:24 +00:00
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;};
2015-02-02 21:58:24 +00:00
if (isTouchingGround _player) exitWith {[(_this select 1)] call CALLSTACK(cba_fnc_removePerFrameHandler);GVAR(PFH) = false;};
2015-02-02 21:58:24 +00:00
private ["_pos"];
_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);
};