Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_on_pause(func)
This callback shall call func, when the player pauses the game by opening the pause menu. This callback should only be called in singleplayer mode.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_on_unpause(func)
This callback shall call func, when the player unpauses/continues the game by closing the pause menu. This callback should only be called in singleplayer mode.
For both callbacks: func takes one argument: player. This is the player object of the player who paused the game. Yeah, I know, it’s just one player but I think of it as a convenience feature. The return value of func is discarded.
The idea of these callbacks is (for example) for mods who need to rely on time. Normally, a modder would want to freeze all timers when the game is paused and unfreeze them when the game continues. Weird results can happen if the timers just move on while the game is “officially” paused.