aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/client/register.lua1
-rw-r--r--clientmods/preview/init.lua28
-rw-r--r--doc/client_lua_api.txt17
-rw-r--r--src/client.cpp1
-rw-r--r--src/script/cpp_api/s_client.cpp11
-rw-r--r--src/script/cpp_api/s_client.h2
6 files changed, 14 insertions, 46 deletions
diff --git a/builtin/client/register.lua b/builtin/client/register.lua
index 2da37ad5f..955655236 100644
--- a/builtin/client/register.lua
+++ b/builtin/client/register.lua
@@ -60,7 +60,6 @@ end
core.registered_globalsteps, core.register_globalstep = make_registration()
core.registered_on_shutdown, core.register_on_shutdown = make_registration()
-core.registered_on_connect, core.register_on_connect = make_registration()
core.registered_on_receiving_chat_message, core.register_on_receiving_chat_message = make_registration()
core.registered_on_sending_chat_message, core.register_on_sending_chat_message = make_registration()
core.registered_on_death, core.register_on_death = make_registration()
diff --git a/clientmods/preview/init.lua b/clientmods/preview/init.lua
index a384fd6bf..223577876 100644
--- a/clientmods/preview/init.lua
+++ b/clientmods/preview/init.lua
@@ -7,21 +7,19 @@ dofile("preview:example.lua")
core.register_on_shutdown(function()
print("[PREVIEW] shutdown client")
end)
-local id = 0
-core.register_on_connect(function()
- print("[PREVIEW] Player connection completed")
- local server_info = core.get_server_info()
- print("Server version: " .. server_info.protocol_version)
- print("Server ip: " .. server_info.ip)
- print("Server address: " .. server_info.address)
- print("Server port: " .. server_info.port)
- mod_channel = core.mod_channel_join("experimental_preview")
-
- core.after(4, function()
- if mod_channel:is_writeable() then
- mod_channel:send_all("preview talk to experimental")
- end
- end)
+local id = nil
+
+local server_info = core.get_server_info()
+print("Server version: " .. server_info.protocol_version)
+print("Server ip: " .. server_info.ip)
+print("Server address: " .. server_info.address)
+print("Server port: " .. server_info.port)
+mod_channel = core.mod_channel_join("experimental_preview")
+
+core.after(4, function()
+ if mod_channel:is_writeable() then
+ mod_channel:send_all("preview talk to experimental")
+ end
end)
core.after(1, function()
diff --git a/doc/client_lua_api.txt b/doc/client_lua_api.txt
index 566b86255..31142cae2 100644
--- a/doc/client_lua_api.txt
+++ b/doc/client_lua_api.txt
@@ -651,8 +651,6 @@ Call these functions only at load time!
* **Warning**: If the client terminates abnormally (i.e. crashes), the registered
callbacks **will likely not be run**. Data should be saved at
semi-frequent intervals as well as on server shutdown.
-* `minetest.register_on_connect(func())`
- * Called at the end of client connection (when player is loaded onto map)
* `minetest.register_on_receiving_chat_message(func(message))`
* Called always when a client receive a message
* Return `true` to mark the message as handled, which means that it will not be shown to chat
@@ -784,8 +782,6 @@ Call these functions only at load time!
* Client joins channel `channel_name`, and creates it, if necessary. You
should listen from incoming messages with `minetest.register_on_modchannel_message`
call to receive incoming messages. Warning, this function is asynchronous.
- * You should use a minetest.register_on_connect(function() ... end) to perform
- a successful channel join on client startup.
### Particles
* `minetest.add_particle(particle definition)`
@@ -935,18 +931,7 @@ Please do not try to access the reference until the camera is initialized, other
* Returns aspect ratio of screen
### LocalPlayer
-An interface to retrieve information about the player. The player is
-not accessible until the client is fully done loading and therefore
-not at module init time.
-
-To get the localplayer handle correctly, use `on_connect()` as follows:
-
-```lua
-local localplayer
-minetest.register_on_connect(function()
- localplayer = minetest.localplayer
-end)
-```
+An interface to retrieve information about the player.
Methods:
diff --git a/src/client.cpp b/src/client.cpp
index 90f1c4e01..6416f7715 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1698,7 +1698,6 @@ void Client::afterContentReceived()
if (g_settings->getBool("enable_client_modding")) {
m_script->on_client_ready(m_env.getLocalPlayer());
- m_script->on_connect();
}
text = wgettext("Done!");
diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp
index c6f7a8e19..457dabfa7 100644
--- a/src/script/cpp_api/s_client.cpp
+++ b/src/script/cpp_api/s_client.cpp
@@ -36,17 +36,6 @@ 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
diff --git a/src/script/cpp_api/s_client.h b/src/script/cpp_api/s_client.h
index 717fbb4cc..402b44e33 100644
--- a/src/script/cpp_api/s_client.h
+++ b/src/script/cpp_api/s_client.h
@@ -40,8 +40,6 @@ public:
// Calls on_shutdown handlers
void on_shutdown();
- void on_connect();
-
// Chat message handlers
bool on_sending_message(const std::string &message);
bool on_receiving_message(const std::string &message);