mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixed ambiance sounds module.
This commit is contained in:
parent
bfc748fbbe
commit
1ea35548e0
@ -11,7 +11,7 @@ class CfgVehicles {
|
|||||||
displayName = "Ambiance Sounds [ACE]";
|
displayName = "Ambiance Sounds [ACE]";
|
||||||
icon = QUOTE(PATHTOF(data\moduleSound.paa));
|
icon = QUOTE(PATHTOF(data\moduleSound.paa));
|
||||||
category = "ACE_missionModules";
|
category = "ACE_missionModules";
|
||||||
function = QUOTE(FUNC(moduleAmbianceSound);
|
function = QUOTE(FUNC(moduleAmbianceSound));
|
||||||
functionPriority = 1;
|
functionPriority = 1;
|
||||||
isGlobal = 1;
|
isGlobal = 1;
|
||||||
isTriggerActivated = 0;
|
isTriggerActivated = 0;
|
||||||
@ -57,7 +57,7 @@ class CfgVehicles {
|
|||||||
displayName = "Volume";
|
displayName = "Volume";
|
||||||
description = "The volume of the sounds played";
|
description = "The volume of the sounds played";
|
||||||
typeName = "NUMBER";
|
typeName = "NUMBER";
|
||||||
defaultValue = 0;
|
defaultValue = 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class ModuleDescription {
|
class ModuleDescription {
|
||||||
|
@ -38,7 +38,7 @@ if (_activated && local _logic) then {
|
|||||||
|
|
||||||
_nilCheckPassedList = "";
|
_nilCheckPassedList = "";
|
||||||
{
|
{
|
||||||
_x = [_x] call EFUNC(common,removeWhiteSpace);
|
_x = [_x] call EFUNC(common,string_removeWhiteSpace);
|
||||||
_splittedList set [_foreachIndex, _x];
|
_splittedList set [_foreachIndex, _x];
|
||||||
}foreach _splittedList;
|
}foreach _splittedList;
|
||||||
|
|
||||||
@ -61,21 +61,22 @@ if (_activated && local _logic) then {
|
|||||||
}foreach _ambianceSounds;
|
}foreach _ambianceSounds;
|
||||||
|
|
||||||
[{
|
[{
|
||||||
private ["_args", "_logic", "_ambianceSounds", "_minimalDistance", "_maximalDistance", "_minDelayBetweensounds", "_maxDelayBetweenSounds", "_volume", "_followPlayers","_lastTimePlayed", "_newPos"]
|
private ["_args", "_logic", "_ambianceSounds", "_minimalDistance", "_maximalDistance", "_minDelayBetweensounds", "_maxDelayBetweenSounds", "_volume", "_followPlayers","_lastTimePlayed", "_newPos"];
|
||||||
_args = _this select 0;
|
_args = _this select 0;
|
||||||
_logic = _args select 0;
|
_logic = _args select 0;
|
||||||
|
_minDelayBetweensounds = _args select 4;
|
||||||
|
_maxDelayBetweenSounds = _args select 5;
|
||||||
_lastTimePlayed = _args select 8;
|
_lastTimePlayed = _args select 8;
|
||||||
|
|
||||||
if (!alive _logic) exitwith {
|
if (!alive _logic) exitwith {
|
||||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_lastTimePlayed - time >= ((_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds)) then {
|
if (time - _lastTimePlayed >= ((_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds)) then {
|
||||||
_ambianceSounds = _args select 1;
|
_ambianceSounds = _args select 1;
|
||||||
_minimalDistance = _args select 2;
|
_minimalDistance = _args select 2;
|
||||||
_maximalDistance = _args select 3;
|
_maximalDistance = _args select 3;
|
||||||
_minDelayBetweensounds = _args select 4;
|
|
||||||
_maxDelayBetweenSounds = _args select 5;
|
|
||||||
_volume = _args select 6;
|
_volume = _args select 6;
|
||||||
_followPlayers = _args select 7;
|
_followPlayers = _args select 7;
|
||||||
|
|
||||||
@ -111,13 +112,12 @@ if (_activated && local _logic) then {
|
|||||||
|
|
||||||
// If no unit is to close to this position, we will play the sound.
|
// If no unit is to close to this position, we will play the sound.
|
||||||
if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then {
|
if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then {
|
||||||
|
|
||||||
playSound3D [_ambianceSounds select (round(random((count _ambianceSounds)-1))), ObjNull, false, _newPos, _volume, 1, 1000];
|
playSound3D [_ambianceSounds select (round(random((count _ambianceSounds)-1))), ObjNull, false, _newPos, _volume, 1, 1000];
|
||||||
_args set [8, time];
|
_args set [8, time];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}, 0.1, [_logic, _ambianceSounds, _minimalDistance, _maximalDistance, _minDelayBetweensounds, _maxDelayBetweenSounds, _volume, _followPlayers, time] ] call CBA_fnc_addPerFrameHandler;
|
}, 0.1, [_logic, _ambianceSounds, _minimalDistance, _maximalDistance, _minDelayBetweensounds, _maxDelayBetweenSounds, _volume, _followPlayers, time] ] call cba_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
true;
|
true;
|
||||||
|
Loading…
Reference in New Issue
Block a user