Fix crash when a player /unwatches and disconnects within 0.1 seconds.
This commit is contained in:
parent
b81ed1761a
commit
d39bd77d12
9
init.lua
9
init.lua
@ -32,11 +32,14 @@ local function unwatching(name)
|
||||
minetest.set_player_privs(name, privs)
|
||||
end
|
||||
|
||||
if original_pos[watcher] then
|
||||
local pos = original_pos[watcher]
|
||||
if pos then
|
||||
-- setpos seems to be very unreliable
|
||||
-- this workaround helps though
|
||||
minetest.after(0.1, function()
|
||||
watcher:setpos(original_pos[watcher])
|
||||
original_pos[watcher] = {}
|
||||
watcher:setpos(pos)
|
||||
end)
|
||||
original_pos[watcher] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user