2015-01-11 16:42:31 +00:00
|
|
|
// by commy2
|
2015-01-17 20:32:34 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-17 20:32:34 +00:00
|
|
|
EXPLODE_2_PVT(_this,_unit,_weapon);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-17 20:32:34 +00:00
|
|
|
private ["_sound"];
|
2015-01-11 16:42:31 +00:00
|
|
|
_sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound");
|
|
|
|
|
|
|
|
if (count _sound == 0) exitWith {
|
2015-01-17 20:32:34 +00:00
|
|
|
playSound "ACE_Sound_Click";
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// add file extension
|
|
|
|
if call {
|
|
|
|
{
|
|
|
|
if (toLower (_sound select 0) find _x == count toArray (_sound select 0) - count toArray _x - 1) exitWith {false};
|
|
|
|
true
|
|
|
|
} forEach [".wav", ".ogg", ".wss"];
|
|
|
|
} then {
|
|
|
|
_sound set [0, (_sound select 0) + ".wss"];
|
|
|
|
};
|
|
|
|
|
|
|
|
// add default volume, pitch and distance
|
|
|
|
if (count _sound < 2) then {_sound pushBack 1};
|
|
|
|
if (count _sound < 3) then {_sound pushBack 1};
|
|
|
|
if (count _sound < 4) then {_sound pushBack 0};
|
|
|
|
|
|
|
|
private "_position";
|
2015-04-03 22:26:27 +00:00
|
|
|
_position = _unit modelToWorldVisual (_unit selectionPosition "RightHand");
|
2015-01-11 16:42:31 +00:00
|
|
|
_position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)];
|
|
|
|
|
|
|
|
playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3];
|