aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-09-23 12:09:33 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-09-23 12:09:33 +0200
commitc846cb1c76fb54d2c3c56d5da13b155f73e0edba (patch)
tree46bbd1b2b193f40bdb299e62fab11616c6862384
parent23cca6232de2ef83f2b45888bba571057a7d174d (diff)
parentd2fe59c56706625f89afc4528e120d2bd7223e9b (diff)
downloadfreezer-c846cb1c76fb54d2c3c56d5da13b155f73e0edba.tar.gz
freezer-c846cb1c76fb54d2c3c56d5da13b155f73e0edba.tar.bz2
freezer-c846cb1c76fb54d2c3c56d5da13b155f73e0edba.zip
Merge https://github.com/h-v-smacker/freezer
-rw-r--r--depends.txt3
-rw-r--r--init.lua107
-rw-r--r--juices.lua35
-rw-r--r--textures/apple_juice.pngbin0 -> 351 bytes
-rw-r--r--textures/apple_juice_inv.pngbin0 -> 322 bytes
-rw-r--r--textures/apple_juice_popsicle.pngbin0 -> 295 bytes
-rw-r--r--textures/freezing_icon.pngbin0 -> 175 bytes
-rw-r--r--textures/pineapple_juice.pngbin0 -> 356 bytes
-rw-r--r--textures/pineapple_juice_inv.pngbin0 -> 322 bytes
-rw-r--r--textures/pineapple_juice_popsicle.pngbin0 -> 293 bytes
10 files changed, 130 insertions, 15 deletions
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 6e2961e..ba1f8ab 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
--
@@ -123,20 +135,21 @@ 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")
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
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 +160,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 +189,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 +207,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 +221,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
@@ -407,6 +428,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({
@@ -416,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 5fd0145..3c2e532 100644
--- a/juices.lua
+++ b/juices.lua
@@ -15,8 +15,28 @@
-- internal_name_of_the_juice_popsicle.png for the popsicle form
]]
+-- clear the recipe for juice from farming redo for consistency's sake
+
+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 = {
+ proper_name = "Apple juice",
+ found_in = "default",
+ obj_name = "apple",
+ orig_nutritional_value = 2
+ },
+ orange_juice = {
proper_name = "Orange juice",
found_in = "ethereal",
obj_name = "orange",
@@ -88,7 +108,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
+ },
}
@@ -122,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/apple_juice.png b/textures/apple_juice.png
new file mode 100644
index 0000000..ebb5783
--- /dev/null
+++ b/textures/apple_juice.png
Binary files differ
diff --git a/textures/apple_juice_inv.png b/textures/apple_juice_inv.png
new file mode 100644
index 0000000..2ca94f7
--- /dev/null
+++ b/textures/apple_juice_inv.png
Binary files differ
diff --git a/textures/apple_juice_popsicle.png b/textures/apple_juice_popsicle.png
new file mode 100644
index 0000000..622be84
--- /dev/null
+++ b/textures/apple_juice_popsicle.png
Binary files differ
diff --git a/textures/freezing_icon.png b/textures/freezing_icon.png
new file mode 100644
index 0000000..099b9f2
--- /dev/null
+++ b/textures/freezing_icon.png
Binary files differ
diff --git a/textures/pineapple_juice.png b/textures/pineapple_juice.png
new file mode 100644
index 0000000..5fc8717
--- /dev/null
+++ b/textures/pineapple_juice.png
Binary files differ
diff --git a/textures/pineapple_juice_inv.png b/textures/pineapple_juice_inv.png
new file mode 100644
index 0000000..063313c
--- /dev/null
+++ b/textures/pineapple_juice_inv.png
Binary files differ
diff --git a/textures/pineapple_juice_popsicle.png b/textures/pineapple_juice_popsicle.png
new file mode 100644
index 0000000..6ec3739
--- /dev/null
+++ b/textures/pineapple_juice_popsicle.png
Binary files differ