Replace deprecated settings_* API methods

This commit is contained in:
ClobberXD 2018-12-31 04:38:25 +05:30 committed by rubenwardy
parent f2c864ac04
commit 904c47dea2
15 changed files with 29 additions and 33 deletions

View file

@ -30,7 +30,7 @@ function chatplus.init()
end
function chatplus.setting(name)
local get = minetest.setting_get("chatplus_" .. name)
local get = minetest.settings:get("chatplus_" .. name)
if get then
return get
elseif chatplus._defsettings[name]~= nil then

@ -1 +1 @@
Subproject commit 6f5bcd05d678811c86b6836786f97f3aafa67ffe
Subproject commit d341978b909b9fad5133c288e01930ffeaf9a9be

View file

@ -310,7 +310,7 @@ function default.register_ores()
})
end
local WATER_H = tonumber(minetest.setting_get("water_level"))
local WATER_H = tonumber(minetest.settings:get("water_level"))
--

View file

@ -20,7 +20,7 @@ local function drop(pos, itemstack)
if obj then
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
local remi = minetest.setting_get("remove_items")
local remi = minetest.settings:get("remove_items")
if minetest.is_yes(remi) then
obj:remove()
end

View file

@ -58,8 +58,8 @@ function gauges.add_HP_gauge(name)
end
-- If health_bars not defined or set to true
if minetest.setting_getbool("health_bars") ~= false and
minetest.setting_getbool("enable_damage") then
if minetest.settings:get_bool("health_bars") ~= false and
minetest.settings:get_bool("enable_damage") then
minetest.register_on_joinplayer(function(player)
minetest.after(2, gauges.add_HP_gauge, player:get_player_name())
end)

View file

@ -1,8 +1,8 @@
local regen_interval = tonumber(minetest.setting_get("regen_interval"))
local regen_interval = tonumber(minetest.settings:get("regen_interval"))
if regen_interval <= 0 then
regen_interval = 6
end
local regen_amount = tonumber(minetest.setting_get("regen_amount"))
local regen_amount = tonumber(minetest.settings:get("regen_amount"))
if regen_amount <= 0 then
regen_amount = 1
end

View file

@ -27,13 +27,13 @@ function table.random( t ) -- luacheck: ignore
end
function random_messages.initialize() --Set the interval in minetest.conf.
minetest.setting_set("random_messages_interval",60)
minetest.setting_save();
minetest.settings:set("random_messages_interval",60)
minetest.settings:write();
return 60
end
function random_messages.set_interval() --Read the interval from minetest.conf and set it if it doesn't exist
MESSAGE_INTERVAL = tonumber(minetest.setting_get("random_messages_interval")) or random_messages.initialize()
MESSAGE_INTERVAL = tonumber(minetest.settings:get("random_messages_interval")) or random_messages.initialize()
end
function random_messages.check_params(name,func,params)

View file

@ -179,7 +179,7 @@ for _, color in pairs(dye_basecolors) do
groups = {not_in_creative_inventory=1},
on_use = function(itemstack, user, pointed_thing)
minetest.sound_play("shooter_click", {object=user})
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/SHOOTER_CROSSBOW_USES)
end
itemstack = "shooter:crossbow 1 "..itemstack:get_wear()
@ -244,7 +244,7 @@ minetest.register_tool("shooter:crossbow", {
local color = string.match(stack:get_name(), "shooter:arrow_(%a+)")
if color then
minetest.sound_play("shooter_reload", {object=user})
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
inv:remove_item("main", "shooter:arrow_"..color.." 1")
end
return "shooter:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
@ -252,7 +252,7 @@ minetest.register_tool("shooter:crossbow", {
for _, color in pairs(dye_basecolors) do
if inv:contains_item("main", "shooter:arrow_"..color) then
minetest.sound_play("shooter_reload", {object=user})
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
inv:remove_item("main", "shooter:arrow_"..color.." 1")
end
return "shooter:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()

View file

@ -104,7 +104,7 @@ minetest.register_tool("shooter:flaregun", {
minetest.sound_play("shooter_click", {object=user})
return itemstack
end
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
inv:remove_item("main", "shooter:flare 1")
itemstack:add_wear(65535/100)
end
@ -144,4 +144,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
},
})
end

View file

@ -4,7 +4,7 @@ local function throw_hook(itemstack, user, vel)
local dir = user:get_look_dir()
local yaw = user:get_look_yaw()
if pos and dir and yaw then
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/100)
end
pos.y = pos.y + 1.5
@ -129,4 +129,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
},
})
end

View file

@ -40,7 +40,7 @@ minetest.register_tool("shooter:grenade", {
description = "Grenade",
inventory_image = "shooter_hand_grenade.png",
on_use = function(itemstack, user, pointed_thing)
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
itemstack = ""
end
-- clarification for future readers: grenade can be used only if player points at nothing (line 47)

View file

@ -46,7 +46,7 @@ minetest.register_tool("shooter:rocket_gun_loaded", {
inventory_image = "shooter_rocket_gun_loaded.png",
groups = {not_in_creative_inventory=1},
on_use = function(itemstack, user, pointed_thing)
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/50)
end
itemstack = "shooter:rocket_gun 1 "..itemstack:get_wear()
@ -85,7 +85,7 @@ minetest.register_tool("shooter:rocket_gun", {
local inv = user:get_inventory()
if inv:contains_item("main", "shooter:rocket") then
minetest.sound_play("shooter_reload", {object=user})
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
inv:remove_item("main", "shooter:rocket 1")
end
itemstack = "shooter:rocket_gun_loaded 1 "..itemstack:get_wear()
@ -111,4 +111,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
},
})
end

View file

@ -148,7 +148,7 @@ minetest.register_entity("shooter:turret_entity", {
return
end
minetest.sound_play("shooter_shotgun", {object=self.object})
if not minetest.setting_getbool("creative_mode") then
if not minetest.settings:get_bool("creative_mode") then
inv:remove_item("main", "tnt:tnt")
end
local pitch = math.rad(self.pitch - 40)
@ -263,4 +263,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
},
})
end

View file

@ -83,7 +83,7 @@ local h_max = 40 -- maximum chest spawning height, relative to water_level
local t_min = 4 -- minimum amount of treasures found in a chest
local t_max = 7 -- maximum amount of treasures found in a chest
local water_level = tonumber(minetest.setting_get("water_level"))
local water_level = tonumber(minetest.settings:get("water_level"))
local get_node = minetest.get_node
local function findGroundLevel(pos, y_min, y_max)

View file

@ -4,8 +4,8 @@ vote = {
}
function vote.new_vote(creator, voteset)
local max_votes = tonumber(minetest.setting_get("vote.maximum_active")) or 1
local max_queue = tonumber(minetest.setting_get("vote.maximum_active")) or 0
local max_votes = tonumber(minetest.settings:get("vote.maximum_active")) or 1
local max_queue = tonumber(minetest.settings:get("vote.maximum_active")) or 0
if #vote.active < max_votes then
vote.start_vote(voteset)
@ -90,7 +90,7 @@ function vote.end_vote(voteset)
voteset:on_result(result, voteset.results)
end
local max_votes = tonumber(minetest.setting_get("vote.maximum_active")) or 1
local max_votes = tonumber(minetest.settings:get("vote.maximum_active")) or 1
if #vote.active < max_votes and #vote.queue > 0 then
local nextvote = table.remove(vote.queue, 1)
vote.start_vote(nextvote)
@ -308,7 +308,7 @@ minetest.register_chatcommand("abstain", {
end
})
local set = minetest.setting_get("vote.kick_vote")
local set = minetest.settings:get("vote.kick_vote")
if set == nil or minetest.is_yes(set) then
dofile(minetest.get_modpath("vote") .. "/vote_kick.lua")
end