Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable g-forces for UAV AI #5094

Merged
merged 1 commit into from
May 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions addons/gforces/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@
if (!hasInterface) exitWith {};

GVAR(pfID) = -1;
GVAR(playerIsVirtual) = false;

["ace_settingsInitialized", {
TRACE_1("SettingsInitialized eh",GVAR(enabledFor));

if (GVAR(enabledFor) == 0) exitWith {}; //Module has no effect if enabledFor is "None"

["unit", { // Add unit changed EH to check if player is either virtual (logic) or a UAV AI
params ["_unit"];
GVAR(playerIsVirtual) = ((getNumber (configFile >> "CfgVehicles" >> (typeOf _unit) >> "isPlayableLogic")) == 1) ||
{(getText (configFile >> "CfgVehicles" >> (typeOf _unit) >> "simulation")) == "UAVPilot"};
TRACE_3("unit changed",_unit,typeOf _unit,GVAR(playerIsVirtual));
}, true] call CBA_fnc_addPlayerEventHandler;

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));
};
["vehicle", {
params ["", "_vehicle"];
TRACE_2("playerVehicleChanged",_vehicle,typeOf _vehicle);
Expand All @@ -35,5 +39,5 @@ GVAR(pfID) = -1;
GVAR(pfID) = -1;
};
};
}] call CBA_fnc_addPlayerEventHandler;
}, true] call CBA_fnc_addPlayerEventHandler;
}] call CBA_fnc_addEventHandler;
2 changes: 1 addition & 1 deletion addons/gforces/functions/fnc_pfhUpdateGForces.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if ((CBA_missionTime - GVAR(lastUpdateTime)) < INTERVAL) exitWith {};
GVAR(lastUpdateTime) = CBA_missionTime;

if (isNull ACE_player || !(alive ACE_player)) exitWith {};
if (GVAR(playerIsVirtual) || {!alive ACE_player}) exitWith {};

BEGIN_COUNTER(everyInterval);

Expand Down