After working and figuring out all details about workings of UAV Terminals I figured that they're pretty buggy and hard to be fixed through scripting. Here is collection of missing scripting commands that are needed to make working with terminals much easier.
1. No way to disconnect UAV from terminal if its not equipped by the player
connectTerminalToUAV can only disconnect if terminal is equipped by the player, I originally wanted to suggest extending the command to make objNull connectTerminalToUAV uav disconnect the UAV from whatever it was connected to, but this has a slight potential for backwards compatibility issues.
- Solution: Introduce new command: BOOL = disconnectUAV ENTITY
ENTITY is UAV vehicle
BOOL returns true if it was connected and disconnected, false if it wasn't connected and disconnection wasn't needed
2. No way to get terminal that UAV is connected to
isUAVConnected only returns a flag but nothing about terminal and where it is.
- Solution: Introduce new command: ARRAY = getConnectedTerminal ENTITY
ENTITY is UAV that might be connected to some terminal
ARRAY consists of [ENTITY, STRING] with ENTITY being vehicle that holds the terminal: player's backpack, ground weapon holder, a vehicle, player unit (assigned to GPS slot) and STRING is terminal class name.
Return empty array if UAV is not connected anywhere.
3. No way to get which player\unit controls certain UAV unit
Right now there is no easy way to know which player\unit controls certain UAV unit, you can only get a link from unit with getConnectedUAVUnit but this will require you to walk through all units in the game.
- Solution: Introduce getter commands for remote control: ENTITY = getRemoteControlBy ENTITY, I have a dedicated ticket about this problem: T171207