ACE3/addons/viewports/functions/fnc_enterVehicle.sqf
PabstMirror a4258f3587
Viewports (#8480)
* Viewports

* Support mem-points

* Update CfgVehicles.hpp

* Add some docs

* Cleanup Debugging

* Update addons/viewports/dev/debugPoints.sqf

Co-authored-by: Dystopian <sddex@ya.ru>

* Update addons/viewports/dev/debugPoints.sqf

Co-authored-by: Dystopian <sddex@ya.ru>

* Update addons/viewports/functions/fnc_eachFrame.sqf

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* configProperties / 3den macro

* Update viewports-framework.md

* Update viewports-framework.md

* Add compats for rhs btrs

* Update addons/viewports/dev/debugPoints.sqf

Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>

Co-authored-by: Dystopian <sddex@ya.ru>
Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>
2022-05-17 11:55:09 -05:00

37 lines
939 B
Plaintext

#include "script_component.hpp"
/*
* Author: PabstMirror
* Handle playerEH for new changing vehicle, check if it has any viewports and start PFEH
*
* Arguments:
* 0: player <OBJECT>
* 1: vehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, vehicle player] call ace_viewports_fnc_enterVehicle
*
* Public: No
*/
params ["_player", "_vehicle"];
TRACE_2("enterVehicle",_player,_vehicle);
if (GVAR(pfeh) != -1) then {
TRACE_1("cleaning up",GVAR(pfeh));
[GVAR(pfeh)] call CBA_fnc_removePerFrameHandler;
GVAR(pfeh) = -1;
call FUNC(viewCleanup);
};
if (!GVAR(enabled)) exitWith {};
if (_player == _vehicle) exitWith {};
private _viewports = [_vehicle] call FUNC(getViewports);
if (_viewports isEqualTo []) exitWith {};
GVAR(pfeh) = [LINKFUNC(eachFrame), 0, [_player, _vehicle, _viewports, -1, -1]] call CBA_fnc_addPerFrameHandler;
TRACE_3("start pfeh",GVAR(pfeh),typeOf _vehicle,count _viewports);