Added Oven, Meats, Sandwiches and Carrot Cake

This commit is contained in:
Rubenwardy 2012-09-01 18:07:06 +01:00
parent 5dc3fa20a9
commit 9817c63921
20 changed files with 293 additions and 7 deletions

View File

@ -24,10 +24,11 @@ minetest.register_craftitem("food:crumble_rhubarb_raw", {
minetest.register_craft({ minetest.register_craft({
output = '"food:crumble_rhubarb_raw" 1', output = '"food:crumble_rhubarb_raw" 1',
recipe = { recipe = {
{'"food:sugar"',"",""},
{'"food:flour"','"food:rhubarb"','"food:butter"'} {'"food:flour"','"food:rhubarb"','"food:butter"'}
} }
}) })
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "food:crumble_rhubarb", output = "food:crumble_rhubarb",

View File

@ -13,26 +13,38 @@ print("RubenFood [Master] - Loading Cakes")
--------------------------Cakes------------------------- --------------------------Cakes-------------------------
minetest.register_craftitem("food:cakemix_plain",{ minetest.register_craftitem("food:cakemix_plain",{
description = "Cake Mix", description = "Cake Mix",
tiles = {"food_pastry.png"},
inventory_image = "food_pastry.png", inventory_image = "food_pastry.png",
}) })
minetest.register_craftitem("food:cakemix_choco",{ minetest.register_craftitem("food:cakemix_choco",{
description = "Chocolate Cake Mix", description = "Chocolate Cake Mix",
tiles = {"food_pastry_choco.png"},
inventory_image = "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({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "food:cake", output = "food:cake",
recipe = "food:cakemix_plain", recipe = "food:cakemix_plain",
cooktime = 10,
}) })
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "food:cake_chocolate", output = "food:cake_chocolate",
recipe = "food:cakemix_choco", 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", { minetest.register_craftitem("food:cake", {
@ -47,6 +59,12 @@ minetest.register_craftitem("food:cake_chocolate", {
on_use = minetest.item_eat(40), 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({ minetest.register_craft({
output = '"food:cakemix_plain" 1', output = '"food:cakemix_plain" 1',
recipe = { recipe = {
{'"food:flour"',"",'"food:egg"'}, {'"food:flour"','"food:sugar"','"food:egg"'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = '"food:cakemix_choco" 1', output = '"food:cakemix_choco" 1',
recipe = { 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"'},
} }
}) })

View File

@ -14,7 +14,10 @@ print ("food: Loading mainframe: [Master]")
----------------------Load Files----------------------------- ----------------------Load Files-----------------------------
dofile(minetest.get_modpath("food").."/support.lua") 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").."/dairy.lua")
dofile(minetest.get_modpath("food").."/meats.lua")
dofile(minetest.get_modpath("food").."/sandwich.lua") dofile(minetest.get_modpath("food").."/sandwich.lua")
dofile(minetest.get_modpath("food").."/baking.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").."/tarts.lua")
dofile(minetest.get_modpath("food").."/drinks.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---------------------------- ----------------------------Cigerete----------------------------
minetest.register_node(":food:cigarette", { minetest.register_node(":food:cigarette", {

25
meats.lua Normal file
View File

@ -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
})

197
oven.lua Normal file
View File

@ -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,
})

View File

@ -19,11 +19,17 @@ minetest.register_craftitem("food:sw_meat", {
on_use = minetest.item_eat(10), 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({ minetest.register_craft({
output = '"food:sw_meat" 1', output = '"food:sw_meat" 1',
recipe = { recipe = {
{"",'"food:bread_slice"',""}, {"",'"food:bread_slice"',""},
{"food:butter","",'"food:butter"'}, {"food:butter","food:meat",'"food:butter"'},
{"",'"food:bread_slice"',""}, {"",'"food:bread_slice"',""},
} }
}) })

View File

@ -39,6 +39,14 @@ minetest.register_craftitem("food:strawberry", {
}) })
end) 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() node_implement("farming","farming:rhubarb_item","food:rhubarb",function()
minetest.register_craftitem("food:rhubarb", { minetest.register_craftitem("food:rhubarb", {
description = "Rhubarb", description = "Rhubarb",
@ -46,6 +54,16 @@ minetest.register_craftitem("food:rhubarb", {
}) })
end) 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() node_implement("farming","farming:bread","food:bread",function()

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

BIN
textures/food_burger.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

BIN
textures/food_meat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

BIN
textures/food_oven_side.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

BIN
textures/food_oven_top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

BIN
textures/food_sugar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
textures/food_sw_meat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B