forked from Mirrorlandia_minetest/minetest
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.
This commit is contained in:
parent
fd3afbced5
commit
d1a39f0140
@ -85,9 +85,12 @@ local function create_world_buttonhandler(this, fields)
|
|||||||
local worldname = fields["te_world_name"]
|
local worldname = fields["te_world_name"]
|
||||||
local gameindex = core.get_textlist_index("games")
|
local gameindex = core.get_textlist_index("games")
|
||||||
|
|
||||||
if gameindex ~= nil and
|
if gameindex ~= nil then
|
||||||
worldname ~= "" 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
|
local message = nil
|
||||||
|
|
||||||
core.settings:set("fixed_map_seed", fields["te_seed"])
|
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))
|
menudata.worldlist:raw_index_by_uid(worldname))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
gamedata.errormessage =
|
gamedata.errormessage = fgettext("No game selected")
|
||||||
fgettext("No worldname given or no game selected")
|
|
||||||
end
|
end
|
||||||
this:delete()
|
this:delete()
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user