Skip to content

Commit e29480d

Browse files
authored
Core - Use fnc_getDescriptiveName for all ACE Action Names (IDI-Systems#1372)
1 parent 755807e commit e29480d

8 files changed

+64
-33
lines changed

addons/ace_interact/stringtable.xml

+11-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<German>%1 Kanal: %2</German>
2424
<Japanese>%1 チャンネル: %2</Japanese>
2525
<Czech>%1 Chn: %2</Czech>
26-
<Italian>%1 Chn: %2</Italian>
26+
<Italian>%1 Canale: %2</Italian>
2727
<French>%1 Canal: %2</French>
2828
<Korean>%1 채널: %2</Korean>
2929
<Polish>%1 Kanał: %2</Polish>
@@ -33,6 +33,16 @@
3333
<Portuguese>%1 Cnl: %2</Portuguese>
3434
<Turkish>%1 Kanal:%2</Turkish>
3535
</Key>
36+
<Key ID="STR_ACRE_ace_interact_channelBlockShort">
37+
<English>%1 Bk %2 Ch %3</English>
38+
<German>%1 Bk %2 Kn %3</German>
39+
<Italian>%1 Bc %2 Cn %3</Italian>
40+
</Key>
41+
<Key ID="STR_ACRE_ace_interact_channelNetIDShort">
42+
<English>Chn %1 NetID %2</English>
43+
<German>SP %1 FK-Nr %2</German>
44+
<Italian>Cn %1 Rete %2</Italian>
45+
</Key>
3646
<Key ID="STR_ACRE_ace_interact_lowerHeadset">
3747
<English>Lower Headset</English>
3848
<Spanish>Bajar auriculares</Spanish>

addons/sys_core/fnc_getDescriptiveName.sqf

+40-10
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ _radioId = toLower _radioId;
2424
// Get the radio's name
2525
private _name = if (_radioId in ACRE_ACCESSIBLE_RACK_RADIOS || {_radioId in ACRE_HEARABLE_RACK_RADIOS}) then {
2626
private _radioRack = [_radioId] call EFUNC(sys_rack,getRackFromRadio);
27-
private _radioClass = [_radioRack] call EFUNC(sys_rack,getRackBaseClassname);
28-
getText (configFile >> "CfgAcreComponents" >> _radioClass >> "name")
27+
private _rackClass = [_radioRack] call EFUNC(sys_rack,getRackBaseClassname);
28+
getText (configFile >> "CfgAcreComponents" >> _rackClass >> "name")
2929
} else {
3030
// Include the owner's name for external radios
3131
private _owner = if (_radioId in ACRE_ACTIVE_EXTERNAL_RADIOS) then {
@@ -38,15 +38,45 @@ private _name = if (_radioId in ACRE_ACCESSIBLE_RACK_RADIOS || {_radioId in ACRE
3838
};
3939

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

43-
private _text = if (isNil "_maxChannels") then {
44-
// Display frequency for single-channel radios (e.g. AN/PRC-77)
45-
private _txData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,dataEvent);
46-
private _currentFreq = HASH_GET(_txData,"frequencyTX");
47-
format ["%1 %2 MHz", _name, _currentFreq];
48-
} else {
49-
format [LELSTRING(ace_interact,channelShort), _name, _radioId call EFUNC(api,getRadioChannel)]
43+
private _text = switch (_radioClass) do {
44+
case "ACRE_PRC77": {
45+
// Display frequency for single-channel radios (e.g. AN/PRC-77)
46+
private _txData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,dataEvent);
47+
private _currentFreq = HASH_GET(_txData,"frequencyTX");
48+
format ["%1 %2 MHz", _name, [_currentFreq, 1, 2] call CBA_fnc_formatNumber]
49+
};
50+
case "ACRE_PRC343": {
51+
private _channelRaw = [_radioId, "getCurrentChannel"] call EFUNC(sys_data,dataEvent);
52+
private _block = floor (_channelRaw / 16) + 1;
53+
private _channel = (_channelRaw % 16) + 1;
54+
format [LELSTRING(ace_interact,channelBlockShort), _name, _block, _channel]
55+
};
56+
case "ACRE_SEM52SL": {
57+
private _channel = _radioId call EFUNC(api,getRadioChannel);
58+
_channel = switch (_channel) do {
59+
case 13: { "H" };
60+
case 14: { "P" };
61+
default { _channel };
62+
};
63+
format [LELSTRING(ace_interact,channelShort), _name, _channel]
64+
};
65+
case "ACRE_SEM70": {
66+
private _hashData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,dataEvent);
67+
private _description = if (HASH_GET(_hashData,"mode") == "singleChannel") then {
68+
// HW (Manual Channel) Mode
69+
format ["%1 MHz", [HASH_GET(_hashData,"frequencyTX"), 1, 3] call CBA_fnc_formatNumber]
70+
} else {
71+
// AKW (Automatic Channel) Mode
72+
private _channelNumber = [_radioId, "getCurrentChannel"] call EFUNC(sys_data,dataEvent);
73+
format [LELSTRING(ace_interact,channelNetIDShort), (_channelNumber), HASH_GET(_hashData,"networkID")]
74+
};
75+
format ["%1 %2", _name, _description]
76+
};
77+
default {
78+
format [LELSTRING(ace_interact,channelShort), _name, _radioId call EFUNC(api,getRadioChannel)]
79+
};
5080
};
5181

5282
// Display radio keys in front of those which are bound

addons/sys_external/fnc_listChildrenActions.sqf

+1-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ private _ownSharedRadios = [acre_player] call FUNC(getSharedExternalRadios);
4343

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

5149
if ([_x, acre_player] call FUNC(checkListChildrenActions)) then {

addons/sys_gsa/fnc_connectChildrenActions.sqf

+1-11
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,7 @@ private _actions = [];
3131
private _baseRadio = [_x] call EFUNC(api,getBaseRadio);
3232
private _item = configFile >> "CfgWeapons" >> _baseRadio;
3333

34-
private "_displayName";
35-
if (_x in ACRE_ACCESSIBLE_RACK_RADIOS || {_x in ACRE_HEARABLE_RACK_RADIOS}) then {
36-
private _radioRack = [_x] call EFUNC(sys_rack,getRackFromRadio);
37-
private _radioClass = [_radioRack] call EFUNC(sys_rack,getRackBaseClassname);
38-
_displayName = getText (configFile >> "CfgAcreComponents" >> _radioClass >> "name");
39-
} else {
40-
_displayName = format ["%1%2", getText (_item >> "displayName"), _owner];
41-
};
42-
43-
private _currentChannel = [_x] call EFUNC(api,getRadioChannel);
44-
_displayName = format [localize ELSTRING(ace_interact,channelShort), _displayName, _currentChannel];
34+
private _displayName = [_x] call EFUNC(sys_core,getDescriptiveName);
4535
private _picture = getText (_item >> "picture");
4636

4737
private _action = [

addons/sys_prc77/radio/fnc_getChannelDescription.sqf

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* 4: Remote <BOOL> (Unused)
1212
*
1313
* Return Value:
14-
* Description of the channel in the form "Block x - Channel y" <STRING>
14+
* Description of the channel in the form "Frequency: x.y MHz" <STRING>
1515
*
1616
* Example:
1717
* ["ACRE_PRC77_ID_1", "getChannelDescription", [], [], false] call acre_sys_prc77_fnc_getChannelDescription
@@ -23,6 +23,6 @@ params ["_radioId", "", "", "", ""];
2323

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

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

2828
_description

addons/sys_rack/fnc_generateMountableRadioActions.sqf

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ _radioList = [_rackClassName, _radioList] call FUNC(getMountableRadios);
2828
{
2929
private _baseRadio = [_x] call EFUNC(api,getBaseRadio);
3030
private _item = configFile >> "CfgWeapons" >> _baseRadio;
31-
private _displayName = getText (_item >> "displayName");
31+
private _displayName = [_x] call EFUNC(sys_core,getDescriptiveName);
3232
private _currentChannel = [_x] call EFUNC(api,getRadioChannel);
33-
_displayName = format [localize ELSTRING(ace_interact,channelShort), _displayName, _currentChannel];
3433
private _picture = getText (_item >> "picture");
3534
//private _isActive = _x isEqualTo _currentRadio;
3635

addons/sys_sem52sl/radio/fnc_getChannelDescription.sqf

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040

4141
params ["_radioId", "", "", ""];
4242

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

4650
_description

addons/sys_sem70/radio/fnc_getChannelDescription.sqf

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ private _hashData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,data
4545
private _description = "";
4646
if (_manualChannel isEqualTo 1) then {
4747
//private _hashData = [_radioId, "getCurrentChannelData"] call EFUNC(sys_data,dataEvent);
48-
_description = format["Frequency: %1 MHz", HASH_GET(_hashData,"frequencyTX")];
48+
_description = format["Frequency: %1 MHz", [HASH_GET(_hashData,"frequencyTX"), 1, 3] call CBA_fnc_formatNumber];
4949
} else {
5050
private _channelNumber = [_radioId, "getCurrentChannel"] call EFUNC(sys_data,dataEvent);
51-
_description = format["Channel %1 -- Network ID %2", ([(_channelNumber), 1] call CBA_fnc_formatNumber), HASH_GET(_hashData,"networkID")];
51+
_description = format["Channel %1 -- Network ID %2", (_channelNumber), HASH_GET(_hashData,"networkID")];
5252
};
5353

5454
_description

0 commit comments

Comments
 (0)