1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-09-17 07:55:19 +02:00

async race condition fix

This commit is contained in:
Luke aka SwissalpS
2024-05-02 23:32:36 +02:00
committed by GitHub
parent fe4d5bfac1
commit 7f63b3f6bf

View File

@@ -50,14 +50,19 @@ if minetest.get_modpath("default") then
if formname ~= "default:chest" then if formname ~= "default:chest" then
return return
end end
local pn = player:get_player_name() if fields.quit then
if not pn then
return return
end end
local pos = default.chest.open_chests[pn].pos local pn = player:get_player_name()
local chest_open = default.chest.open_chests[pn]
if not chest_open then
-- chest already closed before formspec
return
end
local pos = chest_open.pos
local chest = pos and minetest.get_node(pos) local chest = pos and minetest.get_node(pos)
local is_pipeworks_chest = chest and pipeworks.chests[chest] local is_pipeworks_chest = chest and pipeworks.chests[chest]
if is_pipeworks_chest and not fields.quit and pipeworks.may_configure(pos, player) then if is_pipeworks_chest and pipeworks.may_configure(pos, player) then
-- Pipeworks Switch -- Pipeworks Switch
fs_helpers.on_receive_fields(pos, fields) fs_helpers.on_receive_fields(pos, fields)
minetest.show_formspec(pn, minetest.show_formspec(pn,