2015-09-19 18:55:35 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Handle set volume calls. Will use the lowest available volume setting.
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-19 18:55:35 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: id <STRING>
|
|
|
|
* 1: settings <NUMBER>
|
|
|
|
* 2: add (default: true) <BOOL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: Yes
|
2015-09-20 13:52:40 +00:00
|
|
|
*
|
|
|
|
* Note: uses player
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-19 18:55:35 +00:00
|
|
|
params ["_id", "_settings", ["_add", true]];
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-09-19 18:55:35 +00:00
|
|
|
private ["_map", "_exists", "_lowestVolume"];
|
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-09-19 18:55:35 +00:00
|
|
|
false
|
|
|
|
} count _map;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
// in game sounds
|
|
|
|
0 fadeSound _lowestVolume;
|
|
|
|
0 fadeRadio _lowestVolume;
|
|
|
|
0 fadeMusic _lowestVolume;
|
|
|
|
|
|
|
|
// Set Radio mod variables.
|
|
|
|
player setVariable ["tf_globalVolume", _lowestVolume];
|
2015-04-14 21:58:19 +00:00
|
|
|
if (!isNil "acre_api_fnc_setGlobalVolume") then { [_lowestVolume^0.33] call acre_api_fnc_setGlobalVolume; };
|