diff --git a/addons/overpressure/CfgWeapons.hpp b/addons/overpressure/CfgWeapons.hpp index 1f0814a4871..7102e84d1b0 100644 --- a/addons/overpressure/CfgWeapons.hpp +++ b/addons/overpressure/CfgWeapons.hpp @@ -7,6 +7,7 @@ class CfgWeapons { GVAR(angle) = 60; GVAR(range) = 10; GVAR(damage) = 0.7; + GVAR(offset) = 1; }; class Launcher_Base_F: Launcher {}; @@ -16,6 +17,7 @@ class CfgWeapons { GVAR(angle) = 40; GVAR(range) = 8; GVAR(damage) = 0.5; + GVAR(offset) = 1; }; class launch_Titan_short_base: launch_Titan_base { @@ -24,6 +26,7 @@ class CfgWeapons { GVAR(angle) = 30; GVAR(range) = 2; GVAR(damage) = 0.5; + GVAR(offset) = 0.85; }; class launch_NLAW_F: Launcher_Base_F { @@ -32,6 +35,7 @@ class CfgWeapons { GVAR(angle) = 30; GVAR(range) = 2; GVAR(damage) = 0.6; + GVAR(offset) = 1.05; }; class launch_RPG32_F: Launcher_Base_F { @@ -39,6 +43,22 @@ class CfgWeapons { GVAR(angle) = 60; GVAR(range) = 15; GVAR(damage) = 0.7; + GVAR(offset) = 1.2; + }; + + class launch_MRAWS_base_F: Launcher_Base_F { + GVAR(range) = 15; + GVAR(offset) = 1.05; + }; + + class launch_Vorona_base_F: Launcher_Base_F { + GVAR(angle) = 50; + GVAR(offset) = 0.88; + }; + + class launch_RPG7_F: Launcher_Base_F { + GVAR(angle) = 40; + GVAR(offset) = 0.9; }; class CannonCore; diff --git a/addons/overpressure/XEH_PREP.hpp b/addons/overpressure/XEH_PREP.hpp index 1efd39d6e5a..9d1e8e9725b 100644 --- a/addons/overpressure/XEH_PREP.hpp +++ b/addons/overpressure/XEH_PREP.hpp @@ -1,6 +1,5 @@ - PREP(getDistance); PREP(overpressureDamage); -PREP(cacheOverPressureValues); +PREP(getOverPressureValues); PREP(firedEHOP); PREP(firedEHBB); diff --git a/addons/overpressure/XEH_postInit.sqf b/addons/overpressure/XEH_postInit.sqf index bf3758ab3d2..46fe4602682 100644 --- a/addons/overpressure/XEH_postInit.sqf +++ b/addons/overpressure/XEH_postInit.sqf @@ -9,4 +9,6 @@ // Register fire event handler ["ace_firedPlayer", LINKFUNC(firedEHBB)] call CBA_fnc_addEventHandler; ["ace_firedPlayerVehicle", LINKFUNC(firedEHOP)] call CBA_fnc_addEventHandler; + + GVAR(cacheHash) = createHashMap; }] call CBA_fnc_addEventHandler; diff --git a/addons/overpressure/functions/fnc_firedEHBB.sqf b/addons/overpressure/functions/fnc_firedEHBB.sqf index 758f00784cb..b43649607f1 100644 --- a/addons/overpressure/functions/fnc_firedEHBB.sqf +++ b/addons/overpressure/functions/fnc_firedEHBB.sqf @@ -18,20 +18,16 @@ //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -// Bake variable name and check if the variable exists, call the caching function otherwise -private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -private _var = if (isNil _varName) then { - [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); -} else { - missionNameSpace getVariable _varName; -}; -_var params ["_backblastAngle","_backblastRange","_backblastDamage"]; -TRACE_3("cache",_backblastAngle,_backblastRange,_backblastDamage); +// Retrieve backblast values +private _bbValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues); + +_bbValues params ["_backblastAngle", "_backblastRange", "_backblastDamage", "_offset"]; +TRACE_4("cache",_backblastAngle,_backblastRange,_backblastDamage,_offset); if (_backblastDamage <= 0) exitWith {}; -private _position = getPosASL _projectile; private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile); +private _position = ((getPosASL _projectile) vectorAdd (_direction vectorMultiply _offset)); // Damage to others private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange]; diff --git a/addons/overpressure/functions/fnc_firedEHOP.sqf b/addons/overpressure/functions/fnc_firedEHOP.sqf index 5871fae9b87..618cfae6f10 100644 --- a/addons/overpressure/functions/fnc_firedEHOP.sqf +++ b/addons/overpressure/functions/fnc_firedEHOP.sqf @@ -18,20 +18,14 @@ //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -// Bake variable name and check if the variable exists, call the caching function otherwise -private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -private _var = if (isNil _varName) then { - [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); -} else { - missionNameSpace getVariable _varName; -}; -_var params ["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; +// Retrieve overpressure values +private _opValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues); + +_opValues params ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage); if (_dangerZoneDamage <= 0) exitWith {}; - - // The weapon produces overpressure, calculate private _position = getPosASL _projectile; private _direction = vectorDir _projectile; diff --git a/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf b/addons/overpressure/functions/fnc_getOverPressureValues.sqf similarity index 72% rename from addons/overpressure/functions/fnc_cacheOverPressureValues.sqf rename to addons/overpressure/functions/fnc_getOverPressureValues.sqf index 2626004e87b..2b30dc00087 100644 --- a/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf +++ b/addons/overpressure/functions/fnc_getOverPressureValues.sqf @@ -14,9 +14,10 @@ * 0: Angle * 1: Range * 2: Damage + * 3: Offset * * Example: - * ["cannon_125mm","Sh_125mm_APFSDS_T_Green","24Rnd_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_cacheOverPressureValues + * ["cannon_125mm","Sh_125mm_APFSDS_T_Green","24Rnd_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_getOverPressureValues * * Public: No */ @@ -24,6 +25,13 @@ params ["_weapon", "_ammo", "_magazine"]; TRACE_3("Parameter",_weapon,_magazine,_ammo); +// Check cache for weapon/ammo/mag combo +private _return = GVAR(cacheHash) get _this; +if (!isNil "_return") exitWith { + TRACE_3("CacheHit",_weapon,_magazine,_ammo); + _return +}; + // get Priority Array from Config private _array = [ getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(priority)), @@ -43,15 +51,15 @@ private _config = [ ] select _indexOfMaxPriority; TRACE_1("ConfigPath",_config); -// get the Variables out of the Configes and create a array with then -private _return = [ +// get the Variables out of the Configs and populate return array with them +_return = [ (getNumber (_config >> QGVAR(angle))), (getNumber (_config >> QGVAR(range))) * GVAR(distanceCoefficient), - (getNumber (_config >> QGVAR(damage))) + (getNumber (_config >> QGVAR(damage))), + (getNumber (_config >> QGVAR(offset))) ]; -private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -missionNameSpace setVariable [_varName, _return]; -TRACE_2("Return",_varName,_return); +GVAR(cacheHash) set [_this, _return]; +TRACE_2("Return",_this,_return); _return diff --git a/addons/overpressure/functions/fnc_overpressureDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf index dd60fc25d3a..c05c2810758 100644 --- a/addons/overpressure/functions/fnc_overpressureDamage.sqf +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -23,14 +23,10 @@ params ["_firer", "_posASL", "_direction", "_weapon", "_magazine", "_ammo"]; -// Bake variable name and check if the variable exists, call the caching function otherwise -private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -private _var = if (isNil _varName) then { - [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); -} else { - missionNameSpace getVariable _varName; -}; -_var params ["_overpressureAngle","_overpressureRange","_overpressureDamage"]; +// Retrieve overpressure values +private _opValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues); + +_opValues params ["_overpressureAngle", "_overpressureRange", "_overpressureDamage"]; TRACE_3("cache",_overpressureAngle,_overpressureRange,_overpressureDamage); { diff --git a/docs/wiki/development/ace3-config-entries.md b/docs/wiki/development/ace3-config-entries.md index f018246a99c..b8f66a9f185 100644 --- a/docs/wiki/development/ace3-config-entries.md +++ b/docs/wiki/development/ace3-config-entries.md @@ -49,6 +49,7 @@ ace_recoil_shakemultiplier ace_overpressure_angle ace_overpressure_range ace_overpressure_damage +ace_overpressure_offset ace_overheating_closedbolt ace_overheating_dispersion ace_overheating_slowdownfactor diff --git a/docs/wiki/framework/overpressure-framework.md b/docs/wiki/framework/overpressure-framework.md index 23d2080514f..7e7969f62a0 100644 --- a/docs/wiki/framework/overpressure-framework.md +++ b/docs/wiki/framework/overpressure-framework.md @@ -19,9 +19,10 @@ version: ```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) + ace_overpressure_range = 15; // 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 }; }; ``` @@ -31,9 +32,9 @@ class CfgWeapons { ```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_range = 50; // Range in meters in which the damage is applied - ace_overpressure_damage = 0.85; // Damage multiplier + ace_overpressure_angle = 90; // Cone in which the damage is applied (in degrees from the muzzle of the cannon) + ace_overpressure_range = 50; // Range in meters in which the damage is applied + ace_overpressure_damage = 0.85; // Damage multiplier }; }; ``` diff --git a/optionals/compat_rhs_afrf3/CfgWeapons.hpp b/optionals/compat_rhs_afrf3/CfgWeapons.hpp index 4fa6ab09c20..66390bff45e 100644 --- a/optionals/compat_rhs_afrf3/CfgWeapons.hpp +++ b/optionals/compat_rhs_afrf3/CfgWeapons.hpp @@ -117,12 +117,35 @@ class CfgWeapons { }; }; }; + class Launcher; class Launcher_Base_F: Launcher { class WeaponSlotsInfo; }; + + class rhs_weap_strela; + class rhs_weap_igla: rhs_weap_strela { + EGVAR(overpressure,range) = 6; + EGVAR(overpressure,angle) = 40; + EGVAR(overpressure,damage) = 0.6; + EGVAR(overpressure,offset) = 1.65; + }; + class rhs_weap_rpg7: Launcher_Base_F { - ace_reloadlaunchers_enabled = 1; + EGVAR(reloadlaunchers,enabled) = 1; + 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; }; #define HEARING_PROTECTION_VICCREW EGVAR(hearing,protection) = 0.85; EGVAR(hearing,lowerVolume) = 0.6; diff --git a/optionals/compat_rhs_gref3/CfgWeapons.hpp b/optionals/compat_rhs_gref3/CfgWeapons.hpp index 536c7340e6e..9ef0896409e 100644 --- a/optionals/compat_rhs_gref3/CfgWeapons.hpp +++ b/optionals/compat_rhs_gref3/CfgWeapons.hpp @@ -122,6 +122,18 @@ class CfgWeapons { class Launcher_Base_F: Launcher { class WeaponSlotsInfo; }; + + class rhs_weap_panzerfaust60: Launcher_Base_F { + EGVAR(overpressure,range) = 6; + EGVAR(overpressure,angle) = 30; + EGVAR(overpressure,damage) = 0.4; + }; + + class rhs_weap_rpg75: Launcher_Base_F { + EGVAR(overpressure,angle) = 40; + EGVAR(overpressure,offset) = 0.9; + }; + class GVAR(dshkm_carry): Launcher_Base_F { class ACE_CSW { type = "weapon"; diff --git a/optionals/compat_rhs_saf3/CfgWeapons.hpp b/optionals/compat_rhs_saf3/CfgWeapons.hpp index b20dca276b0..1aed7277157 100644 --- a/optionals/compat_rhs_saf3/CfgWeapons.hpp +++ b/optionals/compat_rhs_saf3/CfgWeapons.hpp @@ -71,4 +71,13 @@ class CfgWeapons { class rhssaf_uniform_heli_pilot: Uniform_Base { ACE_GForceCoef = 0.8; }; + + // Launchers + class Launcher_Base_F; + class rhs_weap_m80: Launcher_Base_F { + EGVAR(overpressure,range) = 8; + EGVAR(overpressure,angle) = 40; + EGVAR(overpressure,damage) = 0.7; + EGVAR(overpressure,offset) = 1.15; + }; }; diff --git a/optionals/compat_rhs_usf3/CfgWeapons.hpp b/optionals/compat_rhs_usf3/CfgWeapons.hpp index 96a6f817149..c626d19abb4 100644 --- a/optionals/compat_rhs_usf3/CfgWeapons.hpp +++ b/optionals/compat_rhs_usf3/CfgWeapons.hpp @@ -14,7 +14,6 @@ class CfgWeapons { class Pistol_Base_F; class Rifle_Base_F; class rhs_weap_m14ebrri_base; - class launch_O_Titan_F; class GM6_base_F; class rhs_weap_M107_Base_F: GM6_base_F { ACE_barrelTwist = 381.0; @@ -309,9 +308,12 @@ class CfgWeapons { }; }; }; + // RHS lauchers + class launch_O_Titan_F; class rhs_weap_fgm148: launch_O_Titan_F { - ace_javelin_enabled = 1; + EGVAR(javelin,enabled) = 1; + EGVAR(overpressure,offset) = 1.1; weaponInfoType = "ACE_RscOptics_javelin"; modelOptics = "\z\ace\addons\javelin\data\reticle_titan.p3d"; canLock = 0; @@ -326,19 +328,36 @@ class CfgWeapons { }; }; + 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; class Launcher_Base_F: Launcher { class WeaponSlotsInfo; }; + class rhs_weap_smaw: Launcher_Base_F { - ace_reloadlaunchers_enabled = 1; - ace_overpressure_angle = 45; + EGVAR(reloadlaunchers,enabled) = 1; + EGVAR(overpressure,angle) = 45; + EGVAR(overpressure,offset) = 1.3; }; + class rhs_weap_maaws: Launcher_Base_F { - ace_reloadlaunchers_enabled = 1; - ace_overpressure_range = 15; - ace_overpressure_angle = 70; - ace_overpressure_damage = 0.75; + EGVAR(reloadlaunchers,enabled) = 1; + EGVAR(overpressure,range) = 15; + EGVAR(overpressure,angle) = 70; + EGVAR(overpressure,damage) = 0.75; + EGVAR(overpressure,offset) = 0.95; + }; + + class rhs_weap_M136: Launcher_Base_F { + EGVAR(overpressure,range) = 10; + EGVAR(overpressure,angle) = 50; + EGVAR(overpressure,offset) = 0.9; }; #define HEARING_PROTECTION_OPEN EGVAR(hearing,protection) = 0; EGVAR(hearing,lowerVolume) = 0;