mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
59 lines
2.1 KiB
Plaintext
59 lines
2.1 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: PabstMirror
|
|
* Gets the sound attenuation of a player to the outside.
|
|
*
|
|
* Arguments:
|
|
* None
|
|
*
|
|
* Return Value:
|
|
* Ammount that unit can hear outside <NUMBER>
|
|
*
|
|
* Example:
|
|
* [] call ace_hearing_fnc_updatePlayerVehAttenuation
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
private _vehicle = vehicle ACE_player;
|
|
|
|
if (isNull _vehicle) exitWith {};
|
|
|
|
private _newAttenuation = 1;
|
|
if (ACE_player != _vehicle) then {
|
|
private _turretPath = [ACE_player] call EFUNC(common,getTurretIndex);
|
|
private _effectType = getText (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "attenuationEffectType");
|
|
|
|
if (!(_turretPath isEqualTo [])) then {
|
|
private _turretConfig = [(configFile >> "CfgVehicles" >> (typeOf _vehicle)), _turretPath] call EFUNC(common,getTurretConfigPath);
|
|
|
|
if ((getNumber (_turretConfig >> "disableSoundAttenuation")) == 1) then {
|
|
_effectType = "";
|
|
} else {
|
|
if (isText (_turretConfig >> "soundAttenuationTurret")) then {
|
|
_effectType = getText (_turretConfig >> "soundAttenuationTurret");
|
|
};
|
|
};
|
|
};
|
|
|
|
_newAttenuation = switch (true) do {
|
|
case (_effectType == ""): {1};
|
|
case (_effectType == "CarAttenuation");
|
|
case (_effectType == "RHS_CarAttenuation"): { // Increase protection for armored cars
|
|
private _armor = getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "HitPoints" >> "HitBody" >> "armor");
|
|
linearConversion [2, 8, _armor, 0.5, 0.3, true];};
|
|
case (_effectType == "OpenCarAttenuation"): {1};
|
|
case (_effectType == "TankAttenuation"): {0.1};
|
|
case (_effectType == "HeliAttenuation"): {0.3};
|
|
case (_effectType == "OpenHeliAttenuation"): {0.9};
|
|
case (_effectType == "SemiOpenHeliAttenuation"): {0.6};
|
|
case (_effectType == "HeliAttenuationGunner"): {0.85};
|
|
case (_effectType == "HeliAttenuationRamp"): {0.85};
|
|
default {1};
|
|
};
|
|
};
|
|
|
|
TRACE_2("New vehicle attenuation",_vehicle,_newAttenuation);
|
|
|
|
GVAR(playerVehAttenuation) = _newAttenuation;
|