pioneerspacesim/pioneer — pull request #2399 by lwho (2013-08-17 17:05:12+00:00)
Title: Hyperjump safety rules with fitting AIHyperspaceTo

As reported in #2376, trade ships were hyperjumping directly above spaceports when leaving. As suggested by @Luomu I implemented the following rules for safe hyperjumping:

- Ship must be FLYING
- Wheels must be retracted

- Ship must not be within atmosphere
- Ship must be more than 15km from a spacestation/spaceport
- Ship must be at least 15km above surface *)

An AIHyperspaceTo command is provided to fly to a safe position and initiate hyperjump then. TradeShips and Assassination modules were modified to use this AI command (those were the only LUA modules using hyperjump).

The player can also access AIHyperspaceTo in the communications menu if he has an autopilot equipped and a viable hyperspace target selected (i.e. hyperdrive equipped, enough fuel, within range).

*) I considered using a more complex rule, i.e. safe distance related to mass or size of the planet. While this makes a lot of sense from a "reality" point of view, I have doubts that it would hinder playability, as it would be hard to understand for the player, where he is allowed jump. However, it wouldn't be hard to implement different rules (only `Ship::GetHyperspaceSafetyDistance` would have to be changed).