Skip to content

Commit

Permalink
Improve warnings when no games or only devtest is installed (minetest…
Browse files Browse the repository at this point in the history
  • Loading branch information
rollerozxa committed Jun 29, 2022
1 parent a5f3859 commit 17709d7
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions builtin/mainmenu/dlg_create_world.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ local mgv6_biomes = {

local function create_world_formspec(dialogdata)

-- Error out when no games found
-- Point the player to ContentDB when no games are found
if #pkgmgr.games == 0 then
return "size[12.25,3,true]" ..
"box[0,0;12,2;" .. mt_color_orange .. "]" ..
"textarea[0.3,0;11.7,2;;;"..
fgettext("You have no games installed.") .. "\n" ..
fgettext("Download one from minetest.net") .. "]" ..
"button[4.75,2.5;3,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
return "size[8,2.5,true]" ..
"style[label_button;border=false]" ..
"button[0.5,0.5;7,0.5;label_button;" ..
fgettext("You have no games installed.") .. "]" ..
"button[0.5,1.5;2.5,0.5;world_create_open_cdb;" .. fgettext("Install a game") .. "]" ..
"button[5.0,1.5;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
end

local current_mg = dialogdata.mg
Expand Down Expand Up @@ -301,9 +301,9 @@ local function create_world_formspec(dialogdata)
local gamelist_height = 2.3
if #pkgmgr.games == 1 and pkgmgr.games[1].id == "devtest" then
devtest_only = "box[0,0;5.8,1.7;#ff8800]" ..
"textarea[0.3,0;6,1.8;;;"..
fgettext("Warning: The Development Test is meant for developers.") .. "\n" ..
fgettext("Download a game, such as Minetest Game, from minetest.net") .. "]"
"textarea[0.4,0.1;6,1.8;;;"..
fgettext("Development Test is meant for developers.") .. "]" ..
"button[1,1;4,0.5;world_create_open_cdb;" .. fgettext("Install another game") .. "]"
gamelist_height = 0.5
end

Expand Down Expand Up @@ -358,6 +358,15 @@ end

local function create_world_buttonhandler(this, fields)

if fields["world_create_open_cdb"] then
local dlg = create_store_dlg("game")
dlg:set_parent(this.parent)
this:delete()
this.parent:hide()
dlg:show()
return true
end

if fields["world_create_confirm"] or
fields["key_enter"] then

Expand Down

0 comments on commit 17709d7

Please sign in to comment.