Disables multiple openings of the kestrel & atrag. Allows the overlay toggle, but disables the opening of multiple ones. Used onUnload handlers. Supports both limiting interact and keybinds. Fixes #1086

This commit is contained in:
jaynus 2015-05-09 12:41:01 -07:00
parent 00c28dd146
commit 6b5d95906d
13 changed files with 30 additions and 4 deletions

View File

@ -142,6 +142,7 @@ class ATragMX_Display {
name="ATragMX_Display";
idd=-1;
onLoad="uiNamespace setVariable ['ATragMX_Display', (_this select 0)]";
onUnload=QUOTE(_this call FUNC(on_close_dialog));
movingEnable=1;
controlsBackground[]={};
objects[]={};

View File

@ -68,5 +68,6 @@ PREP(update_target_data);
PREP(update_target_selection);
PREP(update_unit_selection);
PREP(update_zero_range);
PREP(on_close_dialog);
ADDON = true;

View File

@ -16,6 +16,7 @@
#include "script_component.hpp"
//if (dialog) exitWith { false };
if(GVAR(active)) exitWith { false };
if (underwater ACE_player) exitWith { false };
if (!("ACE_ATragMX" in (uniformItems ACE_player)) && !("ACE_ATragMX" in (vestItems ACE_player))) exitWith { false };
@ -47,4 +48,6 @@ GVAR(showTargetSpeedAssistTimer) call FUNC(show_target_speed_assist_timer);
lbAdd [6000, _x select 0];
} forEach GVAR(gunList);
GVAR(active) = true;
true

View File

@ -15,6 +15,8 @@
*/
#include "script_component.hpp"
GVAR(active) = false;
GVAR(workingMemory) = +(GVAR(gunList) select 0);
GVAR(scopeUnits) = ["MILs", "TMOA", "SMOA", "Clicks"];

View File

@ -0,0 +1,4 @@
#include "script_component.hpp"
uiNamespace setVariable ['ATragMX_Display', nil];
GVAR(active) = false;

View File

@ -2,7 +2,7 @@
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if(GVAR(active)) exitWith {};
// Statement
[] call FUNC(create_dialog);
false

View File

@ -54,6 +54,7 @@ class Kestrel4500_Display
name="Kestrel4500_Display";
idd=-1;
onLoad="uiNamespace setVariable ['Kestrel4500_Display', (_this select 0)]";
onUnload=QUOTE(_this call FUNC(onCloseDialog));
movingEnable=1;
controlsBackground[]={};
objects[]={};
@ -217,6 +218,7 @@ class RscTitles
{
idd=-1;
onLoad="with uiNameSpace do { RscKestrel4500 = _this select 0 };";
onUnload=(_this call FUNC(onCloseDisplay));
movingEnable=0;
duration=60;
fadeIn="false";

View File

@ -22,4 +22,4 @@ GVAR(MeasuredWindSpeed) = 0;
GVAR(ImpellerState) = 0;
GVAR(Kestrel4500) = false;
GVAR(Overlay) = false;
GVAR(Overlay) = false;

View File

@ -13,4 +13,7 @@ PREP(measureWindSpeed);
PREP(updateDisplay);
PREP(updateImpellerState);
PREP(onCloseDialog);
PREP(onCloseDisplay);
ADDON = true;

View File

@ -16,6 +16,7 @@
//if (dialog) exitWith { false };
if (underwater ACE_player) exitWith { false };
if(GVAR(Kestrel4500)) exitWith { false };
if (!("ACE_Kestrel4500" in (uniformItems ACE_player)) && !("ACE_Kestrel4500" in (vestItems ACE_player))) exitWith { false };
GVAR(Overlay) = false;

View File

@ -0,0 +1,4 @@
#include "script_component.hpp"
uiNamespace setVariable ['Kestrel4500_Display', nil];
GVAR(Kestrel4500) = false;

View File

@ -0,0 +1,4 @@
#include "script_component.hpp"
uiNamespace setVariable ['RscKestrel4500', nil];
GVAR(Overlay) = false;

View File

@ -2,7 +2,8 @@
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
if(GVAR(Kestrel4500)) exitWith { false };
// Statement
[] call FUNC(createKestrelDialog);
false
@ -14,7 +15,7 @@
{
// Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
// Statement
[] call FUNC(displayKestrel);
false