summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-04-24 08:43:27 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2013-04-24 08:54:48 -0400
commitae09c948ff25503ef6bb7a32d354d21fc0f161d2 (patch)
tree4b5ed89e9aa08f3eeefcaaee37a1f0e70f2e33c0
parentea61c08ae0c5222f6a7a63a7dfcc25d1ca2723ad (diff)
get rid of sideways tree trunks and their stairs/slabs
Add conversion code to handle them. Minor formatting fixes.
-rw-r--r--node_defs.lua78
1 files changed, 28 insertions, 50 deletions
diff --git a/node_defs.lua b/node_defs.lua
index 2fe779d..a0523dc 100644
--- a/node_defs.lua
+++ b/node_defs.lua
@@ -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 },
}
+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
local treename = moretrees.treelist[i][1]
local treedesc = moretrees.treelist[i][2]
@@ -32,27 +36,12 @@ for i in ipairs(moretrees.treelist) do
"moretrees_"..treename.."_trunk_top.png",
"moretrees_"..treename.."_trunk.png"
},
+ 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.."_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",
- })
-
minetest.register_node("moretrees:"..treename.."_planks", {
description = treedesc.." Planks",
tiles = {"moretrees_"..treename.."_wood.png"},
@@ -62,18 +51,18 @@ for i in ipairs(moretrees.treelist) do
})
minetest.register_node("moretrees:"..treename.."_sapling", {
- description = treedesc.." Sapling",
- drawtype = "plantlike",
- tiles = {"moretrees_"..treename.."_sapling.png"},
- inventory_image = "moretrees_"..treename.."_sapling.png",
- paramtype = "light",
- walkable = false,
- selection_box = {
- type = "fixed",
- fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
- },
- groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
- sounds = default.node_sound_defaults(),
+ description = treedesc.." Sapling",
+ drawtype = "plantlike",
+ tiles = {"moretrees_"..treename.."_sapling.png"},
+ inventory_image = "moretrees_"..treename.."_sapling.png",
+ paramtype = "light",
+ walkable = false,
+ selection_box = {
+ type = "fixed",
+ fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
+ },
+ groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1},
+ sounds = default.node_sound_defaults(),
})
-- player will get a sapling with 1/100 chance
@@ -108,43 +97,21 @@ for i in ipairs(moretrees.treelist) do
},
treedesc.." Trunk",
treename.."_trunk",
- "facedir",
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(
- "moretrees",
treename.."_planks",
"moretrees:"..treename.."_planks",
{ snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory=1 },
{ "moretrees_"..treename.."_wood.png" },
treedesc.." Planks",
treename.."_planks",
- "facedir",
0
)
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")
end
@@ -169,6 +136,17 @@ for i in ipairs(moretrees.treelist) do
})
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")
end