Factorio: Fix a bug with single craft free samples. (#974)

This commit is contained in:
CaitSith2 2022-08-28 20:58:26 -07:00 committed by GitHub
parent b1ffbc49c9
commit 26aed9351e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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