fnc_emp_disableVehicle.sqf 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. params["_vehicle"];
  2. if!(local _vehicle) exitWith { diag_log "[RD501][Vehicle EMP] Exiting disable because not local"; };
  3. diag_log format["[RD501][Vehicle EMP] Disabling Vehicle '%1'", _vehicle];
  4. _vehicle allowCrewInImmobile true;
  5. _vehicle lock 2;
  6. {
  7. _x setBehaviour "CARELESS";
  8. _x setCombatMode "BLUE";
  9. _x disableAI "TARGET";
  10. _x disableAI "AUTOTARGET";
  11. _x disableAI "MOVE";
  12. _x disableAI "FSM";
  13. } forEach crew _vehicle;
  14. (getAllHitPointsDamage _vehicle) params [["_allHitPoints", []]];
  15. _fnc_matchesAnyTurret = {
  16. params["_hitpoint"];
  17. private _found = false;
  18. {
  19. if(_hitpoint find _x != -1) exitWith {
  20. _found = true;
  21. };
  22. } forEach ["turret","Turret","vez","Vez","zbran","Zbran","gun","Gun"];
  23. _found
  24. };
  25. {
  26. private _isEngineLower = (_x find "engine") != -1;
  27. private _isEngineUpper = (_x find "Engine") != -1;
  28. if(_isEngineLower || _isEngineUpper) then {
  29. _vehicle setHitPointDamage [_x, 1, true];
  30. diag_log format["[RD501][Vehicle EMP] Damaging %1", _x];
  31. };
  32. private _isTurret = [_x] call _fnc_matchesAnyTurret;
  33. if(_isTurret) then {
  34. _vehicle setHitPointDamage [_x, 1, true];
  35. diag_log format["[RD501][Vehicle EMP] Damaging %1", _x];
  36. };
  37. } forEach _allHitPoints;