Improve texturing of slabs and stairs

This commit is contained in:
Wuzzy 2019-08-29 04:31:49 +02:00
parent 4fd187a528
commit 55e4dc3c0c
12 changed files with 41 additions and 9 deletions

View File

@ -7,7 +7,7 @@ local S = minetest.get_translator("partialblocks")
partialblocks = {}
function partialblocks.register_material(name, desc_slab, desc_stair, node, is_fuel)
function partialblocks.register_material(name, desc_slab, desc_stair, node, is_fuel, tiles_slab, tiles_stair)
local nodedef = minetest.registered_nodes[node]
if nodedef == nil then
@ -17,11 +17,17 @@ function partialblocks.register_material(name, desc_slab, desc_stair, node, is_f
end
-- Slab
local tiles
if tiles_slab then
tiles = tiles_slab
else
tiles = nodedef.tiles
end
minetest.register_node(
"partialblocks:slab_" .. name,
{
tiles = nodedef.tiles,
tiles = tiles,
groups = nodedef.groups,
sounds = nodedef.sounds,
@ -66,10 +72,17 @@ function partialblocks.register_material(name, desc_slab, desc_stair, node, is_f
-- Stair
local tiles
if tiles_stair then
tiles = tiles_stair
else
tiles = nodedef.tiles
end
minetest.register_node(
"partialblocks:stair_" .. name,
{
tiles = nodedef.tiles,
tiles = tiles,
groups = nodedef.groups,
sounds = nodedef.sounds,
@ -106,6 +119,18 @@ function partialblocks.register_material(name, desc_slab, desc_stair, node, is_f
end
end
local adv_slab_tex = function(name, texname)
local t1 = minetest.registered_nodes[name].tiles[1]
local t2 = "partialblocks_"..texname.."_slab.png"
return { t1, t1, t2 }
end
local adv_stair_tex = function(name, texname)
local t1 = minetest.registered_nodes[name].tiles[1]
local t2 = "partialblocks_"..texname.."_stair.png"
local t3 = "partialblocks_"..texname.."_slab.png"
return { t3, t1, t2.."^[transformFX", t2, t1, t3 }
end
-- Stonelike materials
partialblocks.register_material(
@ -131,23 +156,30 @@ partialblocks.register_material(
-- Frames
partialblocks.register_material(
"frame", S("Frame Slab"), S("Frame Stair"), "default:frame", true)
"frame", S("Frame Slab"), S("Frame Stair"), "default:frame", true, adv_slab_tex("default:frame", "frame"), adv_stair_tex("default:frame", "frame"))
partialblocks.register_material(
"reinforced_frame", S("Reinforced Frame Slab"), S("Reinforced Frame Stair"), "default:reinforced_frame", true)
"reinforced_frame", S("Reinforced Frame Slab"), S("Reinforced Frame Stair"), "default:reinforced_frame", true, adv_slab_tex("default:reinforced_frame", "reinforced_frame"), adv_stair_tex("default:reinforced_frame", "reinforced_frame"))
partialblocks.register_material(
"reinforced_cobble", S("Reinforced Cobble Slab"), S("Reinforced Cobble Stair"), "default:reinforced_cobble", false)
"reinforced_cobble", S("Reinforced Cobble Slab"), S("Reinforced Cobble Stair"), "default:reinforced_cobble", false, adv_slab_tex("default:reinforced_cobble", "reinforced_cobbles"), adv_stair_tex("default:reinforced_cobble", "reinforced_cobbles"))
-- Misc. blocks
partialblocks.register_material(
"coal", S("Coal Slab"), S("Coal Stair"), "default:block_coal", false)
"coal", S("Coal Slab"), S("Coal Stair"), "default:block_coal", false, adv_slab_tex("default:block_coal", "block_coal"), adv_stair_tex("default:block_coal", "block_coal"))
partialblocks.register_material(
"steel", S("Steel Slab"), S("Steel Stair"), "default:block_steel", false)
"steel", S("Steel Slab"), S("Steel Stair"), "default:block_steel", false, adv_slab_tex("default:block_steel", "block_steel"), adv_stair_tex("default:block_steel", "block_steel"))
local cs_stair_tiles = {
"default_compressed_sandstone.png",
"default_compressed_sandstone_top.png",
"partialblocks_compressed_sandstone_stair.png^[transformFX",
"partialblocks_compressed_sandstone_stair.png",
"default_compressed_sandstone.png",
"default_compressed_sandstone.png" }
partialblocks.register_material(
"compressed_sandstone", S("Compressed Sandstone Slab"), S("Compressed Sandstone Stair"), "default:compressed_sandstone", false)
"compressed_sandstone", S("Compressed Sandstone Slab"), S("Compressed Sandstone Stair"), "default:compressed_sandstone", false, nil, cs_stair_tiles)
default.log("mod:partialblocks", "loaded")

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B