2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-07-10 22:09:20 +00:00
|
|
|
/*
|
|
|
|
* Author: joko // Jonas
|
2016-02-06 21:17:27 +00:00
|
|
|
* Handle fire of Vehicle Weapons. Called from the unified fired EH only for the local player vehicle.
|
2015-07-10 22:09:20 +00:00
|
|
|
*
|
2015-08-30 05:35:58 +00:00
|
|
|
* Arguments:
|
2016-02-06 21:17:27 +00:00
|
|
|
* None. Parameters inherited from EFUNC(common,firedEH)
|
2015-07-10 22:09:20 +00:00
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-07-10 22:09:20 +00:00
|
|
|
* None
|
2016-01-16 14:04:22 +00:00
|
|
|
*
|
|
|
|
* 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
|
2015-07-10 22:09:20 +00:00
|
|
|
*/
|
2016-01-16 14:04:22 +00:00
|
|
|
|
2016-02-06 21:17:27 +00:00
|
|
|
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
|
2024-02-05 17:04:24 +00:00
|
|
|
TRACE_10("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_vehicle,_gunner,_turret);
|
2015-08-30 05:35:58 +00:00
|
|
|
|
2022-08-01 17:32:02 +00:00
|
|
|
// Retrieve overpressure values
|
|
|
|
private _opValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues);
|
|
|
|
|
|
|
|
_opValues params ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
|
2024-06-20 20:30:33 +00:00
|
|
|
_dangerZoneRange = _dangerZoneRange * GVAR(overpressureDistanceCoefficient);
|
|
|
|
|
2016-02-06 21:17:27 +00:00
|
|
|
TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage);
|
2015-08-30 05:35:58 +00:00
|
|
|
|
2016-02-06 21:17:27 +00:00
|
|
|
if (_dangerZoneDamage <= 0) exitWith {};
|
|
|
|
|
|
|
|
// The weapon produces overpressure, calculate
|
|
|
|
private _position = getPosASL _projectile;
|
|
|
|
private _direction = vectorDir _projectile;
|
|
|
|
|
|
|
|
// Damage to others
|
|
|
|
private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange];
|
|
|
|
|
|
|
|
// Let each client handle their own affected units
|
2016-05-24 13:13:11 +00:00
|
|
|
["ace_overpressure", [_unit, _position, _direction, _weapon, _magazine, _ammo], _affected] call CBA_fnc_targetEvent;
|
2016-02-06 21:17:27 +00:00
|
|
|
|
|
|
|
// Draw debug lines
|
|
|
|
#ifdef DEBUG_MODE_FULL
|
|
|
|
[ _position,
|
|
|
|
_position vectorAdd (_direction vectorMultiply _dangerZoneRange),
|
|
|
|
[1,0,0,1]
|
|
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
|
|
|
|
|
|
private _ref = _direction call EFUNC(common,createOrthonormalReference);
|
|
|
|
[ _position,
|
|
|
|
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
|
|
|
|
[1,1,0,1]
|
|
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
|
|
[ _position,
|
|
|
|
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
|
|
|
|
[1,1,0,1]
|
|
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
|
|
[ _position,
|
|
|
|
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
|
|
|
|
[1,1,0,1]
|
|
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
|
|
[ _position,
|
|
|
|
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
|
|
|
|
[1,1,0,1]
|
|
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
|
|
|
|
|
|
#endif
|