Page 1 of 1
on_construct is not called when using VoxelManip

Posted:
Sun Jan 18, 2015 11:27
by ArguablySane
I'm trying to set metadata for some nodes when they are generated. The dev wiki suggests using the on_construct callback, but unfortunately that doesn't seem to work if I generate them using a VoxelManip during mapgen. For now I'm having to set the metadata manually in the mapgen code.
Is this by design, and is there a nicer way to solve the problem?
Re: on_construct is not called when using VoxelManip

Posted:
Sun Jan 18, 2015 11:59
by rubenwardy
This is by design as the VoxelManipulator needs to be fast, and so doesn't call callbacks. In order to solve this, you could manually call the on_construct from the manip loop. minetest.registered_items["name"].on_construct(pos, minetest.get_node()), but you should try to minimise this. Running the code in the loop rather than calling on_construct would be better, or running it at a later date.
Re: on_construct is not called when using VoxelManip

Posted:
Sun Jan 18, 2015 19:34
by ArguablySane
Yeah, I suspected that might be the case. Thanks for letting me know anyway.