From what I've done in the past, registration for stairs and slabs isn't done through the node registration. Its done through the api in the stairs mod.
For example:
Node registration
Code: Select all
minetest.register_node("interiors:wall_white", {
description = S("White Wall"),
tiles = { "wall_white.png" },
drawtype = "normal",
groups = { choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1 },
sounds = default.node_sound_wood_defaults(),
})
Stairs and slabs
Code: Select all
stairs.register_stair_and_slab(
"wall_white",
"interiors:wall_white",
{ choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1 },
{ "wall_white.png" },
S("White Wall Stair"),
S("White Wall Slab"),
default.node_sound_wood_defaults()
)
This example registers both a stair and slab. From memory the api has methods to only register one. Just look in the stairs mod for the api and which parts you want to use.
Also, this I don't know for sure, if the stairs/slabs don't handle the lighting properly you may need to add
paramtype = "light" to your definition. Just try it out and see what happens.
As far as registering many nodes that are virtually identical there are many considerations in how to do that. For simple nodes you can make a local function to do the registering with parameters for the small differences (make sure each registration creates a unique definition table or you will just be updating the same one).
You could even make a table with each entry the parameters for that function, and have a loop further down which calls the registration function for each entry. That way you can easily add a node just by making an entry in that table.
So far this shouldn't really make any difference than just placing each registration call per node. If your nodes are complex and have extensive callback code which are all the same, coding the callback functions as local functions and just giving the function name in the registration the function will only be compiled once and be used by every node. If the callback function is coded in the definition a unique function will be compiled for each one. This method may reduce load times and memory usage but how much difference it would make (or if it would even be noticeable) is ambiguous.
There is no set way to do this. You just do whatever works best for your mod. Keeping in mind that you may need to go back and make modifications months or years from now, and understand what you did.