From 123d32840e308a61ea245741f017528b7907000e Mon Sep 17 00:00:00 2001 From: h-v-smacker Date: Sun, 7 Jan 2018 17:00:58 +0300 Subject: Fixed pelmeni --- init.lua | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index b1cce8f..73db9eb 100644 --- a/init.lua +++ b/init.lua @@ -123,7 +123,7 @@ local function freezer_node_timer(pos, elapsed) -- takes both regular and river water if inv:contains_item("src", "bucket:bucket_water") or inv:contains_item("src", "bucket:bucket_river_water") then - if inv:room_for_item("dst", "default:ice") then + if inv:room_for_item("dst", "default:ice") and inv:room_for_item("dst", "bucket:bucket_empty") then inv:remove_item("src", "bucket:bucket_water") inv:remove_item("src", "bucket:bucket_river_water") inv:add_item("dst", "default:ice") @@ -136,7 +136,7 @@ local function freezer_node_timer(pos, elapsed) -- of them giving 1 hp, achieving 50% increase in efficiency through processing if minetest.get_modpath("ethereal") then if inv:contains_item("src", "ethereal:bucket_cactus") then - if inv:room_for_item("dst", "freezer:cactus_popsicle 3") then + if inv:room_for_item("dst", "freezer:cactus_popsicle 3") and inv:room_for_item("dst", "bucket:bucket_empty") then inv:remove_item("src", "ethereal:bucket_cactus") inv:add_item("dst", "freezer:cactus_popsicle 3") inv:add_item("dst", "bucket:bucket_empty") @@ -147,7 +147,7 @@ local function freezer_node_timer(pos, elapsed) -- and yet another liquid in a bucket, this time with no extravagance though if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" then if inv:contains_item("src", "mobs:bucket_milk") then - if inv:room_for_item("dst", "freezer:milk_popsicle 3") then + if inv:room_for_item("dst", "freezer:milk_popsicle 3") and inv:room_for_item("dst", "bucket:bucket_empty") then inv:remove_item("src", "mobs:bucket_milk") inv:add_item("dst", "freezer:milk_popsicle 3") inv:add_item("dst", "bucket:bucket_empty") @@ -176,7 +176,7 @@ local function freezer_node_timer(pos, elapsed) local input_name = input_stack:get_name(); if minetest.get_item_group(input_name, "juice") > 0 then local output_name = input_name .. "_popsicle" - while inv:room_for_item("dst", output_name) do + while inv:room_for_item("dst", output_name) and inv:room_for_item("dst", "vessels:drinking_glass") do local removed = inv:remove_item("src", input_name) if removed:get_count() > 0 then inv:add_item("dst", output_name) @@ -194,9 +194,13 @@ local function freezer_node_timer(pos, elapsed) -- raw pelmeni -> pack of frozen pelmeni -> actual cooked pelmeni if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" and minetest.get_modpath("farming") then if inv:contains_item("src", "freezer:pelmeni_raw") then - if inv:room_for_item("dst", "freezer:pelmeni_pack 3") then - inv:remove_item("src", "freezer:pelmeni_raw") - inv:add_item("dst", "freezer:pelmeni_pack 3") + while inv:room_for_item("dst", "freezer:pelmeni_pack 3") do + local removed = inv:remove_item("src", "freezer:pelmeni_raw") + if removed:get_count() > 0 then + inv:add_item("dst", "freezer:pelmeni_pack 3") + else + break + end end end end @@ -204,11 +208,15 @@ local function freezer_node_timer(pos, elapsed) -- aspic if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" and minetest.get_modpath("ethereal") then if inv:contains_item("src", "freezer:meat_broth") then - if inv:room_for_item("dst", "freezer:aspic 5") then - inv:remove_item("src", "freezer:meat_broth") - inv:add_item("dst", "freezer:aspic 5") - inv:add_item("dst", "bucket:bucket_empty") - end + while inv:room_for_item("dst", "freezer:aspic 5") and inv:room_for_item("dst", "bucket:bucket_empty") do + local removed = inv:remove_item("src", "freezer:meat_broth") + if removed:get_count() > 0 then + inv:add_item("dst", "freezer:aspic 5") + inv:add_item("dst", "bucket:bucket_empty") + else + break + end + end end end -- cgit v1.2.3