mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 12:31:05 +01:00
mcl_stairs: Add woodlike cornerstair mode
This commit is contained in:
parent
644387c0ad
commit
85975a2d26
2 changed files with 30 additions and 26 deletions
|
@ -187,25 +187,44 @@ end
|
||||||
--[[
|
--[[
|
||||||
mcl_stairs.cornerstair.add(name, stairtiles)
|
mcl_stairs.cornerstair.add(name, stairtiles)
|
||||||
|
|
||||||
* "name" is the name of the node to make corner stairs for.
|
NOTE: This function is used internally. If you register a stair, this function is already called, no
|
||||||
* "stairtiles" is an optional table of tiles to override textures for inner and outer stairs.
|
need to call it again!
|
||||||
* "stairtiles" format is:
|
|
||||||
|
|
||||||
{tiles_def_for_outer_stair, tiles_def_for_inner_stair}
|
Usage:
|
||||||
|
* name is the name of the node to make corner stairs for.
|
||||||
Note: This function is called when you register a stair, no need to call it again!
|
* stairtiles is optional, can specify textures for inner and outer stairs. 3 data types are accepted:
|
||||||
|
* string: one of:
|
||||||
|
* "default": Use same textures as original node
|
||||||
|
* "woodlike": Take first frame of the original tiles, then take a triangle piece
|
||||||
|
of the texture, rotate it by 90° and overlay it over the original texture
|
||||||
|
* table: Specify textures explicitly. Table of tiles to override textures for
|
||||||
|
inner and outer stairs. Table format:
|
||||||
|
{ tiles_def_for_outer_stair, tiles_def_for_inner_stair }
|
||||||
|
* nil: Equivalent to "default"
|
||||||
]]
|
]]
|
||||||
|
|
||||||
function mcl_stairs.cornerstair.add(name, stairtiles)
|
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 then
|
if stairtiles == "woodlike" then
|
||||||
outer_tiles = stairtiles[1]
|
local t = node_def.tiles[1]
|
||||||
inner_tiles = stairtiles[2]
|
outer_tiles = {
|
||||||
else
|
t.."^("..t.."^[transformR90^mcl_stairs_turntexture.png^[makealpha:255,0,255)",
|
||||||
|
t.."^("..t.."^mcl_stairs_turntexture.png^[transformR270^[makealpha:255,0,255)",
|
||||||
|
t
|
||||||
|
}
|
||||||
|
inner_tiles = {
|
||||||
|
t.."^("..t.."^[transformR90^(mcl_stairs_turntexture.png^[transformR180)^[makealpha:255,0,255)",
|
||||||
|
t.."^("..t.."^[transformR270^(mcl_stairs_turntexture.png^[transformR90)^[makealpha:255,0,255)",
|
||||||
|
t
|
||||||
|
}
|
||||||
|
elseif stairtiles == nil or stairtiles == "default" then
|
||||||
outer_tiles = node_def.tiles
|
outer_tiles = node_def.tiles
|
||||||
inner_tiles = node_def.tiles
|
inner_tiles = node_def.tiles
|
||||||
|
else
|
||||||
|
outer_tiles = stairtiles[1]
|
||||||
|
inner_tiles = stairtiles[2]
|
||||||
end
|
end
|
||||||
local outer_groups = table.copy(node_def.groups)
|
local outer_groups = table.copy(node_def.groups)
|
||||||
outer_groups.not_in_creative_inventory = 1
|
outer_groups.not_in_creative_inventory = 1
|
||||||
|
|
|
@ -3,21 +3,6 @@
|
||||||
-- slabs actually take slightly longer to be dug than their stair counterparts.
|
-- slabs actually take slightly longer to be dug than their stair counterparts.
|
||||||
-- Note sure if it is a good idea to preserve this oddity.
|
-- Note sure if it is a good idea to preserve this oddity.
|
||||||
|
|
||||||
local function make_corner_texture(subname)
|
|
||||||
local t = minetest.registered_nodes["mcl_core:"..subname].tiles[1]
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
t.."^("..t.."^[transformR90^mcl_stairs_turntexture.png^[makealpha:255,0,255)",
|
|
||||||
t.."^("..t.."^mcl_stairs_turntexture.png^[transformR270^[makealpha:255,0,255)",
|
|
||||||
t
|
|
||||||
},
|
|
||||||
{
|
|
||||||
t.."^("..t.."^[transformR90^(mcl_stairs_turntexture.png^[transformR180)^[makealpha:255,0,255)",
|
|
||||||
t.."^("..t.."^[transformR270^(mcl_stairs_turntexture.png^[transformR90)^[makealpha:255,0,255)",
|
|
||||||
t
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
local woods = {
|
local woods = {
|
||||||
{ "wood", "default_wood.png", "Oak Wood Stairs", "Oak Wood Slab", "Double Oak Wood Slab" },
|
{ "wood", "default_wood.png", "Oak Wood Stairs", "Oak Wood Slab", "Double Oak Wood Slab" },
|
||||||
{ "junglewood", "default_junglewood.png", "Jungle Wood Stairs", "Jungle Wood Slab", "Double Jungle Wood Slab" },
|
{ "junglewood", "default_junglewood.png", "Jungle Wood Stairs", "Jungle Wood Slab", "Double Jungle Wood Slab" },
|
||||||
|
@ -35,7 +20,7 @@ for w=1, #woods do
|
||||||
wood[3],
|
wood[3],
|
||||||
mcl_sounds.node_sound_wood_defaults(),
|
mcl_sounds.node_sound_wood_defaults(),
|
||||||
2,
|
2,
|
||||||
make_corner_texture(wood[1]))
|
"woodlike")
|
||||||
mcl_stairs.register_slab(wood[1], "mcl_core:"..wood[1],
|
mcl_stairs.register_slab(wood[1], "mcl_core:"..wood[1],
|
||||||
{handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1},
|
{handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1},
|
||||||
{wood[2]},
|
{wood[2]},
|
||||||
|
|
Loading…
Reference in a new issue