Browse Source

Add empty sound handling, remove systemChats, remove sound from trench

m3ales 4 years ago
parent
commit
eb03916330

+ 15 - 8
addons - Copy/RD501_Main/functions/fired_deployable/fnc_fired_deployable_deployServer.sqf

@@ -20,8 +20,10 @@ if(isNil "_deployable" || _deployable isEqualTo "") exitWith {
 };
 
 _config = configFile >> "CfgVehicles" >> _deployable;
+private _hasLoopSound = isText (_config >> "rd501_fired_deployable_loopSound");
 private _loopSound = getText (_config >> "rd501_fired_deployable_loopSound");
 private _loopDuration = getNumber (_config >> "rd501_fired_deployable_loopDuration");
+private _hasEndSound = isText (_config >> "rd501_fired_deployable_endSound");
 private _endSound = getText (_config >> "rd501_fired_deployable_endSound");
 private _endDuration = getNumber (_config >> "rd501_fired_deployable_endDuration");
 private _soundDistance = getNumber (_config >> "rd501_fired_deployable_soundDistance");
@@ -40,13 +42,18 @@ if(_timeToLive > 0) then {
 		_timeToLive
 	] call CBA_fnc_waitAndExecute;
 
-	[
-		{
-			params["_deployed", "_endSound", "_endDuration", "_distance"];
-			["rd501_fired_deployable_soundEnd", [_deployed, _endSound, _endDuration, _distance]] call CBA_fnc_globalEvent;
-		},
-		[_deployed, _endSound, _endDuration, _soundDistance],
-		(_timeToLive - _endDuration)
-	] call CBA_fnc_waitAndExecute;
+	if(_hasEndSound && !isNil _endSound && _endSound != "") then {
+		[
+			{
+				params["_deployed", "_endSound", "_endDuration", "_distance"];
+				["rd501_fired_deployable_soundEnd", [_deployed, _endSound, _endDuration, _distance]] call CBA_fnc_globalEvent;
+			},
+			[_deployed, _endSound, _endDuration, _soundDistance],
+			(_timeToLive - _endDuration)
+		] call CBA_fnc_waitAndExecute;
+	};
+};
+
+if(_hasLoopSound && !isNil _loopSound && _loopSound != "") then {
 	["rd501_fired_deployable_soundLoop", [_deployed, _loopSound, _loopDuration, _timeToLive, _soundDistance]] call CBA_fnc_globalEvent;
 };

+ 2 - 2
addons - Copy/RD501_Main/functions/fired_deployable/fnc_fired_deployable_endSoundLocal.sqf

@@ -6,12 +6,12 @@ if(!hasInterface) exitWith {
 };
 
 if(isNil "_object" || !alive _object) exitWith {
-	systemChat "No target object to play remote sound";
+	diag_log "No target object to play remote sound";
 };
 
 private _currentLoopSource = _object getVariable ["rd501_fired_deployable_loopSoundSource", objNull];
 if(!(isNil "_currentLoopSource") && !(_currentLoopSource isEqualTo objNull)) then {
-	systemChat "Current Loop Source Exists, Deleting";
+	diag_log "Current Loop Source Exists, Deleting";
 	deleteVehicle _currentLoopSource;
 	_object setVariable ["rd501_fired_deployable_loopSoundSource", objNull, false];
 };

+ 2 - 2
addons - Copy/RD501_Main/functions/fired_deployable/fnc_fired_deployable_loopSoundLocal.sqf

@@ -10,7 +10,7 @@ if(isNil "_object" || !alive _object) exitWith {
 };
 
 private _currentSource = _object getVariable ["rd501_fired_deployable_loopSoundSource", objNull];
-systemChat str _currentSource;
+
 if(!(isNil "_currentSource") && !(_currentSource isEqualTo objNull)) exitWith {
 	diag_log "Source already exists, removing";
 	detach _currentSource;
@@ -31,7 +31,7 @@ for "_i" from 0 to _repeats step 1 do {
 	[
 		{
 			params["_currentSource", "_loopSound", "_distance", "_last"];
-			if(isNil "_currentSource" || !alive _currentSource) exitWith { systemChat "No Source, Exiting." };
+			if(isNil "_currentSource" || !alive _currentSource) exitWith { diag_log "No Source, Exiting." };
 			[_currentSource, player] say3D [_loopSound, _distance, 1, false];
 			if(_last) then {
 				diag_log "Last Loop, Deleting";

+ 0 - 10
addons - Copy/RD501_Vehicles/static/shields/config.cpp

@@ -79,11 +79,6 @@ class CfgVehicles
 		displayName="Trench Shield";
 		model="\RD501_Vehicles\static\shields\trench\trench.p3d";
 		icon="iconObject_1x1";
-		rd501_fired_deployable_loopSound = "rd501_squad_shield_loop";
-		rd501_fired_deployable_loopDuration = 14;
-		rd501_fired_deployable_endSound = "rd501_squad_shield_end";
-		rd501_fired_deployable_endDuration = 1;
-		rd501_fired_deployable_soundDistance = 150;
 		vehicleClass = macro_editor_vehicle_type(statics)
 		editorCategory =  macro_editor_cat(statics)
 		editorSubcategory = macro_editor_cat(static_msc)
@@ -107,11 +102,6 @@ class CfgVehicles
 		displayName="Trench Shield";
 		model="\RD501_Vehicles\static\shields\bubble\deka_shield.p3d";
 		icon="iconObject_1x1";
-		rd501_fired_deployable_loopSound = "rd501_squad_shield_loop";
-		rd501_fired_deployable_loopDuration = 14;
-		rd501_fired_deployable_endSound = "rd501_squad_shield_end";
-		rd501_fired_deployable_endDuration = 1;
-		rd501_fired_deployable_soundDistance = 200;
 		vehicleClass = macro_editor_vehicle_type(statics)
 		editorCategory =  macro_editor_cat(statics)
 		editorSubcategory = macro_editor_cat(static_msc)