1
0
Fork 0

some basic burger cleanup

This commit is contained in:
cora 2022-11-19 05:49:38 +01:00
parent 2149ca1147
commit 8e74a5a56a
3 changed files with 46 additions and 51 deletions

View File

@ -15,11 +15,13 @@ local modpath = minetest.get_modpath(modname)
local table = table local table = table
local DEBUG = false local DEBUG = false
local enable_burger = minetest.settings:get_bool("mcl_enable_hamburger",true)
local use_alt = minetest.settings:get_bool("mcl_hamburger_alt_texture",false)
mcl_hamburger = {} mcl_hamburger = {}
-- call to register your hamburger. -- call to register your hamburger.
function mcl_hamburger.register_burger_craft(cooked_meat, use_alt) function mcl_hamburger.register_burger_craft(cooked_meat, use_alt)
if use_alt == nil or use_alt == "" then if use_alt == nil or use_alt == "" then
use_alt = false use_alt = false
end end
@ -30,11 +32,7 @@ function mcl_hamburger.register_burger_craft(cooked_meat, use_alt)
burntime = 2, burntime = 2,
}) })
-- register crafts (actual recipe)
if minetest.get_modpath(modname) then
local itemstring = "mcl_hamburger:hamburger" local itemstring = "mcl_hamburger:hamburger"
minetest.register_craft({ minetest.register_craft({
output = itemstring, output = itemstring,
recipe = { recipe = {
@ -50,34 +48,31 @@ function mcl_hamburger.register_burger_craft(cooked_meat, use_alt)
_doc_items_longdesc = S("A tasty hamburger that is sure to lure villagers around like a lead. Can be eaten."), _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."), _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."), _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 = "hamburger.png", inventory_image = "mcl_hamburger.png",
wield_image = "hamburger.png", wield_image = "mcl_hamburger.png",
on_place = minetest.item_eat(8), on_place = minetest.item_eat(8),
on_secondary_use = minetest.item_eat(8), on_secondary_use = minetest.item_eat(8),
groups = { food = 2, eatable = 8 }, groups = { food = 2, eatable = 8 },
_mcl_saturation = 12.8, _mcl_saturation = 12.8,
stack_max = 64,
} }
if use_alt == false then if use_alt == false then
minetest.register_craftitem("mcl_hamburger:hamburger", hamburger_def) minetest.register_craftitem("mcl_hamburger:hamburger", hamburger_def)
else else
local hamburger_alt = table.copy(hamburger_def) local hamburger_alt = table.copy(hamburger_def)
hamburger_alt.inventory_image = "mcl_hamburger_hamburger_alt.png" hamburger_alt.inventory_image = "mcl_hamburger_alt.png"
hamburger_alt.wield_image = "mcl_hamburger_hamburger_alt.png" hamburger_alt.wield_image = "mcl_hamburger_alt.png"
minetest.register_craftitem("mcl_hamburger:hamburger", hamburger_alt) minetest.register_craftitem("mcl_hamburger:hamburger", hamburger_alt)
end end
-- make the villagers follow the item -- make the villagers follow the item
minetest.registered_entities["mobs_mc:villager"].nofollow = false 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. -- register the item and crafting recipe.
mcl_hamburger.register_burger_craft("mcl_mobitems:cooked_beef") mcl_hamburger.register_burger_craft("mcl_mobitems:cooked_beef")
-- add it to the follow items.
table.insert(minetest.registered_entities["mobs_mc:villager"].follow,"mcl_hamburger:hamburger")
if DEBUG then if DEBUG then
minetest.log (dump(minetest.registered_entities["mobs_mc:villager"].follow)) minetest.log (dump(minetest.registered_entities["mobs_mc:villager"].follow))
end end

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB