Skip to content

Commit

Permalink
Add 'acre_api_fnc_getRadioOnOffState' to accessible method (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerard-sog authored Dec 18, 2024
1 parent a364c00 commit fbf348d
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 88 deletions.
2 changes: 2 additions & 0 deletions addons/api/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class CfgFunctions {
PATHTO_FNC(setRadioVolume);
PATHTO_FNC(getRadioVolume);

PATHTO_FNC(getRadioOnOffState);

PATHTO_FNC(setCurrentRadioChannelNumber);
PATHTO_FNC(getCurrentRadioChannelNumber);

Expand Down
26 changes: 26 additions & 0 deletions addons/api/fnc_getRadioOnOffState.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "script_component.hpp"
/*
* Author: Gerard
* Gets the status (ON/OFF) for the given radio.
*
* Arguments:
* 0: Radio ID <STRING>
*
* Return Value:
* TRUE if radio is ON, False if the radio is OFF <BOOLEAN>
*
* Example:
* ["ACRE_PR77_ID_1"] call acre_api_fnc_getRadioOnOffState
*
* Public: Yes
*/

params ["_radioId"];

if (isNil "_radioId") exitWith { -1 };

if (!([_radioId] call EFUNC(sys_data,isRadioInitialized))) exitWith { -1 };

private _radioOnOffStatus = [_radioId] call EFUNC(sys_radio,getRadioOnOffState);

_radioOnOffStatus
2 changes: 2 additions & 0 deletions addons/sys_radio/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ PREP(onReturnRadioId);
PREP(getRadioVolume);
PREP(setRadioVolume);

PREP(getRadioOnOffState);

PREP(isUniqueRadio);
PREP(isBaseClassRadio);

Expand Down
22 changes: 22 additions & 0 deletions addons/sys_radio/fnc_getRadioOnOffState.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "script_component.hpp"
/*
* Author: Gerard
* Returns the status (ON/OFF) for the given radio.
*
* Arguments:
* 0: Unique Radio ID <STRING>
*
* Return Value:
* TRUE if radio is ON, False if the radio is OFF <BOOLEAN>
*
* Example:
* ["ACRE_PR77_ID_1"] call acre_sys_radio_fnc_getRadioOnOffState
*
* Public: No
*/

params ["_radio"];

private _onOffState = [_radio, "getOnOffState"] call EFUNC(sys_data,dataEvent);

_onOffState
Loading

0 comments on commit fbf348d

Please sign in to comment.