Roberto wrote:That will screw my new AIs, though
How else could I (or anyone) give a ship different instructions if it's not in its "home system"?
Roberto, I think you are right.
For a version 1.70+ only there is no problem when you use the function
performHyperSpaceExitWithoutReplacing, but when staying compatible with older versions one only can use:
performHyperSpaceExit.
This function results in the current ship appearing in the next system with the message
"EXITED WITCHSPACE" and simultaneously an other ship with the same role appears at the witchpoint of the current system with message
"EXITED_WITCHSPACE".
Changing names completely would ruin backward compatibility. For a trader like ship it won't matter if both messages are the same. But for special missionships, the copy should act as it were a new ship (what it is) and the jumping ship should act as the original ship when interacting with the player.
Meaning: leave it as it is but make sure it is documented well. I now noticed that neither message was mentioned on the wiki with the
performHyperSpaceExit command. I had never noticed there was a difference resulting in AI's not working as intended.
EDIT:
Is "EXITED_WITCHSPACE" working at all? In the past I have tried to use it, but I never succeeded in catching the message "EXITED_WITCHSPACE". I just tried it again with the new knowledge. Only for the original ship that jumped the "EXITED WITCHSPACE" is detected. Can it be that the code is wrong? When I look at the code:
Code: Select all
[ship leaveWitchspace]; // gets added to the universe here!
[[ship getAI] setState:@"GLOBAL"]; // must happen after adding to the universe!
[ship setStatus:STATUS_IN_FLIGHT]; // or ships may not werk rite d'uh!
In the part [ship leaveWitchspace] the message "EXITED_WITCHSPACE" is send. But than the command [[ship getAI] setState:@"GLOBAL"] is getting a new AI and setting it in the global state. Can it be that the message gets lost in this process?