Limit the number of identical items in the recipe to space left in grid

This commit is contained in:
h-v-smacker 2017-11-22 19:05:21 +03:00
parent 3b398d9741
commit f7bb9aafe9
1 changed files with 7 additions and 0 deletions

View File

@ -230,8 +230,15 @@ for product, def in pairs(canned_food_definitions) do
-- to be available in vanilla game (and mushrooms are the guaranteed
-- regular - not sweet - canned food)
local ingredients = {"vessels:glass_bottle"}
local max = 8
if def.sugar then
table.insert(ingredients, "farming:sugar")
max = 7
end
-- prevent creation of a recipe with more items than there are slots
-- left in the 9-tile craft grid
if def.amount > max then
def.amount = max
end
for i=1,def.amount do
table.insert(ingredients, def.obj_name)