2015-01-16 23:21:47 +00:00
|
|
|
/**
|
|
|
|
* fn_setHearingCapability.sqf
|
|
|
|
* @Descr: Handle set volume calls. Will use the lowest available volume setting.
|
|
|
|
* @Author: Glowbal
|
|
|
|
*
|
|
|
|
* @Arguments: [id STRING, settings NUMBER, add BOOL (Optional. True will add, false will remove. Default value is true)]
|
|
|
|
* @Return: nil
|
|
|
|
* @PublicAPI: true
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
private ["_id", "_settings", "_add", "_exists", "_map", "_lowestVolume"];
|
|
|
|
_id = _this select 0;
|
|
|
|
_settings = _this select 1;
|
|
|
|
_add = true;
|
|
|
|
if (count _this > 2) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
_add = _this select 2;
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]];
|
|
|
|
|
|
|
|
_exists = false;
|
|
|
|
{
|
2015-01-18 19:09:19 +00:00
|
|
|
if (_id == _x select 0) exitWith {
|
|
|
|
_exists = true;
|
|
|
|
if (_add) then {
|
|
|
|
_x set [1, _settings];
|
|
|
|
} else {
|
|
|
|
_map set [_forEachIndex, 0];
|
|
|
|
_map = _map - [0];
|
|
|
|
};
|
|
|
|
};
|
2015-01-16 23:21:47 +00:00
|
|
|
} forEach _map;
|
|
|
|
|
|
|
|
if (!_exists && _add) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
_map pushBack [_id, _settings];
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map];
|
|
|
|
|
|
|
|
// find lowest volume
|
|
|
|
_lowestVolume = 1;
|
|
|
|
{
|
2015-01-18 19:09:19 +00:00
|
|
|
_lowestVolume = (_x select 1) min _lowestVolume;
|
2015-01-16 23:21:47 +00:00
|
|
|
} forEach _map;
|
|
|
|
|
|
|
|
// in game sounds
|
|
|
|
0 fadeSound _lowestVolume;
|
|
|
|
0 fadeRadio _lowestVolume;
|
|
|
|
0 fadeMusic _lowestVolume;
|
|
|
|
|
|
|
|
// Set Radio mod variables.
|
|
|
|
player setVariable ["tf_globalVolume", _lowestVolume];
|
|
|
|
player setVariable ["acre_sys_core_globalVolume", _lowestVolume];
|