From af11c3e7585c1cc89686a84c1e133f018d1980af Mon Sep 17 00:00:00 2001 From: Hume2 Date: Sun, 9 Sep 2018 18:21:10 +0200 Subject: Dismount all players on server shutdown --- init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) 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) -- cgit v1.2.3