@@ -37,23 +37,29 @@ dofile(menupath .. DIR_DELIM .. "common.lua")
37
37
dofile (menupath .. DIR_DELIM .. " gamemgr.lua" )
38
38
dofile (menupath .. DIR_DELIM .. " modmgr.lua" )
39
39
dofile (menupath .. DIR_DELIM .. " store.lua" )
40
+ dofile (menupath .. DIR_DELIM .. " textures.lua" )
41
+
40
42
dofile (menupath .. DIR_DELIM .. " dlg_config_world.lua" )
41
- dofile (menupath .. DIR_DELIM .. " tab_credits.lua" )
42
- dofile (menupath .. DIR_DELIM .. " tab_mods.lua" )
43
- dofile (menupath .. DIR_DELIM .. " tab_settings.lua" )
44
43
dofile (menupath .. DIR_DELIM .. " dlg_settings_advanced.lua" )
45
44
if PLATFORM ~= " Android" then
46
45
dofile (menupath .. DIR_DELIM .. " dlg_create_world.lua" )
47
46
dofile (menupath .. DIR_DELIM .. " dlg_delete_mod.lua" )
48
47
dofile (menupath .. DIR_DELIM .. " dlg_delete_world.lua" )
49
48
dofile (menupath .. DIR_DELIM .. " dlg_rename_modpack.lua" )
50
- dofile (menupath .. DIR_DELIM .. " tab_multiplayer.lua" )
51
- dofile (menupath .. DIR_DELIM .. " tab_server.lua" )
52
- dofile (menupath .. DIR_DELIM .. " tab_singleplayer.lua" )
53
- dofile (menupath .. DIR_DELIM .. " tab_texturepacks.lua" )
54
- dofile (menupath .. DIR_DELIM .. " textures.lua" )
49
+ end
50
+
51
+ local tabs = {}
52
+
53
+ tabs .settings = dofile (menupath .. DIR_DELIM .. " tab_settings.lua" )
54
+ tabs .mods = dofile (menupath .. DIR_DELIM .. " tab_mods.lua" )
55
+ tabs .credits = dofile (menupath .. DIR_DELIM .. " tab_credits.lua" )
56
+ if PLATFORM == " Android" then
57
+ tabs .simple_main = dofile (menupath .. DIR_DELIM .. " tab_simple_main.lua" )
55
58
else
56
- dofile (menupath .. DIR_DELIM .. " tab_simple_main.lua" )
59
+ tabs .singleplayer = dofile (menupath .. DIR_DELIM .. " tab_singleplayer.lua" )
60
+ tabs .multiplayer = dofile (menupath .. DIR_DELIM .. " tab_multiplayer.lua" )
61
+ tabs .server = dofile (menupath .. DIR_DELIM .. " tab_server.lua" )
62
+ tabs .texturepacks = dofile (menupath .. DIR_DELIM .. " tab_texturepacks.lua" )
57
63
end
58
64
59
65
---- ----------------------------------------------------------------------------
@@ -69,8 +75,19 @@ local function init_globals()
69
75
-- Init gamedata
70
76
gamedata .worldindex = 0
71
77
78
+ if PLATFORM == " Android" then
79
+ local world_list = core .get_worlds ()
80
+ local world_index = table .indexof (world_list , " singleplayerworld" )
72
81
73
- if PLATFORM ~= " Android" then
82
+ if world_index == - 1 then
83
+ core .create_world (" singleplayerworld" , 1 )
84
+
85
+ world_list = core .get_worlds ()
86
+ world_index = table .indexof (world_list , " singleplayerworld" )
87
+ end
88
+
89
+ gamedata .worldindex = world_index
90
+ else
74
91
menudata .worldlist = filterlist .create (
75
92
core .get_worlds ,
76
93
compare_worlds ,
@@ -89,71 +106,44 @@ local function init_globals()
89
106
90
107
if not core .setting_get (" menu_last_game" ) then
91
108
local default_game = core .setting_get (" default_game" ) or " minetest"
92
- core .setting_set (" menu_last_game" , default_game )
109
+ core .setting_set (" menu_last_game" , default_game )
93
110
end
94
111
95
112
mm_texture .init ()
96
- else
97
- local world_list = core .get_worlds ()
98
-
99
- local found_singleplayerworld = false
100
-
101
- for i ,world in pairs (world_list ) do
102
- if world .name == " singleplayerworld" then
103
- found_singleplayerworld = true
104
- gamedata .worldindex = i
105
- break
106
- end
107
- end
108
-
109
- if not found_singleplayerworld then
110
- core .create_world (" singleplayerworld" , 1 )
111
-
112
- local world_list = core .get_worlds ()
113
-
114
- for i ,world in pairs (world_list ) do
115
- if world .name == " singleplayerworld" then
116
- gamedata .worldindex = i
117
- break
118
- end
119
- end
120
- end
121
113
end
122
114
123
115
-- Create main tabview
124
- local tv_main = tabview_create (" maintab" ,{x = 12 ,y = 5.2 },{x = 0 ,y = 0 })
125
- if PLATFORM ~= " Android" then
126
- tv_main :set_autosave_tab (true )
127
- end
128
- if PLATFORM ~= " Android" then
129
- tv_main :add (tab_singleplayer )
130
- tv_main :add (tab_multiplayer )
131
- tv_main :add (tab_server )
116
+ local tv_main = tabview_create (" maintab" , {x = 12 , y = 5.2 }, {x = 0 , y = 0 })
117
+
118
+ if PLATFORM == " Android" then
119
+ tv_main :add (tabs .simple_main )
120
+ tv_main :add (tabs .settings )
132
121
else
133
- tv_main :add (tab_simple_main )
134
- end
135
- tv_main :add (tab_settings )
136
- if PLATFORM ~= " Android" then
137
- tv_main :add (tab_texturepacks )
122
+ tv_main :set_autosave_tab (true )
123
+ tv_main :add (tabs .singleplayer )
124
+ tv_main :add (tabs .multiplayer )
125
+ tv_main :add (tabs .server )
126
+ tv_main :add (tabs .settings )
127
+ tv_main :add (tabs .texturepacks )
138
128
end
139
- tv_main :add (tab_mods )
140
- tv_main :add (tab_credits )
141
129
142
- tv_main :set_global_event_handler (main_event_handler )
130
+ tv_main :add (tabs .mods )
131
+ tv_main :add (tabs .credits )
143
132
133
+ tv_main :set_global_event_handler (main_event_handler )
144
134
tv_main :set_fixed_size (false )
145
135
146
- if not ( PLATFORM == " Android" ) then
136
+ if PLATFORM ~= " Android" then
147
137
tv_main :set_tab (core .setting_get (" maintab_LAST" ))
148
138
end
149
139
ui .set_default (" maintab" )
150
140
tv_main :show ()
151
141
152
142
-- Create modstore ui
153
143
if PLATFORM == " Android" then
154
- modstore .init ({x = 12 , y = 6 }, 3 , 2 )
144
+ modstore .init ({x = 12 , y = 6 }, 3 , 2 )
155
145
else
156
- modstore .init ({x = 12 , y = 8 }, 4 , 3 )
146
+ modstore .init ({x = 12 , y = 8 }, 4 , 3 )
157
147
end
158
148
159
149
ui .update ()
0 commit comments