Fixed ambiance sounds module.

This commit is contained in:
Glowbal 2015-02-19 18:40:40 +01:00
parent bfc748fbbe
commit 1ea35548e0
2 changed files with 9 additions and 9 deletions

View File

@ -11,7 +11,7 @@ class CfgVehicles {
displayName = "Ambiance Sounds [ACE]";
icon = QUOTE(PATHTOF(data\moduleSound.paa));
category = "ACE_missionModules";
function = QUOTE(FUNC(moduleAmbianceSound);
function = QUOTE(FUNC(moduleAmbianceSound));
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
@ -57,7 +57,7 @@ class CfgVehicles {
displayName = "Volume";
description = "The volume of the sounds played";
typeName = "NUMBER";
defaultValue = 0;
defaultValue = 1;
};
};
class ModuleDescription {

View File

@ -38,7 +38,7 @@ if (_activated && local _logic) then {
_nilCheckPassedList = "";
{
_x = [_x] call EFUNC(common,removeWhiteSpace);
_x = [_x] call EFUNC(common,string_removeWhiteSpace);
_splittedList set [_foreachIndex, _x];
}foreach _splittedList;
@ -61,21 +61,22 @@ if (_activated && local _logic) then {
}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;
_logic = _args select 0;
_minDelayBetweensounds = _args select 4;
_maxDelayBetweenSounds = _args select 5;
_lastTimePlayed = _args select 8;
if (!alive _logic) exitwith {
[(_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;
_minimalDistance = _args select 2;
_maximalDistance = _args select 3;
_minDelayBetweensounds = _args select 4;
_maxDelayBetweenSounds = _args select 5;
_volume = _args select 6;
_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 ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then {
playSound3D [_ambianceSounds select (round(random((count _ambianceSounds)-1))), ObjNull, false, _newPos, _volume, 1, 1000];
_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;