summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHume2 <teratux.mail@gmail.com>2018-09-09 18:21:10 +0200
committerHume2 <teratux.mail@gmail.com>2018-09-09 18:21:10 +0200
commitaf11c3e7585c1cc89686a84c1e133f018d1980af (patch)
tree90ef7f15efc2c34ed7d12c4f4a863478f1e8308a
parentf026ea2894a1e0d24c2378d75a73263153db2311 (diff)
Dismount all players on server shutdown
-rw-r--r--init.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index b46c7f7..ef93f4a 100644
--- a/init.lua
+++ b/init.lua
@@ -418,6 +418,15 @@ minetest.register_on_leaveplayer(function(player)
attached[player:get_player_name()] = nil
end)
+-- Dismount all players on server shutdown
+minetest.register_on_shutdown(function()
+ for _, e in pairs(minetest.luaentities) do
+ if (e.driver ~= nil) then
+ dismount_player(e, true)
+ end
+ end
+end)
+
-- Register the entity
minetest.register_entity("bike:bike", bike)