Register a food item
register item as node
[code]
Example
-- Barley Soup
local barley_soup_def = {
description = S('Barley Soup – Swiss traditional') .. '\n' .. S('Compost chance') .. ': 100%\n'
.. core.colorize(xn_farming.colors.brown, S('Hunger') .. ': 6'),
short_description = S('Barley Soup'),
drawtype = 'mesh',
mesh = 'xn_farming_beetroot_soup.obj',
tiles = { 'xn_farming_barley_soup_mesh.png' },
use_texture_alpha = 'clip',
inventory_image = 'xn_farming_barley_soup.png',
wield_image = 'xn_farming_barley_soup.png',
paramtype = 'light',
paramtype2 = 'facedir',
is_ground_content = false,
walkable = true,
selection_box = {
type = 'fixed',
fixed = { -0.5, -0.5, -0.5, 0.5, 0.1, 0.5 }
},
collision_box = {
type = 'fixed',
fixed = { -0.5, -0.5, -0.5, 0.5, -0.1, 0.5 }
},
groups = {
-- MTG
vessel = 1,
dig_immediate = 3,
attached_node = 1,
-- X Farming
compost = 100,
-- MCL
food = 3,
eatable = 6,
compostability = 100,
handy = 1,
deco_block = 1,
fire_encouragement = 60,
fire_flammability = 100,
dig_by_water = 1,
destroy_by_lava_flow = 1,
},
sounds = xn_farming.node_sound_wood_defaults(),
sunlight_propagates = true,
on_use = core.item_eat(6, 'mcl_core:bowl'),
-- MCL
_mcl_saturation = 0.6,
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
}
[/code]if core.get_modpath('mcl_farming') then
barley_soup_def.on_secondary_use = core.item_eat(6, 'mcl_core:bowl')
end
core.register_node('xn_farming:barley_soup', barley_soup_def)
Register craft for this item
-- barley soup, a typical swiss recipe :-)
core.register_craft({
output = 'xn_farming:barley_soup',
recipe = {
{ 'mcl_farming:carrot_item', 'xn_farming:salt', 'xn_farming:barley','mcl_potions:water','mcl_core:bowl' },
}
})