From 26aed9351ee73696e34d2172f66748508ec87840 Mon Sep 17 00:00:00 2001 From: CaitSith2 Date: Sun, 28 Aug 2022 20:58:26 -0700 Subject: [PATCH] Factorio: Fix a bug with single craft free samples. (#974) --- worlds/factorio/data/mod_template/control.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/worlds/factorio/data/mod_template/control.lua b/worlds/factorio/data/mod_template/control.lua index 63473808..51cd21e4 100644 --- a/worlds/factorio/data/mod_template/control.lua +++ b/worlds/factorio/data/mod_template/control.lua @@ -249,6 +249,10 @@ script.on_event(defines.events.on_player_main_inventory_changed, update_player_e function add_samples(force, name, count) local function add_to_table(t) + if count <= 0 then + -- Fixes a bug with single craft, if a recipe gives 0 of a given item. + return + end t[name] = (t[name] or 0) + count end -- Add to global table of earned samples for future new players