Page 1 of 1

[0.17.50] Mod calling player.begin_crafting causes game crash

Posted: Mon Jun 17, 2019 6:16 pm
by Jorn86
The following code in a mod will make the game crash if the recipe to be crafted requires more than one actual craft (for example a yellow belt if you don't have gear wheels in inventory)

Code: Select all

script.on_event(defines.events.on_player_crafted_item, function(event)
    local player = game.get_player(event.player_index)
    if player.crafting_queue_size == 1 then
        player.begin_crafting{count=1, recipe=event.recipe}
    end
end)
Attached are the log file and a mod with exactly this code, for easy testing.

Re: [0.17.50] Mod calling player.begin_crafting causes game crash

Posted: Tue Jun 18, 2019 7:10 am
by Rseding91
Thanks for the report. It's now fixed for the next version of 0.17.

Re: [0.17.50] Mod calling player.begin_crafting causes game crash

Posted: Tue Jun 18, 2019 7:51 am
by Jorn86
Thank you!