aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu
diff options
context:
space:
mode:
authorlisacvuk <lisacvukhome@gmail.com>2017-08-18 19:39:44 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-08-18 19:39:44 +0200
commitd1a39f01402c06ad3b5f904a2b3467b5ee2eb6e1 (patch)
treee0ade74bde9e507e43d61537bb8d4d79b9c44154 /builtin/mainmenu
parentfd3afbced5410639325e730d5710b8b5039b320e (diff)
downloadminetest-d1a39f01402c06ad3b5f904a2b3467b5ee2eb6e1.tar.gz
minetest-d1a39f01402c06ad3b5f904a2b3467b5ee2eb6e1.tar.bz2
minetest-d1a39f01402c06ad3b5f904a2b3467b5ee2eb6e1.zip
Make world creation menu automatically generate a random world name (#6257)
* Make world creation menu automatically generate a name. * Name is now initialy empty, and generated if player tries to create a world without a name.
Diffstat (limited to 'builtin/mainmenu')
-rw-r--r--builtin/mainmenu/dlg_create_world.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/builtin/mainmenu/dlg_create_world.lua b/builtin/mainmenu/dlg_create_world.lua
index e9ca7799f..4e88ccc48 100644
--- a/builtin/mainmenu/dlg_create_world.lua
+++ b/builtin/mainmenu/dlg_create_world.lua
@@ -85,9 +85,12 @@ local function create_world_buttonhandler(this, fields)
local worldname = fields["te_world_name"]
local gameindex = core.get_textlist_index("games")
- if gameindex ~= nil and
- worldname ~= "" then
-
+ if gameindex ~= nil then
+ if worldname == "" then
+ local random_number = math.random(10000, 99999)
+ local random_world_name = "Unnamed" .. random_number
+ worldname = random_world_name
+ end
local message = nil
core.settings:set("fixed_map_seed", fields["te_seed"])
@@ -112,8 +115,7 @@ local function create_world_buttonhandler(this, fields)
menudata.worldlist:raw_index_by_uid(worldname))
end
else
- gamedata.errormessage =
- fgettext("No worldname given or no game selected")
+ gamedata.errormessage = fgettext("No game selected")
end
this:delete()
return true