mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-22 16:09:33 +01:00
Drop crafting grid on player leave and join
This commit is contained in:
parent
787568e5d6
commit
01049a52fd
1 changed files with 11 additions and 0 deletions
|
@ -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", {
|
||||
|
|
Loading…
Reference in a new issue