mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
1439680795
* 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>
96 lines
3.7 KiB
Plaintext
96 lines
3.7 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: joko // Jonas
|
|
* Handle fire of local launchers. Called from the unified fired EH only for the local player.
|
|
*
|
|
* Arguments:
|
|
* None. Parameters inherited from EFUNC(common,firedEH)
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [player, "launch_RPG32_F", "launch_RPG32_F", "Single", "R_PG32V_F", "RPG32_F", projectile] call ace_overpressure_fnc_firedEHBB;
|
|
*
|
|
* 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 backblast values
|
|
private _bbValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues);
|
|
|
|
_bbValues params ["_backblastAngle", "_backblastRange", "_backblastDamage", "_offset"];
|
|
_backblastRange = _backblastRange * GVAR(backblastDistanceCoefficient);
|
|
|
|
TRACE_4("cache",_backblastAngle,_backblastRange,_backblastDamage,_offset);
|
|
|
|
if (_backblastDamage <= 0) exitWith {};
|
|
|
|
private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
|
|
private _position = ((getPosASL _projectile) vectorAdd (_direction vectorMultiply _offset));
|
|
|
|
// Damage to others
|
|
private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange];
|
|
|
|
// Let each client handle their own affected units
|
|
["ace_overpressure", [_unit, _position, _direction, _weapon, _magazine, _ammo], _affected] call CBA_fnc_targetEvent;
|
|
|
|
// Damage to the firer
|
|
private _distance = 2 * ([_position, _direction, _backblastRange, _unit] call FUNC(getDistance));
|
|
|
|
TRACE_1("Distance",_distance);
|
|
|
|
if (_distance < _backblastRange) then {
|
|
TRACE_2("",isDamageAllowed _unit,_unit getVariable [ARR_2(QEGVAR(medical,allowDamage),true)]);
|
|
|
|
// 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;
|
|
|
|
private _damage = _alpha * _beta * _backblastDamage;
|
|
TRACE_1("",_damage);
|
|
|
|
[_damage * 100] call BIS_fnc_bloodEffect;
|
|
|
|
if (GETEGVAR(medical,enabled,false)) then {
|
|
[_unit, _damage, "body", "backblast", _unit] call EFUNC(medical,addDamageToUnit);
|
|
} else {
|
|
_unit setDamage (damage _unit + _damage);
|
|
};
|
|
};
|
|
};
|
|
|
|
// Draw debug lines
|
|
#ifdef DEBUG_MODE_FULL
|
|
[ _position,
|
|
_position vectorAdd (_direction vectorMultiply _backblastRange),
|
|
[1,1,0,1]
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
|
|
private _ref = _direction call EFUNC(common,createOrthonormalReference);
|
|
[ _position,
|
|
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle),
|
|
[1,1,0,1]
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
[ _position,
|
|
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle),
|
|
[1,1,0,1]
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
[ _position,
|
|
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle),
|
|
[1,1,0,1]
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
[ _position,
|
|
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle),
|
|
[1,1,0,1]
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
|
|
[ _position,
|
|
_position vectorAdd (_direction vectorMultiply ((_distance/2) min _backblastRange)),
|
|
[1,0,0,1]
|
|
] call EFUNC(common,addLineToDebugDraw);
|
|
#endif
|