mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Avoid overshooting target
This commit is contained in:
parent
f7bd523221
commit
395b2b2d12
@ -28,7 +28,7 @@ if (isServer) then {
|
|||||||
|
|
||||||
[QGVAR(registerInterceptor), {
|
[QGVAR(registerInterceptor), {
|
||||||
params ["_interceptor", "_target"];
|
params ["_interceptor", "_target"];
|
||||||
GVAR(interceptors) pushBack [_interceptor, _target, getPosASLVisual _interceptor];
|
GVAR(interceptors) pushBack [_interceptor, _target, getPosASLVisual _interceptor, _interceptor distance _target];
|
||||||
[GVAR(toBeShot), _target] call CBA_fnc_hashRem;
|
[GVAR(toBeShot), _target] call CBA_fnc_hashRem;
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GVAR(interceptors) = GVAR(interceptors) select {
|
GVAR(interceptors) = GVAR(interceptors) select {
|
||||||
_x params ["_projectile", "_target", "_lastPosition"];
|
_x params ["_projectile", "_target", "_lastPosition", "_lastDistance"];
|
||||||
// Sweep along path to ensure we don't overshoot target
|
// Sweep along path to ensure we don't overshoot target
|
||||||
private _minDistance = 0;
|
private _minDistance = 0;
|
||||||
|
|
||||||
@ -35,13 +35,17 @@ GVAR(interceptors) = GVAR(interceptors) select {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_x set [2, _currentPosition];
|
_x set [2, _currentPosition];
|
||||||
|
_x set [3, _minDistance];
|
||||||
|
|
||||||
#ifdef DRAW_TRACKING_INFO
|
#ifdef DRAW_TRACKING_INFO
|
||||||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0,0,1,1], (getPos _target) vectorAdd [0, 0, 0.5], 0.75, 0.75, 0, format ["%1m", _minDistance], 1, 0.025, "TahomaB"];
|
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [0,0,1,1], (getPos _target) vectorAdd [0, 0, 0.5], 0.75, 0.75, 0, format ["%1m", _minDistance], 1, 0.025, "TahomaB"];
|
||||||
#endif
|
#endif
|
||||||
if (!alive _target || { _minDistance <= PROX_RANGE }) then {
|
if (!alive _target || { _minDistance <= PROX_RANGE } || { _minDistance > _lastDistance }) then {
|
||||||
triggerAmmo _projectile;
|
triggerAmmo _projectile;
|
||||||
|
// if we overshot target, dont take out target
|
||||||
|
if (_minDistance <= _lastDistance) then {
|
||||||
deleteVehicle _target;
|
deleteVehicle _target;
|
||||||
|
};
|
||||||
false
|
false
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
|
Loading…
Reference in New Issue
Block a user