Use new Minetest settings API syntax for most mods

This commit is contained in:
Wuzzy 2017-08-09 16:17:00 +02:00
parent 6fa426741e
commit e5a34367c9
41 changed files with 86 additions and 86 deletions

@ -92,7 +92,7 @@ end
-- Similar to minetest.rotate_node. -- Similar to minetest.rotate_node.
function mcl_util.rotate_axis(itemstack, placer, pointed_thing) function mcl_util.rotate_axis(itemstack, placer, pointed_thing)
mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing, mcl_util.rotate_axis_and_place(itemstack, placer, pointed_thing,
core.setting_getbool("creative_mode"), minetest.settings:get_bool("creative_mode"),
placer:get_player_control().sneak) placer:get_player_control().sneak)
return itemstack return itemstack
end end

@ -129,7 +129,7 @@ function boat.on_punch(self, puncher)
if not self._driver then if not self._driver then
self._removed = true self._removed = true
-- Drop boat as item on the ground after punching -- Drop boat as item on the ground after punching
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
minetest.add_item(self.object:getpos(), self._itemstring) minetest.add_item(self.object:getpos(), self._itemstring)
end end
self.object:remove() self.object:remove()
@ -302,7 +302,7 @@ for b=1, #boat_ids do
local boat = minetest.add_entity(pointed_thing.under, "mcl_boats:boat") local boat = minetest.add_entity(pointed_thing.under, "mcl_boats:boat")
boat:get_luaentity()._itemstring = itemstring boat:get_luaentity()._itemstring = itemstring
boat:set_properties({textures = { "mcl_boats_texture_"..images[b].."_boat.png" }}) boat:set_properties({textures = { "mcl_boats_texture_"..images[b].."_boat.png" }})
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

@ -12,7 +12,7 @@ item_drop_settings.drop_single_item = false --if true, the drop control dro
item_drop_settings.magnet_time = 0.75 -- how many seconds an item follows the player before giving up item_drop_settings.magnet_time = 0.75 -- how many seconds an item follows the player before giving up
local get_gravity = function() local get_gravity = function()
return tonumber(minetest.setting_get("movement_gravity")) or 9.81 return tonumber(minetest.settings:get("movement_gravity")) or 9.81
end end
local check_pickup_achievements = function(object, player) local check_pickup_achievements = function(object, player)
@ -54,7 +54,7 @@ end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
for _,player in ipairs(minetest.get_connected_players()) do for _,player in ipairs(minetest.get_connected_players()) do
if player:get_hp() > 0 or not minetest.setting_getbool("enable_damage") then if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
local pos = player:getpos() local pos = player:getpos()
local inv = player:get_inventory() local inv = player:get_inventory()
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z} local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
@ -203,8 +203,8 @@ local check_can_drop = function(node_name, tool_capabilities)
end end
function minetest.handle_node_drops(pos, drops, digger) function minetest.handle_node_drops(pos, drops, digger)
local doTileDrops = minetest.setting_getbool("mcl_doTileDrops") or true local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops") or true
if minetest.setting_getbool("creative_mode") or doTileDrops == false then if minetest.settings:get_bool("creative_mode") or doTileDrops == false then
return return
end end
@ -658,6 +658,6 @@ core.register_entity(":__builtin:item", {
-- Note: on_punch intentionally left out. The player should *not* be able to collect items by punching -- Note: on_punch intentionally left out. The player should *not* be able to collect items by punching
}) })
if minetest.setting_get("log_mods") then if minetest.settings:get_bool("log_mods") then
minetest.log("action", "mcl_item_entity loaded") minetest.log("action", "mcl_item_entity loaded")
end end

@ -188,7 +188,7 @@ minetest.register_chatcommand("toggledownfall", {
-- Configuration setting which allows user to disable ABM for weathers (if they use it). -- Configuration setting which allows user to disable ABM for weathers (if they use it).
-- Weather mods expected to be use this flag before registering ABM. -- Weather mods expected to be use this flag before registering ABM.
local weather_allow_abm = minetest.setting_getbool("weather_allow_abm") local weather_allow_abm = minetest.settings:get_bool("weather_allow_abm")
if weather_allow_abm ~= nil and weather_allow_abm == false then if weather_allow_abm ~= nil and weather_allow_abm == false then
weather.allow_abm = false weather.allow_abm = false
end end

@ -5,7 +5,7 @@ local craftguide, datas, mt = {}, {}, minetest
-- true: Only show recipes which include at least one of the items the player posesses -- true: Only show recipes which include at least one of the items the player posesses
-- false: Show all crafting recipes -- false: Show all crafting recipes
local progressive_mode = false local progressive_mode = false
if mt.setting_getbool("craftguide_progressive_mode") == true then if mt.settings:get_bool("craftguide_progressive_mode") == true then
progressive_mode = true progressive_mode = true
end end
local get_recipe = mt.get_craft_recipe local get_recipe = mt.get_craft_recipe

@ -114,7 +114,7 @@ local last_damages = { }
minetest.register_on_dieplayer(function(player) minetest.register_on_dieplayer(function(player)
-- Death message -- Death message
local message = minetest.setting_getbool("mcl_showDeathMessages") local message = minetest.settings:get_bool("mcl_showDeathMessages")
if message == nil then message = true end if message == nil then message = true end
if message then if message then
local name = player:get_player_name() local name = player:get_player_name()

@ -98,7 +98,7 @@ local function init(player)
local playername = player:get_player_name() local playername = player:get_player_name()
local inv = minetest.create_detached_inventory("creative_"..playername, { local inv = minetest.create_detached_inventory("creative_"..playername, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.setting_getbool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
return count return count
else else
return 0 return 0
@ -108,7 +108,7 @@ local function init(player)
return 0 return 0
end, end,
allow_take = function(inv, listname, index, stack, player) allow_take = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
return -1 return -1
else else
return 0 return 0
@ -121,7 +121,7 @@ end
-- Create the trash field -- Create the trash field
local trash = minetest.create_detached_inventory("trash", { local trash = minetest.create_detached_inventory("trash", {
allow_put = function(inv, listname, index, stack, player) allow_put = function(inv, listname, index, stack, player)
if minetest.setting_getbool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
return stack:get_count() return stack:get_count()
else else
return 0 return 0
@ -363,7 +363,7 @@ end
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
local page = nil local page = nil
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
return return
end end
if formname ~= "" or fields.quit == "true" then if formname ~= "" or fields.quit == "true" then
@ -479,7 +479,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end) end)
if minetest.setting_getbool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
-- Place infinite nodes, except for shulker boxes -- Place infinite nodes, except for shulker boxes
local group = minetest.get_item_group(itemstack:get_name(), "shulker_box") local group = minetest.get_item_group(itemstack:get_name(), "shulker_box")

@ -51,7 +51,7 @@ local function return_fields(player, name)
end end
local function set_inventory(player, armor_change_only) local function set_inventory(player, armor_change_only)
if minetest.setting_getbool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
if armor_change_only then if armor_change_only then
-- Stay on survival inventory plage if only the armor has been changed -- Stay on survival inventory plage if only the armor has been changed
mcl_inventory.set_creative_formspec(player, 0, 0, nil, nil, "inv") mcl_inventory.set_creative_formspec(player, 0, 0, nil, nil, "inv")
@ -124,7 +124,7 @@ end
minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.quit then if fields.quit then
return_fields(player,"craft") return_fields(player,"craft")
if not minetest.setting_getbool("creative_mode") and (formname == "" or formname == "main") then if not minetest.settings:get_bool("creative_mode") and (formname == "" or formname == "main") then
set_inventory(player) set_inventory(player)
end end
end end
@ -161,7 +161,7 @@ minetest.register_on_joinplayer(function(player)
end end
-- In Creative Mode, the initial inventory setup is handled in creative.lua -- In Creative Mode, the initial inventory setup is handled in creative.lua
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
set_inventory(player) set_inventory(player)
end end
@ -172,7 +172,7 @@ minetest.register_on_joinplayer(function(player)
return_fields(player, "craft") return_fields(player, "craft")
end) end)
if minetest.setting_getbool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
dofile(minetest.get_modpath("mcl_inventory").."/creative.lua") dofile(minetest.get_modpath("mcl_inventory").."/creative.lua")
end end

@ -118,12 +118,12 @@ local dispenserdef = {
-- Ignite air or fire -- Ignite air or fire
if dropnode.name == "air" then if dropnode.name == "air" then
minetest.add_node(droppos, {name="mcl_fire:fire"}) minetest.add_node(droppos, {name="mcl_fire:fire"})
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
stack:add_wear(65535/65) -- 65 uses stack:add_wear(65535/65) -- 65 uses
end end
elseif dropnode.name == "mcl_tnt:tnt" then elseif dropnode.name == "mcl_tnt:tnt" then
tnt.ignite(droppos) tnt.ignite(droppos)
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
stack:add_wear(65535/65) -- 65 uses stack:add_wear(65535/65) -- 65 uses
end end
end end

@ -103,7 +103,7 @@ end
local on_rightclick = function(pos, node, player, itemstack, pointed_thing) local on_rightclick = function(pos, node, player, itemstack, pointed_thing)
-- Only allow access in Creative Mode -- Only allow access in Creative Mode
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
return return
end end
@ -179,7 +179,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if index ~= nil and x ~= nil and y ~= nil and z ~= nil then if index ~= nil and x ~= nil and y ~= nil and z ~= nil then
local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)} local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
minetest.chat_send_player(player:get_player_name(), "Editing the command block has failed! You can only change the command block in Creative Mode!") minetest.chat_send_player(player:get_player_name(), "Editing the command block has failed! You can only change the command block in Creative Mode!")
return return
end end

@ -77,7 +77,7 @@ end
local drop_item = function(pos, node, meta) local drop_item = function(pos, node, meta)
if meta:get_string("item") ~= "" then if meta:get_string("item") ~= "" then
if node.name == "itemframes:frame" and not minetest.setting_getbool("creative_mode") then if node.name == "itemframes:frame" and not minetest.settings:get_bool("creative_mode") then
local item = ItemStack(minetest.deserialize(meta:get_string("itemdata"))) local item = ItemStack(minetest.deserialize(meta:get_string("itemdata")))
minetest.add_item(pos, item) minetest.add_item(pos, item)
end end
@ -120,7 +120,7 @@ minetest.register_node("itemframes:frame",{
-- itemdata holds the serialized itemstack in table form -- itemdata holds the serialized itemstack in table form
meta:set_string("itemdata", itemdata) meta:set_string("itemdata", itemdata)
update_item(pos,node) update_item(pos,node)
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
end end

@ -24,12 +24,12 @@ end
local beddesc = "Beds allow you to sleep at night and waste some time. Survival in this world does not demand sleep, but sleeping might have some other uses. " local beddesc = "Beds allow you to sleep at night and waste some time. Survival in this world does not demand sleep, but sleeping might have some other uses. "
local beduse = "Right-click on the bed to try to sleep in it. This only works when the sun sets or at night." local beduse = "Right-click on the bed to try to sleep in it. This only works when the sun sets or at night."
if minetest.setting_getbool("enable_bed_respawn") == false then if minetest.settings:get_bool("enable_bed_respawn") == false then
beddesc = beddesc .. "In local folklore, legends are told of other worlds where setting the start point for your next would be possible. But this world is not one of them. " beddesc = beddesc .. "In local folklore, legends are told of other worlds where setting the start point for your next would be possible. But this world is not one of them. "
else else
beddesc = beddesc .. "By sleeping in a bed, you set the starting point for your next life. " beddesc = beddesc .. "By sleeping in a bed, you set the starting point for your next life. "
end end
if minetest.setting_getbool("enable_bed_night_skip") == false then if minetest.settings:get_bool("enable_bed_night_skip") == false then
beddesc = beddesc .. "In this strange world, the time will not pass faster for you when you sleep." beddesc = beddesc .. "In this strange world, the time will not pass faster for you when you sleep."
else else
beddesc = beddesc .. "Going into bed seems to make time pass faster: The night will be skipped when you go sleep and you're alone in this world. If you're not alone, the night is skipped when all players in this world went to sleep." beddesc = beddesc .. "Going into bed seems to make time pass faster: The night will be skipped when you go sleep and you're alone in this world. If you're not alone, the night is skipped when all players in this world went to sleep."
@ -118,7 +118,7 @@ function mcl_beds.register_bed(name, def)
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir}) minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir}) minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

@ -1,7 +1,7 @@
local pi = math.pi local pi = math.pi
local player_in_bed = 0 local player_in_bed = 0
local is_sp = minetest.is_singleplayer() local is_sp = minetest.is_singleplayer()
local enable_respawn = minetest.setting_getbool("enable_bed_respawn") local enable_respawn = minetest.settings:get_bool("enable_bed_respawn")
if enable_respawn == nil then if enable_respawn == nil then
enable_respawn = true enable_respawn = true
end end
@ -22,7 +22,7 @@ local function get_look_yaw(pos)
end end
local function is_night_skip_enabled() local function is_night_skip_enabled()
local enable_night_skip = minetest.setting_getbool("enable_bed_night_skip") local enable_night_skip = minetest.settings:get_bool("enable_bed_night_skip")
if enable_night_skip == nil then if enable_night_skip == nil then
enable_night_skip = true enable_night_skip = true
end end

@ -77,7 +77,7 @@ function mcl_buckets.register_liquid(source, flowing, itemname, inventory_image,
local place_liquid = function(pos, node, source, flowing, fullness) local place_liquid = function(pos, node, source, flowing, fullness)
sound_place(source, pos) sound_place(source, pos)
if math.floor(fullness/128) == 1 or (not minetest.setting_getbool("liquid_finite")) then if math.floor(fullness/128) == 1 or (not minetest.settings:get_bool("liquid_finite")) then
minetest.add_node(pos, {name=source, param2=fullness}) minetest.add_node(pos, {name=source, param2=fullness})
return return
elseif node.name == flowing then elseif node.name == flowing then
@ -138,7 +138,7 @@ function mcl_buckets.register_liquid(source, flowing, itemname, inventory_image,
end end
-- Handle bucket item and inventory stuff -- Handle bucket item and inventory stuff
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
-- Add empty bucket and put it into inventory, if possible. -- Add empty bucket and put it into inventory, if possible.
-- Drop empty bucket otherwise. -- Drop empty bucket otherwise.
local new_bucket = ItemStack("mcl_buckets:bucket_empty") local new_bucket = ItemStack("mcl_buckets:bucket_empty")
@ -189,10 +189,10 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
liquiddef = mcl_buckets.liquids[nn] liquiddef = mcl_buckets.liquids[nn]
local new_bucket local new_bucket
if liquiddef ~= nil and liquiddef.itemname ~= nil and (nn == liquiddef.source or if liquiddef ~= nil and liquiddef.itemname ~= nil and (nn == liquiddef.source or
(nn == liquiddef.flowing and minetest.setting_getbool("liquid_finite"))) then (nn == liquiddef.flowing and minetest.settings:get_bool("liquid_finite"))) then
-- Fill bucket, but not in Creative Mode -- Fill bucket, but not in Creative Mode
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
new_bucket = ItemStack({name = liquiddef.itemname, metadata = tostring(node.param2)}) new_bucket = ItemStack({name = liquiddef.itemname, metadata = tostring(node.param2)})
end end
@ -206,7 +206,7 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
elseif nn == "mcl_cauldrons:cauldron_3" then elseif nn == "mcl_cauldrons:cauldron_3" then
-- Take water out of full cauldron -- Take water out of full cauldron
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"}) minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
new_bucket = ItemStack("mcl_buckets:bucket_water") new_bucket = ItemStack("mcl_buckets:bucket_water")
end end
sound_take("mcl_core:water_source", pointed_thing.under) sound_take("mcl_core:water_source", pointed_thing.under)
@ -224,7 +224,7 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
else else
minetest.add_item(user:getpos(), new_bucket) minetest.add_item(user:getpos(), new_bucket)
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

@ -629,7 +629,7 @@ for color, desc in pairs(boxtypes) do
local iinv_main = minetest.deserialize(imeta) local iinv_main = minetest.deserialize(imeta)
ninv:set_list("main", iinv_main) ninv:set_list("main", iinv_main)
ninv:set_size("main", 9*3) ninv:set_size("main", 9*3)
if minetest.setting_getbool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
if not ninv:is_empty("main") then if not ninv:is_empty("main") then
return nil return nil
else else
@ -651,7 +651,7 @@ for color, desc in pairs(boxtypes) do
local boxitem = ItemStack("mcl_chests:"..color.."_shulker_box") local boxitem = ItemStack("mcl_chests:"..color.."_shulker_box")
boxitem:set_metadata(data) boxitem:set_metadata(data)
if minetest.setting_getbool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
if not inv:is_empty("main") then if not inv:is_empty("main") then
minetest.add_item(pos, boxitem) minetest.add_item(pos, boxitem)
end end

@ -43,7 +43,7 @@ function mcl_cocoas.place(itemstack, placer, pointed_thing, plantname)
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}) minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0})
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end

@ -1,6 +1,6 @@
mcl_compass = {} mcl_compass = {}
local default_spawn_settings = minetest.setting_get("static_spawnpoint") local default_spawn_settings = minetest.settings:get("static_spawnpoint")
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
local players = minetest.get_connected_players() local players = minetest.get_connected_players()
@ -15,7 +15,7 @@ minetest.register_globalstep(function(dtime)
end end
if has_compass(player) then if has_compass(player) then
local spawn = {x=0,y=0,z=0} local spawn = {x=0,y=0,z=0}
local s = minetest.setting_get("static_spawnpoint") local s = minetest.settings:get("static_spawnpoint")
if s then if s then
local numbers = string.split(s, ",") local numbers = string.split(s, ",")
spawn.x = tonumber(numbers[1]) spawn.x = tonumber(numbers[1])

@ -200,7 +200,7 @@ minetest.register_on_dignode(function(pos, node)
local np={x=pos.x, y=pos.y+1, z=pos.z} local np={x=pos.x, y=pos.y+1, z=pos.z}
while minetest.get_node(np).name==timber_nodenames[i] do while minetest.get_node(np).name==timber_nodenames[i] do
minetest.remove_node(np) minetest.remove_node(np)
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
minetest.add_item(np, timber_nodenames[i]) minetest.add_item(np, timber_nodenames[i])
end end
np={x=np.x, y=np.y+1, z=np.z} np={x=np.x, y=np.y+1, z=np.z}

@ -135,7 +135,7 @@ function mcl_doors:register_door(name, def)
meta = minetest.get_meta(pt2) meta = minetest.get_meta(pt2)
meta:set_int("is_open", 0) meta:set_int("is_open", 0)
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

@ -282,7 +282,7 @@ minetest.register_craftitem("mcl_dye:white", {
end end
-- Use the bone meal on the ground -- Use the bone meal on the ground
if(mcl_dye.apply_bone_meal(pointed_thing) and not minetest.setting_getbool("creative_mode")) then if(mcl_dye.apply_bone_meal(pointed_thing) and not minetest.settings:get_bool("creative_mode")) then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

@ -42,7 +42,7 @@ minetest.register_tool("mcl_farming:hoe_wood", {
end end
if create_soil(pointed_thing.under, user:get_inventory()) then if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/60) itemstack:add_wear(65535/60)
end end
return itemstack return itemstack
@ -92,7 +92,7 @@ minetest.register_tool("mcl_farming:hoe_stone", {
end end
if create_soil(pointed_thing.under, user:get_inventory()) then if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/132) itemstack:add_wear(65535/132)
end end
return itemstack return itemstack
@ -137,7 +137,7 @@ minetest.register_tool("mcl_farming:hoe_iron", {
end end
if create_soil(pointed_thing.under, user:get_inventory()) then if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/251) itemstack:add_wear(65535/251)
end end
return itemstack return itemstack
@ -190,7 +190,7 @@ minetest.register_tool("mcl_farming:hoe_gold", {
end end
if create_soil(pointed_thing.under, user:get_inventory()) then if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/33) itemstack:add_wear(65535/33)
end end
return itemstack return itemstack
@ -244,7 +244,7 @@ minetest.register_tool("mcl_farming:hoe_diamond", {
end end
if create_soil(pointed_thing.under, user:get_inventory()) then if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/1562) itemstack:add_wear(65535/1562)
end end
return itemstack return itemstack

@ -89,7 +89,7 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname)
return return
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

@ -18,12 +18,12 @@ minetest.register_craftitem("mcl_fire:fire_charge", {
if pointed_thing.type == "node" then if pointed_thing.type == "node" then
if minetest.get_node(pointed_thing.under).name == "mcl_tnt:tnt" then if minetest.get_node(pointed_thing.under).name == "mcl_tnt:tnt" then
tnt.ignite(pointed_thing.under) tnt.ignite(pointed_thing.under)
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
else else
mcl_fire.set_fire(pointed_thing) mcl_fire.set_fire(pointed_thing)
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
end end

@ -34,7 +34,7 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=user:getpos(), gain=0.5}) minetest.sound_play(idef.sound.breaks, {pos=user:getpos(), gain=0.5})
end end
if not minetest.setting_getbool("creative_mode") and used == true then if not minetest.settings:get_bool("creative_mode") and used == true then
itemstack:add_wear(65535/65) -- 65 uses itemstack:add_wear(65535/65) -- 65 uses
end end
return itemstack return itemstack

@ -156,7 +156,7 @@ minetest.override_item("mcl_core:lava_source", {
-- Sound -- Sound
-- --
local flame_sound = minetest.setting_getbool("flame_sound") local flame_sound = minetest.settings:get_bool("flame_sound")
if flame_sound == nil then if flame_sound == nil then
-- Enable if no setting present -- Enable if no setting present
flame_sound = true flame_sound = true
@ -292,11 +292,11 @@ minetest.register_abm({
-- Enable the following ABMs according to 'enable fire' setting -- Enable the following ABMs according to 'enable fire' setting
local fire_enabled = minetest.setting_getbool("enable_fire") local fire_enabled = minetest.settings:get_bool("enable_fire")
if fire_enabled == nil then if fire_enabled == nil then
-- New setting not specified, check for old setting. -- New setting not specified, check for old setting.
-- If old setting is also not specified, 'not nil' is true. -- If old setting is also not specified, 'not nil' is true.
fire_enabled = not minetest.setting_getbool("disable_fire") fire_enabled = not minetest.settings:get_bool("disable_fire")
end end
if not fire_enabled then if not fire_enabled then

@ -68,7 +68,7 @@ local go_fishing = function(itemstack, user, pointed_thing)
if inv:room_for_item("main", item) then if inv:room_for_item("main", item) then
inv:add_item("main", item) inv:add_item("main", item)
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
local idef = itemstack:get_definition() local idef = itemstack:get_definition()
itemstack:add_wear(65535/65) -- 65 uses itemstack:add_wear(65535/65) -- 65 uses
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then

@ -59,7 +59,7 @@ minetest.register_node("mcl_flowerpots:flower_pot", {
local flower_node = row[2] local flower_node = row[2]
if item == flower_node then if item == flower_node then
minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower}) minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower})
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
end end
@ -69,7 +69,7 @@ minetest.register_node("mcl_flowerpots:flower_pot", {
local flower_node = row[2] local flower_node = row[2]
if item == flower_node then if item == flower_node then
minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower}) minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower})
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
end end

@ -219,7 +219,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
minetest.sound_play(minetest.registered_nodes["mcl_flowers:"..name].sounds.place, {pos = bottom, gain=1}) minetest.sound_play(minetest.registered_nodes["mcl_flowers:"..name].sounds.place, {pos = bottom, gain=1})
minetest.set_node(bottom, {name="mcl_flowers:"..name}) minetest.set_node(bottom, {name="mcl_flowers:"..name})
minetest.set_node(top, {name="mcl_flowers:"..name.."_top"}) minetest.set_node(top, {name="mcl_flowers:"..name.."_top"})
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
end end
@ -359,7 +359,7 @@ minetest.register_node("mcl_flowers:waterlily", {
minetest.sound_play(idef.sounds.place, {pos=above, gain=1}) minetest.sound_play(idef.sounds.place, {pos=above, gain=1})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
else else

@ -97,7 +97,7 @@ Hoppers interact with containers the following way:
else else
minetest.set_node(bpos, {name="mcl_hoppers:hopper", param2=0}) minetest.set_node(bpos, {name="mcl_hoppers:hopper", param2=0})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

@ -6,7 +6,7 @@ local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP .. "/intllib.lua") local S, NS = dofile(MP .. "/intllib.lua")
local spawn_silverfish = function(pos, oldnode, oldmetadata, digger) local spawn_silverfish = function(pos, oldnode, oldmetadata, digger)
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
minetest.add_entity(pos, "mobs_mc:silverfish") minetest.add_entity(pos, "mobs_mc:silverfish")
end end
end end

@ -117,7 +117,7 @@ minetest.register_craftitem("mcl_nether:nether_wart_item", {
minetest.sound_play({name="default_place_node", gain=1.0}, {pos=placepos}) minetest.sound_play({name="default_place_node", gain=1.0}, {pos=placepos})
minetest.set_node(placepos, {name="mcl_nether:nether_wart_0", param2 = 3}) minetest.set_node(placepos, {name="mcl_nether:nether_wart_0", param2 = 3})
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

@ -350,7 +350,7 @@ minetest.register_node("mcl_signs:wall_sign", {
text_entity:setyaw(sign_info.yaw) text_entity:setyaw(sign_info.yaw)
text_entity:get_luaentity()._signnodename = nodeitem:get_name() text_entity:get_luaentity()._signnodename = nodeitem:get_name()
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}) minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos})
@ -476,6 +476,6 @@ minetest.register_alias("signs:sign_wall", "mcl_signs:wall_sign")
minetest.register_alias("signs:sign_yard", "mcl_signs:standing_sign") minetest.register_alias("signs:sign_yard", "mcl_signs:standing_sign")
if minetest.setting_get("log_mods") then if minetest.settings:get_bool("log_mods") then
minetest.log("action", "[mcl_signs] loaded") minetest.log("action", "[mcl_signs] loaded")
end end

@ -61,7 +61,7 @@ minetest.register_node("mcl_sponges:sponge", {
-- FIXME: pos is not always the right placement position because of pointed_thing -- FIXME: pos is not always the right placement position because of pointed_thing
if absorb(pos) then if absorb(pos) then
minetest.item_place_node(ItemStack("mcl_sponges:sponge_wet"), placer, pointed_thing) minetest.item_place_node(ItemStack("mcl_sponges:sponge_wet"), placer, pointed_thing)
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack

@ -165,7 +165,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local under = minetest.get_node(pointed_thing.under) local under = minetest.get_node(pointed_thing.under)
local wield_item = itemstack:get_name() local wield_item = itemstack:get_name()
local creative_enabled = minetest.setting_getbool("creative_mode") local creative_enabled = minetest.settings:get_bool("creative_mode")
-- place slab using under node orientation -- place slab using under node orientation
local dir = vector.subtract(pointed_thing.above, pointed_thing.under) local dir = vector.subtract(pointed_thing.above, pointed_thing.under)

@ -117,7 +117,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
if self._lastpos.x~=nil then if self._lastpos.x~=nil then
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if (def and def.walkable) or not def then if (def and def.walkable) or not def then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
minetest.add_item(self._lastpos, 'mcl_throwing:arrow') minetest.add_item(self._lastpos, 'mcl_throwing:arrow')
end end
self.object:remove() self.object:remove()

@ -53,7 +53,7 @@ end
local player_shoot_arrow = function(itemstack, player, power, damage) local player_shoot_arrow = function(itemstack, player, power, damage)
local arrow_stack, arrow_stack_id = get_arrow(player) local arrow_stack, arrow_stack_id = get_arrow(player)
local arrow_itemstring local arrow_itemstring
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
if not arrow_stack then if not arrow_stack then
return false return false
end end
@ -86,7 +86,7 @@ local powerup_function = function(nextbow)
end end
-- Check for arrow or Creative Mode -- Check for arrow or Creative Mode
if minetest.setting_getbool("creative_mode") or get_arrow(placer) ~= nil then if minetest.settings:get_bool("creative_mode") or get_arrow(placer) ~= nil then
local wear = itemstack:get_wear() local wear = itemstack:get_wear()
itemstack:replace(nextbow) itemstack:replace(nextbow)
itemstack:set_wear(wear) itemstack:set_wear(wear)
@ -131,7 +131,7 @@ minetest.register_tool("mcl_throwing:bow_0", {
itemstack:replace("mcl_throwing:bow") itemstack:replace("mcl_throwing:bow")
itemstack:set_wear(wear) itemstack:set_wear(wear)
if player_shoot_arrow(itemstack, user, 4, 1) then if player_shoot_arrow(itemstack, user, 4, 1) then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/bow_durability) itemstack:add_wear(65535/bow_durability)
end end
end end
@ -153,7 +153,7 @@ minetest.register_tool("mcl_throwing:bow_1", {
itemstack:replace("mcl_throwing:bow") itemstack:replace("mcl_throwing:bow")
itemstack:set_wear(wear) itemstack:set_wear(wear)
if player_shoot_arrow(itemstack, user, 16, 2) then if player_shoot_arrow(itemstack, user, 16, 2) then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/bow_durability) itemstack:add_wear(65535/bow_durability)
end end
end end
@ -183,7 +183,7 @@ minetest.register_tool("mcl_throwing:bow_2", {
damage = 4 damage = 4
end end
if player_shoot_arrow(itemstack, user, 26, damage) then if player_shoot_arrow(itemstack, user, 26, damage) then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/bow_durability) itemstack:add_wear(65535/bow_durability)
end end
end end

@ -2,7 +2,7 @@
-- Snowballs and other throwable items -- Snowballs and other throwable items
-- --
local GRAVITY = tonumber(minetest.setting_get("movement_gravity")) local GRAVITY = tonumber(minetest.settings:get("movement_gravity"))
local entity_mapping = { local entity_mapping = {
["mcl_throwing:snowball"] = "mcl_throwing:snowball_entity", ["mcl_throwing:snowball"] = "mcl_throwing:snowball_entity",
@ -38,7 +38,7 @@ local throw_function = function(entity_name, velocity)
local dir = player:get_look_dir() local dir = player:get_look_dir()
local obj = mcl_throwing.throw(item, {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, velocity) local obj = mcl_throwing.throw(item, {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, velocity)
obj:get_luaentity()._thrower = player:get_player_name() obj:get_luaentity()._thrower = player:get_player_name()
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
item:take_item() item:take_item()
end end
return item return item

@ -17,7 +17,7 @@
-- The hand -- The hand
local groupcaps local groupcaps
if minetest.setting_getbool("creative_mode") then if minetest.settings:get_bool("creative_mode") then
-- Instant breaking in creative mode -- Instant breaking in creative mode
groupcaps = { groupcaps = {
creative_breakable = {times={[1]=0}, uses=0}, creative_breakable = {times={[1]=0}, uses=0},
@ -174,7 +174,7 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
local above = table.copy(pointed_thing.under) local above = table.copy(pointed_thing.under)
above.y = above.y + 1 above.y = above.y + 1
if minetest.get_node(above).name == "air" then if minetest.get_node(above).name == "air" then
if not minetest.setting_getbool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
-- Add wear, as if digging a level 0 shovely node -- Add wear, as if digging a level 0 shovely node
local toolname = itemstack:get_name() local toolname = itemstack:get_name()
local def = minetest.registered_items[toolname] local def = minetest.registered_items[toolname]

@ -1,13 +1,13 @@
local time = 0 local time = 0
local update_time = tonumber(minetest.setting_get("wieldview_update_time")) local update_time = tonumber(minetest.settings:get("wieldview_update_time"))
if not update_time then if not update_time then
update_time = 2 update_time = 2
minetest.setting_set("wieldview_update_time", tostring(update_time)) minetest.settings:set("wieldview_update_time", tostring(update_time))
end end
local node_tiles = minetest.setting_getbool("wieldview_node_tiles") local node_tiles = minetest.settings:get_bool("wieldview_node_tiles")
if not node_tiles then if not node_tiles then
node_tiles = false node_tiles = false
minetest.setting_set("wieldview_node_tiles", "false") minetest.settings:set("wieldview_node_tiles", "false")
end end
wieldview = { wieldview = {

@ -1,5 +1,5 @@
minetest.register_on_dieplayer(function(player) minetest.register_on_dieplayer(function(player)
local keep = minetest.setting_getbool("mcl_keepInventory") or false local keep = minetest.settings:get_bool("mcl_keepInventory") or false
if keep == false then if keep == false then
-- Drop inventory, crafting grid and armor -- Drop inventory, crafting grid and armor
local inv = player:get_inventory() local inv = player:get_inventory()

@ -26,13 +26,13 @@ mcl_hunger.SATURATION_INIT = 5 -- Initial saturation for new/respawning players
mcl_hunger.active = false mcl_hunger.active = false
if minetest.setting_getbool("enable_damage") then if minetest.settings:get_bool("enable_damage") then
mcl_hunger.active = true mcl_hunger.active = true
-- Debug Mode. If enabled, saturation and exhaustion are shown as well. -- Debug Mode. If enabled, saturation and exhaustion are shown as well.
-- NOTE: Read-only. The setting should only be read at the beginning, this mod is not -- NOTE: Read-only. The setting should only be read at the beginning, this mod is not
-- prepared to change this setting later. -- prepared to change this setting later.
mcl_hunger.debug = minetest.setting_getbool("mcl_hunger_debug") mcl_hunger.debug = minetest.settings:get_bool("mcl_hunger_debug")
if mcl_hunger.debug == nil then if mcl_hunger.debug == nil then
mcl_hunger.debug = false mcl_hunger.debug = false
end end