fnc_fired_deployable_endSoundLocal.sqf 967 B

12345678910111213141516171819202122232425262728293031
  1. params["_object", "_endSound", "_endDuration", "_distance"];
  2. if(!hasInterface) exitWith {
  3. diag_log "No Interface to play sounds from";
  4. };
  5. if(isNil "_object" || !alive _object) exitWith {
  6. diag_log "No target object to play remote sound";
  7. };
  8. private _currentLoopSource = _object getVariable ["rd501_fired_deployable_loopSoundSource", objNull];
  9. if(!(isNil "_currentLoopSource") && !(_currentLoopSource isEqualTo objNull)) then {
  10. diag_log "Current Loop Source Exists, Deleting";
  11. deleteVehicle _currentLoopSource;
  12. _object setVariable ["rd501_fired_deployable_loopSoundSource", objNull, false];
  13. };
  14. private _currentSource = "#dynamicsound" createVehicleLocal ASLToAGL getPosWorld _object;
  15. _currentSource attachTo [_object, [0, 0, 0]];
  16. [_currentSource, player] say3D [_endSound, _distance, 1, false];
  17. [
  18. {
  19. params["_currentSource"];
  20. detach _currentSource;
  21. deleteVehicle _currentSource;
  22. },
  23. [_currentSource],
  24. (_endDuration + 1)
  25. ] call CBA_fnc_waitAndExecute;