Replace deprecated settings_* API methods
This commit is contained in:
parent
f2c864ac04
commit
904c47dea2
15 changed files with 29 additions and 33 deletions
|
@ -30,7 +30,7 @@ function chatplus.init()
|
||||||
end
|
end
|
||||||
|
|
||||||
function chatplus.setting(name)
|
function chatplus.setting(name)
|
||||||
local get = minetest.setting_get("chatplus_" .. name)
|
local get = minetest.settings:get("chatplus_" .. name)
|
||||||
if get then
|
if get then
|
||||||
return get
|
return get
|
||||||
elseif chatplus._defsettings[name]~= nil then
|
elseif chatplus._defsettings[name]~= nil then
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6f5bcd05d678811c86b6836786f97f3aafa67ffe
|
Subproject commit d341978b909b9fad5133c288e01930ffeaf9a9be
|
|
@ -310,7 +310,7 @@ function default.register_ores()
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local WATER_H = tonumber(minetest.setting_get("water_level"))
|
local WATER_H = tonumber(minetest.settings:get("water_level"))
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
|
@ -20,7 +20,7 @@ local function drop(pos, itemstack)
|
||||||
if obj then
|
if obj then
|
||||||
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
|
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
|
if minetest.is_yes(remi) then
|
||||||
obj:remove()
|
obj:remove()
|
||||||
end
|
end
|
||||||
|
|
|
@ -58,8 +58,8 @@ function gauges.add_HP_gauge(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If health_bars not defined or set to true
|
-- If health_bars not defined or set to true
|
||||||
if minetest.setting_getbool("health_bars") ~= false and
|
if minetest.settings:get_bool("health_bars") ~= false and
|
||||||
minetest.setting_getbool("enable_damage") then
|
minetest.settings:get_bool("enable_damage") then
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
minetest.after(2, gauges.add_HP_gauge, player:get_player_name())
|
minetest.after(2, gauges.add_HP_gauge, player:get_player_name())
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -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
|
if regen_interval <= 0 then
|
||||||
regen_interval = 6
|
regen_interval = 6
|
||||||
end
|
end
|
||||||
local regen_amount = tonumber(minetest.setting_get("regen_amount"))
|
local regen_amount = tonumber(minetest.settings:get("regen_amount"))
|
||||||
if regen_amount <= 0 then
|
if regen_amount <= 0 then
|
||||||
regen_amount = 1
|
regen_amount = 1
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,13 +27,13 @@ function table.random( t ) -- luacheck: ignore
|
||||||
end
|
end
|
||||||
|
|
||||||
function random_messages.initialize() --Set the interval in minetest.conf.
|
function random_messages.initialize() --Set the interval in minetest.conf.
|
||||||
minetest.setting_set("random_messages_interval",60)
|
minetest.settings:set("random_messages_interval",60)
|
||||||
minetest.setting_save();
|
minetest.settings:write();
|
||||||
return 60
|
return 60
|
||||||
end
|
end
|
||||||
|
|
||||||
function random_messages.set_interval() --Read the interval from minetest.conf and set it if it doesn't exist
|
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
|
end
|
||||||
|
|
||||||
function random_messages.check_params(name,func,params)
|
function random_messages.check_params(name,func,params)
|
||||||
|
|
|
@ -179,7 +179,7 @@ for _, color in pairs(dye_basecolors) do
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
minetest.sound_play("shooter_click", {object=user})
|
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)
|
itemstack:add_wear(65535/SHOOTER_CROSSBOW_USES)
|
||||||
end
|
end
|
||||||
itemstack = "shooter:crossbow 1 "..itemstack:get_wear()
|
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+)")
|
local color = string.match(stack:get_name(), "shooter:arrow_(%a+)")
|
||||||
if color then
|
if color then
|
||||||
minetest.sound_play("shooter_reload", {object=user})
|
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")
|
inv:remove_item("main", "shooter:arrow_"..color.." 1")
|
||||||
end
|
end
|
||||||
return "shooter:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
|
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
|
for _, color in pairs(dye_basecolors) do
|
||||||
if inv:contains_item("main", "shooter:arrow_"..color) then
|
if inv:contains_item("main", "shooter:arrow_"..color) then
|
||||||
minetest.sound_play("shooter_reload", {object=user})
|
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")
|
inv:remove_item("main", "shooter:arrow_"..color.." 1")
|
||||||
end
|
end
|
||||||
return "shooter:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
|
return "shooter:crossbow_loaded_"..color.." 1 "..itemstack:get_wear()
|
||||||
|
|
|
@ -104,7 +104,7 @@ minetest.register_tool("shooter:flaregun", {
|
||||||
minetest.sound_play("shooter_click", {object=user})
|
minetest.sound_play("shooter_click", {object=user})
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
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")
|
inv:remove_item("main", "shooter:flare 1")
|
||||||
itemstack:add_wear(65535/100)
|
itemstack:add_wear(65535/100)
|
||||||
end
|
end
|
||||||
|
@ -144,4 +144,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ local function throw_hook(itemstack, user, vel)
|
||||||
local dir = user:get_look_dir()
|
local dir = user:get_look_dir()
|
||||||
local yaw = user:get_look_yaw()
|
local yaw = user:get_look_yaw()
|
||||||
if pos and dir and yaw then
|
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)
|
itemstack:add_wear(65535/100)
|
||||||
end
|
end
|
||||||
pos.y = pos.y + 1.5
|
pos.y = pos.y + 1.5
|
||||||
|
@ -129,4 +129,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ minetest.register_tool("shooter:grenade", {
|
||||||
description = "Grenade",
|
description = "Grenade",
|
||||||
inventory_image = "shooter_hand_grenade.png",
|
inventory_image = "shooter_hand_grenade.png",
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
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 = ""
|
itemstack = ""
|
||||||
end
|
end
|
||||||
-- clarification for future readers: grenade can be used only if player points at nothing (line 47)
|
-- clarification for future readers: grenade can be used only if player points at nothing (line 47)
|
||||||
|
|
|
@ -46,7 +46,7 @@ minetest.register_tool("shooter:rocket_gun_loaded", {
|
||||||
inventory_image = "shooter_rocket_gun_loaded.png",
|
inventory_image = "shooter_rocket_gun_loaded.png",
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
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)
|
itemstack:add_wear(65535/50)
|
||||||
end
|
end
|
||||||
itemstack = "shooter:rocket_gun 1 "..itemstack:get_wear()
|
itemstack = "shooter:rocket_gun 1 "..itemstack:get_wear()
|
||||||
|
@ -85,7 +85,7 @@ minetest.register_tool("shooter:rocket_gun", {
|
||||||
local inv = user:get_inventory()
|
local inv = user:get_inventory()
|
||||||
if inv:contains_item("main", "shooter:rocket") then
|
if inv:contains_item("main", "shooter:rocket") then
|
||||||
minetest.sound_play("shooter_reload", {object=user})
|
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")
|
inv:remove_item("main", "shooter:rocket 1")
|
||||||
end
|
end
|
||||||
itemstack = "shooter:rocket_gun_loaded 1 "..itemstack:get_wear()
|
itemstack = "shooter:rocket_gun_loaded 1 "..itemstack:get_wear()
|
||||||
|
@ -111,4 +111,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ minetest.register_entity("shooter:turret_entity", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.sound_play("shooter_shotgun", {object=self.object})
|
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")
|
inv:remove_item("main", "tnt:tnt")
|
||||||
end
|
end
|
||||||
local pitch = math.rad(self.pitch - 40)
|
local pitch = math.rad(self.pitch - 40)
|
||||||
|
@ -263,4 +263,3 @@ if SHOOTER_ENABLE_CRAFTING == true then
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -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_min = 4 -- minimum amount of treasures found in a chest
|
||||||
local t_max = 7 -- maximum 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 get_node = minetest.get_node
|
||||||
|
|
||||||
local function findGroundLevel(pos, y_min, y_max)
|
local function findGroundLevel(pos, y_min, y_max)
|
||||||
|
|
|
@ -4,8 +4,8 @@ vote = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function vote.new_vote(creator, voteset)
|
function vote.new_vote(creator, voteset)
|
||||||
local max_votes = tonumber(minetest.setting_get("vote.maximum_active")) or 1
|
local max_votes = tonumber(minetest.settings:get("vote.maximum_active")) or 1
|
||||||
local max_queue = tonumber(minetest.setting_get("vote.maximum_active")) or 0
|
local max_queue = tonumber(minetest.settings:get("vote.maximum_active")) or 0
|
||||||
|
|
||||||
if #vote.active < max_votes then
|
if #vote.active < max_votes then
|
||||||
vote.start_vote(voteset)
|
vote.start_vote(voteset)
|
||||||
|
@ -90,7 +90,7 @@ function vote.end_vote(voteset)
|
||||||
voteset:on_result(result, voteset.results)
|
voteset:on_result(result, voteset.results)
|
||||||
end
|
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
|
if #vote.active < max_votes and #vote.queue > 0 then
|
||||||
local nextvote = table.remove(vote.queue, 1)
|
local nextvote = table.remove(vote.queue, 1)
|
||||||
vote.start_vote(nextvote)
|
vote.start_vote(nextvote)
|
||||||
|
@ -308,7 +308,7 @@ minetest.register_chatcommand("abstain", {
|
||||||
end
|
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
|
if set == nil or minetest.is_yes(set) then
|
||||||
dofile(minetest.get_modpath("vote") .. "/vote_kick.lua")
|
dofile(minetest.get_modpath("vote") .. "/vote_kick.lua")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue