1
0
Fork 0

Convert stairs to nodebox

This commit is contained in:
codiac 2023-11-03 17:48:59 +10:00 committed by the-real-herowl
parent 0e4b8d9c27
commit 562a9d6d98
2 changed files with 16 additions and 25 deletions

View File

@ -93,17 +93,29 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript
groups.stair = 1 groups.stair = 1
groups.building_block = 1 groups.building_block = 1
local image_table = {}
for i, image in ipairs(images) do
image_table[i] = type(image) == "string" and { name = image } or table.copy(image)
image_table[i].align_style = "world"
end
minetest.register_node(":mcl_stairs:stair_" .. subname, { minetest.register_node(":mcl_stairs:stair_" .. subname, {
description = description, description = description,
_doc_items_longdesc = S("Stairs are useful to reach higher places by walking over them; jumping is not required. Placing stairs in a corner pattern will create corner stairs. Stairs placed on the ceiling or at the upper half of the side of a block will be placed upside down."), _doc_items_longdesc = S("Stairs are useful to reach higher places by walking over them; jumping is not required. Placing stairs in a corner pattern will create corner stairs. Stairs placed on the ceiling or at the upper half of the side of a block will be placed upside down."),
drawtype = "mesh", drawtype = "nodebox",
mesh = "stairs_stair.obj", tiles = image_table,
tiles = images,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
groups = groups, groups = groups,
sounds = sounds, sounds = sounds,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {

View File

@ -207,28 +207,7 @@ function mcl_stairs.cornerstair.add(name, stairtiles)
local node_def = minetest.registered_nodes[name] local node_def = minetest.registered_nodes[name]
local outer_tiles local outer_tiles
local inner_tiles local inner_tiles
if stairtiles == "woodlike" then if stairtiles ~= nil and stairtiles ~= "default" and stairtiles ~= "woodlike" then
outer_tiles = table.copy(node_def.tiles)
inner_tiles = table.copy(node_def.tiles)
for i=2,6 do
if outer_tiles[i] == nil then
outer_tiles[i] = outer_tiles[i-1]
end
if inner_tiles[i] == nil then
inner_tiles[i] = inner_tiles[i-1]
end
end
local t = node_def.tiles[1]
outer_tiles[1] = t.."^("..t.."^[transformR90^mcl_stairs_turntexture.png^[makealpha:255,0,255)"
outer_tiles[2] = t.."^("..t.."^mcl_stairs_turntexture.png^[transformR270^[makealpha:255,0,255)"
outer_tiles[3] = t
inner_tiles[1] = t.."^("..t.."^[transformR90^(mcl_stairs_turntexture.png^[transformR180)^[makealpha:255,0,255)"
inner_tiles[2] = t.."^("..t.."^[transformR270^(mcl_stairs_turntexture.png^[transformR90)^[makealpha:255,0,255)"
inner_tiles[3] = t
elseif stairtiles == nil or stairtiles == "default" then
outer_tiles = node_def.tiles
inner_tiles = node_def.tiles
else
outer_tiles = stairtiles[1] outer_tiles = stairtiles[1]
inner_tiles = stairtiles[2] inner_tiles = stairtiles[2]
end end