mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-26 12:33:43 +01:00
Remember last formspec on re-opening
This commit is contained in:
parent
cf51f9defa
commit
852b07f8e4
5
init.lua
5
init.lua
@ -147,10 +147,13 @@ minetest.register_craftitem(":xdecor:crafting_guide", {
|
|||||||
groups = {book=1},
|
groups = {book=1},
|
||||||
on_use = function(itemstack, user)
|
on_use = function(itemstack, user)
|
||||||
local player_name = user:get_player_name()
|
local player_name = user:get_player_name()
|
||||||
|
if not datas[player_name] then
|
||||||
datas[player_name] = {}
|
datas[player_name] = {}
|
||||||
|
|
||||||
craftguide:get_items(nil, player_name)
|
craftguide:get_items(nil, player_name)
|
||||||
craftguide:get_formspec(itemstack, 1, nil, 1, "", player_name)
|
craftguide:get_formspec(itemstack, 1, nil, 1, "", player_name)
|
||||||
|
else
|
||||||
|
minetest.show_formspec(player_name, "xdecor:crafting_guide", datas[player_name].formspec)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user