mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use "visibleMapChanged" event
This commit is contained in:
parent
f67809b18c
commit
4be7411a05
@ -1,4 +1,6 @@
|
||||
// ACE - Common
|
||||
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
#include "script_component.hpp"
|
||||
|
||||
//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
|
||||
@ -208,6 +210,7 @@ GVAR(OldVisibleMap) = false;
|
||||
|
||||
// PFH to raise varios events
|
||||
[{
|
||||
BEGIN_COUNTER(stateChecker);
|
||||
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen", "_newVisibleMap"];
|
||||
// "playerInventoryChanged" event
|
||||
_newPlayerInventory = [ACE_player] call FUNC(getAllGear);
|
||||
@ -281,6 +284,8 @@ GVAR(OldVisibleMap) = false;
|
||||
["visibleMapChanged", [ACE_player, _newVisibleMap]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
END_COUNTER(stateChecker);
|
||||
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
@ -381,26 +386,4 @@ GVAR(deviceKeyCurrentIndex) = -1;
|
||||
{false},
|
||||
[0xC7, [true, false, false]], false] call cba_fnc_addKeybind; //SHIFT + Home Key
|
||||
|
||||
//Map opened/closed Events:
|
||||
GVAR(mapOpened) = false;
|
||||
[{
|
||||
if (!isNull (findDisplay 12)) then {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
TRACE_1("Installing Map Draw EH for MapOpened event");
|
||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {
|
||||
if (!GVAR(mapOpened)) then {
|
||||
GVAR(mapOpened) = true;
|
||||
["mapOpened", []] call FUNC(localEvent);
|
||||
[{
|
||||
if (!visibleMap) then {
|
||||
GVAR(mapOpened) = false;
|
||||
["mapClosed", []] call FUNC(localEvent);
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
}];
|
||||
};
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
GVAR(commonPostInited) = true;
|
||||
|
@ -66,14 +66,15 @@ GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737];
|
||||
12 call _fnc_installMapEvents;
|
||||
};
|
||||
|
||||
["mapOpened", {
|
||||
// Show GPS if required
|
||||
[GVAR(mapGpsShow)] call FUNC(openMapGps);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
||||
["mapClosed", {
|
||||
// Hide GPS
|
||||
[false] call FUNC(openMapGps);
|
||||
// Cancel drawing
|
||||
call FUNC(cancelDrawing);
|
||||
["visibleMapChanged", {
|
||||
params ["", "_mapOn"];
|
||||
if (_mapOn) then {
|
||||
// Show GPS if required
|
||||
[GVAR(mapGpsShow)] call FUNC(openMapGps);
|
||||
} else {
|
||||
// Hide GPS
|
||||
[false] call FUNC(openMapGps);
|
||||
// Cancel drawing
|
||||
call FUNC(cancelDrawing);
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
Loading…
Reference in New Issue
Block a user