Overpressure - Fix invulnerable units taking backblast damage when firing launchers (#9256)

This commit is contained in:
johnb432 2023-07-14 21:33:54 +02:00 committed by GitHub
parent cdbf572462
commit 8d107776c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 18 deletions

View File

@ -41,18 +41,23 @@ private _distance = 2 * ([_position, _direction, _backblastRange, _unit] call FU
TRACE_1("Distance",_distance);
if (_distance < _backblastRange) then {
private _alpha = sqrt (1 - _distance / _backblastRange);
private _beta = sqrt 0.5;
TRACE_2("",isDamageAllowed _unit,_unit getVariable [ARR_2(QEGVAR(medical,allowDamage),true)]);
private _damage = _alpha * _beta * _backblastDamage;
[_damage * 100] call BIS_fnc_bloodEffect;
// 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 (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
[_unit, _damage, "body", "backblast", _unit] call EFUNC(medical,addDamageToUnit);
} else {
TRACE_1("",isDamageAllowed _unit);
if (!isDamageAllowed _unit) exitWith {}; // Skip damage if not allowed
_unit setDamage (damage _unit + _damage);
private _damage = _alpha * _beta * _backblastDamage;
TRACE_1("",_damage);
[_damage * 100] call BIS_fnc_bloodEffect;
if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
[_unit, _damage, "body", "backblast", _unit] call EFUNC(medical,addDamageToUnit);
} else {
_unit setDamage (damage _unit + _damage);
};
};
};

View File

@ -42,19 +42,21 @@ TRACE_3("cache",_overpressureAngle,_overpressureRange,_overpressureDamage);
TRACE_4("Affected:",_x,_axisDistance,_distance,_angle);
if (_angle < _overpressureAngle && {_distance < _overpressureRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then {
TRACE_2("",isDamageAllowed _unit,_unit getVariable [ARR_2(QEGVAR(medical,allowDamage),true)]);
private _alpha = sqrt (1 - _distance / _overpressureRange);
private _beta = sqrt (1 - _angle / _overpressureAngle);
private _damage = _alpha * _beta * _overpressureDamage;
TRACE_1("",_damage);
TRACE_1("",isDamageAllowed _x);
// Skip damage if not allowed
if (isDamageAllowed _x && {_x getVariable [QEGVAR(medical,allowDamage), true]}) then {
private _alpha = sqrt (1 - _distance / _overpressureRange);
private _beta = sqrt (1 - _angle / _overpressureAngle);
private _damage = _alpha * _beta * _overpressureDamage;
TRACE_1("",_damage);
// If the target is the ACE_player
if (_x isEqualTo ACE_player) then {
[_damage * 100] call BIS_fnc_bloodEffect
[_damage * 100] call BIS_fnc_bloodEffect;
};
if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
[_x, _damage, "body", "backblast", _firer] call EFUNC(medical,addDamageToUnit);
} else {