mcl_vegan/mcl_soy/node.lua

74 lines
1.5 KiB
Lua

local modname = minetest.get_current_modname()
-- copied from wheat for now
local crop_heights = {
-5/16,
-2/16,
0,
3/16,
5/16,
6/16,
7/16,
8/16,
}
local function register_plant_stage (stage, drops)
local texture = modname .. "_soy_stage_" .. (stage - 1) .. ".png"
minetest.register_node(modname .. ":soy_" .. stage, {
description = "Soy Plant (stage " .. stage .. ")",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
drawtype = "plantlike",
drop = drops,
tiles = { texture },
inventory_image = texture,
wield_image = texture,
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, crop_heights[stage], 0.5}
},
},
groups = {
dig_immediate = 3,
not_in_creative_inventory = 1,
plant = 1,
attached_node = 1,
dig_by_water = 1,
destroy_by_lava_flow = 1,
dig_by_piston = 1,
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
end
for i=1,7 do
register_plant_stage(i, modname .. ":soy")
end
register_plant_stage(8, {
max_items = 4,
items = {
{ items = { modname .. ":soy" } },
{ items = { modname .. ":soy 2" }, rarity = 2 },
{ items = { modname .. ":soy 4" }, rarity = 3 },
{ items = { modname .. ":soy" } },
{ items = { modname .. ":soy 5" }, rarity = 6 },
},
})
mcl_farming:add_plant("plant_soy", modname .. ":soy_8", {
modname .. ":soy_1",
modname .. ":soy_2",
modname .. ":soy_3",
modname .. ":soy_4",
modname .. ":soy_5",
modname .. ":soy_6",
modname .. ":soy_7",
}, 20, 15)