If a planet designated as a trade hub gets redesignated, the starport improvement is lost and a spaceport must be manually rebuilt.

Starports could get

destroysTo: (core.spaceport)

...assuming that this does not create problems somehow. This would hypothetically allow players to bypass the spaceport build time but the penalty to efficiency is high enough that in practice this would be unappealing.

Included in pull request 5.

--imperator-- 11 Jun 2018:

One more bug with trade hubs is that if infantry production is set to 0%, it is impossible to build infantry on that world every again. Should add a check that the infantry-producing structure - "military base" I think it's called - is not destroyed if labor alloc = 0.0

Good work with updating the repo!

The issue with militia bases is ticket 71071. Another option would be to make the starport structure build infantry or something else; as an alloc:max structure it cannot permanently disappear.

The changes did not fix this issue. My guess is that destroysTo does not get called when a designationOnly structure is destroyed?

george moromisato 18 Jun 2018:

I'll look into it.

george moromisato 21 Jun 2018:

I fixed this with the following changes:

1. I fixed the problem with destroysTo not being honored for designations.
2. I added a build time for a Starport equal to a Spaceport.
3. If a Spaceport exists and you designate to a Trade Hub, then the Spaceport turns into a Starport without additional build time.

This avoids the problem of redesignating just to get a Spaceport.