mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
[CSM] Add event on_connect player API lua (#5540)
* Add event on_connect player API lua
This commit is contained in:
@@ -35,6 +35,17 @@ void ScriptApiClient::on_shutdown()
|
||||
runCallbacks(0, RUN_CALLBACKS_MODE_FIRST);
|
||||
}
|
||||
|
||||
void ScriptApiClient::on_connect()
|
||||
{
|
||||
SCRIPTAPI_PRECHECKHEADER
|
||||
|
||||
// get registered connect hooks
|
||||
lua_getglobal(L, "core");
|
||||
lua_getfield(L, -1, "registered_on_connect");
|
||||
// Call callback
|
||||
runCallbacks(0, RUN_CALLBACKS_MODE_FIRST);
|
||||
}
|
||||
|
||||
bool ScriptApiClient::on_sending_message(const std::string &message)
|
||||
{
|
||||
SCRIPTAPI_PRECHECKHEADER
|
||||
|
@@ -36,6 +36,8 @@ class ScriptApiClient : virtual public ScriptApiBase
|
||||
public:
|
||||
// Calls on_shutdown handlers
|
||||
void on_shutdown();
|
||||
|
||||
void on_connect();
|
||||
|
||||
// Chat message handlers
|
||||
bool on_sending_message(const std::string &message);
|
||||
|
Reference in New Issue
Block a user