diff --git a/README.md b/README.md index 2b4f6d6..e121dea 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,5 @@ Exceptions: * Other meats, hotdog, sugar and Beef Map images were found through internet searches and modified, some more severely than others. Have I missed out credit? Please tell me. + + diff --git a/cooking.lua b/cooking.lua new file mode 100644 index 0000000..ed4842d --- /dev/null +++ b/cooking.lua @@ -0,0 +1,313 @@ +--------------- +--CRAFT RECIPES +--------------- +--Smoker Craft Recipe +minetest.register_craft( { + output = "bbq:smoker", + recipe = { + {"default:steel_ingot", "default:glass", "default:steel_ingot"}, + {"default:steel_ingot", "group:wood", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} + } +}) + +--Beef Map Recipe +minetest.register_craft( { + output = "bbq:beef_map", + recipe = { + {"group:wood", "group:wood", "group:wood"}, + {"group:wood", "mobs:leather", "group:wood"}, + {"group:wood", "group:wood", "group:wood"}, + } +}) + +--Leg of Lamb Craft Recipe +minetest.register_craft( { + output = "bbq:rack_lamb_raw", + recipe = { + {"", "bbq:bbq_sauce", ""}, + {"", "bbq:mutton_raw", ""}, + {"", "bbq:mutton_raw", ""} + } +}) + +--Leg of Lamb Craft Recipe +minetest.register_craft( { + output = "bbq:leg_lamb_raw", + recipe = { + {"", "", ""}, + {"", "", ""}, + {"bbq:sea_salt", "bbq:mutton_raw", "bbq:mutton_raw"} + } +}) + +--BBQ Chicken Craft Recipe +minetest.register_craft( { + output = "bbq:ham_raw", + recipe = { + {"", "", ""}, + {"", "", ""}, + {"bbq:brine", "mobs:pork_raw", "mobs:honey"} + } +}) + +--BBQ Chicken Craft Recipe +minetest.register_craft( { + output = "bbq:bbq_chicken_raw", + recipe = { + {"", "", ""}, + {"", "", ""}, + {"bbq:bbq_sauce", "mobs:chicken_raw", "bbq:sea_salt"} + } +}) + +--BBQ Beef Ribs Craft Recipe +minetest.register_craft( { + output = "bbq:bbq_beef_ribs_raw", + recipe = { + {"", "", ""}, + {"", "", ""}, + {"bbq:bbq_sauce", "bbq:beef_raw", "bbq:pepper_ground"} + } +}) + +--Hot Wings Craft Recipe +minetest.register_craft( { + output = "bbq:hot_wings_raw", + recipe = { + {"", "", ""}, + {"", "", ""}, + {"bbq:hot_sauce", "mobs:chicken_raw", "bbq:pepper_ground"} + } +}) + +--Hamburger Craft Recipe +minetest.register_craft( { + output = "bbq:hamburger", + recipe = { + {"", "farming:bread", ""}, + {"", "bbq:beef", ""}, + {"", "farming:bread", ""} + } +}) + +--Hotdog Craft Recipe +minetest.register_craft( { + output = "bbq:hotdog", + recipe = { + {"", "", ""}, + {"", "", ""}, + {"mobs:pork_cooked", "mobs:chicken_cooked", "farming:bread"} + } +}) + +--Bacon Craft Recipe +minetest.register_craft( { + output = "bbq:bacon_raw", + recipe = { + {"", "", ""}, + {"bbq:liquid_smoke", "bbq:brine", "mobs:pork_raw"}, + {"", "", ""} + } +}) + +--Beef Jerky Craft Recipe +minetest.register_craft( { + output = "bbq:beef_jerky_raw", + recipe = { + {"", "", ""}, + {"bbq:liquid_smoke", "bbq:brine", "bbq:beef_raw"}, + {"", "", ""} + } +}) + +--Pepper Steak Craft Recipe +minetest.register_craft( { + output = "bbq:pepper_steak_raw", + recipe = { + {"", "", ""}, + {"group:pepper_ground", "bbq:beef_raw", "group:pepper_ground"}, + {"", "", ""} + } +}) + +--Stuffed Pepper Craft Recipe +minetest.register_craft( { + output = "bbq:stuffed_pepper_raw", + recipe = { + {"", "group:cheese", ""}, + {"", "farming:bread", ""}, + {"", "group:pepper", ""} + } +}) + +--Ground Pepper Craft Recipe +minetest.register_craft( { + output = "bbq:pepper_ground", + recipe = { + {"", "", ""}, + {"", "group:peppercorn", ""}, + {"", "vessels:glass_bottle", ""} + } +}) + +--Brine +minetest.register_craft( { + output = "bbq:brine", + recipe = { + {"", "", ""}, + {"bbq:sea_salt", "group:sugar", "bucket:bucket_water"}, + {"", "vessels:drinking_glass", ""} + }, + replacements = {{"bucket:bucket_water","bucket:bucket_empty"}}, +}) + +--Liquid Smoke +minetest.register_craft( { + output = "bbq:liquid_smoke", + recipe = { + {"", "vessels:glass_bottle", ""}, + {"", "", ""}, + {"", "default:torch", ""} + }, +}) + +--Sugar +minetest.register_craft( { + output = "bbq:sugar", +-- type = "shapeless", + recipe = { + {'default:papyrus'}, + }, +}) + +--Hot Sauce +minetest.register_craft( { + output = "bbq:hot_sauce", + recipe = { + {"", "", ""}, + {"group:pepper_ground", "bucket:bucket_water", "group:peppercorn"}, + {"", "vessels:glass_bottle", ""} + }, + replacements = {{"bucket:bucket_water","bucket:bucket_empty"}}, +}) + +--BBQ Sauce +minetest.register_craft( { + output = "bbq:bbq_sauce", + recipe = { + {"", "", ""}, + {"group:sugar", "group:tomato", "bbq:liquid_smoke"}, + {"", "vessels:glass_bottle", ""} + }, +}) + + +--------- +--COOKING +--------- + +--Sea Salt Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:sea_salt", + recipe = "bucket:bucket_water", + replacements = {{"bucket:bucket_water","bucket:bucket_empty"}}, + cooktime = 8, +}) + +--Mutton Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:mutton", + recipe = "bbq:mutton_raw", + cooktime = 5, +}) + +--Beef Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:beef", + recipe = "bbq:beef_raw", + cooktime = 5, +}) + +--Beef Jerky Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:beef_jerky", + recipe = "bbq:beef_jerky_raw", + cooktime = 12, +}) + +--Pepper Steak Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:pepper_steak", + recipe = "bbq:pepper_steak_raw", + cooktime = 6, +}) + +--Bacon Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:bacon", + recipe = "bbq:bacon_raw", + cooktime = 5, +}) + +--Hot Wings Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:hot_wings", + recipe = "bbq:hot_wings_raw", + cooktime = 7, +}) + +--BBQ Beef Ribs Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:bbq_beef_ribs", + recipe = "bbq:bbq_beef_ribs_raw", + cooktime = 15, +}) + +--BBQ Chicken Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:bbq_chicken", + recipe = "bbq:bbq_chicken_raw", + cooktime = 10, +}) + +--Ham +minetest.register_craft({ + type = "cooking", + output = "bbq:ham", + recipe = "bbq:ham_raw", + cooktime = 10, +}) + +--Leg of Lamb +minetest.register_craft({ + type = "cooking", + output = "bbq:leg_lamb", + recipe = "bbq:leg_lamb_raw", + cooktime = 10, +}) + +--Rack of Lamb +minetest.register_craft({ + type = "cooking", + output = "bbq:rack_lamb", + recipe = "bbq:rack_lamb_raw", + cooktime = 10, +}) + +--Stuff Pepper Cooking +minetest.register_craft({ + type = "cooking", + output = "bbq:stuffed_pepper", + recipe = "bbq:stuffed_pepper_raw", + cooktime = 4, +}) diff --git a/crafts.lua b/crafts.lua new file mode 100644 index 0000000..78d3135 --- /dev/null +++ b/crafts.lua @@ -0,0 +1,314 @@ +-- Rack of Lamb +minetest.register_craftitem("bbq:rack_lamb", { + description = ("Rack of Lamb"), + inventory_image = "bbq_rack_lamb.png", + on_use = minetest.item_eat(9), +}) + +-- Rack of Lamb Raw +minetest.register_craftitem("bbq:rack_lamb_raw", { + description = ("Rack of Lamb Raw"), + inventory_image = "bbq_rack_lamb_raw.png", + on_use = minetest.item_eat(4), +}) + +-- Leg of Lamb +minetest.register_craftitem("bbq:leg_lamb", { + description = ("Leg of Lamb"), + inventory_image = "bbq_leg_lamb.png", + on_use = minetest.item_eat(9), +}) + +-- Leg of Lamb Raw +minetest.register_craftitem("bbq:leg_lamb_raw", { + description = ("Leg of Lamb Raw"), + inventory_image = "bbq_leg_lamb_raw.png", + on_use = minetest.item_eat(4), +}) + +-- Ham +minetest.register_craftitem("bbq:ham", { + description = ("Ham"), + inventory_image = "bbq_ham.png", + on_use = minetest.item_eat(9), +}) + +-- Ham Raw +minetest.register_craftitem("bbq:ham_raw", { + description = ("Ham Raw"), + inventory_image = "bbq_ham_raw.png", + on_use = minetest.item_eat(3), +}) + +-- BBQ Chicken +minetest.register_craftitem("bbq:bbq_chicken", { + description = ("BBQ Chicken"), + inventory_image = "bbq_bbq_chicken.png", + on_use = minetest.item_eat(10), +}) + +-- BBQ Chicken Raw +minetest.register_craftitem("bbq:bbq_chicken_raw", { + description = ("BBQ Chicken Raw"), + inventory_image = "bbq_bbq_chicken_raw.png", + on_use = minetest.item_eat(4), +}) + +-- BBQ Beef Ribs +minetest.register_craftitem("bbq:bbq_beef_ribs", { + description = ("BBQ Ribs"), + inventory_image = "bbq_beef_ribs.png", + on_use = minetest.item_eat(10), +}) + +-- BBQ Beef Ribs Raw +minetest.register_craftitem("bbq:bbq_beef_ribs_raw", { + description = ("BBQ Ribs Raw"), + inventory_image = "bbq_beef_ribs_raw.png", + on_use = minetest.item_eat(4), +}) + +-- Hot Wings Raw +minetest.register_craftitem("bbq:hot_wings_raw", { + description = ("Hot Wings Raw"), + inventory_image = "bbq_hot_wings_raw.png", + on_use = minetest.item_eat(3), +}) + +-- Hot Wings +minetest.register_craftitem("bbq:hot_wings", { + description = ("Hot Wings"), + inventory_image = "bbq_hot_wings.png", + on_use = minetest.item_eat(9), +}) + +-- Hamburger +minetest.register_craftitem("bbq:hamburger", { + description = ("Hamburger"), + inventory_image = "bbq_hamburger.png", + on_use = minetest.item_eat(9), +}) + +-- Hot Dog +minetest.register_craftitem("bbq:hotdog", { + description = ("Hot Dog"), + inventory_image = "bbq_hotdog.png", + on_use = minetest.item_eat(8), +}) + +-- Raw Beef Jerky +minetest.register_craftitem("bbq:beef_jerky_raw", { + description = ("Beef Jerky Raw"), + inventory_image = "bbq_beef_jerky_raw.png", + on_use = minetest.item_eat(4), +}) + +-- Beef Jerky +minetest.register_craftitem("bbq:beef_jerky", { + description = ("Beef Jerky"), + inventory_image = "bbq_beef_jerky.png", + on_use = minetest.item_eat(12), +}) + +-- Raw Pepper Steak +minetest.register_craftitem("bbq:pepper_steak_raw", { + description = ("Pepper Steak Raw"), + inventory_image = "bbq_pepper_steak_raw.png", + on_use = minetest.item_eat(4), +}) + +-- Pepper Steak +minetest.register_craftitem("bbq:pepper_steak", { + description = ("Pepper Steak"), + inventory_image = "bbq_pepper_steak.png", + on_use = minetest.item_eat(10), +}) + +-- Raw Bacon +minetest.register_craftitem("bbq:bacon_raw", { + description = ("Bacon Raw"), + inventory_image = "bbq_bacon_raw.png", + on_use = minetest.item_eat(3), +}) + +-- Bacon +minetest.register_craftitem("bbq:bacon", { + description = ("Bacon"), + inventory_image = "bbq_bacon.png", + on_use = minetest.item_eat(9), +}) + +-- Stuffed Pepper +minetest.register_craftitem("bbq:stuffed_pepper", { + description = ("Stuffed Pepper"), + inventory_image = "bbq_stuffed_pepper.png", + on_use = minetest.item_eat(9), +}) + +-- Stuffed Pepper Raw +minetest.register_craftitem("bbq:stuffed_pepper_raw", { + description = ("Stuffed Pepper Raw"), + inventory_image = "bbq_stuffed_pepper_raw.png", + on_use = minetest.item_eat(5), +}) + +--Bell Pepper +minetest.register_craftitem("bbq:pepper", { + description = ("Pepper"), + inventory_image = "bbq_pepper.png", + on_use = minetest.item_eat(1), + groups = {pepper=1}, +}) + +--Tomato +minetest.register_craftitem("bbq:tomato", { + description = ("Tomato"), + inventory_image = "bbq_tomato.png", + on_use = minetest.item_eat(1), + groups = {tomato=1}, +}) + +--Peppercorn +minetest.register_node("bbq:peppercorn", { + description = ("Peppercorn"), + inventory_image = "bbq_peppercorn.png", + wield_image = "bbq_peppercorn.png", + drawtype = "plantlike", + tiles = { "bbq_peppercorn.png" }, + groups = { peppercorn = 1, snappy=3,flammable=3,flora=1,attached_node=1 }, + sounds = default.node_sound_leaves_defaults(), +}) + + + +--Ground Pepper +minetest.register_node("bbq:pepper_ground", { + description = ("Ground Pepper"), + inventory_image = "bbq_pepper_ground.png", + wield_image = "bbq_pepper_ground.png", + drawtype = "plantlike", + tiles = {"bbq_pepper_ground.png"}, + groups = {pepper_ground = 1, vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +-- Sea Salt +minetest.register_node("bbq:sea_salt", { + description = ("Sea Salt"), + inventory_image = "bbq_sea_salt.png", + wield_image = "bbq_sea_salt.png", + drawtype = "plantlike", + tiles = {"bbq_sea_salt.png"}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +-- Brine +minetest.register_node("bbq:brine", { + description = ("Brine"), + inventory_image = "bbq_brine.png", + wield_image = "bbq_brine.png", + drawtype = "plantlike", + tiles = {"bbq_brine.png"}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +-- Liquid Smoke +minetest.register_node("bbq:liquid_smoke", { + description = ("Liquid Smoke"), + inventory_image = "bbq_liquid_smoke.png", + wield_image = "bbq_liquid_smoke.png", + drawtype = "plantlike", + tiles = {"bbq_liquid_smoke.png"}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +-- Sugar +minetest.register_node("bbq:sugar", { + description = ("Sugar"), + inventory_image = "bbq_sugar.png", + wield_image = "bbq_sugar.png", + drawtype = "plantlike", + tiles = {"bbq_sugar.png"}, + groups = {vessel = 1, sugar=1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +-- Hot Sauce +minetest.register_node("bbq:hot_sauce", { + description = ("Hot Sauce"), + inventory_image = "bbq_hot_sauce.png", + wield_image = "bbq_hot_sauce.png", + drawtype = "plantlike", + tiles = {"bbq_hot_sauce.png"}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +-- BBQ Sauce +minetest.register_node("bbq:bbq_sauce", { + description = ("BBQ Sauce"), + inventory_image = "bbq_bbq_sauce.png", + wield_image = "bbq_bbq_sauce.png", + drawtype = "plantlike", + tiles = {"bbq_bbq_sauce.png"}, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("bbq:beef_map", { + description = "Beef Map", + inventory_image = "bbq_cow_map.png", + tiles = { + "default_junglewood.png", "default_junglewood.png", + "default_junglewood.png", "default_junglewood.png", + "default_junglewood.png", "bbq_cow_map.png", + }, + + paramtype2 = "facedir", + paramtype = "light", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}, + + }, + }, + groups = {choppy=3, oddly_breakable_by_hand=2, flammable=3}, + sounds = default.node_sound_wood_defaults(), +}) + +------------------- +--Animal Drop Meats +------------------- + +-- Raw Mutton +minetest.register_craftitem("bbq:mutton_raw", { + description = ("Raw Mutton"), + inventory_image = "bbq_mutton_raw.png", + on_use = minetest.item_eat(3), +}) + +-- Cooked Mutton +minetest.register_craftitem("bbq:mutton", { + description = ("Mutton"), + inventory_image = "bbq_mutton_cooked.png", + on_use = minetest.item_eat(8), +}) + +-- Raw Beef +minetest.register_craftitem("bbq:beef_raw", { + description = ("Raw Beef"), + inventory_image = "bbq_beef_raw.png", + on_use = minetest.item_eat(3), +}) + +-- Cooked Beef +minetest.register_craftitem("bbq:beef", { + description = ("Beef"), + inventory_image = "bbq_beef_cooked.png", + on_use = minetest.item_eat(8), +}) diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..a0c72d8 --- /dev/null +++ b/depends.txt @@ -0,0 +1,8 @@ +default +vessels +bucket +farming +mobs +mobs_animal +craft_guide? +food? diff --git a/description.txt b/description.txt new file mode 100644 index 0000000..98798d0 --- /dev/null +++ b/description.txt @@ -0,0 +1,43 @@ +A BBQ add-on for Minetest. + +Depends on (and expands upon) Mobs-Redo and it's animals add-ons. +Causes cows to drop beef and lambs to drop button. + +Play's nice with Crops and Food addons. Can use tomatos, cheese, sugar, and honey from Crops, Food, and Mobs-Redo add-ons. Also compatible with my expansion of the Crops add-on (adds peppers, peppercorns, and ground pepper to the Crops add-on, all are present in this addon but without the actual pepper plant). + +Upgrades the BTUs of wood and wood planks in a realistic way when used in furnaces (including the smoker). + +All spices and sauces can be placed on the vessels shelf. Also added support for placing the bucket in the vessels shelf. + +Adds the following items: + +Smoker +Beef Map (Wall Hanging) + +Peppercorn +Ground Pepper +Sea Salt +Sugar + +Bell Pepper +Tomato + +Brine +Liquid Smoke +Hot suace +BBQ Sauce + +Mutton (Raw & Cooked) +Beef (Raw & Cooked) +Rack of Lamb (Raw & Cooked) +Leg of Lamb (Raw & Cooked) +Ham (Raw & Cooked) +BBQ Chicken (Raw & Cooked) +BBQ Beef Ribs (Raw & Cooked) +Hot Wings (Raw & Cooked) +Hamburger +Hot Dog +Beef Jerky (Raw & Cooked) +Pepper Steak (Raw & Cooked) +Bacon (Raw & Cooked) +Stuffed Pepper (Raw & Cooked) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..72cc66a --- /dev/null +++ b/init.lua @@ -0,0 +1,4 @@ +dofile(minetest.get_modpath("bbq").."/cooking.lua") +dofile(minetest.get_modpath("bbq").."/crafts.lua") +dofile(minetest.get_modpath("bbq").."/smoker.lua") +dofile(minetest.get_modpath("bbq").."/overrides.lua") diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..9defa35 --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = bbq diff --git a/overrides.lua b/overrides.lua new file mode 100644 index 0000000..0358917 --- /dev/null +++ b/overrides.lua @@ -0,0 +1,149 @@ +------------------------- +--Add food to Like Groups +------------------------- + +-----CHECK FOR FOODS ADDON------------------------------- +if minetest.registered_items["food:tomato"] ~= nil then +minetest.override_item("food:tomato", { + groups = {tomato=1}, +}) + +minetest.override_item("food:cheese", { + groups = {cheese=1}, +}) + +minetest.override_item("food:sugar", { + groups = {sugar=1}, +}) + +end +--------------------------------------------------------- + +minetest.override_item("mobs:honey", { + groups = {sugar=1}, +}) + +minetest.override_item("mobs:cheese", { + groups = {cheese=1}, +}) + + + +--------- +--Aliases +--------- +minetest.register_alias("crops:tomato", "bbq:tomato") +minetest.register_alias("food:tomato", "bbq:tomato") + + +minetest.register_alias("mobs:cheese", "bbq:cheese") +minetest.register_alias("food:cheese", "bbq:cheese") + +minetest.register_alias("crops:pepper", "bbq:pepper") + + +minetest.register_alias("crops:peppercorn", "bbq:peppercorn") + +minetest.register_alias("crops:pepper_ground", "bbq:pepper_ground") + +minetest.register_alias("crops:pepper", "bbq:pepper") + +minetest.register_alias("food:sugar", "bbq:sugar") + + +--------------------------------- +--UPGRADE MEAT DROPS IN MOBS REDO +--------------------------------- +local def = minetest.registered_entities["mobs_animal:sheep_white"] +assert(def, "mobs:sheep not found") +def.drops = { + {name = "bbq:mutton_raw", chance = 1, min = 1, max = 2 }, +} + +local def = minetest.registered_entities["mobs_animal:cow"] +assert(def, "mobs:cow not found") +def.drops = { + {name = "bbq:beef_raw", chance = 1, min = 1, max = 3}, + {name = "mobs:leather", chance = 1, min = 1, max = 2}, +} +----------------------------------------------- +--MAKE VESSEL TYPE ITEMS WORK WITH VESSEL SHELF +----------------------------------------------- +minetest.override_item("bucket:bucket_empty", { + groups = {vessel=1}, +}) + +minetest.override_item("bucket:bucket_water", { + groups = {vessel=1}, +}) + +minetest.override_item("bucket:bucket_river_water", { + groups = {vessel=1}, +}) + +minetest.override_item("bucket:bucket_lava", { + groups = {vessel=1}, +}) + +---------------------- +--UPGRADING WOOD FUELS +---------------------- +minetest.register_craft({ + type = "fuel", + recipe = "default:junglewood", + burntime = 100, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_wood", + burntime = 92, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:wood", + burntime = 85, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_wood", + burntime = 75, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_wood", + burntime = 65, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "stairs:slab_junglewood", + burntime = 12, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "stairs:slab_acacia_wood", + burntime = 11, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "stairs:slab_wood", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "stairs:slab_pine_wood", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "stairs:slab_aspen_wood", + burntime = 7, +}) diff --git a/smoker.lua b/smoker.lua new file mode 100644 index 0000000..1a42a56 --- /dev/null +++ b/smoker.lua @@ -0,0 +1,395 @@ + +-- +-- Formspecs +-- + +function default.get_smoker_active_formspec(fuel_percent, item_percent) + return "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[context;src;2.75,0.5;1,1;]".. + "list[context;fuel;2.75,2.5;1,1;]".. + "image[2.75,1.5;1,1;bbq_smoker_fire_bg.png^[lowpart:".. + (100-fuel_percent)..":bbq_smoker_fire_fg.png]".. + "image[3.75,1.5;1,1;gui_smoker_arrow_bg.png^[lowpart:".. + (item_percent)..":gui_smoker_arrow_fg.png^[transformR270]".. + "list[context;dst;4.8,0.5;3,3;]".. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "listring[context;dst]".. + "listring[current_player;main]".. + "listring[context;src]".. + "listring[current_player;main]".. + "listring[context;fuel]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0, 4.25) +end + +function default.get_smoker_inactive_formspec() + return "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[context;src;2.75,0.5;1,1;]".. + "list[context;fuel;2.75,2.5;1,1;]".. + "image[2.75,1.5;1,1;bbq_smoker_fire_bg.png]".. + "image[3.75,1.5;1,1;gui_smoker_arrow_bg.png^[transformR270]".. + "list[context;dst;4.8,0.5;3,3;]".. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "listring[context;dst]".. + "listring[current_player;main]".. + "listring[context;src]".. + "listring[current_player;main]".. + "listring[context;fuel]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0, 4.25) +end + +-- +-- Node callback functions that are the same for active and inactive smoker +-- + +local function can_dig(pos, player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src") +end + +local function allow_metadata_inventory_put(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if listname == "fuel" then + if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then + if inv:is_empty("src") then + meta:set_string("infotext", "smoker is empty") + end + return stack:get_count() + else + return 0 + end + elseif listname == "src" then + return stack:get_count() + elseif listname == "dst" then + return 0 + end +end + +local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local stack = inv:get_stack(from_list, from_index) + return allow_metadata_inventory_put(pos, to_list, to_index, stack, player) +end + +local function allow_metadata_inventory_take(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() +end + +local function swap_node(pos, name) + local node = minetest.get_node(pos) + if node.name == name then + return + end + node.name = name + minetest.swap_node(pos, node) +end + +local function smoker_node_timer(pos, elapsed) + -- + -- Inizialize metadata + -- + local meta = minetest.get_meta(pos) + local fuel_time = meta:get_float("fuel_time") or 0 + local src_time = meta:get_float("src_time") or 0 + local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 + + local inv = meta:get_inventory() + local srclist, fuellist + + local cookable, cooked + local fuel + + local update = true + while elapsed > 0 and update do + update = false + + srclist = inv:get_list("src") + fuellist = inv:get_list("fuel") + + -- + -- Cooking + -- + + -- Check if we have cookable content + local aftercooked + cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + cookable = cooked.time ~= 0 + + local el = math.min(elapsed, fuel_totaltime - fuel_time) + + + if cookable then -- fuel lasts long enough, adjust el to cooking duration + el = math.min(el, cooked.time - src_time) + end + + -- Check if we have enough fuel to burn + if fuel_time < fuel_totaltime then + -- The smoker is currently active and has enough fuel + fuel_time = fuel_time + el + -- If there is a cookable item then check if it is ready yet + if cookable then + src_time = src_time + el + if src_time >= cooked.time then + -- Place result in dst list if possible + if inv:room_for_item("dst", cooked.item) then + inv:add_item("dst", cooked.item) + inv:set_stack("src", 1, aftercooked.items[1]) + src_time = src_time - cooked.time + update = true + end + else + -- Item could not be cooked: probably missing fuel + update = true + end + end + else + -- smoker ran out of fuel + if cookable then + -- We need to get new fuel + local afterfuel + fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + + if fuel.time == 0 then + -- No valid fuel in fuel list + fuel_totaltime = 0 + src_time = 0 + else + -- Take fuel from fuel list + inv:set_stack("fuel", 1, afterfuel.items[1]) + update = true + fuel_totaltime = fuel.time + (fuel_totaltime - fuel_time) + end + else + -- We don't need to get new fuel since there is no cookable item + fuel_totaltime = 0 + src_time = 0 + end + fuel_time = 0 + end + + elapsed = elapsed - el + end + + if fuel and fuel_totaltime > fuel.time then + fuel_totaltime = fuel.time + end + if srclist[1]:is_empty() then + src_time = 0 + end + + -- + -- Update formspec, infotext and node + -- + local formspec + local item_state + local item_percent = 0 + if cookable then + item_percent = math.floor(src_time / cooked.time * 100) + if item_percent > 100 then + item_state = "100% (output full)" + else + item_state = item_percent .. "%" + end + else + if srclist[1]:is_empty() then + item_state = "Empty" + else + item_state = "Not cookable" + end + end + + local fuel_state = "Empty" + local active = "inactive" + local result = false + + if fuel_totaltime ~= 0 then + active = "active" + local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) + fuel_state = fuel_percent .. "%" + formspec = default.get_smoker_active_formspec(fuel_percent, item_percent) + swap_node(pos, "bbq:smoker_active") + -- make sure timer restarts automatically + result = true + else + if not fuellist[1]:is_empty() then + fuel_state = "0%" + end + formspec = default.get_smoker_inactive_formspec() + swap_node(pos, "bbq:smoker") + -- stop timer on the inactive smoker + minetest.get_node_timer(pos):stop() + end + + local infotext = "smoker " .. active .. "\n(Item: " .. item_state .. + "; Fuel: " .. fuel_state .. ")" + + -- + -- Set meta values + -- + meta:set_float("fuel_totaltime", fuel_totaltime) + meta:set_float("fuel_time", fuel_time) + meta:set_float("src_time", src_time) + meta:set_string("formspec", formspec) + meta:set_string("infotext", infotext) + + return result +end + +------------------- +-- Node definitions +------------------- + +minetest.register_node("bbq:smoker", { + description = "Smoker", + tiles = { + "bbq_smoker_top.png", "bbq_smoker_bottom.png", + "bbq_smoker_side.png", "bbq_smoker_side.png", + "bbq_smoker_back.png", "bbq_smoker_front.png", + }, + + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-1, 0.2, -0.5, 1, 0.25, 0.5},-- wings + {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5}, -- main body + {-0.5, 0.25, -0.5, 0.5, 0.68, 0.5}, -- top + }, + }, + + groups = {cracky=2}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + + can_dig = can_dig, + + on_timer = smoker_node_timer, + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", default.get_smoker_inactive_formspec()) + local inv = meta:get_inventory() + inv:set_size('src', 1) + inv:set_size('fuel', 1 ) + inv:set_size('dst', 9) + end, + + on_metadata_inventory_move = function(pos) + minetest.get_node_timer(pos):start(1.0) + end, + on_metadata_inventory_put = function(pos) + -- start timer function, it will sort out whether smoker can burn or not. + minetest.get_node_timer(pos):start(1.0) + end, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "src", drops) + default.get_inventory_drops(pos, "fuel", drops) + default.get_inventory_drops(pos, "dst", drops) + drops[#drops+1] = "bbq:smoker" + minetest.remove_node(pos) + return drops + end, + + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_move = allow_metadata_inventory_move, + allow_metadata_inventory_take = allow_metadata_inventory_take, +}) + +minetest.register_node("bbq:smoker_active", { + description = "smoker", + + + + tiles = { + "bbq_smoker_top.png", "bbq_smoker_bottom.png", + + { + image = "bbq_smoker_side_active.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + }, + + { + image = "bbq_smoker_side_active.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + }, + + "bbq_smoker_back.png", + { + image = "bbq_smoker_front_active.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + }, + }, + + + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-1, 0.2, -0.5, 1, 0.25, 0.5},-- wings + {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5}, -- main body + {-0.5, 0.25, -0.5, 0.5, 0.68, 0.5}, -- top + }, + }, + + + + + + + + + + + drop = "bbq:smoker", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + on_timer = smoker_node_timer, + + can_dig = can_dig, + + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_move = allow_metadata_inventory_move, + allow_metadata_inventory_take = allow_metadata_inventory_take, +}) diff --git a/textures/bbq_bacon.png b/textures/bbq_bacon.png new file mode 100644 index 0000000..390eeba Binary files /dev/null and b/textures/bbq_bacon.png differ diff --git a/textures/bbq_bacon_raw.png b/textures/bbq_bacon_raw.png new file mode 100644 index 0000000..d289467 Binary files /dev/null and b/textures/bbq_bacon_raw.png differ diff --git a/textures/bbq_bbq_chicken.png b/textures/bbq_bbq_chicken.png new file mode 100644 index 0000000..616b8e4 Binary files /dev/null and b/textures/bbq_bbq_chicken.png differ diff --git a/textures/bbq_bbq_chicken_raw.png b/textures/bbq_bbq_chicken_raw.png new file mode 100644 index 0000000..31ec143 Binary files /dev/null and b/textures/bbq_bbq_chicken_raw.png differ diff --git a/textures/bbq_bbq_sauce.png b/textures/bbq_bbq_sauce.png new file mode 100644 index 0000000..f639143 Binary files /dev/null and b/textures/bbq_bbq_sauce.png differ diff --git a/textures/bbq_beef_cooked.png b/textures/bbq_beef_cooked.png new file mode 100644 index 0000000..23caf58 Binary files /dev/null and b/textures/bbq_beef_cooked.png differ diff --git a/textures/bbq_beef_jerky.png b/textures/bbq_beef_jerky.png new file mode 100644 index 0000000..9a2c6a2 Binary files /dev/null and b/textures/bbq_beef_jerky.png differ diff --git a/textures/bbq_beef_jerky_raw.png b/textures/bbq_beef_jerky_raw.png new file mode 100644 index 0000000..10b27a8 Binary files /dev/null and b/textures/bbq_beef_jerky_raw.png differ diff --git a/textures/bbq_beef_raw.png b/textures/bbq_beef_raw.png new file mode 100644 index 0000000..edd8d06 Binary files /dev/null and b/textures/bbq_beef_raw.png differ diff --git a/textures/bbq_beef_ribs.png b/textures/bbq_beef_ribs.png new file mode 100644 index 0000000..df9a7d1 Binary files /dev/null and b/textures/bbq_beef_ribs.png differ diff --git a/textures/bbq_beef_ribs_raw.png b/textures/bbq_beef_ribs_raw.png new file mode 100644 index 0000000..78f2c68 Binary files /dev/null and b/textures/bbq_beef_ribs_raw.png differ diff --git a/textures/bbq_brine.png b/textures/bbq_brine.png new file mode 100644 index 0000000..c8e9ca3 Binary files /dev/null and b/textures/bbq_brine.png differ diff --git a/textures/bbq_cow_map.jpg b/textures/bbq_cow_map.jpg new file mode 100644 index 0000000..cf55a52 Binary files /dev/null and b/textures/bbq_cow_map.jpg differ diff --git a/textures/bbq_cow_map.png b/textures/bbq_cow_map.png new file mode 100644 index 0000000..695ee10 Binary files /dev/null and b/textures/bbq_cow_map.png differ diff --git a/textures/bbq_ham.png b/textures/bbq_ham.png new file mode 100644 index 0000000..242f7b9 Binary files /dev/null and b/textures/bbq_ham.png differ diff --git a/textures/bbq_ham_raw.png b/textures/bbq_ham_raw.png new file mode 100644 index 0000000..c241d74 Binary files /dev/null and b/textures/bbq_ham_raw.png differ diff --git a/textures/bbq_hamburger.png b/textures/bbq_hamburger.png new file mode 100644 index 0000000..54eb362 Binary files /dev/null and b/textures/bbq_hamburger.png differ diff --git a/textures/bbq_hot_sauce.png b/textures/bbq_hot_sauce.png new file mode 100644 index 0000000..bbaa1aa Binary files /dev/null and b/textures/bbq_hot_sauce.png differ diff --git a/textures/bbq_hot_wings.png b/textures/bbq_hot_wings.png new file mode 100644 index 0000000..bbdf63e Binary files /dev/null and b/textures/bbq_hot_wings.png differ diff --git a/textures/bbq_hot_wings_raw.png b/textures/bbq_hot_wings_raw.png new file mode 100644 index 0000000..7a87af1 Binary files /dev/null and b/textures/bbq_hot_wings_raw.png differ diff --git a/textures/bbq_hotdog.png b/textures/bbq_hotdog.png new file mode 100644 index 0000000..a123449 Binary files /dev/null and b/textures/bbq_hotdog.png differ diff --git a/textures/bbq_leg_lamb.png b/textures/bbq_leg_lamb.png new file mode 100644 index 0000000..8fa7bf7 Binary files /dev/null and b/textures/bbq_leg_lamb.png differ diff --git a/textures/bbq_leg_lamb_raw.png b/textures/bbq_leg_lamb_raw.png new file mode 100644 index 0000000..52dae70 Binary files /dev/null and b/textures/bbq_leg_lamb_raw.png differ diff --git a/textures/bbq_liquid_smoke.png b/textures/bbq_liquid_smoke.png new file mode 100644 index 0000000..438a061 Binary files /dev/null and b/textures/bbq_liquid_smoke.png differ diff --git a/textures/bbq_mutton_cooked.png b/textures/bbq_mutton_cooked.png new file mode 100644 index 0000000..eac7389 Binary files /dev/null and b/textures/bbq_mutton_cooked.png differ diff --git a/textures/bbq_mutton_raw.png b/textures/bbq_mutton_raw.png new file mode 100644 index 0000000..15454c2 Binary files /dev/null and b/textures/bbq_mutton_raw.png differ diff --git a/textures/bbq_pepper.png b/textures/bbq_pepper.png new file mode 100644 index 0000000..bb8f40c Binary files /dev/null and b/textures/bbq_pepper.png differ diff --git a/textures/bbq_pepper_ground.png b/textures/bbq_pepper_ground.png new file mode 100644 index 0000000..d72405a Binary files /dev/null and b/textures/bbq_pepper_ground.png differ diff --git a/textures/bbq_pepper_steak.png b/textures/bbq_pepper_steak.png new file mode 100644 index 0000000..54814fd Binary files /dev/null and b/textures/bbq_pepper_steak.png differ diff --git a/textures/bbq_pepper_steak_raw.png b/textures/bbq_pepper_steak_raw.png new file mode 100644 index 0000000..f2865a1 Binary files /dev/null and b/textures/bbq_pepper_steak_raw.png differ diff --git a/textures/bbq_peppercorn.png b/textures/bbq_peppercorn.png new file mode 100644 index 0000000..0ee3c49 Binary files /dev/null and b/textures/bbq_peppercorn.png differ diff --git a/textures/bbq_rack_lamb.png b/textures/bbq_rack_lamb.png new file mode 100644 index 0000000..9341762 Binary files /dev/null and b/textures/bbq_rack_lamb.png differ diff --git a/textures/bbq_rack_lamb_raw.png b/textures/bbq_rack_lamb_raw.png new file mode 100644 index 0000000..70f5d27 Binary files /dev/null and b/textures/bbq_rack_lamb_raw.png differ diff --git a/textures/bbq_sea_salt.png b/textures/bbq_sea_salt.png new file mode 100644 index 0000000..e28bf7f Binary files /dev/null and b/textures/bbq_sea_salt.png differ diff --git a/textures/bbq_smoker_back.png b/textures/bbq_smoker_back.png new file mode 100644 index 0000000..6d8bd25 Binary files /dev/null and b/textures/bbq_smoker_back.png differ diff --git a/textures/bbq_smoker_bottom.png b/textures/bbq_smoker_bottom.png new file mode 100644 index 0000000..a5a259d Binary files /dev/null and b/textures/bbq_smoker_bottom.png differ diff --git a/textures/bbq_smoker_fire_bg.png b/textures/bbq_smoker_fire_bg.png new file mode 100644 index 0000000..126204a Binary files /dev/null and b/textures/bbq_smoker_fire_bg.png differ diff --git a/textures/bbq_smoker_fire_fg.png b/textures/bbq_smoker_fire_fg.png new file mode 100644 index 0000000..ff271ce Binary files /dev/null and b/textures/bbq_smoker_fire_fg.png differ diff --git a/textures/bbq_smoker_front.png b/textures/bbq_smoker_front.png new file mode 100644 index 0000000..722563a Binary files /dev/null and b/textures/bbq_smoker_front.png differ diff --git a/textures/bbq_smoker_front_active.png b/textures/bbq_smoker_front_active.png new file mode 100644 index 0000000..3aa6020 Binary files /dev/null and b/textures/bbq_smoker_front_active.png differ diff --git a/textures/bbq_smoker_side.png b/textures/bbq_smoker_side.png new file mode 100644 index 0000000..55e337b Binary files /dev/null and b/textures/bbq_smoker_side.png differ diff --git a/textures/bbq_smoker_side_active.png b/textures/bbq_smoker_side_active.png new file mode 100644 index 0000000..7296d7a Binary files /dev/null and b/textures/bbq_smoker_side_active.png differ diff --git a/textures/bbq_smoker_top.png b/textures/bbq_smoker_top.png new file mode 100644 index 0000000..1d87670 Binary files /dev/null and b/textures/bbq_smoker_top.png differ diff --git a/textures/bbq_stuffed_pepper.png b/textures/bbq_stuffed_pepper.png new file mode 100644 index 0000000..2051dbb Binary files /dev/null and b/textures/bbq_stuffed_pepper.png differ diff --git a/textures/bbq_stuffed_pepper_raw.png b/textures/bbq_stuffed_pepper_raw.png new file mode 100644 index 0000000..751acfd Binary files /dev/null and b/textures/bbq_stuffed_pepper_raw.png differ diff --git a/textures/bbq_sugar.png b/textures/bbq_sugar.png new file mode 100644 index 0000000..e58aa4c Binary files /dev/null and b/textures/bbq_sugar.png differ diff --git a/textures/bbq_tomato.png b/textures/bbq_tomato.png new file mode 100644 index 0000000..aa9a524 Binary files /dev/null and b/textures/bbq_tomato.png differ diff --git a/textures/gui_smoker_arrow_bg.png b/textures/gui_smoker_arrow_bg.png new file mode 100644 index 0000000..046d8cd Binary files /dev/null and b/textures/gui_smoker_arrow_bg.png differ diff --git a/textures/gui_smoker_arrow_fg.png b/textures/gui_smoker_arrow_fg.png new file mode 100644 index 0000000..046f12e Binary files /dev/null and b/textures/gui_smoker_arrow_fg.png differ