Handle wood_tile replacement more carefully.

- An LBM is added to handle replacements of wood_tiles on the map while preserving there rotation about the +y (vertical) axis.  This will preserve existing floor patterns.  Unfortunately, due to the preexisting side tile orientations, preserving wall patterns is not possible while also reducing the wood_tiles down to just one node.

 - Deprecate the no longer used wood_tiles (wood_tile_right, wood_tile_left, wood_tile_down, and wood_tile_flipped), and add recipes to convert them.

 - Rename wood_tile_up to wood_tile_offset.

Closes #101
This commit is contained in:
Foz 2017-12-29 18:53:52 -05:00 committed by sofar
parent 652d431664
commit 413054fd2f
4 changed files with 96 additions and 9 deletions

View File

@ -37,7 +37,8 @@ minetest.register_alias("moreblocks:ironstone", "moreblocks:iron_stone")
minetest.register_alias("moreblocks:woodtile", "moreblocks:wood_tile")
minetest.register_alias("moreblocks:woodtile_full", "moreblocks:wood_tile_full")
minetest.register_alias("moreblocks:woodtile_centered", "moreblocks:wood_tile_centered")
minetest.register_alias("moreblocks:woodtile_up", "moreblocks:wood_tile_up")
minetest.register_alias("moreblocks:woodtile_up", "moreblocks:wood_tile_offset")
minetest.register_alias("moreblocks:wood_tile_up", "moreblocks:wood_tile_offset")
minetest.register_alias("moreblocks:woodtile_down", "moreblocks:wood_tile_down")
minetest.register_alias("moreblocks:woodtile_left", "moreblocks:wood_tile_left")
minetest.register_alias("moreblocks:woodtile_right", "moreblocks:wood_tile_right")
@ -56,10 +57,6 @@ minetest.register_alias("moreblocks:emptybookshelf", "moreblocks:empty_bookshelf
minetest.register_alias("moreblocks:junglestick", "moreblocks:jungle_stick")
minetest.register_alias("moreblocks:splitstonesquare","moreblocks:split_stone_tile")
minetest.register_alias("moreblocks:allfacestree","moreblocks:all_faces_tree")
minetest.register_alias("moreblocks:wood_tile_flipped","moreblocks:wood_tile")
minetest.register_alias("moreblocks:wood_tile_down","moreblocks:wood_tile_up")
minetest.register_alias("moreblocks:wood_tile_left","moreblocks:wood_tile_up")
minetest.register_alias("moreblocks:wood_tile_right","moreblocks:wood_tile_up")
minetest.register_alias("moreblocks:empty_bookshelf","moreblocks:empty_shelf")
minetest.register_alias("moreblocks:split_stone_tile_alt","moreblocks:checker_stone_tile")
@ -83,3 +80,26 @@ minetest.register_abm({
})
end,
})
minetest.register_lbm({
name = "moreblocks:reduce_wood_tile_redundancy",
nodenames = {
"moreblocks:wood_tile_left",
"moreblocks:wood_tile_down",
"moreblocks:wood_tile_right",
"moreblocks:wood_tile_flipped",
},
action = function(pos, node)
if node.name:find("left") then
minetest.set_node(pos, {name = "moreblocks:wood_tile_offset", param2=1})
elseif node.name:find("down") then
minetest.set_node(pos, {name = "moreblocks:wood_tile_offset", param2=2})
elseif node.name:find("right") then
minetest.set_node(pos, {name = "moreblocks:wood_tile_offset", param2=3})
else -- wood_tile_flipped
minetest.set_node(pos, {name = "moreblocks:wood_tile", param2=1})
end
minetest.log('action', "LBM replaced " .. node.name ..
" at " .. minetest.pos_to_string(pos))
end,
})

View File

@ -44,6 +44,12 @@ minetest.register_craft({
}
})
minetest.register_craft({
type = "shapeless",
output = "moreblocks:wood_tile",
recipe = {"moreblocks:wood_tile_flipped"}
})
minetest.register_craft({
output = "moreblocks:wood_tile_center 9",
recipe = {
@ -62,13 +68,31 @@ minetest.register_craft({
})
minetest.register_craft({
output = "moreblocks:wood_tile_up",
output = "moreblocks:wood_tile_offset",
recipe = {
{"default:stick"},
{"moreblocks:wood_tile_center"},
}
})
minetest.register_craft({
type = "shapeless",
output = "moreblocks:wood_tile_offset",
recipe = {"moreblocks:wood_tile_down"}
})
minetest.register_craft({
type = "shapeless",
output = "moreblocks:wood_tile_offset",
recipe = {"moreblocks:wood_tile_left"}
})
minetest.register_craft({
type = "shapeless",
output = "moreblocks:wood_tile_offset",
recipe = {"moreblocks:wood_tile_right"}
})
minetest.register_craft({
output = "moreblocks:circle_stone_bricks 8",
recipe = {

View File

@ -22,6 +22,20 @@ local function tile_tiles(name)
return {tex, tex, tex, tex, tex.. "^[transformR90", tex.. "^[transformR90"}
end
local function wood_tile_replace(itemstack, placer, pointed_thing)
local substack
if itemstack:get_name() == "moreblocks:wood_tile_flipped" then
substack = ItemStack("moreblocks:wood_tile")
else -- right, left, and down variants
substack = ItemStack("moreblocks:wood_tile_offset")
end
local _, success = minetest.item_place(substack, placer, pointed_thing)
if success then
itemstack:take_item()
end
return itemstack
end
local nodes = {
["wood_tile"] = {
description = S("Wooden Tile"),
@ -37,6 +51,17 @@ local nodes = {
"default_wood.png^moreblocks_wood_tile.png^[transformR90"},
sounds = sound_wood,
},
["wood_tile_flipped"] = {
description = S("Wooden Tile (Deprecated)"),
tiles = {"default_wood.png^moreblocks_wood_tile.png^[transformR90",
"default_wood.png^moreblocks_wood_tile.png^[transformR90",
"default_wood.png^moreblocks_wood_tile.png^[transformR90",
"default_wood.png^moreblocks_wood_tile.png^[transformR90",
"default_wood.png^moreblocks_wood_tile.png^[transformR180",
"default_wood.png^moreblocks_wood_tile.png^[transformR180"},
no_stairs = true,
on_place = wood_tile_replace
},
["wood_tile_center"] = {
description = S("Centered Wooden Tile"),
groups = {wood = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
@ -51,16 +76,34 @@ local nodes = {
tiles = tile_tiles("wood_tile_full"),
sounds = sound_wood,
},
["wood_tile_up"] = {
description = S("Upwards Wooden Tile"),
["wood_tile_offset"] = {
description = S("Offset Wooden Tile"),
paramtype2 = "facedir",
place_param2 = 0,
groups = {wood = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
is_ground_content = false,
tiles = {"default_wood.png^moreblocks_wood_tile_up.png"},
tiles = {"default_wood.png^moreblocks_wood_tile_offset.png"},
sounds = sound_wood,
no_stairs = true,
},
["wood_tile_down"] = {
description = S("Downwards Wooden Tile (Deprecated)"),
tiles = {"default_wood.png^[transformR180^moreblocks_wood_tile_offset.png^[transformR180"},
no_stairs = true,
on_place = wood_tile_replace
},
["wood_tile_left"] = {
description = S("Leftwards Wooden Tile (Deprecated)"),
tiles = {"default_wood.png^[transformR270^moreblocks_wood_tile_offset.png^[transformR270"},
no_stairs = true,
on_place = wood_tile_replace
},
["wood_tile_right"] = {
description = S("Rightwards Wooden Tile (Deprecated)"),
tiles = {"default_wood.png^[transformR90^moreblocks_wood_tile_offset.png^[transformR90"},
no_stairs = true,
on_place = wood_tile_replace
},
["circle_stone_bricks"] = {
description = S("Circle Stone Bricks"),
groups = {stone = 1, cracky = 3},

View File

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B