Kaks wrote:Aha! Methinks this is exactly the same problem reported here:
Not quite the same problem. Even without reaching the max entities, the oxp freezes oolite. I just tested and created a fix
What is happening: Every update, the energy of the ship is lowered as long as it touches the blast. The amount depends on the framerate so that the amount per second is constant. Every frame the handler in maclanes example triggers. On testing I got a typical amount per frame of about 900. (at least with a TAF == 1 and a normal high frame rate) When the ships energy was higher, the ship never died and the handler just restored its energy to max. With dropping framerate, the energy damage per frame rose, until a level that is was enough to kill the ship.
And only when the energy was enough to kill the ship, a new cascade entity was initiated. But after that creation the energy was restored and the ship did not die. The next frame the energy damage was enough to kill and another energy blast was created. This cycle becomes a loop and completely freezes the game. The max entity limit is reached and while the logging is less severe than before the recent changes, the loop will never break.
The most complex fix would be to create the blast after the
shipTakingDamage
handler has fired. An easier fix that I now tested was just to remember that the ship initiated a new energy blast and reset the energy to zero after the handler. That guarantees that the ship dies on a q-mine when energy drops below. A script can only safe the ship when making sure the energy never can drop below zero. Anyhow, the fix will prevent a freeze on a q-mine for such an energy restoring script.
McLane wrote:In rev 4496 this worked, making the ship immune to q-bombs.
I think this was just coincidence. When the damage per frame was less than the ships energy there never was a problem. The loop only was created when the damage in one frame was bigger than the ships energy. I think McLane hit the second situation in his later testing.