diff --git a/addons/minedetector/ACE_detector.hpp b/addons/minedetector/ACE_detector.hpp index 9dbc3835aa..62067cbbce 100644 --- a/addons/minedetector/ACE_detector.hpp +++ b/addons/minedetector/ACE_detector.hpp @@ -5,7 +5,7 @@ class ACE_detector { class ACE_VMM3 { radius = 2.5; // sounds[] = {"ace_sweep_high", "ace_sweep_low"}; - sounds[] = {"ace_buzz_2", "ace_buzz_1"}; + sounds[] = {"ace_detector_1", "ace_detector_2", "ace_detector_3", "ace_detector_4"}; }; class ACE_VMH3: ACE_VMM3 { }; diff --git a/addons/minedetector/CfgSounds.hpp b/addons/minedetector/CfgSounds.hpp index 2ad60a437b..ff2e5604e5 100644 --- a/addons/minedetector/CfgSounds.hpp +++ b/addons/minedetector/CfgSounds.hpp @@ -10,13 +10,40 @@ class CfgSounds { titles[] = {}; }; class ace_buzz_1 { - name = "ace_buzz_1"; - sound[] = {QUOTE(PATHTOF(sounds\buzz_1.ogg)), "db+1", 1}; + name = "buzz_2"; + sound[] = {QUOTE(PATHTOF(sounds\buzz_2.ogg)), "db+0.5", 0.5}; titles[] = {}; }; class ace_buzz_2 { name = "ace_buzz_2"; + sound[] = {QUOTE(PATHTOF(sounds\buzz_2.ogg)), "db+0.76", 0.7}; + titles[] = {}; + }; + class ace_buzz_3 { + name = "ace_buzz_3"; sound[] = {QUOTE(PATHTOF(sounds\buzz_2.ogg)), "db+1", 1}; titles[] = {}; }; + + + class ace_detector_1 { + name = "ace_detector_1"; + sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 1}; + titles[] = {}; + }; + class ace_detector_2 { + name = "ace_detector_2"; + sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 0.9}; + titles[] = {}; + }; + class ace_detector_3 { + name = "ace_detector_3"; + sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 0.8}; + titles[] = {}; + }; + class ace_detector_4 { + name = "ace_detector_4"; + sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 0.7}; + titles[] = {}; + }; }; diff --git a/addons/minedetector/XEH_clientInit.sqf b/addons/minedetector/XEH_clientInit.sqf index ff868766cb..7b4c76ef1f 100644 --- a/addons/minedetector/XEH_clientInit.sqf +++ b/addons/minedetector/XEH_clientInit.sqf @@ -8,7 +8,7 @@ private _helperObject = "ACE_LogicDummy" createVehicleLocal (getPos _unit); _unit setvariable [QGVAR(helperLogic), _helperObject]; - [FUNC(detectorLoop), 0.05, [_unit, _type, _config, ACE_time, _helperObject]] call CBA_fnc_addPerFrameHandler; + [FUNC(detectorLoop), 0.01, [_unit, _type, _config, ACE_time, _helperObject]] call CBA_fnc_addPerFrameHandler; }] call EFUNC(common,addEventhandler); ["minedetector_disabled", { diff --git a/addons/minedetector/functions/fnc_detectorLoop.sqf b/addons/minedetector/functions/fnc_detectorLoop.sqf index e1b817cc1c..a195718122 100644 --- a/addons/minedetector/functions/fnc_detectorLoop.sqf +++ b/addons/minedetector/functions/fnc_detectorLoop.sqf @@ -35,10 +35,31 @@ if !([_unit, _type] call FUNC(isDetectorEnabled)) exitwith { if (ACE_player == _unit && {currentWeapon _unit == _type}) then { private _detected = [_unit, _detectorConfig] call FUNC(getDetectedObject); _detected params ["_hasDetected", "_object", "_distance"]; - if (_hasDetected && (ACE_time - _lastPlayed > 0.9)) then { + private _distanceTiming = switch (true) do { + case (_distance >= 2): {1}; + case (_distance >= 1.25): {0.85}; + case (_distance >= 0.75): {0.7}; + default {0.5}; + }; + if (_hasDetected && (ACE_time - _lastPlayed > _distanceTiming)) then { _args set [3, ACE_time]; _detectorConfig params ["_type", "_radius", "_detectableTypes", "_sounds"]; - private _sound = _sounds select (_distance >= 1.2); + private _sound = switch (true) do { + case (_distance >= 2): {_sounds select 3}; + case (_distance >= 1.25): {_sounds select 2}; + case (_distance >= 0.5): {_sounds select 1}; + default {_sounds select 0}; + }; + + if ((_distance >= 1.2)) then { + if (_distance >= 2) then { + _sounds select 2; + } else { + _sounds select 1; + }; + } else { + _sounds select 0; + }; [_unit, _sound, true] call FUNC(playDetectorSound); }; }; diff --git a/addons/minedetector/functions/fnc_playDetectorSound.sqf b/addons/minedetector/functions/fnc_playDetectorSound.sqf index 973e51628a..f030886bcc 100644 --- a/addons/minedetector/functions/fnc_playDetectorSound.sqf +++ b/addons/minedetector/functions/fnc_playDetectorSound.sqf @@ -25,6 +25,11 @@ if (!alive _unit) exitwith { }; private _helperObject = _unit getvariable [QGVAR(helperLogic), objNull]; +if (!isNull _helperObject) then { + deleteVehicle _helperObject; +}; +_helperObject = "ACE_LogicDummy" createVehicleLocal (getPos _unit); + if !(isNull _helperObject) then { _helperObject attachto [_unit,[0,0,-3],""]; [_helperObject, _unit] say3D _detectorSound; diff --git a/addons/minedetector/sounds/metal_detector.wav b/addons/minedetector/sounds/metal_detector.wav new file mode 100644 index 0000000000..0e4076725f Binary files /dev/null and b/addons/minedetector/sounds/metal_detector.wav differ