From b8733411916edc44d5756fff9305be5a28281bd2 Mon Sep 17 00:00:00 2001
From: h-v-smacker <hans-von-smacker+github@gmail.com>
Date: Thu, 14 Dec 2017 05:07:13 +0300
Subject: Pelmeni: a variety of dumplings which must be frozen

---
 init.lua | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 74 insertions(+), 20 deletions(-)

(limited to 'init.lua')

diff --git a/init.lua b/init.lua
index 150a970..f657049 100644
--- a/init.lua
+++ b/init.lua
@@ -188,6 +188,18 @@ local function freezer_node_timer(pos, elapsed)
 		end
 	end
 
+	      
+	-- pelmeni
+	-- while freezing is a crucial step in preparation, the full chain involves extra steps:
+	-- 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")
+			end
+		end 
+	end
 
 	-- Check if we have cookable content
 	return
@@ -270,25 +282,73 @@ minetest.register_node("freezer:freezer", {
 	      
 if minetest.get_modpath("ethereal") then
 	minetest.register_craftitem("freezer:cactus_popsicle", {
-	description = "Cactus Pulp Popsicle",
-	inventory_image = "cactus_popsicle.png",
-	wield_image = "cactus_popsicle.png",
-	stack_max = 99,
-	groups = { not_in_creative_inventory = 1 },
-	on_use = minetest.item_eat(1, "default:stick"),
-})
+		description = "Cactus Pulp Popsicle",
+		inventory_image = "cactus_popsicle.png",
+		wield_image = "cactus_popsicle.png",
+		stack_max = 99,
+		groups = { not_in_creative_inventory = 1 },
+		on_use = minetest.item_eat(1, "default:stick"),
+	})
 end
 	      
 	      
 if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" then
 	minetest.register_craftitem("freezer:milk_popsicle", {
-	description = "Eskimo icecream",
-	inventory_image = "milk_popsicle.png",
-	wield_image = "milk_popsicle.png",
-	stack_max = 99,
-	groups = { not_in_creative_inventory = 1 },
-	on_use = minetest.item_eat(1, "default:stick"),
-})
+		description = "Eskimo icecream",
+		inventory_image = "milk_popsicle.png",
+		wield_image = "milk_popsicle.png",
+		stack_max = 99,
+		groups = { not_in_creative_inventory = 1 },
+		on_use = minetest.item_eat(1, "default:stick"),
+	})
+end	
+	      
+if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" and minetest.get_modpath("farming") then
+	
+	-- both the dough and the frozen pelmeni are nigh inedible
+	-- only the cooked product should reveal the benefits of preparing this food
+	      
+	minetest.register_craftitem("freezer:pelmeni_raw", {
+		description = "Raw pelmeni",
+		inventory_image = "pelmeni_raw.png",
+		wield_image = "pelmeni_raw.png",
+		stack_max = 99,
+		groups = { not_in_creative_inventory = 1 },
+		on_use = minetest.item_eat(1),
+	})
+     
+	minetest.register_craftitem("freezer:pelmeni_pack", {
+		description = "A pack of frozen pelmeni",
+		inventory_image = "pelmeni_pack.png",
+		wield_image = "pelmeni_pack.png",
+		stack_max = 99,
+		groups = { not_in_creative_inventory = 1 },
+		on_use = minetest.item_eat(1),
+	})
+	      
+	minetest.register_craftitem("freezer:pelmeni", {
+		description = "Cooked pelmeni",
+		inventory_image = "pelmeni.png",
+		wield_image = "pelmeni.png",
+		stack_max = 99,
+		groups = { not_in_creative_inventory = 1 },
+		on_use = minetest.item_eat(10),
+	})
+	    
+	minetest.register_craft({
+		type = "shapeless",
+		output = "freezer:pelmeni_raw",
+		recipe = {"mobs:meat_raw", "farming:flour", "farming:flour", "farming:flour"},
+	})      
+	      
+	minetest.register_craft({
+		type = "cooking",
+		cooktime = 10,
+		output = "freezer:pelmeni",
+		recipe = "freezer:pelmeni_pack"
+	})
+
+	
 end
 	  
 	      
@@ -309,9 +369,3 @@ minetest.register_craft({
 	 "default:ice"
       }
 })
-
--- -- 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("vessels") and minetest.get_modpath("farming") then
--- 	dofile("juices.lua")
--- end
-- 
cgit v1.2.3