mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-01-12 19:10:29 +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
|
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
|
--show the form when the button is pressed and hide it when done
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if fields.worldedit_gui then --main page
|
if fields.worldedit_gui then --main page
|
||||||
worldedit.show_page(player:get_player_name(), "worldedit_gui")
|
worldedit.show_page(player:get_player_name(), "worldedit_gui")
|
||||||
return true
|
return true
|
||||||
elseif fields.worldedit_gui_exit then --return to original page
|
elseif fields.worldedit_gui_exit then --return to original page
|
||||||
set_page(player, "sfinv:crafting")
|
sfinv.set_page(player, "sfinv:crafting")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
@ -222,11 +214,11 @@ elseif rawget(_G, "sfinv") then --sfinv installed (part of minetest_game since 0
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
error(
|
error(
|
||||||
"worldedit_gui requires a supported \"gui management\" mod to be installed\n"..
|
"worldedit_gui requires a supported gui management mod to be installed.\n"..
|
||||||
"To use the GUI you need to either\n"..
|
"To use the it you need to either:\n"..
|
||||||
"* Use minetest_game (at least 0.4.15) or a subgame with compatible sfinv\n"..
|
"* use minetest_game or another sfinv-compatible subgame\n"..
|
||||||
"* Install Unified Inventory or Inventory++\n"..
|
"* install Unified Inventory, Inventory++ or Smart Inventory\n"..
|
||||||
"If you do not want to use worldedit_gui, disable it by editing world.mt or from the Main Menu"
|
"If you don't want to use worldedit_gui, disable it by editing world.mt or from the main menu."
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user