fn_remoteControlUav.sqf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. Name: cTab_fnc_remoteControlUav
  3. Author(s):
  4. Gundy
  5. Description:
  6. Take control of the currently selected UAV's gunner turret
  7. Parameters:
  8. NONE
  9. Returns:
  10. BOOLEAN - TRUE
  11. Example:
  12. [] call cTab_fnc_remoteControlUav;
  13. */
  14. private ["_uavGunner"];
  15. // see if there is a selected UAV and if it is alive before continuing
  16. if (isNil 'cTabActUav' || {!alive cTabActUav}) exitWith {false};
  17. // make sure there is noone currently controlling the gunner seat
  18. // unfortunately this fails as soon as there is a driver connected as only one unit is returned using UAVControl and it will alwasys be the driver if present.
  19. // see http://feedback.arma3.com/view.php?id=23693
  20. if (UAVControl cTabActUav select 1 != "GUNNER") then {
  21. // see if there is actually a gunner AI that we can remote control
  22. _uavGunner = gunner cTabActUav;
  23. if (!isNull _uavGunner) then {
  24. [] call cTab_fnc_close;
  25. player remoteControl _uavGunner;
  26. cTabActUav switchCamera "Gunner";
  27. cTabUavViewActive = true;
  28. // spawn a loop in-case control of the UAV is released elsewhere
  29. cTabActUav spawn {
  30. waitUntil {(cameraOn != _this) || (!cTabUavViewActive)};
  31. cTabUavViewActive = false;
  32. };
  33. } else {
  34. // show notification
  35. ["UAV","No gunner optics available",5] call cTab_fnc_addNotification;
  36. };
  37. } else {
  38. // show notification
  39. ["UAV","Another user has control",5] call cTab_fnc_addNotification;
  40. };
  41. true