pioneerspacesim/pioneer — pull request #922 by johnbartholomew (2012-01-26 00:23:23+00:00)
Title: Fix #735

This patch adds a debug check to assert that `Space::RemoveBody` and `Space::KillBody` are not called from within the `NotifyRemoved` callback (which was the cause of #735). It also changes `Missile::NotifyRemoved` so that it doesn't try to immediately explode but just clears target or owner; the target and owner values are checked in `Missile::TimeStepUpdate` to make the missile explode in the following frame if its owner or target has gone away.

This means that scripts may receive nil for the attacker parameter of onShipHit or onShipDestroyed. A longer term solution involves keeping Ships (or more generally Bodys) around after they've died. Given the rarity of #735, this patch may not be worth it, but here it is anyway.