diff --git a/addons/shootingrange/CfgVehicles.hpp b/addons/shootingrange/CfgVehicles.hpp index 2363958f..b99b2441 100644 --- a/addons/shootingrange/CfgVehicles.hpp +++ b/addons/shootingrange/CfgVehicles.hpp @@ -35,6 +35,12 @@ class CfgVehicles { typeName = "STRING"; defaultValue = ""; }; + class SoundSources { + displayName = CSTRING(SoundSources); + description = CSTRING(SoundSourcesDesc); + typeName = "STRING"; + defaultValue = ""; + }; class Mode { displayName = CSTRING(Mode); description = CSTRING(ModeDesc); diff --git a/addons/shootingrange/XEH_PREP.hpp b/addons/shootingrange/XEH_PREP.hpp index 678b1e81..aea0af0b 100644 --- a/addons/shootingrange/XEH_PREP.hpp +++ b/addons/shootingrange/XEH_PREP.hpp @@ -11,6 +11,7 @@ PREP(create); PREP(handleHitPart); PREP(moduleInit); PREP(notifyVicinity); +PREP(playSoundSignal); PREP(popupPFH); PREP(popupPFHexit); PREP(setConfigCountdownTime); diff --git a/addons/shootingrange/functions/fnc_create.sqf b/addons/shootingrange/functions/fnc_create.sqf index ffdb4508..93f5ab39 100644 --- a/addons/shootingrange/functions/fnc_create.sqf +++ b/addons/shootingrange/functions/fnc_create.sqf @@ -16,6 +16,7 @@ * 10: Trigger Markers (default: []) * 11: Pop on Trigger Exit (default: true) * 12: Invalid Targets (default: []) + * 13: Sound Sources (default: []) * * Return Value: * None @@ -42,7 +43,8 @@ params [ ["_defaultCountdownTime", COUNTDOWNTIME_DEFAULT, [0] ], ["_triggerMarkers", [], [[]] ], ["_popOnTriggerExit", POPONTRIGGEREXIT_DEFAULT, [true] ], - ["_targetsInvalid", [], [[]] ] + ["_targetsInvalid", [], [[]] ], + ["_soundSources", [], [[]] ] ]; // Verify data @@ -130,6 +132,7 @@ _countdownTimes sort true; if (_x getVariable [QGVAR(mode), 0] == 0) then { _x setVariable [QGVAR(mode), _mode, true]; }; + _x setVariable [QGVAR(soundSources), _controllers + _soundSources]; // Main private _actionRange = [ diff --git a/addons/shootingrange/functions/fnc_handleHitPart.sqf b/addons/shootingrange/functions/fnc_handleHitPart.sqf index 4b7815e0..074d3e77 100644 --- a/addons/shootingrange/functions/fnc_handleHitPart.sqf +++ b/addons/shootingrange/functions/fnc_handleHitPart.sqf @@ -59,7 +59,7 @@ if (_shooter != _starter) exitWith { }; -[_controller, "Beep_Target", 25] call CBA_fnc_globalSay3d; +[_controller, "Beep_Target"] call FUNC(playSoundSignal); // Mark target as already hit _target setVariable [QGVAR(alreadyHit), true]; diff --git a/addons/shootingrange/functions/fnc_moduleInit.sqf b/addons/shootingrange/functions/fnc_moduleInit.sqf index ee908be2..7777cea3 100644 --- a/addons/shootingrange/functions/fnc_moduleInit.sqf +++ b/addons/shootingrange/functions/fnc_moduleInit.sqf @@ -37,6 +37,9 @@ _targetsInvalid = _targetsInvalid apply { [missionNamespace getVariable _x, objN // Exctract controller objects private _controllers = [_logic getVariable "Controllers", true, true] call ACE_Common_fnc_parseList; +// Exctract sound source objects +private _soundSources = [_logic getVariable "SoundSources", true, true] call ACE_Common_fnc_parseList; + // Extract target change event private _mode = _logic getVariable "Mode"; @@ -88,6 +91,6 @@ private _popOnTriggerExit = _logic getVariable "PopOnTriggerExit"; // Prepare with actions -[_name, _targets, _controllers, _mode, _durations, _defaultDuration, _targetAmounts, _defaultTargetAmount, _pauseDurations, _defaultPauseDuration, _countdownTimes, _defaultCountdownTime, _triggerMarkers, _popOnTriggerExit, _targetsInvalid] call FUNC(create); +[_name, _targets, _controllers, _mode, _durations, _defaultDuration, _targetAmounts, _defaultTargetAmount, _pauseDurations, _defaultPauseDuration, _countdownTimes, _defaultCountdownTime, _triggerMarkers, _popOnTriggerExit, _targetsInvalid, _soundSources] call FUNC(create); ACE_LOGINFO("Shooting Range Module Initialized"); diff --git a/addons/shootingrange/functions/fnc_playSoundSignal.sqf b/addons/shootingrange/functions/fnc_playSoundSignal.sqf new file mode 100644 index 00000000..1c0b50a6 --- /dev/null +++ b/addons/shootingrange/functions/fnc_playSoundSignal.sqf @@ -0,0 +1,26 @@ +/* + * Author: Jonpas + * Plays sound signal on all controllers and extra sound sources. + * + * Arguments: + * 0: Controller + * 1: Sound Classname (CfgSound) + * 2: Range (default: 25) + * + * Return Value: + * None + * + * Example: + * [controller, "FD_Timer_F", 25] call tac_shootingrange_fnc_playSoundSignal; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_controller", "_sound", ["_range", 25]]; + +private _soundSources = _controller getVariable [QGVAR(soundSources), []]; + +{ + [_x, _sound, _range] call CBA_fnc_globalSay3d; +} forEach _soundSources; diff --git a/addons/shootingrange/functions/fnc_start.sqf b/addons/shootingrange/functions/fnc_start.sqf index dbe7ff3f..f7f21991 100644 --- a/addons/shootingrange/functions/fnc_start.sqf +++ b/addons/shootingrange/functions/fnc_start.sqf @@ -124,7 +124,7 @@ if (_mode > 1) then { // Countdown timer notification [_textCountdown] call ACE_Common_fnc_displayTextStructured; - [_controller, "FD_Timer_F", 25] call CBA_fnc_globalSay3d; + [_controller, "FD_Timer_F"] call FUNC(playSoundSignal); }, [_controller, _textCountdown], _execTime] call ACE_Common_fnc_waitAndExecute; @@ -139,7 +139,7 @@ if (_mode > 1) then { // Final countdown notification [localize LSTRING(Go)] call ACE_Common_fnc_displayTextStructured; - [_controller, "FD_Start_F", 25] call CBA_fnc_globalSay3d; + [_controller, "FD_Start_F"] call FUNC(playSoundSignal); // Notify supervisor(s) (closer than start/stop notifications) private _playerName = [ACE_player, true] call ACE_Common_fnc_getName; diff --git a/addons/shootingrange/functions/fnc_stop.sqf b/addons/shootingrange/functions/fnc_stop.sqf index d51eddbb..0b6793f3 100644 --- a/addons/shootingrange/functions/fnc_stop.sqf +++ b/addons/shootingrange/functions/fnc_stop.sqf @@ -40,7 +40,7 @@ params ["_controller", "_controllers", "_name", "_targets", "_targetsInvalid", [ // Notification private _playerName = [ACE_player, true] call ACE_Common_fnc_getName; -[_controller, "FD_Finish_F", 25] call CBA_fnc_globalSay3d; +[_controller, "FD_Finish_F"] call FUNC(playSoundSignal); if (_success) then { // Check for zero divisor diff --git a/addons/shootingrange/stringtable.xml b/addons/shootingrange/stringtable.xml index 76fcc53a..8397a516 100644 --- a/addons/shootingrange/stringtable.xml +++ b/addons/shootingrange/stringtable.xml @@ -39,6 +39,12 @@ List of object names used as controllers, separated by commas. Liste der Objektnamen, die als Regler genutzt werden. Durch Kommas trennen. + + Sound Sources + + + List of object names used as sound sources (in addition to controllers), separated by commas. + Mode Modus