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 From 1796ed169c853113de20b42019ad5a3f0438349f Mon Sep 17 00:00:00 2001 From: h-v-smacker Date: Sun, 21 Jan 2018 15:54:50 +0300 Subject: added apple juice --- juices.lua | 6 ++++++ textures/apple_juice.png | Bin 0 -> 351 bytes textures/apple_juice_inv.png | Bin 0 -> 322 bytes textures/apple_juice_popsicle.png | Bin 0 -> 295 bytes 4 files changed, 6 insertions(+) create mode 100644 textures/apple_juice.png create mode 100644 textures/apple_juice_inv.png create mode 100644 textures/apple_juice_popsicle.png diff --git a/juices.lua b/juices.lua index 5fd0145..03b1879 100644 --- a/juices.lua +++ b/juices.lua @@ -16,6 +16,12 @@ ]] local juice_table = { + orange_juice = { + proper_name = "Apple juice", + found_in = "default", + obj_name = "apple", + orig_nutritional_value = 2 + }, orange_juice = { proper_name = "Orange juice", found_in = "ethereal", diff --git a/textures/apple_juice.png b/textures/apple_juice.png new file mode 100644 index 0000000..ebb5783 Binary files /dev/null and b/textures/apple_juice.png differ diff --git a/textures/apple_juice_inv.png b/textures/apple_juice_inv.png new file mode 100644 index 0000000..2ca94f7 Binary files /dev/null and b/textures/apple_juice_inv.png differ diff --git a/textures/apple_juice_popsicle.png b/textures/apple_juice_popsicle.png new file mode 100644 index 0000000..622be84 Binary files /dev/null and b/textures/apple_juice_popsicle.png differ -- cgit v1.2.3 From 98468c473c70829c1dd21d2f71905af3bcd31586 Mon Sep 17 00:00:00 2001 From: h-v-smacker Date: Wed, 28 Feb 2018 01:26:57 +0300 Subject: new juices --- init.lua | 12 ++++++++++++ juices.lua | 18 +++++++++++++++++- textures/pineapple_juice.png | Bin 0 -> 356 bytes textures/pineapple_juice_inv.png | Bin 0 -> 322 bytes textures/pineapple_juice_popsicle.png | Bin 0 -> 293 bytes 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 textures/pineapple_juice.png create mode 100644 textures/pineapple_juice_inv.png create mode 100644 textures/pineapple_juice_popsicle.png diff --git a/init.lua b/init.lua index 73db9eb..2900a19 100644 --- a/init.lua +++ b/init.lua @@ -415,6 +415,18 @@ minetest.register_craft({ {"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"} } }) + +if minetest.get_modpath("ethereal") then + minetest.register_craft({ + output = "freezer:freezer", + recipe = { + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "", "default:steel_ingot"}, + {"default:steel_ingot", "ethereal:crystal_spike", "default:steel_ingot"} + } + }) +end + minetest.register_craft({ diff --git a/juices.lua b/juices.lua index 03b1879..1f000fa 100644 --- a/juices.lua +++ b/juices.lua @@ -15,6 +15,17 @@ -- internal_name_of_the_juice_popsicle.png for the popsicle form ]] +-- clear the recipe for juice from farming redo for consistency's sake + +minetest.clear_craft({ + output = "farming:pineapple_juice", + type = "shapeless", + recipe = {"vessels:drinking_glass", "farming:pineapple_ring", + "farming:pineapple_ring", "farming:pineapple_ring"} +}) +minetest.unregister_item("farming:pineapple_juice") + + local juice_table = { orange_juice = { proper_name = "Apple juice", @@ -94,7 +105,12 @@ local juice_table = { obj_name = "tomato", orig_nutritional_value = 4 }, - + pineapple_juice = { + proper_name = "Pineapple juice", + found_in = "farming", + obj_name = "pineapple_ring", + orig_nutritional_value = 1 + }, } diff --git a/textures/pineapple_juice.png b/textures/pineapple_juice.png new file mode 100644 index 0000000..5fc8717 Binary files /dev/null and b/textures/pineapple_juice.png differ diff --git a/textures/pineapple_juice_inv.png b/textures/pineapple_juice_inv.png new file mode 100644 index 0000000..063313c Binary files /dev/null and b/textures/pineapple_juice_inv.png differ diff --git a/textures/pineapple_juice_popsicle.png b/textures/pineapple_juice_popsicle.png new file mode 100644 index 0000000..6ec3739 Binary files /dev/null and b/textures/pineapple_juice_popsicle.png differ -- cgit v1.2.3 From d2fe59c56706625f89afc4528e120d2bd7223e9b Mon Sep 17 00:00:00 2001 From: h-v-smacker Date: Thu, 20 Sep 2018 14:46:28 +0300 Subject: unified inventory integration --- depends.txt | 3 ++- init.lua | 63 ++++++++++++++++++++++++++++++++++++++++++++- juices.lua | 25 +++++++++++++----- textures/freezing_icon.png | Bin 0 -> 175 bytes 4 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 textures/freezing_icon.png diff --git a/depends.txt b/depends.txt index 62c1b68..3919d3c 100644 --- a/depends.txt +++ b/depends.txt @@ -3,4 +3,5 @@ pipeworks? ethereal? mobs? farming? -vessels? \ No newline at end of file +vessels? +unified_inventory? \ No newline at end of file diff --git a/init.lua b/init.lua index 2900a19..ab14f9b 100644 --- a/init.lua +++ b/init.lua @@ -7,10 +7,22 @@ -- enable extra popsicle types provided there are both vessels and fruits/veggies available -- fruit + glass -> juice; juice @ freezer -> popsicle + empty glass +if minetest.get_modpath("unified_inventory") and unified_inventory.register_craft_type then + unified_inventory.register_craft_type("freezing", { + description = "Freezing", + icon = "freezing_icon.png", + width = 1, + height = 1, + uses_crafting_grid = false, + }) +end + if minetest.get_modpath("vessels") then dofile(minetest.get_modpath("freezer") .. "/juices.lua") end + + -- -- Formspecs -- @@ -130,7 +142,8 @@ local function freezer_node_timer(pos, elapsed) inv:add_item("dst", "bucket:bucket_empty") end end - + + -- an extra recipe involving liquid in a bucket, for good measure -- a cactus pulp bucket gives 2 hp, but freezing it gives 3 popsicles, each -- of them giving 1 hp, achieving 50% increase in efficiency through processing @@ -436,3 +449,51 @@ minetest.register_craft({ "default:ice" } }) + +if minetest.get_modpath("unified_inventory") and unified_inventory.register_craft then + unified_inventory.register_craft({ + type = "freezing", + output = "default:ice", + items = {"bucket:bucket_water"}, + }) + + + unified_inventory.register_craft({ + type = "freezing", + output = "default:ice", + items = {"bucket:bucket_river_water"}, + }) + + if minetest.get_modpath("ethereal") then + unified_inventory.register_craft({ + type = "freezing", + output = "freezer:cactus_popsicle 3", + items = {"ethereal:bucket_cactus"}, + }) + end + + if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" then + unified_inventory.register_craft({ + type = "freezing", + output = "freezer:milk_popsicle 3", + items = {"mobs:bucket_milk"}, + }) + end + + if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" and minetest.get_modpath("farming") then + unified_inventory.register_craft({ + type = "freezing", + output = "freezer:pelmeni_pack 3", + items = {"freezer:pelmeni_raw"}, + }) + end + + if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" and minetest.get_modpath("ethereal") then + unified_inventory.register_craft({ + type = "freezing", + output = "freezer:aspic 5", + items = {"freezer:meat_broth"}, + }) + end + +end \ No newline at end of file diff --git a/juices.lua b/juices.lua index 1f000fa..3c2e532 100644 --- a/juices.lua +++ b/juices.lua @@ -17,14 +17,17 @@ -- clear the recipe for juice from farming redo for consistency's sake -minetest.clear_craft({ - output = "farming:pineapple_juice", - type = "shapeless", - recipe = {"vessels:drinking_glass", "farming:pineapple_ring", - "farming:pineapple_ring", "farming:pineapple_ring"} -}) -minetest.unregister_item("farming:pineapple_juice") +if minetest.get_modpath("farming") and farming.mod and farming.mod == "redo" then + minetest.clear_craft({ + output = "farming:pineapple_juice", + type = "shapeless", + recipe = {"vessels:drinking_glass", "farming:pineapple_ring", + "farming:pineapple_ring", "farming:pineapple_ring"} + }) + minetest.unregister_item("farming:pineapple_juice") + +end local juice_table = { orange_juice = { @@ -144,6 +147,14 @@ for juice_name, def in pairs(juice_table) do recipe = {"vessels:drinking_glass", def.found_in .. ":" .. def.obj_name}, }) + if minetest.get_modpath("unified_inventory") and unified_inventory.register_craft then + unified_inventory.register_craft({ + type = "freezing", + output = "freezer:" .. juice_name .. "_popsicle", + items = {"freezer:" .. juice_name}, + }) + end + end end diff --git a/textures/freezing_icon.png b/textures/freezing_icon.png new file mode 100644 index 0000000..099b9f2 Binary files /dev/null and b/textures/freezing_icon.png differ -- cgit v1.2.3