[Rseding91] [0.14.x] Hard crash on "on_entity_died" event.
Posted: Tue Oct 04, 2016 8:14 am
The game hard crashes when I try to call "destroy()" inside "on_event_died" for the fire that killed the entity
I used this script that destroys any fire in an area around every entity killed
If I set something on fire on the game, it crashes right before the entity is killed
I used this script that destroys any fire in an area around every entity killed
Code: Select all
script.on_event(defines.events.on_entity_died, function(event)
local area_start = {event.entity.position.x - 10, event.entity.position.y - 10}
local area_end = {event.entity.position.x + 10, event.entity.position.y + 10}
for _, ent in pairs(event.entity.surface.find_entities{area_start, area_end}) do
if ent.valid then
if ent.type == "fire" then
ent.destroy()
end
end
end
end)