aboutsummaryrefslogtreecommitdiff
path: root/builtin/game
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2016-10-16 17:35:07 +0100
committersfan5 <sfan5@live.de>2017-09-11 20:54:07 +0200
commitd10cccee3108b45cf7085ffdbff9b5f2a4045ea7 (patch)
treeeecf15cbb9e096d5ff80415a30f2dd6819af40f0 /builtin/game
parentbb225672f97eecc5c8e09a702d7412748bbfb37d (diff)
downloadminetest-d10cccee3108b45cf7085ffdbff9b5f2a4045ea7.tar.gz
minetest-d10cccee3108b45cf7085ffdbff9b5f2a4045ea7.tar.bz2
minetest-d10cccee3108b45cf7085ffdbff9b5f2a4045ea7.zip
Allow the join/leave message to be overridden by mods.
Diffstat (limited to 'builtin/game')
-rw-r--r--builtin/game/misc.lua22
1 files changed, 15 insertions, 7 deletions
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua
index bfe407b9d..39ef9b461 100644
--- a/builtin/game/misc.lua
+++ b/builtin/game/misc.lua
@@ -42,22 +42,30 @@ end
local player_list = {}
-core.register_on_joinplayer(function(player)
- local player_name = player:get_player_name()
- player_list[player_name] = player
+function core.send_join_message(player_name)
if not minetest.is_singleplayer() then
core.chat_send_all("*** " .. player_name .. " joined the game.")
end
-end)
+end
-core.register_on_leaveplayer(function(player, timed_out)
- local player_name = player:get_player_name()
- player_list[player_name] = nil
+function core.send_leave_message(player_name, timed_out)
local announcement = "*** " .. player_name .. " left the game."
if timed_out then
announcement = announcement .. " (timed out)"
end
core.chat_send_all(announcement)
+end
+
+core.register_on_joinplayer(function(player)
+ local player_name = player:get_player_name()
+ player_list[player_name] = player
+ core.send_join_message(player_name)
+end)
+
+core.register_on_leaveplayer(function(player, timed_out)
+ local player_name = player:get_player_name()
+ player_list[player_name] = nil
+ core.send_leave_message(player_name, timed_out)
end)
function core.get_connected_players()