2019-06-08 04:48:37 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
[QGVAR(detachSight), LINKFUNC(sightDetach)] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(attachSight), LINKFUNC(sightAttach)] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
["vehicle", {
|
|
|
|
params ["","_vehicle"];
|
|
|
|
TRACE_2("vehicle change",_vehicle,typeOf _vehicle);
|
|
|
|
if (!(_vehicle isKindOf QGVAR(staticBase))) exitWith {};
|
|
|
|
|
|
|
|
_vehicle animate ["rest_rotate", 0];
|
|
|
|
|
|
|
|
if (isNil QGVAR(pfID)) then {GVAR(pfID) = -1};
|
|
|
|
[GVAR(pfID)] call CBA_fnc_removePerFrameHandler;
|
|
|
|
|
|
|
|
private _lastView = cameraView;
|
|
|
|
if (!(_lastView in ["INTERNAL", "EXTERNAL"])) then { _lastView == "INTERNAL"; };
|
|
|
|
|
|
|
|
GVAR(pfID) = [{
|
|
|
|
params ["_args"];
|
|
|
|
(_this select 0) params ["_vehicle", "_lastView"];
|
2019-07-05 22:57:22 +00:00
|
|
|
|
2019-06-08 04:48:37 +00:00
|
|
|
if ((!alive _vehicle) || {!alive ACE_player} || {(vehicle ACE_player) != _vehicle}) exitWith {
|
|
|
|
TRACE_1("exiting PFEH",GVAR(pfID));
|
|
|
|
[GVAR(pfID)] call CBA_fnc_removePerFrameHandler;
|
2019-07-05 22:57:22 +00:00
|
|
|
if ((alive _vehicle) && {!alive gunner _vehicle}) then {
|
|
|
|
TRACE_1("reseting rest rotate anim",_vehicle);
|
|
|
|
_vehicle animate ["rest_rotate", -0.35];
|
|
|
|
};
|
2019-06-08 04:48:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (cameraView in ["INTERNAL", "EXTERNAL"]) then {
|
|
|
|
_args set [1, cameraView];
|
|
|
|
} else {
|
|
|
|
if ((cameraOn == _vehicle) && {!(_vehicle getVariable [QGVAR(sightAttached), ((typeOf _vehicle) == QGVAR(staticAssembled))])}) then {
|
|
|
|
_vehicle switchCamera _lastView;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}, 0, [_vehicle, _lastView]] call CBA_fnc_addPerFrameHandler;
|
|
|
|
TRACE_1("started PFEH",GVAR(pfID));
|
|
|
|
}, true] call CBA_fnc_addPlayerEventHandler;
|