Page 1 of 1

[Rseding91] Crash when throwing grenades at transport belts

Posted: Sun Jul 03, 2016 3:05 am
by swni

EDIT. Ignore this message, see my reply with better information.


I wrote some scripting code that creates an explosive mess whenever a filter inserter is built... my code is similar to the following: (if there's a better way, let me know)

Code: Select all

local function check_for_filters(event)
    local e = event.created_entity
    if e.name == "filter-inserter" or e.name == "stack-filter-inserter" then
        local surface = e.surface
        local p = e.position

        e.health = 1
        surface.create_entity{
                name = 'cluster-grenade',
                position = p,
                target = e,
                speed = 0
            }
    end
end

script.on_event(defines.events.on_built_entity, check_for_filters)
script.on_event(defines.events.on_robot_built_entity, check_for_filters)
When I tried it out in game, it looked like it was working fine, and I was having a fun time making explosions everywhere when suddenly Factorio crashed as I placed an inserter. Log is attached.

As is suggested in the stack trace, some transport belts were being destroyed by the blasts, which might be relevant somehow.

I will experiment a bit further, and if I can figure out the exact conditions that are necessary to cause the crash, I will post with more information.

log: http://pastebin.com/Nk7qx7Tw

Re: Crash when using scripting to spawn grenades

Posted: Sun Jul 03, 2016 3:27 am
by swni
I was able to reproduce the crash with no mods enabled and no scripting of any kind. I have attached a save ("crashtest.zip") and new log.

Load the save and fire two grenades at the spot show in the screenshot. The screenshot shows the last thing I see before Factorio crashes.

Image

v 0.13.3, by the way

Re: [Rseding91] Crash when throwing grenades at transport belts

Posted: Sun Jul 03, 2016 10:40 am
by Rseding91
Fixed for 0.13.4.

Re: [Rseding91] Crash when throwing grenades at transport belts

Posted: Sun Jul 03, 2016 3:05 pm
by swni
Thanks! Fixed very fast! Can I ask if there are conditions I can avoid in 0.13.3 to make it less likely to get a crash? (I'm playing a large multiplayer game today that is likely going to have explosions next to transport belts and want to avoid crashes.) In any case I appreciate the fix!

Re: [Rseding91] Crash when throwing grenades at transport belts

Posted: Sun Jul 03, 2016 3:17 pm
by swni
Never mind, I just noticed that 0.13.4 was released -- perfect timing! Though I'm still a bit curious about why the crash happens....