get rid of sideways tree trunks and their stairs/slabs

Add conversion code to handle them.  Minor formatting fixes.
This commit is contained in:
Vanessa Ezekowitz 2013-04-24 08:43:27 -04:00
parent ea61c08ae0
commit ae09c948ff

View File

@ -15,6 +15,10 @@ moretrees.treelist = {
{"fir", "Douglas Fir", "fir_cone", "Fir Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 }, {"fir", "Douglas Fir", "fir_cone", "Fir Cone", {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
} }
local dirs1 = { 21, 20, 23, 22, 21 }
local dirs2 = { 12, 9, 18, 7, 12 }
local dirs3 = { 14, 11, 16, 5, 14 }
for i in ipairs(moretrees.treelist) do for i in ipairs(moretrees.treelist) do
local treename = moretrees.treelist[i][1] local treename = moretrees.treelist[i][1]
local treedesc = moretrees.treelist[i][2] local treedesc = moretrees.treelist[i][2]
@ -32,25 +36,10 @@ for i in ipairs(moretrees.treelist) do
"moretrees_"..treename.."_trunk_top.png", "moretrees_"..treename.."_trunk_top.png",
"moretrees_"..treename.."_trunk.png" "moretrees_"..treename.."_trunk.png"
}, },
is_ground_content = true,
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("moretrees:"..treename.."_trunk_sideways", {
description = "Sideways "..treedesc.." Trunk",
tiles = {
"moretrees_"..treename.."_trunk.png^[transformR90",
"moretrees_"..treename.."_trunk.png^[transformR90",
"moretrees_"..treename.."_trunk_top.png",
"moretrees_"..treename.."_trunk_top.png",
"moretrees_"..treename.."_trunk.png^[transformR90",
"moretrees_"..treename.."_trunk.png^[transformR90"
},
is_ground_content = true,
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = true,
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
}) })
minetest.register_node("moretrees:"..treename.."_planks", { minetest.register_node("moretrees:"..treename.."_planks", {
@ -62,18 +51,18 @@ for i in ipairs(moretrees.treelist) do
}) })
minetest.register_node("moretrees:"..treename.."_sapling", { minetest.register_node("moretrees:"..treename.."_sapling", {
description = treedesc.." Sapling", description = treedesc.." Sapling",
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"moretrees_"..treename.."_sapling.png"}, tiles = {"moretrees_"..treename.."_sapling.png"},
inventory_image = "moretrees_"..treename.."_sapling.png", inventory_image = "moretrees_"..treename.."_sapling.png",
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
}, },
groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1}, groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}) })
-- player will get a sapling with 1/100 chance -- player will get a sapling with 1/100 chance
@ -108,29 +97,9 @@ for i in ipairs(moretrees.treelist) do
}, },
treedesc.." Trunk", treedesc.." Trunk",
treename.."_trunk", treename.."_trunk",
"facedir",
0 0
) )
register_stair_slab_panel_micro(
"moretrees",
treename.."_trunk_sideways",
"moretrees:"..treename.."_trunk_sideways",
{ snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2, not_in_creative_inventory=1 },
{ "moretrees_"..treename.."_trunk.png^[transformR90",
"moretrees_"..treename.."_trunk.png^[transformR90",
"moretrees_"..treename.."_trunk_top.png",
"moretrees_"..treename.."_trunk_top.png",
"moretrees_"..treename.."_trunk.png^[transformR90",
"moretrees_"..treename.."_trunk.png^[transformR90"
},
"Sideways "..treedesc.." Trunk",
treename.."_trunk_sideways",
"facedir",
0
)
register_stair_slab_panel_micro( register_stair_slab_panel_micro(
"moretrees", "moretrees",
treename.."_planks", treename.."_planks",
@ -139,12 +108,10 @@ for i in ipairs(moretrees.treelist) do
{ "moretrees_"..treename.."_wood.png" }, { "moretrees_"..treename.."_wood.png" },
treedesc.." Planks", treedesc.." Planks",
treename.."_planks", treename.."_planks",
"facedir",
0 0
) )
table.insert(circular_saw.known_stairs, "moretrees:"..treename.."_trunk") table.insert(circular_saw.known_stairs, "moretrees:"..treename.."_trunk")
table.insert(circular_saw.known_stairs, "moretrees:"..treename.."_trunk_sideways")
table.insert(circular_saw.known_stairs, "moretrees:"..treename.."_planks") table.insert(circular_saw.known_stairs, "moretrees:"..treename.."_planks")
end end
@ -169,6 +136,17 @@ for i in ipairs(moretrees.treelist) do
}) })
end end
minetest.register_abm({
nodenames = { "moretrees:"..treename.."_trunk_sideways" },
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local fdir = node.param2 or 0
nfdir = dirs2[fdir+1]
minetest.env:add_node(pos, {name = "moretrees:"..treename.."_trunk", param2 = nfdir})
end,
})
table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_trunk") table.insert(moretrees.avoidnodes, "moretrees:"..treename.."_trunk")
end end