Merge pull request #3172 from acemod/overpressureCleanup

Overpressure cleanup and fix distance check
This commit is contained in:
Thomas Kooi 2016-01-19 09:30:43 +01:00
commit fbb358233b
10 changed files with 128 additions and 116 deletions

View File

@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers {
class Extended_FiredBIS_EventHandlers { class Extended_FiredBIS_EventHandlers {
class CAManBase { class CAManBase {
class ADDON { class ADDON {
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHBB);};); clientFiredBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHBB);};);
}; };
}; };

View File

@ -49,6 +49,20 @@ class CfgWeapons {
GVAR(damage) = 0.85; GVAR(damage) = 0.85;
}; };
class cannon_125mm: CannonCore {
GVAR(priority) = 1;
GVAR(angle) = 90;
GVAR(range) = 50;
GVAR(damage) = 0.85;
};
class cannon_105mm: CannonCore {
GVAR(priority) = 1;
GVAR(angle) = 90;
GVAR(range) = 50;
GVAR(damage) = 0.85;
};
class mortar_155mm_AMOS: CannonCore { class mortar_155mm_AMOS: CannonCore {
GVAR(priority) = 1; GVAR(priority) = 1;
GVAR(angle) = 90; GVAR(angle) = 90;

View File

@ -1,7 +1,7 @@
/* /*
* Author: joko // Jonas * Author: joko // Jonas
* * Cache the shot data for a given weapon/mag/ammo combination.
* Handle fire of local launchers * Will use the config that has the highest priority.
* *
* Argument: * Argument:
* 0: Weapon <STRING> * 0: Weapon <STRING>
@ -9,68 +9,49 @@
* 2: Ammo <STRING> * 2: Ammo <STRING>
* *
* Return value: * Return value:
* Array: * Shot Config <ARRAY>:
* 0: Angle <Number> * 0: Angle <Number>
* 1: Range <Number> * 1: Range <Number>
* 2: Damage <Number> * 2: Damage <Number>
* *
* Example:
* ["cannon_125mm","Sh_125mm_APFSDS_T_Green","24Rnd_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_cacheOverPressureValues
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_weapon", "_ammo", "_magazine"]; params ["_weapon", "_ammo", "_magazine"];
TRACE_3("Parameter",_weapon,_magazine,_ammo); TRACE_3("Parameter",_weapon,_magazine,_ammo);
private ["_array", "_type", "_return", "_config" /*, "_priority"*/];
// get Priority Array from Config // get Priority Array from Config
_array = [ private _array = [
getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(priority)), getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(priority)),
getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(priority)), getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(priority)),
getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(priority)) getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(priority))
]; ];
TRACE_1("Proiroity Array",_array); (_array call CBA_fnc_findMax) params ["", ["_indexOfMaxPriority", 0, [0]]];
/* for CBA Upadte 2.1 TRACE_2("Priority Array",_array,_indexOfMaxPriority);
_priority = _array call CBA_fnc_findMax;
_type = if (isNil "_priority") then {
0
} else {
_priority select 1
};
*/
// obsolete as CBA Update 2.1 start
_array params ["_max"];
// set Default type
_type = 0;
// get Highest Entry out the the Priority Array
{
if (_max < _x) then {
_max = _x;
_type = _forEachIndex;
};
} forEach _array;
// obsolete end
TRACE_2("Highest Value",_max,_type);
// create the Config entry Point // create the Config entry Point
_config = [ private _config = [
(configFile >> "CfgWeapons" >> _weapon), (configFile >> "CfgWeapons" >> _weapon),
(configFile >> "CfgMagazines" >> _magazine), (configFile >> "CfgMagazines" >> _magazine),
(configFile >> "CfgAmmo" >> _ammo) (configFile >> "CfgAmmo" >> _ammo)
] select _type; ] select _indexOfMaxPriority;
TRACE_1("ConfigPath",_config); TRACE_1("ConfigPath",_config);
// get the Variables out of the Configes and create a array with then // get the Variables out of the Configes and create a array with then
_return = [ private _return = [
(getNumber (_config >> QGVAR(angle))), (getNumber (_config >> QGVAR(angle))),
(getNumber (_config >> QGVAR(range))), (getNumber (_config >> QGVAR(range))),
(getNumber (_config >> QGVAR(damage))) (getNumber (_config >> QGVAR(damage)))
]; ];
TRACE_1("Return",_return);
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
missionNameSpace setVariable [format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine], _return]; missionNameSpace setVariable [_varName, _return];
TRACE_2("Return",_varName,_return);
_return _return

View File

@ -1,7 +1,7 @@
/* /*
* Author: commy2 and esteldunedain * Author: commy2 and esteldunedain
*
* Handle fire of local launchers * Handle fire of local launchers
* Called from firedEHBB, only for ace_player with shot that will cause damage
* *
* Arguments: * Arguments:
* 0: Unit that fired <OBJECT> * 0: Unit that fired <OBJECT>
@ -14,51 +14,46 @@
* *
* Return value: * Return value:
* None * None
*
* Example:
* [player, "launch_RPG32_F", "launch_RPG32_F", "Single", "R_PG32V_F", "RPG32_F", projectile] call ace_overpressure_fnc_fireLauncherBackblast;
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; params ["_firer", "_weapon", "_muzzle", "", "_ammo", "_magazine", "_projectile"];
TRACE_6("params",_firer,_weapon,_muzzle,_ammo,_magazine,_projectile);
// Prevent AI from causing backblast damage private _position = getPosASL _projectile;
if !([_firer] call EFUNC(common,isPlayer)) exitWith {}; private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
private ["_position", "_direction"];
_position = getPosASL _projectile;
_direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
private ["_var","_varName","_backblastAngle", "_backblastRange", "_backblastDamage"];
// Bake variable name and check if the variable exists, call the caching function otherwise // Bake variable name and check if the variable exists, call the caching function otherwise
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
_var = if (isNil _varName) then { private _var = if (isNil _varName) then {
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
} else { } else {
missionNameSpace getVariable _varName; missionNameSpace getVariable _varName;
}; };
_var params["_backblastAngle","_backblastRange","_backblastDamage"]; _var params["_backblastAngle","_backblastRange","_backblastDamage"];
TRACE_3("cache",_backblastAngle,_backblastRange,_backblastDamage);
// Damage to others // Damage to others
private "_affected"; private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange];
_affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange];
// Let each client handle their own affected units // Let each client handle their own affected units
["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); ["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
// Damage to the firer // Damage to the firer
private "_distance"; private _distance = 2 * ([_position, _direction, _backblastRange, _firer] call FUNC(getDistance));
_distance = 2 * ([_position, _direction, _backblastRange, _firer] call FUNC(getDistance));
TRACE_1("Distance",_distance); TRACE_1("Distance",_distance);
if (_distance < _backblastRange) then { if (_distance < _backblastRange) then {
private ["_alpha", "_beta", "_damage"]; private _alpha = sqrt (1 - _distance / _backblastRange);
private _beta = sqrt 0.5;
_alpha = sqrt (1 - _distance / _backblastRange); private _damage = _alpha * _beta * _backblastDamage;
_beta = sqrt 0.5;
_damage = _alpha * _beta * _backblastDamage;
[_damage * 100] call BIS_fnc_bloodEffect; [_damage * 100] call BIS_fnc_bloodEffect;
if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_firer] call EFUNC(medical,hasMedicalEnabled))}) then { if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_firer] call EFUNC(medical,hasMedicalEnabled))}) then {
@ -75,8 +70,7 @@ if (_distance < _backblastRange) then {
[1,1,0,1] [1,1,0,1]
] call EFUNC(common,addLineToDebugDraw); ] call EFUNC(common,addLineToDebugDraw);
private "_ref"; private _ref = _direction call EFUNC(common,createOrthonormalReference);
_ref = _direction call EFUNC(common,createOrthonormalReference);
[ _position, [ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle),
[1,1,0,1] [1,1,0,1]

View File

@ -1,10 +1,10 @@
/* /*
* Author: commy2 and esteldunedain * Author: commy2 and esteldunedain
*
* Handle fire of local vehicle weapons creating overpressure zones * Handle fire of local vehicle weapons creating overpressure zones
* Called from firedEHOP, only for local vehicles
* *
* Arguments: * Arguments:
* 0: Unit that fired <OBJECT> * 0: Vehicle that fired <OBJECT>
* 1: Weapon fired <STRING> * 1: Weapon fired <STRING>
* 2: Muzzle <STRING> * 2: Muzzle <STRING>
* 3: Mode <STRING> * 3: Mode <STRING>
@ -14,33 +14,35 @@
* *
* Return value: * Return value:
* None * None
*
* Example:
* [tank, "cannon_125mm", "cannon_125mm", "player", "Sh_125mm_APFSDS_T_Green", "24Rnd_125mm_APFSDS_T_Green", projectile] call ace_overpressure_fnc_fireOverpressureZone
*
* Public: No
*/ */
//#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; params ["_firer", "_weapon", "_muzzle", "", "_ammo", "_magazine", "_projectile"];
// Prevent AI from causing overpressure damage TRACE_6("params",_firer,_weapon,_muzzle,_ammo,_magazine,_projectile);
if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets?
private ["_position", "_direction"]; // Prevent AI from causing overpressure damage (NOTE: Vehicle is local, but turret gunner may not be)
if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {};
_position = getPosASL _projectile; private _position = getPosASL _projectile;
_direction = vectorDir _projectile; private _direction = vectorDir _projectile;
private ["_var", "_varName", "_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
// Bake variable name and check if the variable exists, call the caching function otherwise // Bake variable name and check if the variable exists, call the caching function otherwise
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
_var = if (isNil _varName) then { private _var = if (isNil _varName) then {
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
} else { } else {
missionNameSpace getVariable _varName; missionNameSpace getVariable _varName;
}; };
_var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; _var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"];
TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage);
// Damage to others // Damage to others
private "_affected"; private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange];
_affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange];
// Let each client handle their own affected units // Let each client handle their own affected units
["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); ["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
@ -52,8 +54,7 @@ _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange];
[1,0,0,1] [1,0,0,1]
] call EFUNC(common,addLineToDebugDraw); ] call EFUNC(common,addLineToDebugDraw);
private "_ref"; private _ref = _direction call EFUNC(common,createOrthonormalReference);
_ref = _direction call EFUNC(common,createOrthonormalReference);
[ _position, [ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
[1,1,0,1] [1,1,0,1]

View File

@ -1,6 +1,5 @@
/* /*
* Author: joko // Jonas * Author: joko // Jonas
*
* Handle fire of local launchers * Handle fire of local launchers
* *
* Arguments: * Arguments:
@ -14,14 +13,22 @@
* *
* Return value: * Return value:
* None * None
*
* Example:
* [player, "launch_RPG32_F", "launch_RPG32_F", "Single", "R_PG32V_F", "RPG32_F", projectile] call ace_overpressure_fnc_firedEHBB;
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_damage","_varName"];
params ["", "_weapon", "", "", "_ammo", "_magazine", ""]; params ["_firer", "_weapon", "", "", "_ammo", "_magazine", ""];
// Prevent AI from causing backblast damage (fast exit to only run for local players)
if (_firer != ACE_player) exitWith {};
// Bake variable name and check if the variable exists, call the caching function otherwise // Bake variable name and check if the variable exists, call the caching function otherwise
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
_damage = if (isNil _varName) then { private _damage = if (isNil _varName) then {
([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2; ([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2;
} else { } else {
(missionNameSpace getVariable _varName) select 2; (missionNameSpace getVariable _varName) select 2;

View File

@ -1,10 +1,9 @@
/* /*
* Author: joko // Jonas * Author: joko // Jonas
* * Handle fire of Vehicle Weapons
* Handle fire of Other Weapons
* *
* Arguments: * Arguments:
* 0: Unit that fired <OBJECT> * 0: Vehicle that fired (XEH will filter only local) <OBJECT>
* 1: Weapon fired <STRING> * 1: Weapon fired <STRING>
* 2: Muzzle <STRING> * 2: Muzzle <STRING>
* 3: Mode <STRING> * 3: Mode <STRING>
@ -14,14 +13,19 @@
* *
* Return value: * Return value:
* None * None
*
* Example:
* [tank, "cannon_125mm", "cannon_125mm", "player", "Sh_125mm_APFSDS_T_Green", "24Rnd_125mm_APFSDS_T_Green", projectile] call ace_overpressure_fnc_firedEHOP
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_damage","_varName"];
params ["", "_weapon", "", "", "_ammo", "_magazine", ""]; params ["", "_weapon", "", "", "_ammo", "_magazine", ""];
// Bake variable name and check if the variable exists, call the caching function otherwise // Bake variable name and check if the variable exists, call the caching function otherwise
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
_damage = if (isNil _varName) then { private _damage = if (isNil _varName) then {
([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2; ([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2;
} else { } else {
(missionNameSpace getVariable _varName) select 2; (missionNameSpace getVariable _varName) select 2;

View File

@ -1,6 +1,5 @@
/* /*
* Author: commy2 and esteldunedain * Author: commy2 and esteldunedain
*
* Calculate the distance to the first intersection of a line * Calculate the distance to the first intersection of a line
* *
* Arguments: * Arguments:
@ -15,11 +14,12 @@
* Example: * Example:
* [[1823.41,5729.05,6.66627], [-0.953255,0.109689,-0.281554], 15, ace_player] call ace_overpressure_fnc_getDistance * [[1823.41,5729.05,6.66627], [-0.953255,0.109689,-0.281554], 15, ace_player] call ace_overpressure_fnc_getDistance
* *
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_posASL", "_direction", "_maxDistance", "_shooter"]; params ["_posASL", "_direction", "_maxDistance", "_shooter"];
TRACE_3("params",_posASL,_direction,_maxDistance); 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, objNull, true, 99];
@ -29,9 +29,10 @@ private _distance = 999;
{ {
_x params ["_intersectPosASL", "_surfaceNormal", "_intersectObject"]; _x params ["_intersectPosASL", "_surfaceNormal", "_intersectObject"];
TRACE_3("Intersect",_intersectPosASL,_surfaceNormal,_intersectObject);
//Hit something solid that can reflect - (Static covers Building)
if ((isNull _intersectObject) || {(_intersectObject isKindOf "Static") || {_intersectObject isKindOf "AllVehicles"}}) exitWith { //Hit something solid that can reflect - (Static covers Building) [Need to manually filter out _shoot for FFV shots]
if ((isNull _intersectObject) || {(_intersectObject != _shooter) && {(_intersectObject isKindOf "Static") || {_intersectObject isKindOf "AllVehicles"}}}) exitWith {
_distance = _posASL vectorDistance _intersectPosASL; _distance = _posASL vectorDistance _intersectPosASL;
TRACE_3("hit solid object",_distance,_intersectObject,typeOf _intersectObject); TRACE_3("hit solid object",_distance,_intersectObject,typeOf _intersectObject);

View File

@ -1,56 +1,56 @@
/* /*
* Author: commy2 and esteldunedain * Author: commy2 and esteldunedain
*
* Calculate and apply backblast damage to potentially affected local units * Calculate and apply backblast damage to potentially affected local units
* Handles the "overpressure" event.
* *
* Argument: * Argument:
* 0: Unit that fired <OBJECT> * 0: Unit that fired <OBJECT>
* 1: Pos ASL of the projectile <ARRAY> * 1: Pos ASL of the projectile <ARRAY>
* 2: Direction of the projectile <ARRAY> * 2: Direction of the projectile (reversed for launcher backblast) <ARRAY>
* 3: Weapon fired <STRING> * 3: Weapon fired <STRING>
* 4: Magazine <STRING> * 4: Magazine <STRING>
* 5: Ammo <STRING> * 5: Ammo <STRING>
* *
* Return value: * Return value:
* None * None
*
* Example:
* [tank, [1727.57,5786.15,7.24899], [-0.982474,-0.185998,-0.0122501], "cannon_125mm", "24Rnd_125mm_APFSDS_T_Green", "Sh_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_overpressureDamage
*
* Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_var","_overpressureAngle", "_overpressureRange", "_overpressureDamage"];
params ["_firer", "_posASL", "_direction", "_weapon", "_magazine", "_ammo"]; params ["_firer", "_posASL", "_direction", "_weapon", "_magazine", "_ammo"];
// Bake variable name and check if the variable exists, call the caching function otherwise // Bake variable name and check if the variable exists, call the caching function otherwise
_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
_var = if (isNil _varName) then { private _var = if (isNil _varName) then {
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
} else { } else {
missionNameSpace getVariable _varName; missionNameSpace getVariable _varName;
}; };
_var params["_overpressureAngle","_overpressureRange","_overpressureDamage"]; _var params["_overpressureAngle","_overpressureRange","_overpressureDamage"];
TRACE_3("cache",_overpressureAngle,_overpressureRange,_overpressureDamage);
TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon);
{ {
if (local _x && {_x != _firer} && {vehicle _x == _x}) then { if (local _x && {_x != _firer} && {vehicle _x == _x}) then {
private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"]; private _targetPositionASL = eyePos _x;
private _relativePosition = _targetPositionASL vectorDiff _posASL;
private _axisDistance = _relativePosition vectorDotProduct _direction;
private _distance = vectorMagnitude _relativePosition;
private _angle = acos (_axisDistance / _distance);
_targetPositionASL = eyePos _x; private _line = [_posASL, _targetPositionASL, _firer, _x];
_relativePosition = _targetPositionASL vectorDiff _posASL; private _line2 = [_posASL, _targetPositionASL];
_axisDistance = _relativePosition vectorDotProduct _direction;
_distance = vectorMagnitude _relativePosition;
_angle = acos (_axisDistance / _distance);
_line = [_posASL, _targetPositionASL, _firer, _x];
_line2 = [_posASL, _targetPositionASL];
TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); TRACE_4("Affected:",_x,_axisDistance,_distance,_angle);
if (_angle < _overpressureAngle && {_distance < _overpressureRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { if (_angle < _overpressureAngle && {_distance < _overpressureRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then {
private ["_alpha", "_beta", "_damage"];
_alpha = sqrt (1 - _distance / _overpressureRange); private _alpha = sqrt (1 - _distance / _overpressureRange);
_beta = sqrt (1 - _angle / _overpressureAngle); private _beta = sqrt (1 - _angle / _overpressureAngle);
_damage = _alpha * _beta * _overpressureDamage; private _damage = _alpha * _beta * _overpressureDamage;
// If the target is the ACE_player // If the target is the ACE_player
if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect};
@ -60,6 +60,14 @@ TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,
} else { } else {
_x setDamage (damage _x + _damage); _x setDamage (damage _x + _damage);
}; };
#ifdef DEBUG_MODE_FULL
//Shows damage lines in green
[ _posASL,
_targetPositionASL,
[0,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
#endif
}; };
}; };
} forEach ((ASLtoAGL _posASL) nearEntities ["CAManBase", _overpressureRange]); } forEach ((ASLtoAGL _posASL) nearEntities ["CAManBase", _overpressureRange]);

View File

@ -1,6 +1,8 @@
#define COMPONENT overpressure #define COMPONENT overpressure
#include "\z\ace\addons\main\script_mod.hpp" #include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
#ifdef DEBUG_ENABLED_OVERPRESSURE #ifdef DEBUG_ENABLED_OVERPRESSURE
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
#endif #endif