2022-11-13 01:07:28 +01:00
|
|
|
---
|
|
|
|
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
|
|
|
--- Created by michieal.
|
|
|
|
--- DateTime: 10/23/22 4:50 AM
|
|
|
|
---
|
|
|
|
-- LOCALIZATION
|
2022-11-15 17:27:46 +01:00
|
|
|
|
2022-11-16 01:34:38 +01:00
|
|
|
local S = minetest.get_translator("mcl_hamburger")
|
2022-11-13 01:07:28 +01:00
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
local modpath = minetest.get_modpath(modname)
|
|
|
|
|
|
|
|
local table = table
|
|
|
|
local DEBUG = false
|
|
|
|
|
2022-11-19 05:49:38 +01:00
|
|
|
local enable_burger = minetest.settings:get_bool("mcl_enable_hamburger",true)
|
|
|
|
local use_alt = minetest.settings:get_bool("mcl_hamburger_alt_texture",false)
|
|
|
|
|
2022-11-16 01:34:38 +01:00
|
|
|
mcl_hamburger = {}
|
|
|
|
|
|
|
|
-- call to register your hamburger.
|
|
|
|
function mcl_hamburger.register_burger_craft(cooked_meat, use_alt)
|
2022-11-19 05:49:38 +01:00
|
|
|
if use_alt == nil or use_alt == "" then
|
|
|
|
use_alt = false
|
2022-11-16 01:34:38 +01:00
|
|
|
end
|
|
|
|
|
2022-11-19 05:49:38 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "mcl_hamburger:hamburger",
|
|
|
|
burntime = 2,
|
|
|
|
})
|
|
|
|
|
|
|
|
local itemstring = "mcl_hamburger:hamburger"
|
|
|
|
minetest.register_craft({
|
|
|
|
output = itemstring,
|
|
|
|
recipe = {
|
|
|
|
{ "mcl_farming:bread"},
|
|
|
|
{ cooked_meat }, -- "mcl_mobitems:cooked_beef" for a reg hamburger. Grind up clowns for a Big Mac.
|
|
|
|
{ "mcl_farming:bread" },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
local hamburger_def = {
|
|
|
|
description = S("A Hamburger"),
|
|
|
|
_doc_items_longdesc = S("A tasty hamburger that is sure to lure villagers around like a lead. Can be eaten."),
|
|
|
|
_doc_items_usagehelp = S("wield this item to pull villagers to you."),
|
|
|
|
_tt_help = S("A tasty hamburger that is sure to lure villagers.\n'I'll gladly pay you Tuesday, for a hamburger today.' - Wimpy."),
|
|
|
|
inventory_image = "mcl_hamburger.png",
|
|
|
|
wield_image = "mcl_hamburger.png",
|
|
|
|
on_place = minetest.item_eat(8),
|
|
|
|
on_secondary_use = minetest.item_eat(8),
|
|
|
|
groups = { food = 2, eatable = 8 },
|
|
|
|
_mcl_saturation = 12.8,
|
|
|
|
}
|
|
|
|
|
2022-11-19 06:00:53 +01:00
|
|
|
if not enable_burger then
|
|
|
|
hamburger_def.groups.not_in_creative_inventory = 1
|
|
|
|
end
|
|
|
|
|
2022-11-19 05:49:38 +01:00
|
|
|
if use_alt == false then
|
|
|
|
minetest.register_craftitem("mcl_hamburger:hamburger", hamburger_def)
|
|
|
|
else
|
|
|
|
local hamburger_alt = table.copy(hamburger_def)
|
|
|
|
hamburger_alt.inventory_image = "mcl_hamburger_alt.png"
|
|
|
|
hamburger_alt.wield_image = "mcl_hamburger_alt.png"
|
|
|
|
minetest.register_craftitem("mcl_hamburger:hamburger", hamburger_alt)
|
|
|
|
end
|
2022-11-16 01:34:38 +01:00
|
|
|
|
2022-11-19 06:00:53 +01:00
|
|
|
if enable_burger then
|
|
|
|
-- make the villagers follow the item
|
|
|
|
minetest.registered_entities["mobs_mc:villager"].nofollow = false
|
|
|
|
-- add it to the follow items.
|
|
|
|
table.insert(minetest.registered_entities["mobs_mc:villager"].follow,"mcl_hamburger:hamburger")
|
|
|
|
-- register the item and crafting recipe.
|
|
|
|
mcl_hamburger.register_burger_craft("mcl_mobitems:cooked_beef")
|
2022-11-19 05:49:38 +01:00
|
|
|
end
|