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

Core - Use fnc_getDescriptiveName for all ACE Action Names #1372

Merged
12 changes: 11 additions & 1 deletion addons/ace_interact/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<German>%1 Kanal: %2</German>
<Japanese>%1 チャンネル: %2</Japanese>
<Czech>%1 Chn: %2</Czech>
<Italian>%1 Chn: %2</Italian>
<Italian>%1 Canale: %2</Italian>
<French>%1 Canal: %2</French>
<Korean>%1 채널: %2</Korean>
<Polish>%1 Kanał: %2</Polish>
Expand All @@ -33,6 +33,16 @@
<Portuguese>%1 Cnl: %2</Portuguese>
<Turkish>%1 Kanal:%2</Turkish>
</Key>
<Key ID="STR_ACRE_ace_interact_channelBlockShort">
<English>%1 Bk %2 Ch %3</English>
<German>%1 Bk %2 Kn %3</German>
<Italian>%1 Bc %2 Cn %3</Italian>
</Key>
<Key ID="STR_ACRE_ace_interact_channelNetIDShort">
<English>Chn %1 NetID %2</English>
<German>SP %1 FK-Nr %2</German>
<Italian>Cn %1 Rete %2</Italian>
</Key>
<Key ID="STR_ACRE_ace_interact_lowerHeadset">
<English>Lower Headset</English>
<Spanish>Bajar auriculares</Spanish>
Expand Down
50 changes: 40 additions & 10 deletions addons/sys_core/fnc_getDescriptiveName.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ _radioId = toLower _radioId;
// Get the radio's name
private _name = if (_radioId in ACRE_ACCESSIBLE_RACK_RADIOS || {_radioId in ACRE_HEARABLE_RACK_RADIOS}) then {
private _radioRack = [_radioId] call EFUNC(sys_rack,getRackFromRadio);
private _radioClass = [_radioRack] call EFUNC(sys_rack,getRackBaseClassname);
getText (configFile >> "CfgAcreComponents" >> _radioClass >> "name")
private _rackClass = [_radioRack] call EFUNC(sys_rack,getRackBaseClassname);
getText (configFile >> "CfgAcreComponents" >> _rackClass >> "name")
} else {
// Include the owner's name for external radios
private _owner = if (_radioId in ACRE_ACTIVE_EXTERNAL_RADIOS) then {
Expand All @@ -38,15 +38,45 @@ private _name = if (_radioId in ACRE_ACCESSIBLE_RACK_RADIOS || {_radioId in ACRE
};

// Display current radio channel
private _maxChannels = [_radioId, "getState", "channels"] call EFUNC(sys_data,dataEvent);
private _radioClass = [_radioId] call EFUNC(sys_radio,getRadioBaseClassname);

private _text = if (isNil "_maxChannels") then {
// Display frequency for single-channel radios (e.g. AN/PRC-77)
private _txData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,dataEvent);
private _currentFreq = HASH_GET(_txData,"frequencyTX");
format ["%1 %2 MHz", _name, _currentFreq];
} else {
format [LELSTRING(ace_interact,channelShort), _name, _radioId call EFUNC(api,getRadioChannel)]
private _text = switch (_radioClass) do {
case "ACRE_PRC77": {
// Display frequency for single-channel radios (e.g. AN/PRC-77)
private _txData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,dataEvent);
private _currentFreq = HASH_GET(_txData,"frequencyTX");
format ["%1 %2 MHz", _name, [_currentFreq, 1, 2] call CBA_fnc_formatNumber]
};
case "ACRE_PRC343": {
private _channelRaw = [_radioId, "getCurrentChannel"] call EFUNC(sys_data,dataEvent);
private _block = floor (_channelRaw / 16) + 1;
private _channel = (_channelRaw % 16) + 1;
format [LELSTRING(ace_interact,channelBlockShort), _name, _block, _channel]
};
case "ACRE_SEM52SL": {
private _channel = _radioId call EFUNC(api,getRadioChannel);
_channel = switch (_channel) do {
case 13: { "H" };
case 14: { "P" };
default { _channel };
};
format [LELSTRING(ace_interact,channelShort), _name, _channel]
};
case "ACRE_SEM70": {
private _hashData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,dataEvent);
private _description = if (HASH_GET(_hashData,"mode") == "singleChannel") then {
// HW (Manual Channel) Mode
format ["%1 MHz", [HASH_GET(_hashData,"frequencyTX"), 1, 3] call CBA_fnc_formatNumber]
} else {
// AKW (Automatic Channel) Mode
private _channelNumber = [_radioId, "getCurrentChannel"] call EFUNC(sys_data,dataEvent);
format [LELSTRING(ace_interact,channelNetIDShort), (_channelNumber), HASH_GET(_hashData,"networkID")]
};
format ["%1 %2", _name, _description]
};
default {
format [LELSTRING(ace_interact,channelShort), _name, _radioId call EFUNC(api,getRadioChannel)]
};
};

// Display radio keys in front of those which are bound
Expand Down
4 changes: 1 addition & 3 deletions addons/sys_external/fnc_listChildrenActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ private _ownSharedRadios = [acre_player] call FUNC(getSharedExternalRadios);

private _baseRadio = [_x] call EFUNC(api,getBaseRadio);
private _item = configFile >> "CfgWeapons" >> _baseRadio;
private _displayName = getText (_item >> "displayName") + _owner;
private _currentChannel = [_x] call EFUNC(api,getRadioChannel);
_displayName = format [localize ELSTRING(ace_interact,channelShort), _displayName, _currentChannel];
private _displayName = [_x] call EFUNC(sys_core,getDescriptiveName);
private _picture = getText (_item >> "picture");

if ([_x, acre_player] call FUNC(checkListChildrenActions)) then {
Expand Down
12 changes: 1 addition & 11 deletions addons/sys_gsa/fnc_connectChildrenActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,7 @@ private _actions = [];
private _baseRadio = [_x] call EFUNC(api,getBaseRadio);
private _item = configFile >> "CfgWeapons" >> _baseRadio;

private "_displayName";
if (_x in ACRE_ACCESSIBLE_RACK_RADIOS || {_x in ACRE_HEARABLE_RACK_RADIOS}) then {
private _radioRack = [_x] call EFUNC(sys_rack,getRackFromRadio);
private _radioClass = [_radioRack] call EFUNC(sys_rack,getRackBaseClassname);
_displayName = getText (configFile >> "CfgAcreComponents" >> _radioClass >> "name");
} else {
_displayName = format ["%1%2", getText (_item >> "displayName"), _owner];
};

private _currentChannel = [_x] call EFUNC(api,getRadioChannel);
_displayName = format [localize ELSTRING(ace_interact,channelShort), _displayName, _currentChannel];
private _displayName = [_x] call EFUNC(sys_core,getDescriptiveName);
private _picture = getText (_item >> "picture");

private _action = [
Expand Down
4 changes: 2 additions & 2 deletions addons/sys_prc77/radio/fnc_getChannelDescription.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* 4: Remote <BOOL> (Unused)
*
* Return Value:
* Description of the channel in the form "Block x - Channel y" <STRING>
* Description of the channel in the form "Frequency: x.y MHz" <STRING>
*
* Example:
* ["ACRE_PRC77_ID_1", "getChannelDescription", [], [], false] call acre_sys_prc77_fnc_getChannelDescription
Expand All @@ -23,6 +23,6 @@ params ["_radioId", "", "", "", ""];

private _hashData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,dataEvent);

private _description = format["Frequency: %1 MHz", HASH_GET(_hashData,"frequencyTX")];
private _description = format["Frequency: %1 MHz", [HASH_GET(_hashData,"frequencyTX"), 1, 2] call CBA_fnc_formatNumber];

_description
3 changes: 1 addition & 2 deletions addons/sys_rack/fnc_generateMountableRadioActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ _radioList = [_rackClassName, _radioList] call FUNC(getMountableRadios);
{
private _baseRadio = [_x] call EFUNC(api,getBaseRadio);
private _item = configFile >> "CfgWeapons" >> _baseRadio;
private _displayName = getText (_item >> "displayName");
private _displayName = [_x] call EFUNC(sys_core,getDescriptiveName);
private _currentChannel = [_x] call EFUNC(api,getRadioChannel);
_displayName = format [localize ELSTRING(ace_interact,channelShort), _displayName, _currentChannel];
private _picture = getText (_item >> "picture");
//private _isActive = _x isEqualTo _currentRadio;

Expand Down
8 changes: 6 additions & 2 deletions addons/sys_sem52sl/radio/fnc_getChannelDescription.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@

params ["_radioId", "", "", ""];

private _channelNumber = [_radioId, "getCurrentChannel"] call EFUNC(sys_data,dataEvent);
private _description = format ["Channel %1", ([(_channelNumber+1), 2] call CBA_fnc_formatNumber)];
private _channelNumber = ([_radioId, "getCurrentChannel"] call EFUNC(sys_data,dataEvent)) + 1;
private _description = switch (_channelNumber) do {
case 13: { "Channel H" };
case 14: { "Channel P" };
default { format ["Channel %1", ([_channelNumber, 2] call CBA_fnc_formatNumber)] };
};

_description
4 changes: 2 additions & 2 deletions addons/sys_sem70/radio/fnc_getChannelDescription.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ private _hashData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,data
private _description = "";
if (_manualChannel isEqualTo 1) then {
//private _hashData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,dataEvent);
_description = format["Frequency: %1 MHz", HASH_GET(_hashData,"frequencyTX")];
_description = format["Frequency: %1 MHz", [HASH_GET(_hashData,"frequencyTX"), 1, 3] call CBA_fnc_formatNumber];
} else {
private _channelNumber = [_radioId, "getCurrentChannel"] call EFUNC(sys_data,dataEvent);
_description = format["Channel %1 -- Network ID %2", ([(_channelNumber), 1] call CBA_fnc_formatNumber), HASH_GET(_hashData,"networkID")];
_description = format["Channel %1 -- Network ID %2", (_channelNumber), HASH_GET(_hashData,"networkID")];
};

_description