2012-04-01 02:37:41 -07:00
|
|
|
-- Minetest: builtin/deprecated.lua
|
|
|
|
|
2013-05-24 15:51:02 -07:00
|
|
|
--
|
|
|
|
-- EnvRef
|
|
|
|
--
|
2014-04-27 18:02:48 -07:00
|
|
|
core.env = {}
|
2013-05-24 15:51:02 -07:00
|
|
|
local envref_deprecation_message_printed = false
|
2014-04-27 18:02:48 -07:00
|
|
|
setmetatable(core.env, {
|
2013-05-24 15:51:02 -07:00
|
|
|
__index = function(table, key)
|
|
|
|
if not envref_deprecation_message_printed then
|
2015-10-13 00:57:44 -07:00
|
|
|
core.log("deprecated", "core.env:[...] is deprecated and should be replaced with core.[...]")
|
2013-05-24 15:51:02 -07:00
|
|
|
envref_deprecation_message_printed = true
|
|
|
|
end
|
2014-04-27 18:02:48 -07:00
|
|
|
local func = core[key]
|
2013-05-24 15:51:02 -07:00
|
|
|
if type(func) == "function" then
|
|
|
|
rawset(table, key, function(self, ...)
|
2013-08-18 06:15:33 -07:00
|
|
|
return func(...)
|
2013-05-24 15:51:02 -07:00
|
|
|
end)
|
|
|
|
else
|
|
|
|
rawset(table, key, nil)
|
|
|
|
end
|
|
|
|
return rawget(table, key)
|
|
|
|
end
|
|
|
|
})
|
2013-11-12 13:13:00 -08:00
|
|
|
|
2014-04-27 18:02:48 -07:00
|
|
|
function core.rollback_get_last_node_actor(pos, range, seconds)
|
|
|
|
return core.rollback_get_node_actions(pos, range, seconds, 1)[1]
|
2013-11-12 13:13:00 -08:00
|
|
|
end
|
2014-12-12 11:49:19 -08:00
|
|
|
|
|
|
|
--
|
|
|
|
-- core.setting_*
|
|
|
|
--
|
|
|
|
|
|
|
|
local settings = core.settings
|
|
|
|
|
|
|
|
local function setting_proxy(name)
|
|
|
|
return function(...)
|
|
|
|
core.log("deprecated", "WARNING: minetest.setting_* "..
|
|
|
|
"functions are deprecated. "..
|
|
|
|
"Use methods on the minetest.settings object.")
|
|
|
|
return settings[name](settings, ...)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
core.setting_set = setting_proxy("set")
|
|
|
|
core.setting_get = setting_proxy("get")
|
|
|
|
core.setting_setbool = setting_proxy("set_bool")
|
|
|
|
core.setting_getbool = setting_proxy("get_bool")
|
|
|
|
core.setting_save = setting_proxy("write")
|
2020-05-23 04:24:06 -07:00
|
|
|
|
|
|
|
--
|
|
|
|
-- core.register_on_auth_fail
|
|
|
|
--
|
|
|
|
|
|
|
|
function core.register_on_auth_fail(func)
|
|
|
|
core.log("deprecated", "core.register_on_auth_fail " ..
|
2021-01-21 10:17:09 -08:00
|
|
|
"is deprecated and should be replaced by " ..
|
2020-05-23 04:24:06 -07:00
|
|
|
"core.register_on_authplayer instead.")
|
|
|
|
|
|
|
|
core.register_on_authplayer(function (player_name, ip, is_success)
|
|
|
|
if not is_success then
|
|
|
|
func(player_name, ip)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|