auto-rotating tree trunks

Post Reply
User avatar
firefox
Member
Posts: 1709
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox
Location: Xanadu

auto-rotating tree trunks

by firefox » Post

i have noticed that tree trunks rotate automatic to horizontal position when they are placed on the side of another node. very handy.
but this only affects the default, jungle and pine tree trunks. all 3 are in the default game, so i guess it is coded into the node definition.

wooden planks are all included in the group "wood" so that crafting recipes that use wood can use every kind of wood planks from any mod.
i was wondering if it was possible to make a group "trunk" that includes all tree trunks, so that every trunk from every mod would auto rotate itself when placed.
✨🏳️‍🌈♣️✨

User avatar
TenPlus1
Member
Posts: 3728
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: auto-rotating tree trunks

by TenPlus1 » Post

Here is the node definition for the default tree trunk:

Code: Select all

minetest.register_node("default:tree", {
	description = "Tree",
	tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
	paramtype2 = "facedir",
	is_ground_content = false,
	groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
	sounds = default.node_sound_wood_defaults(),

	on_place = minetest.rotate_node
})
so long as the on_place = minetest.rotate_node is in place with the paramtype2 = "facedir", then no-matter what node or tree type it is, it will automatically rotate when placed...

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests