From bffbb1c82291a993d94f0679382e143f9491d55a Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Wed, 19 May 2021 14:38:30 +0100 Subject: [PATCH] fix player disconnect in minetest.after --- init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 7044e35..31a0ede 100644 --- a/init.lua +++ b/init.lua @@ -206,10 +206,10 @@ minetest.register_globalstep(function(dtime) --print(string.format("elapsed time: %.4f\n", os.clock() - t1)) - ok = true -- everything starts off ok + ok = playing[player_name] -- everything starts off ok if player around -- are we playing something already? - if playing[player_name].handler then + if ok and playing[player_name].handler then -- stop current sound if another set active or gain changed if playing[player_name].set ~= set_name @@ -263,7 +263,8 @@ minetest.register_globalstep(function(dtime) --print("-- after", set_name, handler) -- make sure we are stopping same sound we started - if playing[player_name].handler + if playing[player_name] + and playing[player_name].handler and playing[player_name].handler == handler then --print("-- timed stop", set_name, handler)