Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CBA setting for noRadio #5571

Merged
merged 3 commits into from
Nov 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/noradio/CfgEventhandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};
29 changes: 0 additions & 29 deletions addons/noradio/XEH_postInit.sqf

This file was deleted.

38 changes: 38 additions & 0 deletions addons/noradio/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions addons/noradio/stringtable.xml
Original file line number Diff line number Diff line change
@@ -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>