Destroy projectile on all clients

The projectile needs to be destroyed on all clients to stop it from being simulated. If not destroyed where projectile is local, it will still explode when hitting the ground. If not destroyed on remote clients, the projectile will still be visible but deal no damage
This commit is contained in:
Brandon Danyluk 2021-07-02 17:47:15 -06:00
parent d8eb425ece
commit d50491f44f
2 changed files with 7 additions and 1 deletions

View File

@ -90,5 +90,11 @@ GVAR(projectilesToIntercept) = [];
};
}] call CBA_fnc_addClassEventHandler;
// Needed on all clients to properly destroy it. Despite the fact that deleteVehicle is AG EG, unless if you delete it on all clients there will still be missiles seen
[QGVAR(destroyProjectile), {
params ["_projectile"];
deleteVehicle _projectile;
}] call CBA_fnc_addEventHandler;
ADDON = true;

View File

@ -45,7 +45,7 @@ GVAR(interceptors) = GVAR(interceptors) select {
// if we overshot target, dont take out target
if (_minDistance <= _lastDistance && { GVAR(proximityFuseFailureChance) <= random 1 }) then {
private _explosion = createVehicle ["SmallSecondary", _target, [], 0, "CAN_COLLIDE"];
deleteVehicle _target;
[QGVAR(destroyProjectile), [_target]] call CBA_fnc_globalEvent;
};
false
} else {