mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-11-13 22:20:19 +01:00
Adjust GUI compatibility code
This commit is contained in:
parent
324eb556f6
commit
b50294d10c
|
@ -194,21 +194,13 @@ elseif rawget(_G, "sfinv") then --sfinv installed (part of minetest_game since 0
|
|||
end
|
||||
})
|
||||
|
||||
--compatibility with pre-0.4.16 sfinv
|
||||
local set_page = sfinv.set_page or function(player, name)
|
||||
--assumptions: src pg has no leave callback, dst pg has no enter callback
|
||||
local ctx = {page=name}
|
||||
sfinv.contexts[player:get_player_name()] = ctx
|
||||
sfinv.set_player_inventory_formspec(player, ctx)
|
||||
end
|
||||
|
||||
--show the form when the button is pressed and hide it when done
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if fields.worldedit_gui then --main page
|
||||
worldedit.show_page(player:get_player_name(), "worldedit_gui")
|
||||
return true
|
||||
elseif fields.worldedit_gui_exit then --return to original page
|
||||
set_page(player, "sfinv:crafting")
|
||||
sfinv.set_page(player, "sfinv:crafting")
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
@ -222,11 +214,11 @@ elseif rawget(_G, "sfinv") then --sfinv installed (part of minetest_game since 0
|
|||
end
|
||||
else
|
||||
error(
|
||||
"worldedit_gui requires a supported \"gui management\" mod to be installed\n"..
|
||||
"To use the GUI you need to either\n"..
|
||||
"* Use minetest_game (at least 0.4.15) or a subgame with compatible sfinv\n"..
|
||||
"* Install Unified Inventory or Inventory++\n"..
|
||||
"If you do not want to use worldedit_gui, disable it by editing world.mt or from the Main Menu"
|
||||
"worldedit_gui requires a supported gui management mod to be installed.\n"..
|
||||
"To use the it you need to either:\n"..
|
||||
"* use minetest_game or another sfinv-compatible subgame\n"..
|
||||
"* install Unified Inventory, Inventory++ or Smart Inventory\n"..
|
||||
"If you don't want to use worldedit_gui, disable it by editing world.mt or from the main menu."
|
||||
)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user