That looks to me to be it. There was check that the faction was being played by a human player - that should do it. We've been using that same logic elsewhere to tell the script to do something when it's an AI faction.
Incidentally, the same issue was there in Roman and Carthaginian colony management - something triggered by the end_turn button, but no check that the faction was human-played. Which of course it has to be, since the AI factions can't press the button.
Bookmarks