mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added SettingChanged EH and proper handling
This commit is contained in:
parent
a7cd36bc3e
commit
2edbacd15b
@ -23,7 +23,23 @@ GVAR(ShowNamesTime) = -10;
|
||||
[29, [false, false, false]], false] call cba_fnc_addKeybind; //LeftControl Key
|
||||
|
||||
|
||||
// Draw handle
|
||||
// Draw handle on start if set
|
||||
if (GVAR(showPlayerNames) > 0) then {
|
||||
addMissionEventHandler ["Draw3D", {_this call FUNC(onDraw3d);}];
|
||||
GVAR(drawHandler) = addMissionEventHandler ["Draw3D", {_this call FUNC(onDraw3d);}];
|
||||
};
|
||||
|
||||
// Set the EH which waits for a setting to be changed, so that the effect is shown immediately
|
||||
if (!GVAR(showPlayerNamesForce)) then {
|
||||
["SettingChanged", {
|
||||
PARAMS_2(_name,_value)
|
||||
if (_name == QGVAR(showPlayerNames)) then {
|
||||
if ((GVAR(showPlayerNames) > 0) && (_value == 0)) then {
|
||||
removeMissionEventHandler ["Draw3D", GVAR(drawHandler)];
|
||||
GVAR(drawHandler) = nil;
|
||||
};
|
||||
if ((GVAR(showPlayerNames) == 0) && (_value > 0)) then {
|
||||
GVAR(drawHandler) = addMissionEventHandler ["Draw3D", {_this call FUNC(onDraw3d);}];
|
||||
};
|
||||
};
|
||||
}] call ace_common_fnc_addEventHandler;
|
||||
};
|
@ -30,4 +30,4 @@ if (GVAR(showPlayerNamesForce)) then {
|
||||
[_logic, QGVAR(showPlayerNames), "showPlayerNames" ] call EFUNC(common,readSettingFromModule);
|
||||
};
|
||||
|
||||
diag_log text "[ACE]: NameTags Module Initialized.";
|
||||
diag_log format ["[ACE]: NameTags Module Initialized. Forced Name Tags Setting: %1",GVAR(showPlayerNamesForce)];
|
||||
|
@ -26,7 +26,7 @@
|
||||
<Russian>Показывать имена игроков (включить имена)</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NameTags_ShowPlayerNamesForce">
|
||||
<English>Force show player names setting</English>
|
||||
<English>Force names setting</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NameTags_ShowPlayerNamesForce_Desc">
|
||||
<English>Force name tags option, or by default allows players to choose it on their own. Default: Do Not Force</English>
|
||||
|
Loading…
Reference in New Issue
Block a user