mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 05:43:43 +01:00
Merge pull request 'Convert stairs to nodebox and use world-aligned tiling (fixes #4578)' (#4588) from nodebox_stairs into master
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4588 Reviewed-by: kno10 <kno10@noreply.git.minetest.land>
This commit is contained in:
commit
05bfe5513f
@ -93,17 +93,29 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript
|
||||
groups.stair = 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, {
|
||||
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."),
|
||||
drawtype = "mesh",
|
||||
mesh = "stairs_stair.obj",
|
||||
tiles = images,
|
||||
drawtype = "nodebox",
|
||||
tiles = image_table,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = groups,
|
||||
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 = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
@ -207,31 +207,12 @@ function mcl_stairs.cornerstair.add(name, stairtiles)
|
||||
local node_def = minetest.registered_nodes[name]
|
||||
local outer_tiles
|
||||
local inner_tiles
|
||||
if 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
|
||||
if stairtiles ~= nil and stairtiles ~= "default" and stairtiles ~= "woodlike" then
|
||||
outer_tiles = stairtiles[1]
|
||||
inner_tiles = stairtiles[2]
|
||||
end
|
||||
if inner_tiles == nil then inner_tiles = node_def.tiles end
|
||||
if outer_tiles == nil then outer_tiles = node_def.tiles end
|
||||
local outer_groups = table.copy(node_def.groups)
|
||||
outer_groups.not_in_creative_inventory = 1
|
||||
local inner_groups = table.copy(outer_groups)
|
||||
|
Loading…
Reference in New Issue
Block a user