From 01049a52fd3d677f63f3f7a22511a3a105100193 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 1 Mar 2017 23:34:48 +0100 Subject: [PATCH] Drop crafting grid on player leave and join --- mods/HUD/craftingpack/crafting/init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mods/HUD/craftingpack/crafting/init.lua b/mods/HUD/craftingpack/crafting/init.lua index 4417a56f17..a3aa93f346 100644 --- a/mods/HUD/craftingpack/crafting/init.lua +++ b/mods/HUD/craftingpack/crafting/init.lua @@ -127,6 +127,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end end) +-- Drop crafting grid items on leaving +minetest.register_on_leaveplayer(function(player) + drop_fields(player, "craft") +end) + minetest.register_on_joinplayer(function(player) --init inventory set_inventory(player) @@ -147,6 +152,12 @@ minetest.register_on_joinplayer(function(player) set_inventory(player) end end + + --[[ Make sure the crafting grid is empty. Why? Because the player might have + items remaining in the crafting grid from the previous join; this is likely + when the server has been shutdown and the server didn't clean up the player + inventories. ]] + drop_fields(player, "craft") end) minetest.register_node("crafting:workbench", {