HuntIR - Fix connecting when ammo is null (#6099)

Fix #6093

`[_nearestHuntIRs select 0] call FUNC(cam);` would pass nill
Also delay opening GUI for a frame to prevent issue with interaction menu
This commit is contained in:
PabstMirror 2018-01-30 21:50:24 -06:00 committed by GitHub
parent 4857294510
commit 1b6dc5ae2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -7,7 +7,7 @@ class CfgVehicles {
class GVAR(open) {
displayName = CSTRING(activateMonitor);
condition = QUOTE([ARR_2(ACE_player,'ACE_HuntIR_monitor')] call EFUNC(common,hasItem));
statement = QUOTE(call FUNC(huntir));
statement = QUOTE([FUNC(huntir)] call CBA_fnc_execNextFrame;);
showDisabled = 0;
priority = 2;
icon = QPATHTOF(UI\w_huntir_monitor_ca.paa);

View File

@ -49,6 +49,14 @@ createDialog QGVAR(cam_dialog_off);
private _elapsedTime = CBA_missionTime - GVAR(startTime);
private _nearestHuntIRs = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE];
if ((GVAR(state) in ["connecting", "connected"]) && {_nearestHuntIRs isEqualTo []}) then {
TRACE_1("reseting back to search because no valid ammo exists anymore",GVAR(state));
GVAR(state) = "searching";
GVAR(done) = false;
GVAR(message) = [];
GVAR(connectionDelay) = 5;
};
if ((!dialog) || GVAR(done)) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;