auto-rotating tree trunks

User avatar
firefox
Member
 
Posts: 1185
Joined: Wed Jan 14, 2015 07:34
In-game: Red_Fox

auto-rotating tree trunks

by firefox » Fri Jul 10, 2015 06:44

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: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: auto-rotating tree trunks

by TenPlus1 » Fri Jul 10, 2015 06:48

Here is the node definition for the default tree trunk:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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...
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 31 guests

cron