Builtin: minor cleanup
parent
b1f78df35e
commit
c59b9009cd
|
@ -8,7 +8,7 @@ local function handle_job(jobid, serialized_retval)
|
|||
end
|
||||
|
||||
if core.register_globalstep then
|
||||
core.register_globalstep(function(dtime)
|
||||
core.register_globalstep(function()
|
||||
for _, job in ipairs(core.get_finished_jobs()) do
|
||||
handle_job(job.jobid, job.retval)
|
||||
end
|
||||
|
|
|
@ -162,7 +162,7 @@ core.builtin_auth_handler = {
|
|||
end,
|
||||
}
|
||||
|
||||
core.register_on_prejoinplayer(function(name, ip)
|
||||
core.register_on_prejoinplayer(function(name)
|
||||
if core.registered_auth_handler ~= nil then
|
||||
return -- Don't do anything if custom auth handler registered
|
||||
end
|
||||
|
|
|
@ -90,7 +90,7 @@ core.register_chatcommand("me", {
|
|||
|
||||
core.register_chatcommand("admin", {
|
||||
description = "Show the name of the server owner",
|
||||
func = function(name)
|
||||
func = function()
|
||||
local admin = core.settings:get("name")
|
||||
if admin then
|
||||
return true, "The administrator of this server is " .. admin .. "."
|
||||
|
@ -119,7 +119,7 @@ core.register_chatcommand("haspriv", {
|
|||
params = "<privilege>",
|
||||
description = "Return list of all online players with privilege.",
|
||||
privs = {basic_privs = true},
|
||||
func = function(caller, param)
|
||||
func = function(_, param)
|
||||
param = param:trim()
|
||||
if param == "" then
|
||||
return false, "Invalid parameters (see /help haspriv)"
|
||||
|
@ -322,7 +322,7 @@ core.register_chatcommand("clearpassword", {
|
|||
core.register_chatcommand("auth_reload", {
|
||||
description = "Reload authentication data",
|
||||
privs = {server = true},
|
||||
func = function(name, param)
|
||||
func = function()
|
||||
local done = core.auth_reload()
|
||||
return done, (done and "Done." or "Failed.")
|
||||
end
|
||||
|
@ -356,7 +356,7 @@ core.register_chatcommand("remove_player", {
|
|||
core.register_chatcommand("auth_save", {
|
||||
description = "Write authentication data to disk",
|
||||
privs = {server = true},
|
||||
func = function(name, param)
|
||||
func = function()
|
||||
local done = core.auth_save()
|
||||
return done, (done and "Authentication data successfully saved to disk." or "Failed to write the auth.txt file.")
|
||||
end
|
||||
|
@ -472,7 +472,7 @@ core.register_chatcommand("set", {
|
|||
params = "([-n] <name> <value>) | <name>",
|
||||
description = "Set or read server configuration setting",
|
||||
privs = {server = true},
|
||||
func = function(name, param)
|
||||
func = function(_, param)
|
||||
local arg, setname, setvalue = string.match(param, "(-[n]) ([^ ]+) (.+)")
|
||||
if arg and arg == "-n" and setname and setvalue then
|
||||
core.settings:set(setname, setvalue)
|
||||
|
@ -885,7 +885,7 @@ register_chatcommand_alias("settime", "time")
|
|||
|
||||
core.register_chatcommand("days", {
|
||||
description = "Show day count since world creation",
|
||||
func = function(name, param)
|
||||
func = function()
|
||||
return true, "Current day is " .. core.get_day_count()
|
||||
end
|
||||
})
|
||||
|
|
|
@ -286,8 +286,8 @@ function core.check_single_for_falling(p)
|
|||
local nc = core.get_node(pa)
|
||||
if core.get_item_group(nc.name, "attached_node2") ~= 0 then
|
||||
local connected
|
||||
for i = 1, 4 do
|
||||
local ptwo = vadd(pa, check_connected[i])
|
||||
for j = 1, 4 do
|
||||
local ptwo = vadd(pa, check_connected[j])
|
||||
local ntwo = core.get_node(ptwo)
|
||||
if core.registered_nodes[ntwo.name].walkable then
|
||||
connected = true
|
||||
|
|
|
@ -115,7 +115,6 @@ function hud.remove_item(player, name)
|
|||
|
||||
local elem = hud_id[i_name]
|
||||
|
||||
local i_name = player:get_player_name() .. "_" .. name
|
||||
if not elem then
|
||||
throw_error("Given HUD element " .. dump(name) .. " does not exist")
|
||||
return false
|
||||
|
@ -155,11 +154,11 @@ core.register_on_joinplayer(function(player)
|
|||
end)
|
||||
|
||||
core.register_on_leaveplayer(function(player)
|
||||
local player = player:get_player_name()
|
||||
local player_name = player:get_player_name()
|
||||
for name, _ in pairs(sb_bg) do
|
||||
sb_bg[player .. "_" .. name] = nil
|
||||
sb_bg[player_name .. "_" .. name] = nil
|
||||
end
|
||||
for name, _ in pairs(items) do
|
||||
hud_id[player .. "_" .. name] = nil
|
||||
hud_id[player_name .. "_" .. name] = nil
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -35,12 +35,14 @@ weather = {
|
|||
}
|
||||
|
||||
local file_name = core.get_worldpath() .. "/weather"
|
||||
local file = io.open(file_name, "r")
|
||||
if file ~= nil then
|
||||
local saved_weather = core.deserialize(file:read("*a"))
|
||||
io.close(file)
|
||||
if type(saved_weather) == "table" then
|
||||
weather = saved_weather
|
||||
do
|
||||
local file = io.open(file_name, "r")
|
||||
if file ~= nil then
|
||||
local saved_weather = core.deserialize(file:read("*a"))
|
||||
io.close(file)
|
||||
if type(saved_weather) == "table" then
|
||||
weather = saved_weather
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -159,7 +159,6 @@ local function handle_buttons(this, fields)
|
|||
|
||||
local rawlist = this.data.list:get_raw_list()
|
||||
|
||||
local i,mod
|
||||
for _, mod in ipairs(rawlist) do
|
||||
if not mod.is_modpack and
|
||||
not mod.is_game_content then
|
||||
|
@ -266,7 +265,7 @@ function create_configure_world_dlg(worldidx)
|
|||
return true
|
||||
end,
|
||||
{
|
||||
worldpat h= dlg.data.worldspec.path,
|
||||
worldpath = dlg.data.worldspec.path,
|
||||
gameid = dlg.data.worldspec.gameid
|
||||
}
|
||||
)
|
||||
|
|
|
@ -20,7 +20,6 @@ local function create_world_formspec()
|
|||
|
||||
local current_seed = core.formspec_escape(core.settings:get("fixed_map_seed")) or ""
|
||||
local current_mg = core.settings:get("mg_name")
|
||||
local gameid = core.settings:get("menu_last_game")
|
||||
|
||||
local mglist = ""
|
||||
local selindex = 1
|
||||
|
|
Loading…
Reference in New Issue