Skip to content

Commit

Permalink
Preserve PTT assignments after using remote voice radios
Browse files Browse the repository at this point in the history
Previously, PTT customization would be reset after using a remote controlled AI's radios.
  • Loading branch information
mrschick committed Nov 29, 2023
1 parent 68995eb commit 4c54e78
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
7 changes: 6 additions & 1 deletion addons/api/fnc_getMultiPushToTalkAssignment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@

//Emulate behaviour of the handleMultiPttKeyPress algorithm

private _radioLists = [+ ACRE_ASSIGNED_PTT_RADIOS, [] call EFUNC(sys_data,getPlayerRadioList)] call EFUNC(sys_data,sortRadioList);
private _radioLists = [];

if (acre_player isEqualTo player) then { // using zeus player voice
_radioLists = [+ ACRE_ASSIGNED_PTT_RADIOS, [] call EFUNC(sys_data,getPlayerRadioList)] call EFUNC(sys_data,sortRadioList);
} else { // using zeus remote voice
_radioLists = [+ ACRE_ASSIGNED_PTT_RADIOS_REMOTE, [] call EFUNC(sys_data,getPlayerRadioList)] call EFUNC(sys_data,sortRadioList);
};

private _returnValue = (_radioLists select 1);

Expand Down
6 changes: 5 additions & 1 deletion addons/api/fnc_setMultiPushToTalkAssignment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ private _index = _var findIf {

if (_index != -1) exitWith { false };

ACRE_ASSIGNED_PTT_RADIOS = _var;
if (acre_player isEqualTo player) then { // using zeus player voice
ACRE_ASSIGNED_PTT_RADIOS = _var;
} else { // using zeus remote voice
ACRE_ASSIGNED_PTT_RADIOS_REMOTE = _var;
};

true
1 change: 1 addition & 0 deletions addons/sys_core/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ DVAR(ACRE_LISTENER_DIVE) = 0;

DVAR(ACRE_PTT_RELEASE_DELAY) = 0.2;
DVAR(ACRE_ASSIGNED_PTT_RADIOS) = [];
DVAR(ACRE_ASSIGNED_PTT_RADIOS_REMOTE) = [];
GVAR(delayReleasePTT_Handle) = nil;

DVAR(ACRE_ACTIVE_PTTKEY) = -2;
Expand Down
16 changes: 11 additions & 5 deletions addons/sys_core/fnc_handleMultiPttKeyPress.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,17 @@ if (ACRE_ACTIVE_PTTKEY == -2) then {
private _radioList = [] call EFUNC(sys_data,getPlayerRadioList);
if (ACRE_ACTIVE_PTTKEY <= (count _radioList) - 1) then {
if ((count ACRE_ASSIGNED_PTT_RADIOS) > 0) then {
private _sortList = [ACRE_ASSIGNED_PTT_RADIOS, _radioList] call EFUNC(sys_data,sortRadioList);
// This will handle cleanup automatically too
ACRE_ASSIGNED_PTT_RADIOS = _sortList select 0;
_radioList = _sortList select 1;

if (acre_player isEqualTo player) then { // using zeus player voice
private _sortList = [ACRE_ASSIGNED_PTT_RADIOS, _radioList] call EFUNC(sys_data,sortRadioList);
// This will handle cleanup automatically too
ACRE_ASSIGNED_PTT_RADIOS = _sortList select 0;
_radioList = _sortList select 1;
} else {
private _sortList = [ACRE_ASSIGNED_PTT_RADIOS_REMOTE, _radioList] call EFUNC(sys_data,sortRadioList);
// This will handle cleanup automatically too
ACRE_ASSIGNED_PTT_RADIOS_REMOTE = _sortList select 0;
_radioList = _sortList select 1;
};
};
_sendRadio = _radioList select ACRE_ACTIVE_PTTKEY;
[_sendRadio] call EFUNC(sys_radio,setActiveRadio);
Expand Down

0 comments on commit 4c54e78

Please sign in to comment.