mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Overpressure - Fix backblast originating at projectile (#8985)
* Overpressure - Fix backblast originating at the projectile * RHSUSF - Improve backblast for shoulder launchers * RHSAFRF - Improve backblast for shoulder launchers * RHSGREF - Improve backblast for shoulder launchers * RHSSAF - Improve backblast for shoulder launchers * Overpressure - Simplify projectile offset and cache lookups * Overpressure - Remove parentheses and use array as hash key * Overpressure - Rename caching function and move lookup
This commit is contained in:
parent
cd9372a8e1
commit
fc17697ef7
@ -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;
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
PREP(getDistance);
|
||||
PREP(overpressureDamage);
|
||||
PREP(cacheOverPressureValues);
|
||||
PREP(getOverPressureValues);
|
||||
PREP(firedEHOP);
|
||||
PREP(firedEHBB);
|
||||
|
@ -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;
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
@ -14,9 +14,10 @@
|
||||
* 0: Angle <Number>
|
||||
* 1: Range <Number>
|
||||
* 2: Damage <Number>
|
||||
* 3: Offset <Number>
|
||||
*
|
||||
* 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
|
@ -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);
|
||||
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
};
|
||||
};
|
||||
```
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user