summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorh-v-smacker <hans-von-smacker+github@gmail.com>2017-11-22 19:05:21 +0300
committerh-v-smacker <hans-von-smacker+github@gmail.com>2017-11-22 19:05:21 +0300
commitf7bb9aafe9c88901acb38de1d6c7854348e9ea29 (patch)
treed280040bc8f182a219e52cbf8f55678f71a295f0
parent3b398d97416614d03e7897116e1aee8dbf99c384 (diff)
Limit the number of identical items in the recipe to space left in grid
-rw-r--r--init.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index dae9cf0..5829e06 100644
--- a/init.lua
+++ b/init.lua
@@ -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)