I have some map lua code where I have a `unit` object and I would like to tell if it has changed army.
What I have so far is `if unit.originalBuilder == nil then`. This works to distinguish player created unit from those that changed army, though has some false positives. Units created by the map will also not have an originalBuilder and the same goes for those created via the cheating menu. The same is presumably true for captured units. Is there a more sure way to tell if a unit has changed army?
The reason I'm asking is because of /viewtopic.php?f=53&t=16598. If there is a way to detect unit creation, then I don't need to bother with detecting if a unit has changed army or not.
My unit creation event thing is using entity ids to keep track of which units are new. The problem I'm running into is that the game changes the entity id when a unit changes army, which happens because the game creates a new unit object and just copies over a bunch of stuff. So I need to be able to tell if I'm dealing with such a copied object or not