Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adjust GUI compatibility code
  • Loading branch information
sfan5 committed Jul 16, 2019
1 parent 324eb55 commit b50294d
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions worldedit_gui/init.lua
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit b50294d

Please sign in to comment.