ACE3/addons/hearing/functions/fnc_updatePlayerVehAttenuation.sqf

48 lines
1.3 KiB
Plaintext
Raw Normal View History

2015-04-11 04:21:54 +00:00
/*
* Author: PabstMirror
2015-04-20 07:17:47 +00:00
* Gets the sound attenuation of a player to the outside.
2015-04-11 04:21:54 +00:00
*
* Arguments:
2015-04-20 07:17:47 +00:00
* None
2015-04-11 04:21:54 +00:00
*
* Return Value:
* Ammount that unit can hear outside <NUMBER>
*
* Example:
2015-04-20 07:17:47 +00:00
* [] call ace_hearing_fnc_updatePlayerVehAttenuation
2015-04-11 04:21:54 +00:00
*
* Public: No
*/
#include "script_component.hpp"
_vehicle = vehicle ACE_player;
if (isNull _vehicle) exitWith {};
2015-04-20 07:17:47 +00:00
_newAttenuation = 1;
if (ACE_player != _vehicle) then {
2015-04-11 04:21:54 +00:00
_effectType = "";
_turretPath = [ACE_player] call EFUNC(common,getTurretIndex);
_effectType = getText (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "attenuationEffectType");
2015-04-11 04:51:07 +00:00
2015-04-11 04:21:54 +00:00
if (!(_turretPath isEqualTo [])) then {
_turretConfig = [(configFile >> "CfgVehicles" >> (typeOf _vehicle)), _turretPath] call EFUNC(common,getTurretConfigPath);
2015-04-11 04:51:07 +00:00
2015-04-11 04:21:54 +00:00
if ((getNumber (_turretConfig >> "disableSoundAttenuation")) == 1) then {
_effectType = "";
} else {
if (isText (_turretConfig >> "soundAttenuationTurret")) then {
_effectType = getText (_turretConfig >> "soundAttenuationTurret");
};
};
};
_newAttenuation = switch (true) do {
default {1};
};
};
2015-04-20 07:17:47 +00:00
TRACE_2("New vehicle attenuation",_vehicle,_newAttenuation);
GVAR(playerVehAttenuation) = _newAttenuation;