Page 1 of 1

[0.9.8 Script Crash] onentitydied event.entity.destroy()

Posted: Thu May 29, 2014 1:39 am
by FreeER
So as the title says, calling destroy() on the entity from the onentitydied event crashes Factorio to the desktop...Should probably raise a script error (or ignore the call) instead. Yes I realize it's a minor issue but thought I'd mention it.
As a side note, this bug was discovered when attempting to prevent ghosts from being created for an entity see Modding help: Ghost entities

Re: [0.9.8 Script Crash] onentitydied event.entity.destroy()

Posted: Fri May 30, 2014 4:51 pm
by kovarex
Hi, thanks for the report.

Yes, and not even talking about trying to call entity.die() :)
My humble guess is, that crashes on stack overflow.

Fixed for 0.10, it will not throw error, but calling die, or destroy on entity in the process of destroying it will just be silently discarded.

P.S. I don't have time to test this kind of bug, but as the fix is quite simple, it should work, let me know if it isn't so.

Re: [0.9.8 Script Crash] onentitydied event.entity.destroy()

Posted: Fri May 30, 2014 6:38 pm
by FreeER
kovarex wrote:Yes, and not even talking about trying to call entity.die() :)
Oh, I hadn't even tested die(), figured if destroy crashed it die would likely be just as bad (since it involves health and dropping the loot as well). I suppose I got a bit lazy there, :lol:
My humble guess is, that crashes on stack overflow.
Seems like a fair guess
P.S. I don't have time to test this kind of bug, but as the fix is quite simple, it should work, let me know if it isn't so.
A 'quick' build of master (which takes a nice 45 minutes or so on my laptop...) reveals no crashes, I'll test again with the official release of 0.10, when it's out, to be sure but I doubt any problems would be reintroduced at this point.

Re: [0.9.8 Script Crash] onentitydied event.entity.destroy()

Posted: Fri May 30, 2014 6:48 pm
by kovarex
FreeER wrote:A 'quick' build of master (which takes a nice 45 minutes or so on my laptop...) reveals no crashes, I'll test again with the official release of 0.10, when it's out, to be sure but I doubt any problems would be reintroduced at this point.
Great, thanks for the check, we should find a time to optimise the make again :)