mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Overpresure - Misc fixes
- Fix passing magazine/ammo to overpressure event - Use AGL for nearEntities - Fix getDistance returning nil
This commit is contained in:
parent
99852f2071
commit
391bfc160a
@ -41,10 +41,10 @@ _var params["_backblastAngle","_backblastRange","_backblastDamage"];
|
||||
|
||||
// Damage to others
|
||||
private "_affected";
|
||||
_affected = getPos _projectile nearEntities ["CAManBase", _backblastRange];
|
||||
_affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange];
|
||||
|
||||
// Let each client handle their own affected units
|
||||
["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent);
|
||||
["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
|
||||
|
||||
// Damage to the firer
|
||||
private "_distance";
|
||||
|
@ -40,7 +40,7 @@ _var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"];
|
||||
|
||||
// Damage to others
|
||||
private "_affected";
|
||||
_affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange];
|
||||
_affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange];
|
||||
|
||||
// Let each client handle their own affected units
|
||||
["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
|
||||
|
@ -13,7 +13,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_3_PVT(_this,_posASL,_direction,_maxDistance);
|
||||
params ["_posASL", "_direction", "_maxDistance"];
|
||||
TRACE_3("params",_posASL,_direction,_maxDistance);
|
||||
|
||||
private ["_distance", "_interval", "_line", "_intersections", "_terrainIntersect", "_lastTerrainIntersect"];
|
||||
|
||||
@ -42,20 +43,21 @@ while {
|
||||
};
|
||||
|
||||
_distance = _distance + ([1, -1] select (_intersections > 0 || _terrainIntersect)) * _interval;
|
||||
|
||||
if (_distance > _maxDistance) exitWith {_distance = 999};
|
||||
};
|
||||
|
||||
TRACE_4("while done",_distance,_maxDistance,_terrainIntersect,_lastTerrainIntersect);
|
||||
|
||||
if (_distance > _maxDistance) exitWith {_distance};
|
||||
|
||||
// If the intersection was with the terrain, check slope
|
||||
if (_terrainIntersect || _lastTerrainIntersect) exitWith {
|
||||
if (_terrainIntersect || _lastTerrainIntersect) then {
|
||||
private ["_slope","_angle"];
|
||||
_slope = surfaceNormal (_posASL vectorAdd (_direction vectorMultiply _distance));
|
||||
// Calculate the angle between the terrain and the back blast direction
|
||||
_angle = 90 - acos (- (_slope vectorDotProduct _direction));
|
||||
|
||||
//systemChat format ["Angle: %1", _angle];
|
||||
TRACE_3("Terrain Intersect",_slope,_direction,_angle);
|
||||
// Angles is below 25º, no backblast at all
|
||||
if (_angle < 25) exitWith {_distance = 999};
|
||||
// Angles is below 45º the distance is increased according to the difference
|
||||
|
@ -30,12 +30,6 @@ _var params["_overpressureAngle","_overpressureRange","_overpressureDamage"];
|
||||
|
||||
TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon);
|
||||
|
||||
private "_pos";
|
||||
_pos = _posASL;
|
||||
if (!surfaceIsWater _pos) then {
|
||||
_pos = ASLtoATL _pos;
|
||||
};
|
||||
|
||||
{
|
||||
if (local _x && {_x != _firer} && {vehicle _x == _x}) then {
|
||||
private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"];
|
||||
@ -68,4 +62,4 @@ if (!surfaceIsWater _pos) then {
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach (_pos nearEntities ["CAManBase", _overpressureRange]);
|
||||
} forEach ((ASLtoAGL _posASL) nearEntities ["CAManBase", _overpressureRange]);
|
||||
|
Loading…
Reference in New Issue
Block a user