Page 1 of 1

Changing textures of a node

PostPosted: Thu Sep 05, 2013 20:32
by super_tnt
I haven't seen this listed in any documentation so I'm assuming it doesn't exist.

Shouldn't there be a method in the lua api to select the texture we want to use rather than just setting it in the register function. I understand this can cause some lag due to IO operations so the should be some customizations such as use another node's texture or store multiple textures and select later. We could use this and the metadata to make a node contain different types of itself rather than creating separate nodes, for example technic's battery box which uses 8 nodes just to display power level. I believe this will be very beneficial to many modders and open up more modding potential.

To summarise, I believe there should be a way to change textures of a node outside of the register command.
To actually change the texture the following options could be used - use another nodes textures/load from File system/have a table of textures to use.

Now if want to take it further maybe some way of creating textures on the fly, such as editing loaded ones or fully creating them.

PostPosted: Thu Sep 05, 2013 21:20
by PilzAdam
There is currently no way to change the nodedef at runtime, thats due to the design of Minetest.

There are some old branches about changing the nodedef in meta, but there were some problems and it needs further development.

PostPosted: Thu Sep 05, 2013 21:43
by super_tnt
I don't fully understand.
When a node is in the world is it a reference to a node object which is created when the world is opened. And for different textures the nodes in the world would have to store separate data about the texture to use?

PostPosted: Fri Sep 06, 2013 14:57
by Casimir
The way I understand it:
On position x,y,z there is a node called default:dirt, minetest looks up what texture is registered for default:dirt and uses it. What Adam says is that on position x,y,z there is a node called default:dirt and metadata. The metadata is independent from the used node and saved per position. And with that branch the metadata is able to say: don't use the texture you read from the node, use default_cobble.png.

If that's right than this would be a very interesting feature and would make many more and better mods possible.

PostPosted: Fri Sep 06, 2013 15:56
by LionsDen
Yeah, it's a feature I would have liked to have about a month ago with my negabomb. :)

PostPosted: Fri Sep 06, 2013 16:25
by super_tnt
I don't want to sound like a know it all but it seems so simple to use a different texture.
What went wrong when it was tried?