ACE3/addons/overpressure/functions/fnc_firedEHOP.sqf
bluefield 1439680795
Overpressure - Separate backblast and overpressure range coefficient (#10070)
* feat: separate overpressure and backblast configurations

* documentation: remove undefined return

* typo: trace macro padding

* refactor: add range<number> return

* refactor: reuse return values for overpressure coef

* refactor: reuse return values for backblast coef

* whitespace

Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>

* headers

Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* feat: change backblast limit to 0

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* remove: deleted ACE_Settings.hpp

* fix: update postInit.sqf event handler to register new GVARs

* fix: remove `ACE_Settings.hpp`

* typo: add spacing

Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>

* typo: fix spacing

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* feat: switch distanceCoef minimun value to 0

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* typo: update the slider checks with new minimuns

temporary solution until i figure out the EH

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* feat: new stringable elements

* Update stringtable.xml

* Added translations

* Switched order of settings to match age of settings

* setting require restart, split adding firedEH

* Added notifications about mission restart

---------

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2024-06-20 22:30:33 +02:00

67 lines
2.7 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: joko // Jonas
* Handle fire of Vehicle Weapons. Called from the unified fired EH only for the local player vehicle.
*
* Arguments:
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* 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
*/
//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);
// Retrieve overpressure values
private _opValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues);
_opValues params ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"];
_dangerZoneRange = _dangerZoneRange * GVAR(overpressureDistanceCoefficient);
TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage);
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
["ace_overpressure", [_unit, _position, _direction, _weapon, _magazine, _ammo], _affected] call CBA_fnc_targetEvent;
// 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