summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--baking.lua3
-rw-r--r--cakes.lua33
-rw-r--r--init.lua16
-rw-r--r--meats.lua25
-rw-r--r--oven.lua197
-rw-r--r--sandwich.lua8
-rw-r--r--support.lua18
-rw-r--r--textures/animalmaterials_meat_raw.pngbin0 -> 426 bytes
-rw-r--r--textures/food_bread_slice.pngbin0 -> 519 bytes
-rw-r--r--textures/food_burger.pngbin0 -> 501 bytes
-rw-r--r--textures/food_cake_carrot.pngbin0 -> 782 bytes
-rw-r--r--textures/food_meat.pngbin0 -> 624 bytes
-rw-r--r--textures/food_oven_bottom.pngbin0 -> 731 bytes
-rw-r--r--textures/food_oven_front.pngbin0 -> 250 bytes
-rw-r--r--textures/food_oven_front_active.pngbin0 -> 293 bytes
-rw-r--r--textures/food_oven_side.pngbin0 -> 731 bytes
-rw-r--r--textures/food_oven_top.pngbin0 -> 731 bytes
-rw-r--r--textures/food_pastry_carrot.pngbin0 -> 846 bytes
-rw-r--r--textures/food_sugar.pngbin0 -> 4425 bytes
-rw-r--r--textures/food_sw_meat.pngbin0 -> 549 bytes
20 files changed, 293 insertions, 7 deletions
diff --git a/baking.lua b/baking.lua
index d0c6aea..850c28e 100644
--- a/baking.lua
+++ b/baking.lua
@@ -24,10 +24,11 @@ minetest.register_craftitem("food:crumble_rhubarb_raw", {
minetest.register_craft({
output = '"food:crumble_rhubarb_raw" 1',
recipe = {
+ {'"food:sugar"',"",""},
{'"food:flour"','"food:rhubarb"','"food:butter"'}
}
})
-
+
minetest.register_craft({
type = "cooking",
output = "food:crumble_rhubarb",
diff --git a/cakes.lua b/cakes.lua
index 94a9d34..e06cd0f 100644
--- a/cakes.lua
+++ b/cakes.lua
@@ -13,26 +13,38 @@ print("RubenFood [Master] - Loading Cakes")
--------------------------Cakes-------------------------
minetest.register_craftitem("food:cakemix_plain",{
description = "Cake Mix",
- tiles = {"food_pastry.png"},
inventory_image = "food_pastry.png",
})
minetest.register_craftitem("food:cakemix_choco",{
description = "Chocolate Cake Mix",
- tiles = {"food_pastry_choco.png"},
inventory_image = "food_pastry_choco.png",
})
+minetest.register_craftitem("food:cakemix_carrot",{
+ description = "Carrot Cake Mix",
+ inventory_image = "food_pastry_carrot.png",
+})
+
minetest.register_craft({
type = "cooking",
output = "food:cake",
recipe = "food:cakemix_plain",
+ cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "food:cake_chocolate",
recipe = "food:cakemix_choco",
+ cooktime = 10,
+})
+
+minetest.register_craft({
+ type = "cooking",
+ output = "food:cake_carrot",
+ recipe = "food:cakemix_carrot",
+ cooktime = 10,
})
minetest.register_craftitem("food:cake", {
@@ -47,6 +59,12 @@ minetest.register_craftitem("food:cake_chocolate", {
on_use = minetest.item_eat(40),
})
+minetest.register_craftitem("food:cake_carrot", {
+ description = "Carrot Cake",
+ inventory_image = "food_cake_carrot.png",
+ on_use = minetest.item_eat(40),
+})
+
@@ -57,13 +75,20 @@ minetest.register_craftitem("food:cake_chocolate", {
minetest.register_craft({
output = '"food:cakemix_plain" 1',
recipe = {
- {'"food:flour"',"",'"food:egg"'},
+ {'"food:flour"','"food:sugar"','"food:egg"'},
}
})
minetest.register_craft({
output = '"food:cakemix_choco" 1',
recipe = {
- {'""','"default:dirt"','""'}, {'"food:flour"',"",'"food:egg"'},
+ {'""','"default:dirt"','""'}, {'"food:flour"','"food:sugar"','"food:egg"'},
+ }
+})
+
+minetest.register_craft({
+ output = '"food:cakemix_carrot" 1',
+ recipe = {
+ {'""','"food:carrot"','""'}, {'"food:flour"','"food:sugar"','"food:egg"'},
}
}) \ No newline at end of file
diff --git a/init.lua b/init.lua
index a01a7e0..565a33b 100644
--- a/init.lua
+++ b/init.lua
@@ -14,7 +14,10 @@ print ("food: Loading mainframe: [Master]")
----------------------Load Files-----------------------------
dofile(minetest.get_modpath("food").."/support.lua")
+dofile(minetest.get_modpath("food").."/oven.lua")
+
dofile(minetest.get_modpath("food").."/dairy.lua")
+dofile(minetest.get_modpath("food").."/meats.lua")
dofile(minetest.get_modpath("food").."/sandwich.lua")
dofile(minetest.get_modpath("food").."/baking.lua")
@@ -22,7 +25,6 @@ dofile(minetest.get_modpath("food").."/cakes.lua")
dofile(minetest.get_modpath("food").."/tarts.lua")
dofile(minetest.get_modpath("food").."/drinks.lua")
---dofile(minetest.get_modpath("food").."/fruits.lua")
@@ -42,6 +44,18 @@ minetest.register_craft({
}
})
+-----------------------------Sugar------------------------------
+minetest.register_craftitem("food:sugar", {
+ description = "Sugar",
+ inventory_image = "food_sugar.png",
+})
+minetest.register_craft({
+ output = '"food:sugar" 20',
+ recipe = {
+ {'"default:papyrus"'},
+
+ }
+})
----------------------------Cigerete----------------------------
minetest.register_node(":food:cigarette", {
diff --git a/meats.lua b/meats.lua
new file mode 100644
index 0000000..091ba77
--- /dev/null
+++ b/meats.lua
@@ -0,0 +1,25 @@
+-- RUBENFOOD MOD
+-- A mod written by rubenwardy that adds
+-- food to the minetest game
+-- ======================================
+-- >> rubenfood/meats.lua
+-- adds meat products
+-- ======================================
+-- [regis-food] Meat
+-- ======================================
+
+minetest.register_craftitem("food:meat", {
+ description = "Venison",
+ inventory_image = "food_meat.png",
+})
+
+minetest.register_craft({
+ type = "cooking",
+ output = "food:meat",
+ recipe = "food:meat_raw",
+ cooktime = 20
+})
+
+
+
+
diff --git a/oven.lua b/oven.lua
new file mode 100644
index 0000000..0d1a14b
--- /dev/null
+++ b/oven.lua
@@ -0,0 +1,197 @@
+-- RUBENFOOD MOD
+-- A mod written by rubenwardy that adds
+-- food to the minetest game
+-- ======================================
+-- >> rubenfood/diary.lua
+-- adds diary products
+-- ======================================
+-- [regis-furnace] Rings
+-- [regis-furnace] Oven
+-- ======================================
+
+local oven_inactive_formspec =
+ "invsize[8,9;]"..
+ "image[2,2;1,1;default_furnace_fire_bg.png]"..
+ "list[current_name;fuel;2,3;1,1;]"..
+ "list[current_name;src;2,1;1,1;]"..
+ "list[current_name;dst;5,1;2,2;]"..
+ "list[current_player;main;0,5;8,4;]"
+
+minetest.register_node("food:oven", {
+ description = "Oven",
+ tiles = {"food_oven_top.png", "food_oven_bottom.png", "food_oven_side.png",
+ "food_oven_side.png", "food_oven_side.png", "food_oven_front.png"},
+ paramtype2 = "facedir",
+ groups = {cracky=2},
+ legacy_facedir_simple = true,
+ sounds = default.node_sound_stone_defaults(),
+ on_construct = function(pos)
+ local meta = minetest.env:get_meta(pos)
+ meta:set_string("formspec", oven_inactive_formspec)
+ meta:set_string("infotext", "Oven")
+ local inv = meta:get_inventory()
+ inv:set_size("fuel", 1)
+ inv:set_size("src", 1)
+ inv:set_size("dst", 4)
+ end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("fuel") then
+ return false
+ elseif not inv:is_empty("dst") then
+ return false
+ elseif not inv:is_empty("src") then
+ return false
+ end
+ return true
+ end,
+})
+
+minetest.register_node("food:oven_active", {
+ description = "Oven",
+ tiles = {"food_oven_top.png", "food_oven_bottom.png", "food_oven_side.png",
+ "food_oven_side.png", "food_oven_side.png", "food_oven_front_active.png"},
+ paramtype2 = "facedir",
+ light_source = 8,
+ drop = "food:furnace",
+ groups = {cracky=2, not_in_creative_inventory=1},
+ legacy_facedir_simple = true,
+ sounds = default.node_sound_stone_defaults(),
+ on_construct = function(pos)
+ local meta = minetest.env:get_meta(pos)
+ meta:set_string("formspec", oven_inactive_formspec)
+ meta:set_string("infotext", "Oven");
+ local inv = meta:get_inventory()
+ inv:set_size("fuel", 1)
+ inv:set_size("src", 1)
+ inv:set_size("dst", 4)
+ end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("fuel") then
+ return false
+ elseif not inv:is_empty("dst") then
+ return false
+ elseif not inv:is_empty("src") then
+ return false
+ end
+ return true
+ end,
+})
+
+function hacky_swap_node(pos,name)
+ local node = minetest.env:get_node(pos)
+ local meta = minetest.env:get_meta(pos)
+ local meta0 = meta:to_table()
+ if node.name == name then
+ return
+ end
+ node.name = name
+ local meta0 = meta:to_table()
+ minetest.env:set_node(pos,node)
+ meta = minetest.env:get_meta(pos)
+ meta:from_table(meta0)
+end
+
+minetest.register_abm({
+ nodenames = {"food:oven","food:oven_active"},
+ interval = 1.0,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+ local meta = minetest.env:get_meta(pos)
+ for i, name in ipairs({
+ "fuel_totaltime",
+ "fuel_time",
+ "src_totaltime",
+ "src_time"
+ }) do
+ if meta:get_string(name) == "" then
+ meta:set_float(name, 0.0)
+ end
+ end
+
+ local inv = meta:get_inventory()
+
+ local srclist = inv:get_list("src")
+ local cooked = nil
+
+ if srclist then
+ cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
+ end
+
+ local was_active = false
+
+ if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
+ was_active = true
+ meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
+ meta:set_float("src_time", meta:get_float("src_time") + 1)
+ if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then
+ -- check if there's room for output in "dst" list
+ if inv:room_for_item("dst",cooked.item) then
+ -- Put result in "dst" list
+ inv:add_item("dst", cooked.item)
+ -- take stuff from "src" list
+ srcstack = inv:get_stack("src", 1)
+ srcstack:take_item()
+ inv:set_stack("src", 1, srcstack)
+ else
+ --print("Could not insert '"..cooked.item.."'")
+ end
+ meta:set_string("src_time", 0)
+ end
+ end
+
+ if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
+ local percent = math.floor(meta:get_float("fuel_time") /
+ meta:get_float("fuel_totaltime") * 100)
+ meta:set_string("infotext","Oven active: "..percent.."%")
+ hacky_swap_node(pos,"food:oven_active")
+ meta:set_string("formspec",
+ "invsize[8,9;]"..
+ "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
+ (100-percent)..":default_furnace_fire_fg.png]"..
+ "list[current_name;fuel;2,3;1,1;]"..
+ "list[current_name;src;2,1;1,1;]"..
+ "list[current_name;dst;5,1;2,2;]"..
+ "list[current_player;main;0,5;8,4;]")
+ return
+ end
+
+ local fuel = nil
+ local cooked = nil
+ local fuellist = inv:get_list("fuel")
+ local srclist = inv:get_list("src")
+
+ if srclist then
+ cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
+ end
+ if fuellist then
+ fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
+ end
+
+ if fuel.time <= 0 then
+ meta:set_string("infotext","Furnace out of fuel")
+ hacky_swap_node(pos,"food:oven")
+ meta:set_string("formspec", oven_inactive_formspec)
+ return
+ end
+
+ if cooked.item:is_empty() then
+ if was_active then
+ meta:set_string("infotext","Oven is empty")
+ hacky_swap_node(pos,"food:oven")
+ meta:set_string("formspec", oven_inactive_formspec)
+ end
+ return
+ end
+
+ meta:set_string("fuel_totaltime", fuel.time)
+ meta:set_string("fuel_time", 0)
+
+ local stack = inv:get_stack("fuel", 1)
+ stack:take_item()
+ inv:set_stack("fuel", 1, stack)
+ end,
+}) \ No newline at end of file
diff --git a/sandwich.lua b/sandwich.lua
index 08c4213..5355215 100644
--- a/sandwich.lua
+++ b/sandwich.lua
@@ -19,11 +19,17 @@ minetest.register_craftitem("food:sw_meat", {
on_use = minetest.item_eat(10),
})
+minetest.register_craftitem("food:burger", {
+ description = "Burger",
+ inventory_image = "food_burger.png",
+ on_use = minetest.item_eat(10),
+})
+
minetest.register_craft({
output = '"food:sw_meat" 1',
recipe = {
{"",'"food:bread_slice"',""},
- {"food:butter","",'"food:butter"'},
+ {"food:butter","food:meat",'"food:butter"'},
{"",'"food:bread_slice"',""},
}
})
diff --git a/support.lua b/support.lua
index 6002142..cd5bdc3 100644
--- a/support.lua
+++ b/support.lua
@@ -39,6 +39,14 @@ minetest.register_craftitem("food:strawberry", {
})
end)
+node_implement("farming","farming:carrot_item","food:carrot",function()
+minetest.register_craftitem("farming:carrot_item", {
+ description = "Carrot",
+ inventory_image = "farming_carrot.png",
+ on_use = minetest.item_eat(3),
+})
+end)
+
node_implement("farming","farming:rhubarb_item","food:rhubarb",function()
minetest.register_craftitem("food:rhubarb", {
description = "Rhubarb",
@@ -46,6 +54,16 @@ minetest.register_craftitem("food:rhubarb", {
})
end)
+node_implement("animalmaterials","animalmaterials:meat_raw","food:meat_raw",function()
+minetest.register_craftitem("food:meat_raw", {
+ description = "Raw meat",
+ image = "animalmaterials_meat_raw.png",
+ on_use = minetest.item_eat(1),
+ groups = { meat=1, eatable=1 },
+ stack_max=25
+})
+end)
+
node_implement("farming","farming:bread","food:bread",function()
diff --git a/textures/animalmaterials_meat_raw.png b/textures/animalmaterials_meat_raw.png
new file mode 100644
index 0000000..0dea4ec
--- /dev/null
+++ b/textures/animalmaterials_meat_raw.png
Binary files differ
diff --git a/textures/food_bread_slice.png b/textures/food_bread_slice.png
new file mode 100644
index 0000000..6ada224
--- /dev/null
+++ b/textures/food_bread_slice.png
Binary files differ
diff --git a/textures/food_burger.png b/textures/food_burger.png
new file mode 100644
index 0000000..8036541
--- /dev/null
+++ b/textures/food_burger.png
Binary files differ
diff --git a/textures/food_cake_carrot.png b/textures/food_cake_carrot.png
new file mode 100644
index 0000000..9e95bbd
--- /dev/null
+++ b/textures/food_cake_carrot.png
Binary files differ
diff --git a/textures/food_meat.png b/textures/food_meat.png
new file mode 100644
index 0000000..d4e4abb
--- /dev/null
+++ b/textures/food_meat.png
Binary files differ
diff --git a/textures/food_oven_bottom.png b/textures/food_oven_bottom.png
new file mode 100644
index 0000000..c86782a
--- /dev/null
+++ b/textures/food_oven_bottom.png
Binary files differ
diff --git a/textures/food_oven_front.png b/textures/food_oven_front.png
new file mode 100644
index 0000000..55ee708
--- /dev/null
+++ b/textures/food_oven_front.png
Binary files differ
diff --git a/textures/food_oven_front_active.png b/textures/food_oven_front_active.png
new file mode 100644
index 0000000..ba732e6
--- /dev/null
+++ b/textures/food_oven_front_active.png
Binary files differ
diff --git a/textures/food_oven_side.png b/textures/food_oven_side.png
new file mode 100644
index 0000000..c86782a
--- /dev/null
+++ b/textures/food_oven_side.png
Binary files differ
diff --git a/textures/food_oven_top.png b/textures/food_oven_top.png
new file mode 100644
index 0000000..c86782a
--- /dev/null
+++ b/textures/food_oven_top.png
Binary files differ
diff --git a/textures/food_pastry_carrot.png b/textures/food_pastry_carrot.png
new file mode 100644
index 0000000..b0b973b
--- /dev/null
+++ b/textures/food_pastry_carrot.png
Binary files differ
diff --git a/textures/food_sugar.png b/textures/food_sugar.png
new file mode 100644
index 0000000..10ecf70
--- /dev/null
+++ b/textures/food_sugar.png
Binary files differ
diff --git a/textures/food_sw_meat.png b/textures/food_sw_meat.png
new file mode 100644
index 0000000..56f4e56
--- /dev/null
+++ b/textures/food_sw_meat.png
Binary files differ