Add overpressure to vehicle missile/rocket launchers

This commit is contained in:
mrschick 2024-08-28 13:34:58 +02:00
parent d56a3a6a95
commit 79115a8400
2 changed files with 55 additions and 1 deletions

View File

@ -1,6 +1,8 @@
class CfgWeapons {
// Man-Portable launchers, rear-facing overpressure
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 overpressure
class MissileLauncher;
class MissileLauncher: LauncherCore {
GVAR(priority) = 1;
GVAR(angle) = 60;
GVAR(range) = 10;
GVAR(damage) = 0.7;
GVAR(offset) = -0.8;
};
class missiles_titan_static;
class missiles_titan_static {
GVAR(angle) = 40;
GVAR(range) = 8;
GVAR(damage) = 0.5;
};
class EGVAR(javelin,Titan_Static): missiles_titan_static {
// Titan is a soft-launch launcher
GVAR(priority) = 1;
GVAR(angle) = 30;
GVAR(range) = 2;
GVAR(damage) = 0.5;
GVAR(offset) = -0.5;
};
class missiles_Vorona: MissileLauncher {
GVAR(angle) = 50;
GVAR(offset) = -0.5;
};
class RocketPods;
class RocketPods: LauncherCore {
GVAR(priority) = 1;
GVAR(angle) = 60;
GVAR(range) = 10;
GVAR(damage) = 0.7;
GVAR(offset) = -0.8;
};
// Vehicle cannons, forward-facing overpressure
class CannonCore;
class cannon_120mm: CannonCore {
GVAR(priority) = 1;

View File

@ -21,7 +21,7 @@ TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_veh
// Retrieve overpressure values
private _opValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues);
_opValues params ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
_opValues params ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage", "_offset"];
_dangerZoneRange = _dangerZoneRange * GVAR(overpressureDistanceCoefficient);
TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage);
@ -32,6 +32,15 @@ if (_dangerZoneDamage <= 0) exitWith {};
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);
// A negative offset will invert the direction, for vehicle weapons like recoilless rifles and missile launchers
if (_offset < 0) then {
_direction = _direction vectorMultiply -1;
};
};
// Damage to others
private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange];