diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp index e8cfb683518..d49fd993e5e 100644 --- a/addons/common/XEH_PREP.hpp +++ b/addons/common/XEH_PREP.hpp @@ -214,6 +214,7 @@ PREP(unloadPerson); PREP(unloadPersonLocal); PREP(unloadUnitWeapon); PREP(unmuteUnit); +PREP(updatePlayerVehAttenuation); PREP(useItem); PREP(useMagazine); PREP(watchVariable); diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index ced3bf305b1..235c92c3d13 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -375,6 +375,15 @@ GVAR(OldIsCamera) = false; ["ace_activeCameraChanged", [_player, GVAR(OldIsCamera)]] call CBA_fnc_localEvent; }, true] call CBA_fnc_addPlayerEventHandler; +// Update vehicle audio attenuation when player vehicle changes +GVAR(playerVehAttenuation) = 1; +["vehicle", { + params ["_player", "_vehicle"]; + TRACE_2("vehicle change",_player,_vehicle); + _this call FUNC(updatePlayerVehAttenuation); +}, true] call CBA_fnc_addPlayerEventHandler; +["turret", LINKFUNC(updatePlayerVehAttenuation), false] call CBA_fnc_addPlayerEventHandler; + // Add event handler for UAV control change ACE_controlledUAV = [objNull, objNull, [], ""]; addMissionEventHandler ["PlayerViewChanged", { diff --git a/addons/hearing/functions/fnc_updatePlayerVehAttenuation.sqf b/addons/common/functions/fnc_updatePlayerVehAttenuation.sqf similarity index 95% rename from addons/hearing/functions/fnc_updatePlayerVehAttenuation.sqf rename to addons/common/functions/fnc_updatePlayerVehAttenuation.sqf index 856b694a3f6..fd432f50293 100644 --- a/addons/hearing/functions/fnc_updatePlayerVehAttenuation.sqf +++ b/addons/common/functions/fnc_updatePlayerVehAttenuation.sqf @@ -10,7 +10,7 @@ * Amount that unit can hear outside * * Example: - * call ace_hearing_fnc_updatePlayerVehAttenuation + * call ace_common_fnc_updatePlayerVehAttenuation * * Public: No */ @@ -27,7 +27,7 @@ if (ACE_player != _vehicle) then { private _effectType = getText (_vehicleConfig >> "attenuationEffectType"); if (_turretPath isNotEqualTo []) then { - private _turretConfig = [_vehicleConfig, _turretPath] call EFUNC(common,getTurretConfigPath); + private _turretConfig = [_vehicleConfig, _turretPath] call FUNC(getTurretConfigPath); if ((getNumber (_turretConfig >> "disableSoundAttenuation")) == 1) then { _effectType = ""; diff --git a/addons/compat_rhs_afrf3/CfgVehicles.hpp b/addons/compat_rhs_afrf3/CfgVehicles.hpp index 2ba6caf56f9..4e60ebfaf6d 100644 --- a/addons/compat_rhs_afrf3/CfgVehicles.hpp +++ b/addons/compat_rhs_afrf3/CfgVehicles.hpp @@ -101,6 +101,10 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 360; }; + class RHS_BM21_MSV_01: RHS_Ural_BaseTurret { + EGVAR(overpressure,noReflection) = 1; + }; + class RHS_Ural_Base: RHS_Ural_BaseTurret {}; class RHS_Ural_MSV_Base: RHS_Ural_Base {}; class RHS_Ural_Support_MSV_Base_01: RHS_Ural_MSV_Base {}; diff --git a/addons/compat_rhs_afrf3/CfgWeapons.hpp b/addons/compat_rhs_afrf3/CfgWeapons.hpp index a25d1f7cd05..c6c664dbb1c 100644 --- a/addons/compat_rhs_afrf3/CfgWeapons.hpp +++ b/addons/compat_rhs_afrf3/CfgWeapons.hpp @@ -88,18 +88,15 @@ class CfgWeapons { EGVAR(overpressure,angle) = 40; EGVAR(overpressure,offset) = 0.9; }; - class rhs_weap_rpg26: Launcher_Base_F { EGVAR(overpressure,range) = 10; EGVAR(overpressure,angle) = 50; EGVAR(overpressure,offset) = 0.65; }; - class rhs_weap_rpg18: rhs_weap_rpg26 { EGVAR(overpressure,angle) = 45; EGVAR(overpressure,offset) = 1; }; - class rhs_weap_strela; class rhs_weap_igla: rhs_weap_strela { EGVAR(overpressure,range) = 6; @@ -107,20 +104,21 @@ class CfgWeapons { EGVAR(overpressure,damage) = 0.6; EGVAR(overpressure,offset) = 1.65; }; - - class rhs_zsh7a; - class rhs_zsh7a_alt: rhs_zsh7a { - ACE_Protection = 1; + class missiles_titan_static; + class rhs_Igla_AA_pod_Base: missiles_titan_static { // Soft-launched Igla missile + EGVAR(overpressure,range) = 6; + EGVAR(overpressure,angle) = 40; + EGVAR(overpressure,damage) = 0.6; + EGVAR(overpressure,offset) = 1.8; }; - class rhs_zsh7a_mike; - class rhs_zsh7a_mike_alt: rhs_zsh7a_mike { - ACE_Protection = 1; + class RocketPods; + class rhs_weap_SPG9: RocketPods { + EGVAR(overpressure,offset) = 1.2; }; - class rhs_zsh7a_mike_green; - class rhs_zsh7a_mike_green_alt: rhs_zsh7a_mike_green { - ACE_Protection = 1; + class rhs_weap_grad; + class rhs_weap_bm21: rhs_weap_grad { + EGVAR(overpressure,offset) = 0; }; - class rhs_weap_d81; class rhs_weap_2a70: rhs_weap_d81 { // "Low pressure" 100mm cannon EGVAR(overpressure,range) = 15; @@ -131,6 +129,23 @@ class CfgWeapons { EGVAR(overpressure,range) = 15; EGVAR(overpressure,damage) = 0.5; }; + class mortar_82mm; + class rhs_weap_2b14: mortar_82mm { + EGVAR(overpressure,offset) = 0.4; + }; + + class rhs_zsh7a; + class rhs_zsh7a_alt: rhs_zsh7a { + ACE_Protection = 1; + }; + class rhs_zsh7a_mike; + class rhs_zsh7a_mike_alt: rhs_zsh7a_mike { + ACE_Protection = 1; + }; + class rhs_zsh7a_mike_green; + class rhs_zsh7a_mike_green_alt: rhs_zsh7a_mike_green { + ACE_Protection = 1; + }; class rhs_uniform_flora; class rhs_uniform_df15: rhs_uniform_flora { diff --git a/addons/compat_rhs_gref3/CfgVehicles.hpp b/addons/compat_rhs_gref3/CfgVehicles.hpp index 89692c83002..72ca7a22638 100644 --- a/addons/compat_rhs_gref3/CfgVehicles.hpp +++ b/addons/compat_rhs_gref3/CfgVehicles.hpp @@ -14,5 +14,6 @@ class CfgVehicles { GVAR(turretFireProb) = 0.7; GVAR(engineFireProb) = 0.7; GVAR(detonationDuringFireProb) = 0.5; + EGVAR(overpressure,noReflection) = 1; }; }; diff --git a/addons/compat_rhs_usf3/CfgWeapons.hpp b/addons/compat_rhs_usf3/CfgWeapons.hpp index 50b09c760f9..f6f5b517293 100644 --- a/addons/compat_rhs_usf3/CfgWeapons.hpp +++ b/addons/compat_rhs_usf3/CfgWeapons.hpp @@ -175,15 +175,6 @@ class CfgWeapons { }; // RHS launchers - class launch_O_Titan_F; - - class rhs_weap_fim92: launch_O_Titan_F { - EGVAR(overpressure,range) = 6; - EGVAR(overpressure,angle) = 40; - EGVAR(overpressure,damage) = 0.6; - EGVAR(overpressure,offset) = 1.45; - }; - class Launcher_Base_F; class rhs_weap_smaw: Launcher_Base_F { @@ -206,6 +197,40 @@ class CfgWeapons { EGVAR(overpressure,offset) = 0.9; }; + class launch_O_Titan_F; + class rhs_weap_fim92: launch_O_Titan_F { + EGVAR(overpressure,range) = 6; + EGVAR(overpressure,angle) = 40; + EGVAR(overpressure,damage) = 0.6; + EGVAR(overpressure,offset) = 1.45; + }; + + class rhs_weap_stinger_Launcher; + class rhs_weap_stinger_Launcher_static: rhs_weap_stinger_Launcher { + EGVAR(overpressure,range) = 6; + EGVAR(overpressure,angle) = 40; + EGVAR(overpressure,damage) = 0.6; + EGVAR(overpressure,offset) = 1.2; + }; + + class missiles_titan; + class Rhs_weap_TOW_Launcher_static: missiles_titan { + EGVAR(overpressure,angle) = 40; + EGVAR(overpressure,range) = 4; + EGVAR(overpressure,damage) = 0.7; + EGVAR(overpressure,offset) = 0.8; + }; + + class rockets_230mm_GAT; + class rhs_weap_mlrs: rockets_230mm_GAT { + EGVAR(overpressure,offset) = 3.8; + }; + + class mortar_82mm; + class rhs_mortar_81mm: mortar_82mm { + EGVAR(overpressure,offset) = 0.2; + }; + class rhsusf_hgu56p; class rhsusf_hgu56p_visor: rhsusf_hgu56p { ACE_Protection = 1; diff --git a/addons/dragon/CfgWeapons.hpp b/addons/dragon/CfgWeapons.hpp index 0bdd53e34f2..ea4903cf5ac 100644 --- a/addons/dragon/CfgWeapons.hpp +++ b/addons/dragon/CfgWeapons.hpp @@ -33,9 +33,10 @@ class CfgWeapons { }; class GVAR(superStatic): missiles_titan_static { - EGVAR(overpressure,angle) = 90; - EGVAR(overpressure,range) = 30; + EGVAR(overpressure,angle) = 60; + EGVAR(overpressure,range) = 10; EGVAR(overpressure,damage) = 0.85; + EGVAR(overpressure,offset) = -0.4; initSpeed = 120; diff --git a/addons/hearing/XEH_PREP.hpp b/addons/hearing/XEH_PREP.hpp index f2b70b8ab53..c9ada6881fc 100644 --- a/addons/hearing/XEH_PREP.hpp +++ b/addons/hearing/XEH_PREP.hpp @@ -14,5 +14,4 @@ PREP(removeEHP); PREP(statBarStatement_hearingProtection); PREP(statTextStatement_hearingProtection); PREP(updateHearingProtection); -PREP(updatePlayerVehAttenuation); PREP(updateVolume); diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf index 3108161900b..a919fae7fe5 100644 --- a/addons/hearing/XEH_postInit.sqf +++ b/addons/hearing/XEH_postInit.sqf @@ -45,7 +45,6 @@ GVAR(cacheAmmoLoudness) = createHashMap; GVAR(deafnessDV) = 0; GVAR(deafnessPrior) = 0; GVAR(volume) = 1; -GVAR(playerVehAttenuation) = 1; GVAR(time3) = 0; GVAR(damageCoefficent) = 1; GVAR(volumeAttenuation) = 1; @@ -69,7 +68,6 @@ GVAR(ehpTimeout) = -1; params ["_player", "_vehicle"]; TRACE_2("vehicle change",_player,_vehicle); - _this call FUNC(updatePlayerVehAttenuation); if (!isNull GVAR(lastPlayerVehicle)) then { private _firedEH = GVAR(lastPlayerVehicle) getVariable [QGVAR(firedEH), -1]; @@ -87,8 +85,6 @@ GVAR(ehpTimeout) = -1; }; }, true] call CBA_fnc_addPlayerEventHandler; - ["turret", LINKFUNC(updatePlayerVehAttenuation), false] call CBA_fnc_addPlayerEventHandler; - [QGVAR(firedNear), "FiredNear", LINKFUNC(firedNear), true] call CBA_fnc_addBISPlayerEventHandler; [QGVAR(slotItemChanged), "SlotItemChanged", {(_this select 2) call FUNC(updateHearingProtection)}, true] call CBA_fnc_addBISPlayerEventHandler; diff --git a/addons/hearing/functions/fnc_explosion.sqf b/addons/hearing/functions/fnc_explosion.sqf index 2d3d5929895..19a12c1e834 100644 --- a/addons/hearing/functions/fnc_explosion.sqf +++ b/addons/hearing/functions/fnc_explosion.sqf @@ -34,7 +34,7 @@ private _hit = getNumber (_ammoConfig >> "hit"); if (_hit < 0.5) exitWith { TRACE_1("ignore smoke/flare",_hit) }; private _explosive = getNumber (_ammoConfig >> "explosive"); -private _vehAttenuation = [GVAR(playerVehAttenuation), 1] select (isNull objectParent ACE_player || {isTurnedOut ACE_player}); +private _vehAttenuation = [EGVAR(common,playerVehAttenuation), 1] select (isNull objectParent ACE_player || {isTurnedOut ACE_player}); TRACE_4("",typeOf _projectile,_distance,_explosive,_vehAttenuation); diff --git a/addons/hearing/functions/fnc_firedNear.sqf b/addons/hearing/functions/fnc_firedNear.sqf index 1c9a1c54968..be3ef007d08 100644 --- a/addons/hearing/functions/fnc_firedNear.sqf +++ b/addons/hearing/functions/fnc_firedNear.sqf @@ -51,7 +51,7 @@ if (_magazine == "") exitWith { TRACE_6("mag",_magazine,_weapon,_muzzle,_ammo,_firer,_gunner); -private _vehAttenuation = [GVAR(playerVehAttenuation), 1] select (isNull objectParent ACE_player || {isTurnedOut ACE_player}); +private _vehAttenuation = [EGVAR(common,playerVehAttenuation), 1] select (isNull objectParent ACE_player || {isTurnedOut ACE_player}); private _loudness = _magazine call FUNC(getAmmoLoudness); _loudness = _loudness * _audibleFireCoef; diff --git a/addons/hearing/functions/fnc_handleVehicleKilled.sqf b/addons/hearing/functions/fnc_handleVehicleKilled.sqf index 08e44ed194c..3e434f31348 100644 --- a/addons/hearing/functions/fnc_handleVehicleKilled.sqf +++ b/addons/hearing/functions/fnc_handleVehicleKilled.sqf @@ -56,7 +56,7 @@ private _powerCoef = getNumber (_cfg >> "fuelExplosionPower"); // Number + coef mechanics found through extensive testing if (_explosionPower > 6.25 * _powerCoef) then { // Calculate effective strength for player - private _vehAttenuation = [GVAR(playerVehAttenuation), 1] select (isNull objectParent ACE_player || {isTurnedOut ACE_player}); + private _vehAttenuation = [EGVAR(common,playerVehAttenuation), 1] select (isNull objectParent ACE_player || {isTurnedOut ACE_player}); private _effect = getText (_cfg >> "explosionEffect"); private _strength = [VEHICLE_EXPLOSION_STRENGTH, VEHICLE_EXPLOSION_BIG_STRENGTH] select (toLower _effect in ["fuelexplosionbig", "fuelcapacitorexplosion"]); diff --git a/addons/javelin/CfgWeapons.hpp b/addons/javelin/CfgWeapons.hpp index e06c6aae0bc..cbd5661050f 100644 --- a/addons/javelin/CfgWeapons.hpp +++ b/addons/javelin/CfgWeapons.hpp @@ -19,6 +19,13 @@ class CfgWeapons { magazines[] = {"1Rnd_GAT_missiles"}; lockingTargetSound[] = {"",0,1}; lockedTargetSound[] = {"",0,1}; + + // Titan is a soft-launch launcher + EGVAR(overpressure,priority) = 1; + EGVAR(overpressure,angle) = 30; + EGVAR(overpressure,range) = 2; + EGVAR(overpressure,damage) = 0.5; + EGVAR(overpressure,offset) = -0.5; }; class Launcher_Base_F; diff --git a/addons/overpressure/CfgVehicles.hpp b/addons/overpressure/CfgVehicles.hpp new file mode 100644 index 00000000000..116fa7eee72 --- /dev/null +++ b/addons/overpressure/CfgVehicles.hpp @@ -0,0 +1,6 @@ +class CfgVehicles { + class Truck_02_base_F; + class Truck_02_MRL_base_F: Truck_02_base_F { + GVAR(noReflection) = 1; + }; +}; diff --git a/addons/overpressure/CfgWeapons.hpp b/addons/overpressure/CfgWeapons.hpp index 7102e84d1b0..eadbc39a9fe 100644 --- a/addons/overpressure/CfgWeapons.hpp +++ b/addons/overpressure/CfgWeapons.hpp @@ -1,6 +1,8 @@ class CfgWeapons { + // Man-Portable launchers, rear-facing backblast + class LauncherCore; class Launcher: LauncherCore { GVAR(priority) = 1; @@ -61,6 +63,49 @@ class CfgWeapons { GVAR(offset) = 0.9; }; + // Vehicle recoilless rifles and missile launchers, rear-facing backblast + + class MissileLauncher: LauncherCore { + GVAR(priority) = 1; + GVAR(angle) = 60; + GVAR(range) = 10; + GVAR(damage) = 0.7; + GVAR(offset) = 0.8; + GVAR(backblast) = 1; + }; + + class missiles_titan; + class missiles_titan_static: missiles_titan { + GVAR(angle) = 40; + GVAR(range) = 8; + GVAR(damage) = 0.5; + }; + + class missiles_Vorona: MissileLauncher { + GVAR(angle) = 50; + GVAR(offset) = 0.5; + }; + + class launcher_SPG9: MissileLauncher { + GVAR(offset) = 1.25; + }; + + class RocketPods: LauncherCore { + GVAR(priority) = 1; + GVAR(angle) = 60; + GVAR(range) = 10; + GVAR(damage) = 0.7; + GVAR(offset) = 0.8; + GVAR(backblast) = 1; + }; + + class rockets_230mm_GAT: RocketPods { + GVAR(damage) = 0.85; + GVAR(offset) = 1; + }; + + // Vehicle cannons, forward-facing overpressure + class CannonCore; class cannon_120mm: CannonCore { GVAR(priority) = 1; @@ -89,4 +134,12 @@ class CfgWeapons { GVAR(range) = 60; GVAR(damage) = 1; }; + + class mortar_82mm: CannonCore { + GVAR(priority) = 1; + GVAR(angle) = 80; + GVAR(range) = 5; + GVAR(damage) = 0.7; + GVAR(offset) = 0.6; + }; }; diff --git a/addons/overpressure/XEH_postInit.sqf b/addons/overpressure/XEH_postInit.sqf index 4b014e89e24..525c0a436db 100644 --- a/addons/overpressure/XEH_postInit.sqf +++ b/addons/overpressure/XEH_postInit.sqf @@ -10,7 +10,13 @@ ["ace_firedPlayer", LINKFUNC(firedEHBB)] call CBA_fnc_addEventHandler; }; if (GVAR(overpressureDistanceCoefficient) > 0) then { - ["ace_firedPlayerVehicle", LINKFUNC(firedEHOP)] call CBA_fnc_addEventHandler; + ["ace_firedPlayerVehicle", { + if (getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(backblast)) == 1) then { + _this call FUNC(firedEHBB); + } else { + _this call FUNC(firedEHOP); + }; + }] call CBA_fnc_addEventHandler; }; GVAR(cacheHash) = createHashMap; diff --git a/addons/overpressure/config.cpp b/addons/overpressure/config.cpp index f4e128c1862..94643538f4b 100644 --- a/addons/overpressure/config.cpp +++ b/addons/overpressure/config.cpp @@ -15,6 +15,7 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" #include "CfgWeapons.hpp" #include "ACE_Arsenal_Stats.hpp" #include "CfgEden.hpp" diff --git a/addons/overpressure/functions/fnc_firedEHBB.sqf b/addons/overpressure/functions/fnc_firedEHBB.sqf index 59b51f28629..780f0e4f43b 100644 --- a/addons/overpressure/functions/fnc_firedEHBB.sqf +++ b/addons/overpressure/functions/fnc_firedEHBB.sqf @@ -18,6 +18,8 @@ //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; TRACE_8("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_gunner); +private _shooter = [_gunner, _unit] select (isNil "_gunner"); + // Retrieve backblast values private _bbValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues); @@ -35,31 +37,35 @@ private _position = (getPosASL _projectile) vectorAdd (_direction vectorMultiply private _affected = (ASLToAGL _position) nearEntities ["CAManBase", _backblastRange]; // Let each client handle their own affected units -["ace_overpressure", [_unit, _position, _direction, _weapon, _magazine, _ammo], _affected] call CBA_fnc_targetEvent; +["ace_overpressure", [_shooter, _position, _direction, _weapon, _magazine, _ammo], _affected] call CBA_fnc_targetEvent; // Damage to the firer -private _distance = 2 * ([_position, _direction, _backblastRange, _unit] call FUNC(getDistance)); +private _distance = 2 * ([_position, _direction, _backblastRange, _shooter] call FUNC(getDistance)); TRACE_1("Distance",_distance); -if (_distance < _backblastRange) then { - TRACE_2("",isDamageAllowed _unit,_unit getVariable [ARR_2(QEGVAR(medical,allowDamage),true)]); +if (_distance < _backblastRange && {EGVAR(common,playerVehAttenuation) > 0.8}) then { + TRACE_2("",isDamageAllowed _shooter,_shooter getVariable [ARR_2(QEGVAR(medical,allowDamage),true)]); // Skip damage if not allowed - if (isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), true]}) then { - private _alpha = sqrt (1 - _distance / _backblastRange); - private _beta = sqrt 0.5; + if (!isDamageAllowed _shooter || {!(_shooter getVariable [QEGVAR(medical,allowDamage), true])}) exitWith {}; + + // Skip if vehicle backblast reflection is disabled + private _vehicle = vehicle _shooter; + if (_vehicle != _shooter && {getNumber (configOf _vehicle >> QGVAR(noReflection)) == 1}) exitWith {}; + + private _alpha = sqrt (1 - _distance / _backblastRange); + private _beta = sqrt 0.5; - private _damage = _alpha * _beta * _backblastDamage; - TRACE_1("",_damage); + private _damage = _alpha * _beta * _backblastDamage; + TRACE_1("",_damage); - [_damage * 100] call BIS_fnc_bloodEffect; + [_damage * 100] call BIS_fnc_bloodEffect; - if (GETEGVAR(medical,enabled,false)) then { - [_unit, _damage, "body", "backblast", _unit] call EFUNC(medical,addDamageToUnit); - } else { - _unit setDamage (damage _unit + _damage); - }; + if (GETEGVAR(medical,enabled,false)) then { + [_shooter, _damage, "body", "backblast", _shooter] call EFUNC(medical,addDamageToUnit); + } else { + _shooter setDamage (damage _shooter + _damage); }; }; diff --git a/addons/overpressure/functions/fnc_firedEHOP.sqf b/addons/overpressure/functions/fnc_firedEHOP.sqf index 35aa54d4e80..5624ba2c392 100644 --- a/addons/overpressure/functions/fnc_firedEHOP.sqf +++ b/addons/overpressure/functions/fnc_firedEHOP.sqf @@ -21,7 +21,7 @@ TRACE_8("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_gunn // Retrieve overpressure values private _opValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues); -_opValues params ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; +_opValues params ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage", "_offset"]; TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage); @@ -34,6 +34,11 @@ _dangerZoneRange = _dangerZoneRange * _unitOverpressureRangeAttribute; private _position = getPosASL _projectile; private _direction = vectorDir _projectile; +// Offset overpressure origin position along the barrel +if (_offset != 0) then { + _position = _position vectorAdd (_direction vectorMultiply _offset); +}; + // Damage to others private _affected = (ASLToAGL _position) nearEntities ["CAManBase", _dangerZoneRange]; diff --git a/addons/overpressure/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf index 64ee5639742..cedb8f4c09d 100644 --- a/addons/overpressure/functions/fnc_getDistance.sqf +++ b/addons/overpressure/functions/fnc_getDistance.sqf @@ -21,7 +21,7 @@ params ["_posASL", "_direction", "_maxDistance", "_shooter"]; TRACE_4("params",_posASL,_direction,_maxDistance,_shooter); -private _intersections = lineIntersectsSurfaces [_posASL, _posASL vectorAdd (_direction vectorMultiply _maxDistance), _shooter, objNull, true, 99]; +private _intersections = lineIntersectsSurfaces [_posASL, _posASL vectorAdd (_direction vectorMultiply _maxDistance), _shooter, vehicle _shooter, true, 99]; TRACE_1("lineIntersectsSurfaces",_intersections); @@ -40,11 +40,11 @@ private _distance = 999; // Calculate the angle between the terrain and the back blast direction private _angle = 90 - acos (- (_surfaceNormal vectorDotProduct _direction)); TRACE_3("Terrain Intersect",_surfaceNormal,_direction,_angle); - // Angles is below 25deg, no backblast at all + // Angles below 25° don't cause backblast reflection if (_angle < 25) exitWith {_distance = 999}; - // Angles is below 45deg the distance is increased according to the difference + // At angles below 45° the distance is increased according to the difference if (_angle < 45) exitWith {_distance = _distance * (5 - 4 * sqrt ((_angle - 25)/20))}; - // Angles above 45degcreate full backblast + // Angles above 45° create full backblast reflection }; }; } forEach _intersections; diff --git a/addons/overpressure/functions/fnc_overpressureDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf index 37c1f02330b..2b8d0302417 100644 --- a/addons/overpressure/functions/fnc_overpressureDamage.sqf +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -37,7 +37,7 @@ TRACE_3("cache",_overpressureAngle,_overpressureRange,_overpressureDamage); private _distance = vectorMagnitude _relativePosition; private _angle = acos (_axisDistance / _distance); - private _line = [_posASL, _targetPositionASL, _firer, _x]; + private _line = [_posASL, _targetPositionASL, vehicle _firer, _x]; private _line2 = [_posASL, _targetPositionASL]; TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); diff --git a/docs/wiki/feature/overpressure.md b/docs/wiki/feature/overpressure.md index e9c8ab15c68..c10de2fa2d3 100644 --- a/docs/wiki/feature/overpressure.md +++ b/docs/wiki/feature/overpressure.md @@ -16,4 +16,7 @@ version: ## 1. Overview ### 1.1 Overpressure -Adds backblast to AT launchers and overpressure zones to tank cannons, don't stay behind a firing RPG or it'll hurt. +Adds backblast to Man-Portable AT/AA launchers, static/vehicle-mounted Missile launchers and Recoilless Guns. +Tank and Artillery cannons also have large overpressure zones that can cause injury to dismounted personnel. + +Don't stand behind a firing RPG or it'll hurt! diff --git a/docs/wiki/framework/overpressure-framework.md b/docs/wiki/framework/overpressure-framework.md index 243157c186b..899550a8cc9 100644 --- a/docs/wiki/framework/overpressure-framework.md +++ b/docs/wiki/framework/overpressure-framework.md @@ -14,33 +14,55 @@ version: ## 1. Config Values -### 1.1 Launchers +### 1.1 Man-Portable Launchers ```cpp class CfgWeapons { class MyLauncher { - ace_overpressure_angle = 60; // Cone in which the damage is applied (in degrees from the back end of the launcher) - ace_overpressure_range = 15; // Range in meters in which the damage is applied + ace_overpressure_angle = 60; // Cone in which the damage is applied (in degrees from the back end of the launcher towards the side) + ace_overpressure_range = 10; // Range in meters in which the damage is applied ace_overpressure_damage = 0.7; // Damage multiplier - ace_overpressure_offset = 1; // Offset from the projectile, where the backblast originates + ace_overpressure_offset = 1; // Offset from the projectile origin backwards, to where the backblast should originate from }; }; ``` -### 1.2 Cannons +### 1.2 Vehicle-mounted/Static Cannons, forward-facing overpressure ```cpp class CfgWeapons { class MyBananaCannon { - ace_overpressure_angle = 90; // Cone in which the damage is applied (in degrees from the muzzle of the cannon) + ace_overpressure_angle = 90; // Cone in which the damage is applied (in degrees from the muzzle of the cannon towards the side) ace_overpressure_range = 50; // Range in meters in which the damage is applied ace_overpressure_damage = 0.85; // Damage multiplier + ace_overpressure_offset = 1; // Offset from the projectile origin forwards, to where the overpressure should originate from }; }; ``` -- You can note that the angle range and damage values are higher, that's because this is a cannon and the backblast area is bigger. +- You can note that the angle, range and damage values are higher, that's because this is a cannon and the overpressure area is much larger. + +### 1.3 Vehicle-mounted/Static Missile launchers and Recoilless Guns, rear-facing backblast +```cpp +class CfgWeapons { + class MyStaticATGM { + ace_overpressure_angle = 60; // Cone in which the damage is applied (in degrees from the back end of the launcher towards the side) + ace_overpressure_range = 15; // Range in meters in which the damage is applied + ace_overpressure_damage = 0.8; // Damage multiplier + ace_overpressure_offset = 1; // Offset from the projectile origin backwards, to where the backblast should originate from + ace_overpressure_backblast = 1; // Defines the overpressure as backblast, so that it will be directed backwards + }; +}; +``` + +```cpp +class CfgVehicles { + class MyClosedMLRS { + ace_overpressure_noReflection = 1; // Prevents backblast reflection to the gunner in light vehicles like Vanilla MLRS Trucks, which are otherwise counted as "open" by ace_common_fnc_updatePlayerVehAttenuation + }; +}; +``` ## 2. Events