fnc_emp_enableVehicle.sqf 977 B

123456789101112131415161718192021222324252627282930313233343536
  1. params["_vehicle"];
  2. if!(local _vehicle) exitWith { };
  3. diag_log format["[RD501][Vehicle EMP] Enabling Vehicle '%1'", _vehicle];
  4. _vehicle allowCrewInImmobile false;
  5. _vehicle lock 0;
  6. {
  7. _x setBehaviour "AWARE";
  8. _x setCombatMode "YELLOW";
  9. _x enableAI "TARGET";
  10. _x enableAI "AUTOTARGET";
  11. _x enableAI "MOVE";
  12. _x enableAI "FSM";
  13. } forEach crew _vehicle;
  14. (getAllHitPointsDamage _vehicle) params [["_allHitPoints", []]];
  15. {
  16. private _isEngineLower = (_x find "engine") != -1;
  17. private _isEngineUpper = (_x find "Engine") != -1;
  18. if(_isEngineLower || _isEngineUpper) then {
  19. _vehicle setHitPointDamage [_x, 0];
  20. diag_log format["[RD501][Vehicle EMP] Repairing %1", _x];
  21. };
  22. private _isTurretLower = (_x find "turret") != -1;
  23. private _isTurretUpper = (_x find "Turret") != -1;
  24. if(_isEngineLower || _isEngineUpper) then {
  25. _vehicle setHitPointDamage [_x, 0];
  26. diag_log format["[RD501][Vehicle EMP] Repairing %1", _x];
  27. };
  28. } forEach _allHitPoints;
  29. _vehicle engineOn true;