minetest_game/mods/vipworld/ferns/horsetail.lua

72 lines
2.2 KiB
Lua

-----------------------------------------------------------------------------------------------
-- Archae Plantae - Horsetail 0.0.5
-----------------------------------------------------------------------------------------------
-- by Mossmanikin
-- Contains code from: biome_lib
-- Looked at code from: default, flowers, trees
-- Dependencies: biome_lib
-- Supports: dryplants, stoneage, sumpf
-----------------------------------------------------------------------------------------------
-- support for i18n
-----------------------------------------------------------------------------------------------
-- HORSETAIL (EQUISETUM)
-----------------------------------------------------------------------------------------------
local node_names = {}
local function create_nodes()
local selection_boxes = {
{ -0.15, -1/2, -0.15, 0.15, -1/16, 0.15 },
{ -0.15, -1/2, -0.15, 0.15, 1/16, 0.15 },
{ -0.15, -1/2, -0.15, 0.15, 4/16, 0.15 },
{ -0.15, -1/2, -0.15, 0.15, 7/16, 0.15 },
}
for i = 1, 4 do
local node_name = "ferns:horsetail_" .. string.format("%02d", i)
local node_img = "ferns_horsetail_" .. string.format("%02d", i) .. ".png"
local node_desc
local node_on_use = nil
local node_drop = "ferns:horsetail_04"
if i == 1 then
node_desc = "Young Horsetail (Equisetum)"
node_on_use = minetest.item_eat(1) -- young ones edible https://en.wikipedia.org/wiki/Equisetum
node_drop = node_name
elseif i == 4 then
node_desc = "Horsetail (Equisetum)"
else
node_desc = "Horsetail (Equisetum)".." ".. string.format("%02d", i)
end
node_names[i] = node_name
minetest.register_node(node_name, {
description = node_desc,
drawtype = "plantlike",
paramtype = "light",
tiles = { node_img },
inventory_image = node_img,
walkable = false,
buildable_to = true,
groups = {snappy=3,flammable=2,attached_node=1,horsetail=1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = selection_boxes[i],
},
on_use = node_on_use,
drop = node_drop,
})
end
end
-----------------------------------------------------------------------------------------------
-- Init
-----------------------------------------------------------------------------------------------
create_nodes()