mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixed injured sounds
This commit is contained in:
parent
784a5e9fcb
commit
4ed19dce75
@ -51,6 +51,7 @@ if ([_unit] call FUNC(hasMedicalEnabled)) then {
|
||||
if (_pain > 0.7 && {random(1) > 0.6}) then {
|
||||
[_unit] call FUNC(setUnconscious);
|
||||
};
|
||||
|
||||
[_unit, _pain] call FUNC(playInjuredSound);
|
||||
};
|
||||
};
|
||||
|
@ -17,55 +17,47 @@
|
||||
|
||||
private ["_unit","_amountOfDamage","_bodyPartStatus","_availableSounds_A","_availableSounds_B","_availableSounds_C","_sound"];
|
||||
_unit = _this select 0;
|
||||
if (!local _unit) exitwith{};
|
||||
_pain = _this select 1;
|
||||
if (!local _unit || !GVAR(enableScreams)) exitwith{};
|
||||
|
||||
// Lock if the unit is already playing a sound.
|
||||
if ((_unit getvariable [QGVAR(playingInjuredSound),false])) exitwith {};
|
||||
_unit setvariable [QGVAR(playingInjuredSound),true];
|
||||
|
||||
// Classnames of the available sounds.
|
||||
_availableSounds_A = [
|
||||
"WoundedGuyA_01",
|
||||
"WoundedGuyA_02",
|
||||
"WoundedGuyA_03",
|
||||
"WoundedGuyA_04",
|
||||
"WoundedGuyA_05",
|
||||
"WoundedGuyA_06",
|
||||
"WoundedGuyA_07",
|
||||
"WoundedGuyA_08"
|
||||
];
|
||||
_availableSounds_B = [
|
||||
"WoundedGuyB_01",
|
||||
"WoundedGuyB_02",
|
||||
"WoundedGuyB_03",
|
||||
"WoundedGuyB_04",
|
||||
"WoundedGuyB_05",
|
||||
"WoundedGuyB_06",
|
||||
"WoundedGuyB_07",
|
||||
"WoundedGuyB_08"
|
||||
];
|
||||
_availableSounds_C = [
|
||||
"WoundedGuyC_01",
|
||||
"WoundedGuyC_02",
|
||||
"WoundedGuyC_03",
|
||||
"WoundedGuyC_04",
|
||||
"WoundedGuyC_05"
|
||||
];
|
||||
|
||||
// TODO Base this off hitpoint damage
|
||||
// Find the amount of damage for this unit, based upon body part status.
|
||||
//_bodyPartStatus = [_unit,QGVAR(bodyPartStatus)] call EFUNC(common,getDefinedVariable);
|
||||
_amountOfDamage = 0;
|
||||
/*{
|
||||
_amountOfDamage = _amountOfDamage + _x;
|
||||
}foreach _bodyPartStatus;*/
|
||||
|
||||
// Play the sound if there is any damage present.
|
||||
if (_amountOfDamage > 0) exitwith {
|
||||
if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitwith {
|
||||
// Classnames of the available sounds.
|
||||
_availableSounds_A = [
|
||||
"WoundedGuyA_01",
|
||||
"WoundedGuyA_02",
|
||||
"WoundedGuyA_03",
|
||||
"WoundedGuyA_04",
|
||||
"WoundedGuyA_05",
|
||||
"WoundedGuyA_06",
|
||||
"WoundedGuyA_07",
|
||||
"WoundedGuyA_08"
|
||||
];
|
||||
_availableSounds_B = [
|
||||
"WoundedGuyB_01",
|
||||
"WoundedGuyB_02",
|
||||
"WoundedGuyB_03",
|
||||
"WoundedGuyB_04",
|
||||
"WoundedGuyB_05",
|
||||
"WoundedGuyB_06",
|
||||
"WoundedGuyB_07",
|
||||
"WoundedGuyB_08"
|
||||
];
|
||||
_availableSounds_C = [
|
||||
"WoundedGuyC_01",
|
||||
"WoundedGuyC_02",
|
||||
"WoundedGuyC_03",
|
||||
"WoundedGuyC_04",
|
||||
"WoundedGuyC_05"
|
||||
];
|
||||
_sound = "";
|
||||
|
||||
// Select the to be played sound based upon damage amount.
|
||||
if (_amountOfDamage > 1) then {
|
||||
if (_pain > 0.5) then {
|
||||
if (random(1) > 0.5) then {
|
||||
_sound = _availableSounds_A select (round(random((count _availableSounds_A) - 1)));
|
||||
} else {
|
||||
@ -74,18 +66,12 @@ if (_amountOfDamage > 0) exitwith {
|
||||
} else {
|
||||
_sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1)));
|
||||
};
|
||||
|
||||
// Play the sound
|
||||
playSound3D [((getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0)), _unit, false, getPos _unit, 2, 1, 15]; // +2db, 15 meters.
|
||||
playSound3D [(getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0) + ".wss", objNull, false, getPos _unit, 15, 1, 25]; // +2db, 15 meters.
|
||||
|
||||
// Figure out what the delay will be before it is possible to play a sound again.
|
||||
private "_delay";
|
||||
_delay = 1;
|
||||
if (_amountOfDamage < 1) then {
|
||||
_delay = 10 + random(50);
|
||||
} else {
|
||||
_delay = (60 / _amountOfDamage);
|
||||
};
|
||||
_delay = (30 - (random(25) * _pain)) max (3.5 + random(2));
|
||||
|
||||
// Clean up the lock
|
||||
[{
|
||||
|
Loading…
Reference in New Issue
Block a user