mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
parent
2163e712e5
commit
64384280d0
@ -1,38 +1,43 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
* Plays a sound defined in CfgSounds using playSound3D, with global effect
|
||||
* Plays a sound defined in CfgSounds using playSound3D, with global effect.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Sound class <STRING>
|
||||
* 1: Position ASL <ARRAY>
|
||||
* 2: Volume <NUMBER>
|
||||
* 3: Distance <NUMBER>
|
||||
* 2: Volume <NUMBER> (default: from sound config)
|
||||
* 3: Distance <NUMBER> (default: from sound config)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* ["sound", [0,0,0], 5, 5] call ace_common_fnc_playConfigSound3D
|
||||
* ["hint", getPosASL player, 5, 5] call ace_common_fnc_playConfigSound3D
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
// #define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_soundClass", "_posASL", "_volume", "_distance"];
|
||||
|
||||
private _cfgSound = configFile >> "CfgSounds" >> _soundClass;
|
||||
|
||||
if (!isClass _cfgSound) exitWith {
|
||||
ERROR_1("CfgSounds class [%1] does not exist", _soundClass);
|
||||
private _sound = getArray (configFile >> "CfgSounds" >> _soundClass >> "sound");
|
||||
if (_sound isEqualTo []) exitWith {
|
||||
ERROR_1("CfgSounds class [%1] does not exist or contains empty sound array", _soundClass);
|
||||
};
|
||||
TRACE_2("sound",_soundClass,_sound);
|
||||
|
||||
_sound params ["_fileName", "_cfgVolume", "_pitch", ["_cfgDistance", 0]];
|
||||
|
||||
ISNILS(_volume,_cfgVolume);
|
||||
ISNILS(_distance,_cfgDistance);
|
||||
|
||||
private _args = getArray (_cfgSound >> "sound");
|
||||
TRACE_1("playConfigSound3D args", _args);
|
||||
private _pitch = (_args select 2);
|
||||
// Strip the first \ from the filename
|
||||
private _fileName = _args select 0;
|
||||
_fileName = _fileName select [1, count _fileName - 1];
|
||||
TRACE_1("playConfigSound3D filename", _fileName);
|
||||
_fileName = _fileName select [1];
|
||||
|
||||
// add file extension .wss as default
|
||||
if !(toLower (_fileName select [count _fileName - 4]) in [".wav", ".ogg", ".wss"]) then {
|
||||
ADD(_fileName,".wss");
|
||||
};
|
||||
TRACE_5("vars",_fileName,_posASL,_volume,_pitch,_distance);
|
||||
|
||||
playSound3D [_fileName, objNull, false, _posASL, _volume, _pitch, _distance];
|
||||
|
9
addons/repair/CfgMoves.hpp
Normal file
9
addons/repair/CfgMoves.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
class CfgMovesBasic;
|
||||
class CfgMovesMaleSdr: CfgMovesBasic {
|
||||
class States {
|
||||
class Campaign_Base;
|
||||
class Acts_carFixingWheel: Campaign_Base {
|
||||
soundOverride = "";
|
||||
};
|
||||
};
|
||||
};
|
@ -16,7 +16,8 @@ class CfgPatches {
|
||||
|
||||
#include "ACE_Repair.hpp"
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgActions.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgEden.hpp"
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgMoves.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
|
@ -177,6 +177,9 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
|
||||
};
|
||||
};
|
||||
|
||||
private _soundPosition = AGLToASL (_caller modelToWorldVisual (_caller selectionPosition "RightHand"));
|
||||
["Acts_carFixingWheel", _soundPosition, nil, 50] call EFUNC(common,playConfigSound3D);
|
||||
|
||||
// Get repair time
|
||||
private _repairTime = [
|
||||
configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(repairTimes) >> configName _config,
|
||||
|
Loading…
Reference in New Issue
Block a user