You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.8 KiB

local minetest, nodecore
= minetest, nodecore
local MOD_NAME = minetest.get_current_modname()
-- Properties that every non-full block we're adding should share.
local SHARED_NONFULL_PROPERTIES = {
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
}
local function make_node_box(...) return { type = "fixed", fixed = { ... } } end
local STAIR_NODE_BOX = make_node_box({ -0.5, -0.5, -0.5, 0.5, 0.0, 0.5 },
{ -0.5, 0.0, 0.0, 0.5, 0.5, 0.5 })
local SLAB_NODE_BOX = make_node_box({ -0.5, -0.5, -0.5, 0.5, 0.0, 0.5 })
local STEP_NODE_BOX = make_node_box({ -0.5, -0.5, 0.0, 0.5, 0.0, 0.5 })
local function do_the_cursed_thing(base_full_name, base_def)
base_def = base_def or minetest.registered_nodes[base_full_name]
local base_mod_name = base_full_name:gsub(":.*", "")
local base_node_name = base_full_name:gsub(".*:", "")
local function register_node_variant(variant, node_box)
minetest.register_node(
MOD_NAME .. ":" .. base_mod_name .. "__" .. base_node_name .. "_" .. variant:lower(),
nodecore.underride({
description = base_def.description .. " " .. variant,
groups = { [MOD_NAME .. ":" .. variant:lower()] = 1 },
tiles = { { name = base_def.tiles[1], align_style = "world" } },
node_box = node_box, selection_box = node_box,
drop = base_def.drop or base_full_name,
silktouch_as = base_def.silktouch_as or base_full_name,
}, SHARED_NONFULL_PROPERTIES, base_def))
end
register_node_variant("Stair", STAIR_NODE_BOX)
register_node_variant("Slab" , SLAB_NODE_BOX)
register_node_variant("Step" , STEP_NODE_BOX)
end
do_the_cursed_thing("nc_woodwork:plank")