I just committed r4604. The AI commands '
becomeExplosion
' and "
becomeEnergyBlast
' now also trigger the shipDied() handler. I was thinking about using 'self" as the who parameter, but because the JS method
explode()
gives
null
and
energyDamage
, the same now happens with the AI command.
I think it went wrong around oolite 1.71. In the past, 'becomeExplosion' did trigged the death events.
CommonSenseOTB wrote:So Eric, are you saying that I should use this.entityDestroyed() instead of this.shipDied() in any script that has frameCallbacks and Timers(all my oxp's)? As far as I know everything works super using this.shipDied(). I'm not sure I understand what exactly the problem is.
shipDied() is not always triggering. e.g. not when a ship docks or when a ship leaves the system trough a wormhole. Also when the player leaves the system, all remaining ships are removed silently without triggering a shipDied event.
I only know that in the past there were a lot of crashes because of timers that were still firing but the code they called was already removed. I think that the crashes are now fixed because the timers now notice that the underlying script has been removed, but for the benefit of real cleanup code the
this.entityDestroyed()
was added. This always fires, no matter how the entity was removed.