A new minetest.register_on_ function

User avatar
BrandonReese
Member
 
Posts: 839
Joined: Wed Sep 12, 2012 00:44
Location: USA
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

A new minetest.register_on_ function

by BrandonReese » Sun Dec 22, 2013 19:20

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.
 

User avatar
stu
Member
 
Posts: 923
Joined: Sat Feb 02, 2013 02:51
Location: United Kingdom
GitHub: stujones11

by stu » Sun Dec 22, 2013 19:39

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.
Last edited by stu on Sun Dec 22, 2013 19:40, edited 1 time in total.
 


Return to Feature Discussion



Who is online

Users browsing this forum: No registered users and 2 guests