mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add CBA setting for noRadio (#5571)
* Add ace_setting for noRadio * Delay adding server EH * make noradio a cba setting
This commit is contained in:
parent
fbaa071a4e
commit
3c8d5d6052
@ -1,5 +1,5 @@
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
@ -1,29 +0,0 @@
|
||||
// By commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Unmute unit if that player disconnects
|
||||
if (isServer) then {
|
||||
addMissionEventHandler ["HandleDisconnect", {
|
||||
[_this select 0, "isPlayer"] call EFUNC(common,unmuteUnit);
|
||||
}];
|
||||
};
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// Handle early CBA_fnc_addPlayerEventHandler
|
||||
if (!isNull ace_player) then {
|
||||
[ace_player, "isPlayer"] call EFUNC(common,muteUnit);
|
||||
};
|
||||
|
||||
// Mutes/unmutes units when the player changes
|
||||
["unit", {
|
||||
params ["_newPlayer", "_oldPlayer"];
|
||||
|
||||
// Mute the new player
|
||||
[_newPlayer, "isPlayer"] call EFUNC(common,muteUnit);
|
||||
|
||||
// Unmute the old player
|
||||
if (alive _oldPlayer) then {
|
||||
[_oldPlayer, "isPlayer"] call EFUNC(common,unmuteUnit);
|
||||
};
|
||||
}] call CBA_fnc_addPlayerEventHandler;
|
38
addons/noradio/XEH_preInit.sqf
Normal file
38
addons/noradio/XEH_preInit.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
// By commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isServer) then {
|
||||
// Unmute unit if that player disconnects
|
||||
addMissionEventHandler ["HandleDisconnect", {
|
||||
TRACE_1("re-enabling voice",_this);
|
||||
[_this select 0, "isPlayer"] call EFUNC(common,unmuteUnit);
|
||||
}];
|
||||
};
|
||||
|
||||
if (hasInterface) then {
|
||||
// Mutes/unmutes units when the player changes
|
||||
["unit", {
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
|
||||
params ["_newPlayer", "_oldPlayer"];
|
||||
TRACE_2("player change",_newPlayer,_oldPlayer);
|
||||
|
||||
// Mute the new player
|
||||
[_newPlayer, "isPlayer"] call EFUNC(common,muteUnit);
|
||||
|
||||
// Unmute the old player
|
||||
if (alive _oldPlayer) then {
|
||||
[_oldPlayer, "isPlayer"] call EFUNC(common,unmuteUnit);
|
||||
};
|
||||
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||
};
|
||||
|
||||
[QGVAR(enabled), "CHECKBOX", [LSTRING(setting), LSTRING(setting_tooltip)], localize ELSTRING(common,ACEKeybindCategoryCommon), true, nil, {
|
||||
params ["_enabled"];
|
||||
|
||||
if (_enabled) then {
|
||||
[ACE_player, "isPlayer"] call EFUNC(common,muteUnit);
|
||||
} else {
|
||||
[ACE_player, "isPlayer"] call EFUNC(common,unmuteUnit);
|
||||
};
|
||||
}] call CBA_settings_fnc_init;
|
13
addons/noradio/stringtable.xml
Normal file
13
addons/noradio/stringtable.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project name="ACE">
|
||||
<Package name="noradio">
|
||||
<Key ID="STR_ACE_noradio_setting">
|
||||
<English>Mute Player</English>
|
||||
<German>Spieler stummschalten</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_noradio_setting_tooltip">
|
||||
<English>Mutes the controlled player avatar.</English>
|
||||
<German>Schaltet eigenen Spieleravatar stumm.</German>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user