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

Racked radio speakers #481

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions addons/ace_interact/fnc_radioChildrenActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ if (!(_radio in ACRE_EXTERNALLY_USED_PERSONAL_RADIOS)) then {
_action = [QGVAR(makeActive), localize LSTRING(setAsActive), "", {[(_this select 2) select 0] call EFUNC(api,setCurrentRadio)}, {!((_this select 2) select 1)}, {}, [_radio, _active]] call ace_interact_menu_fnc_createAction;
_actions pushBack [_action, [], _target];

// Loudspeakers
if (_radio in ACRE_ACCESSIBLE_RACK_RADIOS) then {
if ([_radio, "isExternalAudio"] call EFUNC(sys_data,dataEvent)) then {
_action = ["acre_loudspeaker", localize ELSTRING(sys_rack,turnOffSpeaker), "", {[((_this select 2) select 0), false] call EFUNC(sys_rack,activateRackSpeaker)}, {true}, {}, _params] call ace_interact_menu_fnc_createAction;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QGVAR?

} else {
_action = ["acre_loudspeaker", localize ELSTRING(sys_rack,turnOnSpeaker), "", {[((_this select 2) select 0), true] call EFUNC(sys_rack,activateRackSpeaker)}, {true}, {}, _params] call ace_interact_menu_fnc_createAction;
};

_actions pushBack [_action, [], _target];
};

// External radios. Show only options to share/stop sharing the radio if you are the actual owner and not an external user.
if (!(_radio in ACRE_ACTIVE_EXTERNAL_RADIOS || _radio in ACRE_HEARABLE_RACK_RADIOS)) then {
_action = [QGVAR(shareRadio), localize ELSTRING(sys_external,shareRadio), "", {[(_this select 2) select 0, true] call EFUNC(sys_external,allowExternalUse)}, {!([(_this select 2) select 0] call EFUNC(sys_external,isRadioShared))}, {}, _params] call ace_interact_menu_fnc_createAction;
Expand Down
7 changes: 4 additions & 3 deletions addons/api/fnc_addRackToVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
* 4: Base classname of the mounted radio (Without ID). Empty string for no radio <STRING> (default: "")
* 7: Components <ARRAY> (default: [])
* 8: Connected intercoms <ARRAY> (default: [])
* 9: Speaker position <ARRAY> (default: [0,0,0])
* 2: Force initialisation <BOOL> (default: false)
* 3: Condition called with argument "_unit". If a longer function is given, it should be precompiled. <CODE> (default: {})
*
* Return Value:
* Rack added successfully <BOOL>
*
* Example:
* [cursorTarget, ["ACRE_VRC103", "Upper Dash", "Dash", false, ["external"], [], "ACRE_PRC117F", [], ["intercom_1"]], false] call acre_api_fnc_addRackToVehicle
* [cursorTarget, ["ACRE_VRC103", "Upper Dash", "Dash", false, ["external"], [], "ACRE_PRC117F", [], ["intercom_1"], [-1.0, 2.0, 0.0]]] call acre_api_fnc_addRackToVehicle
*
* Public: Yes
*/
Expand Down Expand Up @@ -67,7 +68,7 @@ if (count _rackConfiguration != 9) exitWith {
false
};

_rackConfiguration params [["_rackClassname", ""], ["_rackName", ""], ["_rackShortName", ""], ["_isRadioRemovable", false], ["_allowed", ["inside"]], ["_disabled", []], ["_mountedRadio", ""], ["_defaultComponents", []], ["_intercoms", []]];
_rackConfiguration params [["_rackClassname", ""], ["_rackName", ""], ["_rackShortName", ""], ["_isRadioRemovable", false], ["_allowed", ["inside"]], ["_disabled", []], ["_mountedRadio", ""], ["_defaultComponents", []], ["_intercoms", []], ["_speakerPosition", [0, 0, 0]]];

if (_rackClassname isEqualTo "") exitWith {
WARNING_1("No rack specified for vehicle %1",_vehicle);
Expand Down Expand Up @@ -134,7 +135,7 @@ private _selectPlayer = {
_vehicle setVariable [QEGVAR(sys_rack,initPlayer), _player, true];
};

[QEGVAR(sys_rack,addVehicleRacks), [_vehicle, _rackClassname, _rackName, _rackShortName, _isRadioRemovable, _allowed, _disabled, _mountedRadio, _defaultComponents, _intercoms], _player] call CBA_fnc_targetEvent;
[QEGVAR(sys_rack,addVehicleRacks), [_vehicle, _rackClassname, _rackName, _rackShortName, _isRadioRemovable, _allowed, _disabled, _mountedRadio, _defaultComponents, _intercoms, _speakerPosition], _player] call CBA_fnc_targetEvent;
}, [_selectPlayer, _condition, _vehicle, _rackClassname, _rackName, _rackShortName, _isRadioRemovable, _allowed, _disabled, _mountedRadio, _defaultComponents, _intercoms]] call CBA_fnc_waitUntilAndExecute;

true
3 changes: 2 additions & 1 deletion addons/sys_prc117f/fnc_initializeRadio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ HASH_SET(_radioData,"volume",1);
HASH_SET(_radioData,"currentChannel",0);
HASH_SET(_radioData,"radioOn", 1);
HASH_SET(_radioData,"pressedButton", -1);
HASH_SET(_radioData,"powerSource", "BAT");
HASH_SET(_radioData,"powerSource","BAT");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our macro definition has spaces #define HASH_SET(hash, key, val)
To be consistent, I suggest:

Suggested change
HASH_SET(_radioData,"powerSource","BAT");
HASH_SET(_radioData," volume", 1);
HASH_SET(_radioData," currentChannel", 0);
HASH_SET(_radioData," radioOn", 1);
HASH_SET(_radioData," pressedButton", -1);
HASH_SET(_radioData," powerSource", "BAT");
HASH_SET(_radioData," pgm_pa_mode", "ON");
HASH_SET(_radioData," audioPath", "HEADSET");

HASH_SET(_radioData,"pgm_pa_mode", "ON");
HASH_SET(_radioData,"audioPath","HEADSET");
18 changes: 17 additions & 1 deletion addons/sys_prc117f/radio/fnc_getExternalAudioPosition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,20 @@
* Public: No
*/

[0,0,0]
params ["_radioId", "_event", "_eventData", "_radioData"];

private _obj = [_radioId] call EFUNC(sys_radio,getRadioObject);
private _pos = getPosASL _obj;

private _rackId = [_radioId] call EFUNC(sys_rack,getRackFromRadio);
if (_rackId isEqualTo "") then {
_pos = [0,0,0];
} else {
private _vehicle = [_radioId] call EFUNC(sys_rack,getVehicleFromRack);
private _position = [_rackId, _vehicle] call EFUNC(sys_rack,getRackPosition);
if !(_position isEqualTo [0, 0, 0]) then {
_pos = ATLtoASL (_vehicle modelToWorld _position);
};
};

_pos
4 changes: 3 additions & 1 deletion addons/sys_prc117f/radio/fnc_isExternalAudio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@
* Public: No
*/

false
params ["_radioId", "_event", "_eventData", "_radioData"];

(HASH_GET(_radioData, "audioPath") == "RACKSPEAKER")
14 changes: 12 additions & 2 deletions addons/sys_prc148/radio/fnc_getExternalAudioPosition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@ params ["_radioId", "_event", "_eventData", "_radioData"];

private _obj = [_radioId] call EFUNC(sys_radio,getRadioObject);
private _pos = getPosASL _obj;
if (_obj isKindOf "Man") then {
_pos = ATLtoASL (_obj modelToWorld (_obj selectionPosition "RightShoulder"));

private _rackId = [_radioId] call EFUNC(sys_rack,getRackFromRadio);
if (_rackId isEqualTo "") then {
if (_obj isKindOf "Man") then {
_pos = ATLtoASL (_obj modelToWorld (_obj selectionPosition "RightShoulder"));
};
} else {
private _vehicle = [_radioId] call EFUNC(sys_rack,getVehicleFromRack);
private _position = [_rackId, _vehicle] call EFUNC(sys_rack,getRackPosition);
if !(_position isEqualTo [0, 0, 0]) then {
_pos = ATLtoASL (_vehicle modelToWorld _position);
};
};

_pos;
2 changes: 1 addition & 1 deletion addons/sys_prc148/radio/fnc_isExternalAudio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

params ["_radioId", "_event", "_eventData", "_radioData"];

(HASH_GET(_radioData, "audioPath") == "INTAUDIO")
(HASH_GET(_radioData, "audioPath") in ["INTAUDIO", "RACKSPEAKER"])
2 changes: 1 addition & 1 deletion addons/sys_prc152/fnc_initializeRadio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ for "_i" from 0 to (count _channels)-1 do {
HASH_SET(_radioData,"volume",1);
HASH_SET(_radioData,"currentChannel",0);
HASH_SET(_radioData,"radioOn",1);
HASH_SET(_radioData,"audioPath", "TOPAUDIO");
HASH_SET(_radioData,"audioPath","TOPAUDIO");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above:

Suggested change
HASH_SET(_radioData,"audioPath","TOPAUDIO");
HASH_SET(_radioData, "volume", 1);
HASH_SET(_radioData, "currentChannel", 0);
HASH_SET(_radioData, "radioOn", 1);
HASH_SET(_radioData, "audioPath", "TOPAUDIO");
HASH_SET(_radioData, "powerSource", "BAT");

HASH_SET(_radioData,"powerSource","BAT");
14 changes: 12 additions & 2 deletions addons/sys_prc152/radio/fnc_getExternalAudioPosition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@ params ["_radioId", "_event", "_eventData", "_radioData"];

private _obj = [_radioId] call EFUNC(sys_radio,getRadioObject);
private _pos = getPosASL _obj;
if (_obj isKindOf "Man") then {
_pos = ATLtoASL (_obj modelToWorld (_obj selectionPosition "RightShoulder"));

private _rackId = [_radioId] call EFUNC(sys_rack,getRackFromRadio);
if (_rackId isEqualTo "") then {
if (_obj isKindOf "Man") then {
_pos = ATLtoASL (_obj modelToWorld (_obj selectionPosition "RightShoulder"));
};
} else {
private _vehicle = [_radioId] call EFUNC(sys_rack,getVehicleFromRack);
private _position = [_rackId, _vehicle] call EFUNC(sys_rack,getRackPosition);
if !(_position isEqualTo [0, 0, 0]) then {
_pos = ATLtoASL (_vehicle modelToWorld _position);
};
};

_pos;
2 changes: 1 addition & 1 deletion addons/sys_prc152/radio/fnc_isExternalAudio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

params ["_radioId", "_event", "_eventData", "_radioData"];

(HASH_GET(_radioData, "audioPath") == "INTAUDIO")
(HASH_GET(_radioData, "audioPath") in ["INTAUDIO", "RACKSPEAKER"])
18 changes: 17 additions & 1 deletion addons/sys_prc77/radio/fnc_getExternalAudioPosition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,20 @@
* Public: No
*/

[0,0,0];
params ["_radioId", "_event", "_eventData", "_radioData"];

private _obj = [_radioId] call EFUNC(sys_radio,getRadioObject);
private _pos = getPosASL _obj;

private _rackId = [_radioId] call EFUNC(sys_rack,getRackFromRadio);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all same for all radios, with just 2 cases based on handheld or rack radio. An outside function with arguments for that would probably be a good idea.

if (_rackId isEqualTo "") then {
_pos = [0,0,0];
} else {
private _vehicle = [_radioId] call EFUNC(sys_rack,getVehicleFromRack);
private _position = [_rackId, _vehicle] call EFUNC(sys_rack,getRackPosition);
if !(_position isEqualTo [0, 0, 0]) then {
_pos = ATLtoASL (_vehicle modelToWorld _position);
};
};

_pos
7 changes: 4 additions & 3 deletions addons/sys_prc77/radio/fnc_initializeRadio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@ HASH_SET(_radioData,"radioOn",1); //0 - OFF, 1 - ON
HASH_SET(_radioData,"band",_band); //{0,1}
HASH_SET(_radioData,"currentPreset",[ARR_2(_knobPositions,_secondPresetKnobPositions)]); //Array of Presetarrays (KnobPositions)
HASH_SET(_radioData,"currentChannel",_knobPositions);
HASH_SET(_radioData,"powerSource", "BAT");
HASH_SET(_radioData,"powerSource","BAT");
HASH_SET(_radioData,"audioPath","HEADSET");

//Common Channel Settings
HASH_SET(_radioData,"frequencyTX",_frequencyTx);
HASH_SET(_radioData,"frequencyRX",_frequencyTx);
HASH_SET(_radioData,"power",3500);
HASH_SET(_radioData,"mode","singleChannel");
HASH_SET(_radioData,"CTCSSTx", 150);
HASH_SET(_radioData,"CTCSSRx", 150);
HASH_SET(_radioData,"CTCSSTx",150);
HASH_SET(_radioData,"CTCSSRx",150);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

HASH_SET(_radioData,"modulation","FM");
HASH_SET(_radioData,"encryption",0);
HASH_SET(_radioData,"TEK","");
Expand Down
4 changes: 3 additions & 1 deletion addons/sys_prc77/radio/fnc_isExternalAudio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@
* Public: No
*/

false;
params ["_radioId", "_event", "_eventData", "_radioData"];

(HASH_GET(_radioData, "audioPath") == "RACKSPEAKER")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for outer parentheses.

1 change: 1 addition & 0 deletions addons/sys_rack/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PREP(rackListChildrenActions);

PREP(onReturnRackId);
PREP(onReturnRadioId);
PREP(activateRackSpeaker);
PREP(addRack);
PREP(addRackOnReturn);
PREP(initVehicle);
Expand Down
4 changes: 2 additions & 2 deletions addons/sys_rack/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ if (vehicle acre_player != acre_player) then {
}] call CBA_fnc_addEventHandler;

[QGVAR(addVehicleRacks), {
params ["_vehicle", "_rackClassname", "_displayName", "_rackName", "_rackShortName", "_isRadioRemovable", "_allowed", "_disabled", "_mountedRadio", "_components", "_intercoms"];
params ["_vehicle", "_rackClassname", "_displayName", "_rackName", "_rackShortName", "_isRadioRemovable", "_allowed", "_disabled", "_mountedRadio", "_components", "_intercoms", "_speakerPosition"];

[_vehicle, _rackClassname, _displayName, _rackName, _rackShortName, _isRadioRemovable, _allowed, _disabled, _mountedRadio, _components, _intercoms] call FUNC(addRack);
[_vehicle, _rackClassname, _displayName, _rackName, _rackShortName, _isRadioRemovable, _allowed, _disabled, _mountedRadio, _components, _intercoms, _speakerPosition] call FUNC(addRack);

// Give some time for the racks to initialise properly
[{
Expand Down
24 changes: 24 additions & 0 deletions addons/sys_rack/fnc_activateRackSpeaker.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "script_component.hpp"
/*
* Author: ACRE2Team
* Sets the mounted radio external audio to ON/OFF.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Toggles the mounted radio external audio.
Maybe rename the function accordingly as well.

*
* Arguments:
* 0: Radio Unique ID <STRING>
* 1: External audio on/off <BOOL>
* 1: Rack Unique ID <STRING><OPTIONAL>
*
* Return Value:
* None
*
* Example:
* ["ACRE_PRC152_ID_1", true] call acre_sys_rack_fnc_activateRackSpeaker
*
* Public: No
*/

params ["_radioId", "_active", ["_rackId",""]];

// TODO: For version 2.7. Implement check if rack has an external speaker
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do it!? :D


[_radioId, "setState", ["audioPath", "RACKSPEAKER"]] call EFUNC(sys_data,dataEvent);
4 changes: 2 additions & 2 deletions addons/sys_rack/fnc_addRack.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
* Public: No
*/

params ["_vehicle", "_rackClassname", "_rackName", "_rackShortName", ["_isRadioRemovable", true], ["_allowed", ["inside"]], ["_disabled", []], ["_mountedRadio",""], ["_defaultComponents", []], ["_intercoms",[]]];
params ["_vehicle", "_rackClassname", "_rackName", "_rackShortName", ["_isRadioRemovable", true], ["_allowed", ["inside"]], ["_disabled", []], ["_mountedRadio",""], ["_defaultComponents", []], ["_intercoms",[]], ["_rackPosition", [0, 0, 0]]];

private _queue = _vehicle getVariable [QGVAR(queue), []];

_queue pushBack [_rackClassname, _rackName, _rackShortName, _isRadioRemovable, _allowed, _disabled, _mountedRadio, _defaultComponents, _intercoms];
_queue pushBack [_rackClassname, _rackName, _rackShortName, _isRadioRemovable, _allowed, _disabled, _mountedRadio, _defaultComponents, _intercoms, _rackPosition];
_vehicle setVariable [QGVAR(queue), _queue];

// Request RACK ID
Expand Down
12 changes: 11 additions & 1 deletion addons/sys_rack/fnc_initVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ if (!_initialized) then {
WARNING_2("Rack short name %1 is longer than 4 characters for vehicle %2",_shortName,_vehicle);
};

[_vehicle, _componentName, _displayName, _shortName, _isRadioRemovable, _allowed, _disabled, _mountedRadio, _components, _intercoms] call FUNC(addRack);
// Speaker
private _positionConfig = _x >> "rackPosition";
private _speakerPosition = [0, 0, 0]; // Default to main action point
if (isText _positionConfig) then {
_speakerPosition = _vehicle selectionPosition (getText _positionConfig); // Convert to coordinates for sys_core intercomPFH checks
};
if (isArray _positionConfig) then {
_speakerPosition = getArray _positionConfig;
};

[_vehicle, _componentName, _displayName, _shortName, _isRadioRemovable, _allowed, _disabled, _mountedRadio, _components, _intercoms, _positionConfig] call FUNC(addRack);
} forEach (configProperties [_racks, "isClass _x", true]);

_vehicle setVariable [QGVAR(initialized), true, true];
Expand Down
5 changes: 3 additions & 2 deletions addons/sys_rack/fnc_initializeRack.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
* None
*
* Example:
* ["ACRE_VRC110_ID_1","initializeRack",["ACRE_VRC110_ID_1","Dash",true,["inside"],[["cargo", 1],["ffv", [2]]],false,[],vehicle1],(acre_sys_data_radioData getVariable "ACRE_VRC110_ID_1")] call acre_sys_rack_fnc_initializeRack
* ["ACRE_VRC110_ID_1","initializeRack",["ACRE_VRC110_ID_1","Dash",true,["inside"],[["cargo", 1],["ffv", [2]]],false,[],[0,0,0],vehicle1],(acre_sys_data_radioData getVariable "ACRE_VRC110_ID_1")] call acre_sys_rack_fnc_initializeRack
*
* Public: No
*/

params ["_rackId", "", "_eventData", "_rackData"];
_eventData params ["_componentName", "_displayName", "_shortName", "_isRadioRemovable", "_allowed", "_disabled", "_mountedRadio", "_defaultComponents", "_intercoms", "_vehicle"];
_eventData params ["_componentName", "_displayName", "_shortName", "_isRadioRemovable", "_allowed", "_disabled", "_mountedRadio", "_defaultComponents", "_intercoms", "_rackPosition", "_vehicle"];


HASH_SET(_rackData,"name",_displayName);
Expand All @@ -29,6 +29,7 @@ HASH_SET(_rackData,"disabled",_disabled);
HASH_SET(_rackData,"mountedRadio",_mountedRadio);
HASH_SET(_rackData,"isRadioRemovable",_isRadioRemovable);
HASH_SET(_rackData,"wiredIntercoms",_intercoms);
HASH_SET(_rackData,"rackPosition",_rackPosition);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above:

Suggested change
HASH_SET(_rackData,"rackPosition",_rackPosition);
HASH_SET(_rackData, "name", _displayName);
HASH_SET(_rackData, "shortName", _shortName);
HASH_SET(_rackData, "allowed", _allowed);
HASH_SET(_rackData, "disabled", _disabled);
HASH_SET(_rackData, "mountedRadio", _mountedRadio);
HASH_SET(_rackData, "isRadioRemovable", _isRadioRemovable);
HASH_SET(_rackData, "wiredIntercoms", _intercoms);
HASH_SET(_rackData, "rackPosition", _rackPosition);
HASH_SET(_rackData, "vehicle", _vehicle);

HASH_SET(_rackData,"vehicle",_vehicle);

//Only run on server as initializeRack is called globally.
Expand Down
1 change: 1 addition & 0 deletions addons/sys_rack/sem90/fnc_sem90UnmountRadio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ private _radioId = _eventData;

//Enable VAA Mode.
[_radioId, "setState", ["powerSource", "BAT"]] call EFUNC(sys_data,dataEvent);
[_radioId, "setState", ["audioPath", "HEADSET"]] call EFUNC(sys_data,dataEvent);
6 changes: 6 additions & 0 deletions addons/sys_rack/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,11 @@
<Spanish>Dejar de usar todas</Spanish>
<French>Arrêter de tout utiliser</French>
</Key>
<Key ID="STR_ACRE_sys_rack_turnOnSpeaker">
<English>Turn On Speaker</English>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does maybe Speaker On and Speaker Off fit better with the rest of action naming? (I am not sure.)

</Key>
<Key ID="STR_ACRE_sys_rack_turnOffSpeaker">
<English>Turn Off Speaker</English>
</Key>
</Package>
</Project>
1 change: 1 addition & 0 deletions addons/sys_rack/vrc103/fnc_vrc103UnmountRadio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ private _radioId = _eventData;

//Enable VAA Mode.
[_radioId, "setState", ["powerSource", "BAT"]] call EFUNC(sys_data,dataEvent);
[_radioId, "setState", ["audioPath", "HEADSET"]] call EFUNC(sys_data,dataEvent);
6 changes: 6 additions & 0 deletions addons/sys_rack/vrc110/fnc_vrc110UnmountRadio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ private _radioId = _eventData;

// Switch back to battery mode.
[_radioId, "setState", ["powerSource", "BAT"]] call EFUNC(sys_data,dataEvent);

private _audioPath = [_radioId, "getState", "audioPath"] call EFUNC(sys_data,dataEvent);

if (_audioPath == "RACKSPEAKER") then {
[_radioId, "setState", ["audioPath", "TOPAUDIO"]] call EFUNC(sys_data,dataEvent);
};
6 changes: 6 additions & 0 deletions addons/sys_rack/vrc111/fnc_vrc111UnmountRadio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ private _radioId = _eventData;

// Switch back to battery mode.
[_radioId, "setState", ["powerSource", "BAT"]] call EFUNC(sys_data,dataEvent);

private _audioPath = [_radioId, "getState", "audioPath"] call EFUNC(sys_data,dataEvent);

if (_audioPath == "RACKSPEAKER") then {
[_radioId, "setState", ["audioPath", "TOPAUDIO"]] call EFUNC(sys_data,dataEvent);
};
1 change: 1 addition & 0 deletions addons/sys_rack/vrc64/fnc_vrc64UnmountRadio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ private _radioId = _eventData;

//Enable VAA Mode.
[_radioId, "setState", ["powerSource", "BAT"]] call EFUNC(sys_data,dataEvent);
[_radioId, "setState", ["audioPath", "HEADSET"]] call EFUNC(sys_data,dataEvent);
14 changes: 12 additions & 2 deletions addons/sys_sem52sl/radio/fnc_getExternalAudioPosition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,18 @@ params ["_radioId", "_event", "_eventData", "_radioData"];

private _obj = [_radioId] call EFUNC(sys_radio,getRadioObject);
private _pos = getPosASL _obj;
if (_obj isKindOf "Man") then {
_pos = ATLtoASL (_obj modelToWorldVisual (_obj selectionPosition "RightShoulder"));

private _rackId = [_radioId] call EFUNC(sys_rack,getRackFromRadio);
if (_rackId isEqualTo "") then {
if (_obj isKindOf "Man") then {
_pos = ATLtoASL (_obj modelToWorld (_obj selectionPosition "RightShoulder"));
};
} else {
private _vehicle = [_radioId] call EFUNC(sys_rack,getVehicleFromRack);
private _position = [_rackId, _vehicle] call EFUNC(sys_rack,getRackPosition);
if !(_position isEqualTo [0, 0, 0]) then {
_pos = ATLtoASL (_vehicle modelToWorld _position);
};
};

_pos;
2 changes: 1 addition & 1 deletion addons/sys_sem52sl/radio/fnc_initializeRadio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ HASH_SET(_radioData,"channelKnobPosition", 2); // Channel 1 (after on/off option
HASH_SET(_radioData,"volumeKnobPosition", 0);// mid-way
HASH_SET(_radioData,"programmingStep", 0);
HASH_SET(_radioData,"lastActiveChannel",0);
HASH_SET(_radioData,"audioPath", "HEADSET");
HASH_SET(_radioData,"audioPath","HEADSET");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
HASH_SET(_radioData,"audioPath","HEADSET");
HASH_SET(_radioData, "volume", 1);
HASH_SET(_radioData, "radioOn", 1);
HASH_SET(_radioData, "currentChannel", 0);
HASH_SET(_radioData, "channelKnobPosition", 2); // Channel 1 (after on/off options)
HASH_SET(_radioData, "volumeKnobPosition", 0);// mid-way
HASH_SET(_radioData, "programmingStep", 0);
HASH_SET(_radioData, "lastActiveChannel", 0);
HASH_SET(_radioData, "audioPath", "HEADSET");

2 changes: 1 addition & 1 deletion addons/sys_sem52sl/radio/fnc_isExternalAudio.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@

params ["_radioId", "_event", "_eventData", "_radioData"];

(HASH_GET(_radioData, "audioPath") == "INTSPEAKER")
(HASH_GET(_radioData, "audioPath") in ["INTSPEAKER", "RACKSPEAKER"])
Loading