Space Engineers

Space Engineers

Drone/Utility Ship Manager
This topic has been locked
ZerothAngel  [developer] 8 Feb, 2016 @ 1:07pm
Smart Undock
The Smart Undock module automates undocking and adds a simple "return-to-base" feature. It is not a fully automated docking script. It is best used when the mothership is mobile i.e. not a station.

The script adds 3 new commands accessed by sending an argument to the script's programmable block.

The commands are:
  • smartundock -- This is similar to the Docking Manager's "undock" command. It will activate all flight systems (and any configured blocks), unlock the connector & any landing gear, and finally disable all connectors.

    Then it takes it a step further. If a connector was actually unlocked, the ship will thrust 50 meters away from the mothership. This point 50 meters away will be saved as the "undock point."

    If no connector was unlocked, then any saved undock point is erased.

    The undock point is saved in such a way so that it will persist even through the loading/saving of the world. So keep that in mind. If you use this module, you should always undock using "smartundock" rather than the "undock" command or the 'P' key.

  • rtb -- This is the "return-to-base" command. If there is a saved undock point, the ship will point to it and then thrust there at the configured speed (default 25 m/s).

    Note that the RTB autopilot is dumb and will fly in a beeline toward the undock point. Make sure you have clear line of sight to the undock point (which is 50m "away" from the mothership's connector).

    If there is no saved undock point, then nothing happens.

    Once it arrives at the undock point, the ship will reorient itself to its original orientation when it undocked.

  • smartreset -- This is an emergency command and will stop any sort of automated flight by this module (whether undocking or return-to-base).
Reference Group

If your ship ends up flying weirdly, the grid axis might be off (maybe you built it with the projector aligned strangely, or maybe the blueprint is off). Simply create a group around any ship controller block (cockpit, flight seat, remote, etc.) that is correctly aligned toward the "forward" and "up" directions of your ship. The group should be named "Autopilot Reference"

Be sure to recompile the script if you do this.
Last edited by ZerothAngel; 14 Feb, 2016 @ 2:23am