From f73534640a18709921519ee43110292cf658e67f Mon Sep 17 00:00:00 2001 From: Vincent Glize Date: Sat, 8 Apr 2017 08:20:30 +0200 Subject: [CSM] Add event on_connect player API lua (#5540) * Add event on_connect player API lua --- src/script/cpp_api/s_client.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/script/cpp_api/s_client.cpp') diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp index 666fd693d..a8a7d5e26 100644 --- a/src/script/cpp_api/s_client.cpp +++ b/src/script/cpp_api/s_client.cpp @@ -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 -- cgit v1.2.3