-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Radio - Add radio item replacement CBA Setting (#1283)
Co-authored-by: PabstMirror <[email protected]> Co-authored-by: jonpas <[email protected]> Co-authored-by: Freddo3000 <[email protected]>
- Loading branch information
1 parent
c3f289a
commit 5178ef6
Showing
14 changed files
with
114 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
#define true 1 | ||
#define false 0 | ||
// WIP concept | ||
class CfgAcreAPI { | ||
class RadioAPIFunctions { | ||
class setChannel { | ||
required = true; | ||
required = 1; | ||
}; | ||
class setVolume { | ||
required = true; | ||
required = 1; | ||
}; | ||
class setTransmitPower { | ||
required = false; | ||
required = 0; | ||
defaultFunction = QFUNC(api_setTransmitPower); | ||
}; | ||
class toggleOnOff { | ||
required = false; | ||
required = 0; | ||
defaultFunction = QFUNC(api_toggleOnOffState); | ||
}; | ||
class getOnOffState { | ||
required = false; | ||
required = 0; | ||
defaultFunction = QFUNC(api_getOnOffState); | ||
}; | ||
class getVolume { | ||
required = true; | ||
required = 1; | ||
}; | ||
class getChannel { | ||
required = true; | ||
required = 1; | ||
}; | ||
class getTransmitPower { | ||
required = true; | ||
required = 1; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: ACRE2Team | ||
* Returns all radios defined in CfgAcreRadios. Caches result for future calls. | ||
* | ||
* Arguments: | ||
* None | ||
* | ||
* Return Value: | ||
* 0: Radio Class Names <ARRAY> | ||
* 1: Radio Display Names <ARRAY> | ||
* | ||
* Example: | ||
* [] call acre_sys_core_fnc_getAllRadios; | ||
* | ||
* Public: No | ||
*/ | ||
|
||
// Return cached if already ran | ||
if (!isNil QGVAR(allRadios)) exitWith { | ||
GVAR(allRadios) | ||
}; | ||
|
||
// Compile and cache for later calls | ||
private _classes = []; | ||
private _names = []; | ||
{ | ||
private _isRadio = getNumber (_x >> "type") == ACRE_COMPONENT_RADIO; | ||
private _hasComponents = getArray (_x >> "defaultComponents") isNotEqualTo []; // Only non-base classes have that | ||
private _name = getText (_x >> "name"); | ||
|
||
// Has name and isAcre, assume valid radio class | ||
if (_isRadio && {_hasComponents} && {_name != ""}) then { | ||
_classes pushBack (configName _x); | ||
_names pushBack _name; | ||
}; | ||
} forEach ("true" configClasses (configFile >> "CfgAcreComponents")); | ||
|
||
GVAR(allRadios) = [_classes, _names]; | ||
GVAR(allRadios) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
QGVAR(defaultRadio), | ||
"LIST", | ||
[LLSTRING(DefaultRadio_DisplayName), LLSTRING(DefaultRadio_Description)], | ||
"ACRE2", | ||
[ | ||
[""] + (GVAR(defaultRadios) select 0), | ||
[localize "str_a3_cfgglasses_none0"] + (GVAR(defaultRadios) select 1), | ||
((GVAR(defaultRadios) select 0) find "ACRE_PRC343") + 1 | ||
], | ||
true | ||
] call CBA_fnc_addSetting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters