Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation is wrong about behavior of core.register_on_leaveplayer #15702

Open
mruncreative opened this issue Jan 22, 2025 · 1 comment
Open
Labels
@ Script API Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible

Comments

@mruncreative
Copy link

mruncreative commented Jan 22, 2025

https://api.luanti.org/core-namespace-reference/

core.register_on_leaveplayer(function(ObjectRef, timed_out))
Does not get executed for connected players on shutdown.

However in my experience it does get executed on shutdown. At least in singleplayer. This should be clarified or removed if entirely wrong.

@Zughy Zughy added the Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible label Jan 28, 2025
@Sneglium
Copy link

In singleplayer, the player disconnecting is what triggers a shutdown, which takes place after the player has disconnected. In that case the callback is run as the player disconnects, not when the server shuts down — it's just that the server then shuts down immediately after. What the docs are trying to communicate here is just that the server shutting down doesn't itself trigger register_on_leaveplayer callbacks, and also that players being disconnected because of a server shutdown will not have the callback run for them (because the game is no longer running at that point).

Maybe it should be rephrased to something like 'Server shutdown does not trigger the callback'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@ Script API Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible
Projects
None yet
Development

No branches or pull requests

4 participants