Page 1 of 1

A new minetest.register_on_ function

PostPosted: Sun Dec 22, 2013 19:20
by BrandonReese
It would be nice if there were a way to register functions to run when a player is fully connected. After everything is downloaded, processed, and they are actually ready to play the game. Maybe minetest.register_on_readytoplay. This would be handy when showing a formspec on login, or applying physics overrides on login. I'm sure there would be other uses, but those are the two issues I have come across that this would fix. To show a formspec on login I use mintest.after with a large delay. I think registering a function in my proposed way would be a much cleaner way of doing it. Thank you for your consideration.

PostPosted: Sun Dec 22, 2013 19:39
by stu
BrandonReese wrote:It would be nice if there were a way to register functions to run when a player is fully connected. After everything is downloaded, processed, and they are actually ready to play the game. Maybe minetest.register_on_readytoplay. This would be handy when showing a formspec on login, or applying physics overrides on login. I'm sure there would be other uses, but those are the two issues I have come across that this would fix. To show a formspec on login I use mintest.after with a large delay. I think registering a function in my proposed way would be a much cleaner way of doing it. Thank you for your consideration.


Funny, I have just been thinking along the same lines while reviewing your physics pull on the armor mod. It seems that at some stages of the login process, player properties are available while some player methods are not. One Idea I have used in the past is to check that something like player:getpos() does not return nil but this does not seem to be 100% reliable either, perhaps an object:is_loaded() method could be an alternative solution.