]> git.lizzy.rs Git - minetest.git/commitdiff
Improve warnings when no games or only devtest is installed (#11955)
authorROllerozxa <temporaryemail4meh+github@gmail.com>
Wed, 29 Jun 2022 20:20:12 +0000 (22:20 +0200)
committerGitHub <noreply@github.com>
Wed, 29 Jun 2022 20:20:12 +0000 (22:20 +0200)
builtin/mainmenu/dlg_create_world.lua

index 76ceb0f16c7d0325d1dd81c6671d6016c002fdbd..8628ed3121ae66dd8ce584255172b46570cbb031 100644 (file)
@@ -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
@@ -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
 
@@ -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