Skip to content

Commit

Permalink
fix the tfar calls
Browse files Browse the repository at this point in the history
  • Loading branch information
AdlerSalbei committed Sep 4, 2024
1 parent a0c85e5 commit 3e5c7d5
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 74 deletions.
4 changes: 2 additions & 2 deletions addons/screenshotMode/functions/fn_toggleTFAR.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ if (!_tfarEnabled) exitWith {};

if (_newState) then {
TFAR_VolumeHudTransparency = GVAR(tfar);
[] call TFAR_fnc_updateSpeakVolumeUI;
{call TFAR_fnc_updateSpeakVolumeUI} call CBA_fnc_directCall;
} else {
GVAR(tfar) = TFAR_VolumeHudTransparency;
TFAR_VolumeHudTransparency = 1;
[] call TFAR_fnc_updateSpeakVolumeUI;
{call TFAR_fnc_updateSpeakVolumeUI} call CBA_fnc_directCall;
};
101 changes: 55 additions & 46 deletions addons/zeus/XEH_preClientInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,77 +38,86 @@ if (isClass (configFile >> "CfgPatches" >> "tfar_core")) then {
[
"TFAR_event_OnSWchannelSet",
{
if !(isNull (getAssignedCuratorLogic ace_player)) exitWith {};
[{
if !(isNull (getAssignedCuratorLogic ace_player)) exitWith {};

params ["_unit", "_radio", "_channel", "_additional"];
params ["", "_args"];
_args params ["_unit", "_radio", "_channel", "_additional"];

private _frequency = [(call TFAR_fnc_activeSwRadio), (_channel +1)] call TFAR_fnc_getChannelFrequency;
if (_additional) then {
if (_channel isEqualTo (_unit getVariable [QGVAR(channelAdditionalSW), -1])) exitWith {
_unit setVariable [QGVAR(channelAdditionalSW), nil, true];
_unit setVariable [QGVAR(freqAdditionalSW), nil, true];
private _frequency = [(call TFAR_fnc_activeSwRadio), (_channel +1)] call TFAR_fnc_getChannelFrequency;
if (_additional) then {
if (_channel isEqualTo (_unit getVariable [QGVAR(channelAdditionalSW), -1])) exitWith {
_unit setVariable [QGVAR(channelAdditionalSW), nil, true];
_unit setVariable [QGVAR(freqAdditionalSW), nil, true];
};
_unit setVariable [QGVAR(channelAdditionalSW), _channel, true];
_unit setVariable [QGVAR(freqAdditionalSW), _frequency, true];
}else{
_unit setVariable [QGVAR(channelSW), _channel, true];
_unit setVariable [QGVAR(freqSW), _frequency, true];
};
_unit setVariable [QGVAR(channelAdditionalSW), _channel, true];
_unit setVariable [QGVAR(freqAdditionalSW), _frequency, true];
}else{
_unit setVariable [QGVAR(channelSW), _channel, true];
_unit setVariable [QGVAR(freqSW), _frequency, true];
};
}, _this] call CBA_fnc_directCall;
}
] call CBA_fnc_addEventHandler;

[
"TFAR_event_OnLRchannelSet",
{
if !(isNull (getAssignedCuratorLogic ace_player)) exitWith {};
[{
if !(isNull (getAssignedCuratorLogic ace_player)) exitWith {};

params ["_unit", "", "", "_channel", "_additional"];
params ["", "_args"];
_args params ["_unit", "", "", "_channel", "_additional"];

// TFAR_fnc_activeLRRadio has to be called in a non-scheduled environment
private _frequency = {[(call TFAR_fnc_activeLRRadio), (_channel + 1)] call TFAR_fnc_getChannelFrequency; } call CBA_fnc_directCall;
if (_additional) then {
// TFAR_fnc_activeLRRadio has to be called in a non-scheduled environment
private _frequency = {[(call TFAR_fnc_activeLRRadio), (_channel + 1)] call TFAR_fnc_getChannelFrequency; } call CBA_fnc_directCall;
if (_additional) then {

if (_channel isEqualTo (_unit getVariable [QGVAR(freqAdditionalLR), -1])) exitWith {
_unit setVariable [QGVAR(channelAdditionalLR), nil, true];
_unit setVariable [QGVAR(freqAdditionalLR), nil, true];
if (_channel isEqualTo (_unit getVariable [QGVAR(freqAdditionalLR), -1])) exitWith {
_unit setVariable [QGVAR(channelAdditionalLR), nil, true];
_unit setVariable [QGVAR(freqAdditionalLR), nil, true];
};
_unit setVariable [QGVAR(channelAdditionalLR), _channel, true];
_unit setVariable [QGVAR(freqAdditionalLR), _frequency, true];
}else{
_unit setVariable [QGVAR(channelLR), _channel, true];
_unit setVariable [QGVAR(freqLR), _frequency, true];
};
_unit setVariable [QGVAR(channelAdditionalLR), _channel, true];
_unit setVariable [QGVAR(freqAdditionalLR), _frequency, true];
}else{
_unit setVariable [QGVAR(channelLR), _channel, true];
_unit setVariable [QGVAR(freqLR), _frequency, true];
};
}, _this] call CBA_fnc_directCall;
}
] call CBA_fnc_addEventHandler;

[
"TFAR_event_OnFrequencyChanged",
{
if !(isNull (getAssignedCuratorLogic ace_player)) exitWith {};
[{
if !(isNull (getAssignedCuratorLogic ace_player)) exitWith {};

params ["_unit", "_radio", "_channel", "", "_frequency"];
params ["", "_args"];
params ["_unit", "_radio", "_channel", "", "_frequency"];

private _backpackLR = call TFAR_fnc_activeLRRadio;
if (_backpackLR isEqualTo _radio) then {
if (_channel isEqualTo (_unit getVariable [QGVAR(channelLR), -1])) then {
_unit setVariable [QGVAR(freqLR), _frequency, true];
}else{
if (_channel isEqualTo (_unit getVariable [QGVAR(channelAdditionalLR), -1])) then {
_unit setVariable [QGVAR(freqAdditionalLR), _frequency, true];
};
};
}else{
private _loadoutRadio = call TFAR_fnc_activeSwRadio;
if (_loadoutRadio isEqualTo _radio) then {
if (_channel isEqualTo (_unit getVariable [QGVAR(channelSW), -1])) then {
_unit setVariable [QGVAR(freqSW), _frequency, true];
private _backpackLR = call TFAR_fnc_activeLRRadio;
if (_backpackLR isEqualTo _radio) then {
if (_channel isEqualTo (_unit getVariable [QGVAR(channelLR), -1])) then {
_unit setVariable [QGVAR(freqLR), _frequency, true];
}else{
if (_channel isEqualTo (_unit getVariable [QGVAR(channelAdditionalSW), -1])) then {
_unit setVariable [QGVAR(freqAdditionalSW), _frequency, true];
if (_channel isEqualTo (_unit getVariable [QGVAR(channelAdditionalLR), -1])) then {
_unit setVariable [QGVAR(freqAdditionalLR), _frequency, true];
};
};
}else{
private _loadoutRadio = call TFAR_fnc_activeSwRadio;
if (_loadoutRadio isEqualTo _radio) then {
if (_channel isEqualTo (_unit getVariable [QGVAR(channelSW), -1])) then {
_unit setVariable [QGVAR(freqSW), _frequency, true];
}else{
if (_channel isEqualTo (_unit getVariable [QGVAR(channelAdditionalSW), -1])) then {
_unit setVariable [QGVAR(freqAdditionalSW), _frequency, true];
};
};
};
};
};
}, _this] call CBA_fnc_directCall;
}
] call CBA_fnc_addEventHandler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,37 @@ if (isClass (configFile >> "CfgPatches" >> "acre_main")) then {
};

if (isClass (configFile >> "CfgPatches" >> "tfar_core")) then {
private _radioSW = call TFAR_fnc_activeSwRadio;
if (!(isNil "_radioSW") && {!(_radioSW isEqualTo "")} && {(player getVariable [QGVAR(freqSW), -1]) isEqualTo -1}) then {

private _radioChannelSW = _radioSW call TFAR_fnc_getSwChannel;
if (!(isNil "_radioChannelSW") && {!(_radioChannelSW isEqualTo -1)}) then {
player setVariable [QGVAR(channelSW), _radioChannelSW, true];
player setVariable [QGVAR(freqSW), [_radioSW, (_radioChannelSW +1)] call TFAR_fnc_getChannelFrequency, true];
};

private _radioAdditionalChannelSW = _radioSW call TFAR_fnc_getAdditionalSwChannel;
if (!(isNil "_radioAdditionalChannelSW") && {!(_radioAdditionalChannelSW isEqualTo -1)}) then {
player setVariable [QGVAR(channelAdditionalSW), _radioAdditionalChannelSW, true];
player setVariable [QGVAR(freqAdditionalSW), [_radioSW, (_radioAdditionalChannelSW +1)] call TFAR_fnc_getChannelFrequency, true];
{
private _radioSW = call TFAR_fnc_activeSwRadio;
if (!(isNil "_radioSW") && {!(_radioSW isEqualTo "")} && {(player getVariable [QGVAR(freqSW), -1]) isEqualTo -1}) then {

private _radioChannelSW = _radioSW call TFAR_fnc_getSwChannel;
if (!(isNil "_radioChannelSW") && {!(_radioChannelSW isEqualTo -1)}) then {
player setVariable [QGVAR(channelSW), _radioChannelSW, true];
player setVariable [QGVAR(freqSW), [_radioSW, (_radioChannelSW +1)] call TFAR_fnc_getChannelFrequency, true];
};

private _radioAdditionalChannelSW = _radioSW call TFAR_fnc_getAdditionalSwChannel;
if (!(isNil "_radioAdditionalChannelSW") && {!(_radioAdditionalChannelSW isEqualTo -1)}) then {
player setVariable [QGVAR(channelAdditionalSW), _radioAdditionalChannelSW, true];
player setVariable [QGVAR(freqAdditionalSW), [_radioSW, (_radioAdditionalChannelSW +1)] call TFAR_fnc_getChannelFrequency, true];
};
};
};

private _radioLR = call TFAR_fnc_activeLRRadio;
if (!(isNil "_radioLR") && {!(_radioSW isEqualTo "")} && {(player getVariable [QGVAR(freqLR), -1]) isEqualTo -1}) then {
private _radioLR = call TFAR_fnc_activeLRRadio;
if (!(isNil "_radioLR") && {!(_radioSW isEqualTo "")} && {(player getVariable [QGVAR(freqLR), -1]) isEqualTo -1}) then {

private _radioChannelLR = _radioLR call TFAR_fnc_getLrChannel;
if (!(isNil "_radioChannelLR") && {!(_radioChannelLR isEqualTo -1)}) then {
player setVariable [QGVAR(channelLR), _radioChannelLR, true];
player setVariable [QGVAR(freqLR), [_radioLR, (_radioChannelLR +1)] call TFAR_fnc_getChannelFrequency, true];
};
private _radioChannelLR = _radioLR call TFAR_fnc_getLrChannel;
if (!(isNil "_radioChannelLR") && {!(_radioChannelLR isEqualTo -1)}) then {
player setVariable [QGVAR(channelLR), _radioChannelLR, true];
player setVariable [QGVAR(freqLR), [_radioLR, (_radioChannelLR +1)] call TFAR_fnc_getChannelFrequency, true];
};

private _radioAdditionalChannelLR = _radioLR call TFAR_fnc_getAdditionalLrChannel;
if (!(isNil "_radioAdditionalChannelLR") && {!(_radioAdditionalChannelLR isEqualTo -1)}) then {
player setVariable [QGVAR(channelAdditionalLR), _radioAdditionalChannelLR, true];
player setVariable [QGVAR(freqAdditionalLR), [_radioLR, (_radioAdditionalChannelLR +1)] call TFAR_fnc_getChannelFrequency, true];
private _radioAdditionalChannelLR = _radioLR call TFAR_fnc_getAdditionalLrChannel;
if (!(isNil "_radioAdditionalChannelLR") && {!(_radioAdditionalChannelLR isEqualTo -1)}) then {
player setVariable [QGVAR(channelAdditionalLR), _radioAdditionalChannelLR, true];
player setVariable [QGVAR(freqAdditionalLR), [_radioLR, (_radioAdditionalChannelLR +1)] call TFAR_fnc_getChannelFrequency, true];
};
};
};
} call CBA_fnc_directCall;
};

0 comments on commit 3e5c7d5

Please sign in to comment.