2015-01-17 02:01:41 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-11 14:58:26 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
2015-01-17 02:01:41 +00:00
|
|
|
|
2016-04-19 17:59:41 +00:00
|
|
|
GVAR(pfID) = -1;
|
2015-01-17 02:01:41 +00:00
|
|
|
|
2016-05-24 13:13:11 +00:00
|
|
|
["ace_settingsInitialized", {
|
2016-04-19 17:59:41 +00:00
|
|
|
TRACE_1("SettingsInitialized eh",GVAR(enabledFor));
|
2015-01-17 02:01:41 +00:00
|
|
|
|
2016-04-19 17:59:41 +00:00
|
|
|
if (GVAR(enabledFor) == 0) exitWith {}; //Module has no effect if enabledFor is "None"
|
|
|
|
if (GVAR(enabledFor) == 2) exitWith { //PFEH is always on when enabledFor is "All"
|
|
|
|
[] call FUNC(addPFEH);
|
|
|
|
TRACE_1("adding perm PFEH",GVAR(pfID));
|
|
|
|
};
|
|
|
|
|
|
|
|
//PFEH only runs when player is in a type "Air" vehicle when enabledFor is "Aircraft"
|
|
|
|
|
|
|
|
if ((!isNull (vehicle ACE_player)) && {(vehicle ACE_player) isKindOf "Air"}) then { //"playerVehicleChanged" can happen before "settingInit"
|
|
|
|
[] call FUNC(addPFEH);
|
|
|
|
TRACE_1("adding temp PFEH [start in]",GVAR(pfID));
|
|
|
|
};
|
2016-06-21 23:39:20 +00:00
|
|
|
["vehicle", {
|
2016-04-19 17:59:41 +00:00
|
|
|
params ["", "_vehicle"];
|
|
|
|
TRACE_2("playerVehicleChanged",_vehicle,typeOf _vehicle);
|
|
|
|
if (_vehicle isKindOf "Air") then {
|
|
|
|
if (GVAR(pfID) == -1) then {
|
|
|
|
[] call FUNC(addPFEH);
|
|
|
|
TRACE_1("adding temp PFEH",GVAR(pfID));
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
if (GVAR(pfID) != -1) then {
|
|
|
|
TRACE_1("removing temp PFEH",GVAR(pfID));
|
|
|
|
ppEffectDestroy GVAR(GForces_CC);
|
|
|
|
[GVAR(pfID)] call CBA_fnc_removePerFrameHandler;
|
|
|
|
GVAR(pfID) = -1;
|
|
|
|
};
|
|
|
|
};
|
2016-06-21 23:39:20 +00:00
|
|
|
}] call CBA_fnc_addPlayerEventHandler;
|
2016-05-22 15:29:05 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|