summaryrefslogtreecommitdiff
path: root/bushes_classic/cooking.lua
blob: 25af7e85233e40dfb4525dd7ca7c1c7745b51ea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
local S = biome_lib.intllib

-- Basket

minetest.register_craft({
	output = "bushes:basket_empty",
	recipe = {
		{ "default:stick", "default:stick", "default:stick" },
		{ "", "default:stick", "" },
	},
})

-- Sugar

minetest.register_craftitem(":bushes:sugar", {
	description = S("Sugar"),
	inventory_image = "bushes_sugar.png",
	on_use = minetest.item_eat(1),
	groups = {food_sugar=1}
})

minetest.register_craft({
	output = "bushes:sugar 1",
	recipe = {
		{ "default:papyrus", "default:papyrus" },
	},
})

for i, berry in ipairs(bushes_classic.bushes) do
	local desc = bushes_classic.bushes_descriptions[i]

	minetest.register_craftitem(":bushes:"..berry.."_pie_raw", {
		description = S("Raw "..desc.." pie"),
		inventory_image = "bushes_"..berry.."_pie_raw.png",
		on_use = minetest.item_eat(4),
	})

	if berry ~= "mixed_berry" then

		-- Special case for strawberries, blueberries and raspberries
		-- when farming_plus or farming redo is in use. Use items
		-- from these mods, but redefine there so they has the right
		-- groups and does't look so ugly!

		if berry == "strawberry" and minetest.registered_nodes["farming_plus:strawberry"] then
			minetest.register_craftitem(":farming_plus:strawberry_item", {
				description = S("Strawberry"),
				inventory_image = "bushes_"..berry..".png",
				on_use = minetest.item_eat(2),
				groups = {berry=1, strawberry=1}
			})
			minetest.register_alias("bushes:strawberry", "farming_plus:strawberry_item")

		elseif berry == "blueberry" and minetest.registered_items["farming:blueberries"] then
			minetest.register_craftitem(":farming:blueberries", {
				description = S("Blueberry"),
				inventory_image = "bushes_"..berry..".png",
				on_use = minetest.item_eat(1),
				groups = {berry=1, blueberry=1}
			})
			minetest.register_alias("bushes:blueberry", "farming:blueberries")

		elseif berry == "raspberry" and minetest.registered_items["farming:raspberries"] then
			minetest.register_craftitem(":farming:raspberries", {
				description = S("Raspberry"),
				inventory_image = "bushes_"..berry..".png",
				on_use = minetest.item_eat(1),
				groups = {berry=1, raspberry=1}
			})
			minetest.register_alias("bushes:raspberry", "farming:raspberries")

		else
			minetest.register_craftitem(":bushes:"..berry, {
				description = desc,
				inventory_image = "bushes_"..berry..".png",
				groups = {berry = 1, [berry] = 1},
				on_use = minetest.item_eat(1),
			})
		end

		minetest.register_craft({
			output = "bushes:"..berry.."_pie_raw 1",
			recipe = {
			{ "group:food_sugar", "farming:flour", "group:food_sugar" },
			{ "group:"..berry, "group:"..berry, "group:"..berry },
			},
		})
	end

	-- Cooked pie

	minetest.register_craftitem(":bushes:"..berry.."_pie_cooked", {
		description = S("Cooked "..desc.." pie"),
		inventory_image = "bushes_"..berry.."_pie_cooked.png",
		on_use = minetest.item_eat(6),
	})

	minetest.register_craft({
		type = "cooking",
		output = "bushes:"..berry.."_pie_cooked",
		recipe = "bushes:"..berry.."_pie_raw",
		cooktime = 30,
	})

	-- slice of pie

	minetest.register_craftitem(":bushes:"..berry.."_pie_slice", {
		description = S("Slice of "..desc.." pie"),
		inventory_image = "bushes_"..berry.."_pie_slice.png",
		on_use = minetest.item_eat(1),
	})

	minetest.register_craft({
		output = "bushes:"..berry.."_pie_slice 6",
		recipe = {
		{ "bushes:"..berry.."_pie_cooked" },
		},
	})

	-- Basket with pies

	minetest.register_craft({
		output = "bushes:basket_"..berry.." 1",
		recipe = {
		{ "bushes:"..berry.."_pie_cooked", "bushes:"..berry.."_pie_cooked", "bushes:"..berry.."_pie_cooked" },
		{ "", "bushes:basket_empty", "" },
		},
	})
end

minetest.register_craft({
	output = "bushes:mixed_berry_pie_raw 2",
	recipe = {
	{ "group:food_sugar", "farming:flour", "group:food_sugar" },
	{ "group:berry", "group:berry", "group:berry" },
	{ "group:berry", "group:berry", "group:berry" },
	},
})