Events
Planetary Processing provides the ability for you to run functions when specific events occur. This is implemented in the (optional) events.lua
file in the root directory of your game repository. The default template repository comes with the following events file:
The above code causes the server to print out a message when a player joins or leaves. The Lua environment in use is that of the chunk where the event occurs. This means you can still access data like the chunk
variable.
Events API
The full events API is shown below, these functions are accessed within an events.lua
file.
on_player_join
Called when a player joins the game.
player
- this player's entity
first
- boolean, true if this player has never joined before
on_player_leave
Called when a player leaves the game.
player
- this player's entity
Last updated