Fix builtin

This commit is contained in:
Maksim Gamarnik 2017-07-20 00:36:10 +03:00
parent e6f54b1fce
commit 4d948c4b9c
4 changed files with 11 additions and 12 deletions

View File

@ -101,7 +101,7 @@ local function create_world_buttonhandler(this, fields)
core.settings:set("fixed_map_seed", fields["te_seed"]) core.settings:set("fixed_map_seed", fields["te_seed"])
if not menudata.worldlist:uid_exists_raw(worldname) then if not menudata.worldlist:uid_exists_raw(worldname) then
core.setting_set("mg_name","v6") core.settings:set("mg_name","v6")
message = core.create_world(worldname,gameindex) message = core.create_world(worldname,gameindex)
else else
message = fgettext("A world named \"$1\" already exists", worldname) message = fgettext("A world named \"$1\" already exists", worldname)

View File

@ -1,4 +1,4 @@
--Minetest --Minetest
--Copyright (C) 2013 sapier --Copyright (C) 2013 sapier
-- --
--This program is free software; you can redistribute it and/or modify --This program is free software; you can redistribute it and/or modify

View File

@ -73,15 +73,14 @@ local function main_button_handler(this, fields, name, tabdata)
end end
if fields["cb_creative_mode"] then if fields["cb_creative_mode"] then
core.setting_set("creative_mode", fields["cb_creative_mode"]) core.settings:set("creative_mode", fields["cb_creative_mode"])
local bool = fields["cb_creative_mode"] local bool = fields["cb_creative_mode"]
if bool == 'true' then if bool == 'true' then
bool = 'false' bool = 'false'
else else
bool = 'true' bool = 'true'
end end
core.setting_set("enable_damage", bool) core.settings:set("enable_damage", bool)
core.setting_save()
return true return true
end end

View File

@ -80,7 +80,7 @@ local function main_button_handler(this, fields, name, tabdata)
world_doubleclick = true world_doubleclick = true
end end
if event.type == "CHG" then if event.type == "CHG" then
core.setting_set("mainmenu_last_selected_world", core.settings:set("mainmenu_last_selected_world",
menudata.worldlist:get_raw_index(core.get_textlist_index("srv_worlds"))) menudata.worldlist:get_raw_index(core.get_textlist_index("srv_worlds")))
return true return true
end end
@ -91,7 +91,7 @@ local function main_button_handler(this, fields, name, tabdata)
end end
if fields["cb_creative_mode"] then if fields["cb_creative_mode"] then
core.setting_set("creative_mode", fields["cb_creative_mode"]) core.settings:set("creative_mode", fields["cb_creative_mode"])
local selected = core.get_textlist_index("srv_worlds") local selected = core.get_textlist_index("srv_worlds")
menu_worldmt(selected, "creative_mode", fields["cb_creative_mode"]) menu_worldmt(selected, "creative_mode", fields["cb_creative_mode"])
@ -99,7 +99,7 @@ local function main_button_handler(this, fields, name, tabdata)
end end
if fields["cb_enable_damage"] then if fields["cb_enable_damage"] then
core.setting_set("enable_damage", fields["cb_enable_damage"]) core.settings:set("enable_damage", fields["cb_enable_damage"])
local selected = core.get_textlist_index("srv_worlds") local selected = core.get_textlist_index("srv_worlds")
menu_worldmt(selected, "enable_damage", fields["cb_enable_damage"]) menu_worldmt(selected, "enable_damage", fields["cb_enable_damage"])
@ -107,7 +107,7 @@ local function main_button_handler(this, fields, name, tabdata)
end end
if fields["cb_server_announce"] then if fields["cb_server_announce"] then
core.setting_set("server_announce", fields["cb_server_announce"]) core.settings:set("server_announce", fields["cb_server_announce"])
local selected = core.get_textlist_index("srv_worlds") local selected = core.get_textlist_index("srv_worlds")
menu_worldmt(selected, "server_announce", fields["cb_server_announce"]) menu_worldmt(selected, "server_announce", fields["cb_server_announce"])
@ -125,16 +125,16 @@ local function main_button_handler(this, fields, name, tabdata)
gamedata.port = fields["te_serverport"] gamedata.port = fields["te_serverport"]
gamedata.address = "" gamedata.address = ""
core.setting_set("port",gamedata.port) core.settings:set("port",gamedata.port)
if fields["te_serveraddr"] ~= nil then if fields["te_serveraddr"] ~= nil then
core.setting_set("bind_address",fields["te_serveraddr"]) core.settings:set("bind_address",fields["te_serveraddr"])
end end
--update last game --update last game
local world = menudata.worldlist:get_raw_element(gamedata.selected_world) local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
if world then if world then
local game, index = gamemgr.find_by_gameid(world.gameid) local game, index = gamemgr.find_by_gameid(world.gameid)
core.setting_set("menu_last_game", game.id) core.settings:set("menu_last_game", game.id)
end end
core.start() core.start()