Skip to content

Commit d1a39f0

Browse files
lisacvuknerzhul
authored andcommittedAug 18, 2017
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.
1 parent fd3afbc commit d1a39f0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

Diff for: ‎builtin/mainmenu/dlg_create_world.lua

+7-5
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ local function create_world_buttonhandler(this, fields)
8585
local worldname = fields["te_world_name"]
8686
local gameindex = core.get_textlist_index("games")
8787

88-
if gameindex ~= nil and
89-
worldname ~= "" then
90-
88+
if gameindex ~= nil then
89+
if worldname == "" then
90+
local random_number = math.random(10000, 99999)
91+
local random_world_name = "Unnamed" .. random_number
92+
worldname = random_world_name
93+
end
9194
local message = nil
9295

9396
core.settings:set("fixed_map_seed", fields["te_seed"])
@@ -112,8 +115,7 @@ local function create_world_buttonhandler(this, fields)
112115
menudata.worldlist:raw_index_by_uid(worldname))
113116
end
114117
else
115-
gamedata.errormessage =
116-
fgettext("No worldname given or no game selected")
118+
gamedata.errormessage = fgettext("No game selected")
117119
end
118120
this:delete()
119121
return true

0 commit comments

Comments
 (0)
Please sign in to comment.