From e5a34367c92a1ac9b8b7208f4eef3bed413886dc Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 9 Aug 2017 16:17:00 +0200 Subject: [PATCH] Use new Minetest settings API syntax for most mods --- mods/CORE/mcl_util/init.lua | 2 +- mods/ENTITIES/mcl_boats/init.lua | 4 ++-- mods/ENTITIES/mcl_item_entity/init.lua | 10 +++++----- mods/ENVIRONMENT/weather_pack/weather_core.lua | 2 +- mods/HELP/mcl_craftguide/init.lua | 2 +- mods/HUD/mcl_death_messages/init.lua | 2 +- mods/HUD/mcl_inventory/creative.lua | 10 +++++----- mods/HUD/mcl_inventory/init.lua | 8 ++++---- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 4 ++-- mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua | 4 ++-- mods/ITEMS/itemframes/init.lua | 4 ++-- mods/ITEMS/mcl_beds/api.lua | 6 +++--- mods/ITEMS/mcl_beds/functions.lua | 4 ++-- mods/ITEMS/mcl_buckets/init.lua | 12 ++++++------ mods/ITEMS/mcl_chests/init.lua | 4 ++-- mods/ITEMS/mcl_cocoas/init.lua | 2 +- mods/ITEMS/mcl_compass/init.lua | 4 ++-- mods/ITEMS/mcl_core/functions.lua | 2 +- mods/ITEMS/mcl_doors/api_doors.lua | 2 +- mods/ITEMS/mcl_dye/init.lua | 2 +- mods/ITEMS/mcl_farming/hoes.lua | 10 +++++----- mods/ITEMS/mcl_farming/shared_functions.lua | 2 +- mods/ITEMS/mcl_fire/fire_charge.lua | 4 ++-- mods/ITEMS/mcl_fire/flint_and_steel.lua | 2 +- mods/ITEMS/mcl_fire/init.lua | 6 +++--- mods/ITEMS/mcl_fishing/init.lua | 2 +- mods/ITEMS/mcl_flowerpots/nodes.lua | 4 ++-- mods/ITEMS/mcl_flowers/init.lua | 4 ++-- mods/ITEMS/mcl_hoppers/init.lua | 2 +- mods/ITEMS/mcl_monster_eggs/init.lua | 2 +- mods/ITEMS/mcl_nether/nether_wart.lua | 2 +- mods/ITEMS/mcl_signs/init.lua | 4 ++-- mods/ITEMS/mcl_sponges/init.lua | 2 +- mods/ITEMS/mcl_stairs/api.lua | 2 +- mods/ITEMS/mcl_throwing/arrow.lua | 2 +- mods/ITEMS/mcl_throwing/init.lua | 10 +++++----- mods/ITEMS/mcl_throwing/throwable.lua | 4 ++-- mods/ITEMS/mcl_tools/init.lua | 4 ++-- mods/ITEMS/minetest-3d_armor/wieldview/init.lua | 8 ++++---- mods/PLAYER/mcl_death_drop/init.lua | 2 +- mods/PLAYER/mcl_hunger/init.lua | 4 ++-- 41 files changed, 86 insertions(+), 86 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index e274da65f..2da93dd7d 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -92,7 +92,7 @@ end -- Similar to minetest.rotate_node. function mcl_util.rotate_axis(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) return itemstack end diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index 0cc0a5aa2..e03beac87 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -129,7 +129,7 @@ function boat.on_punch(self, puncher) if not self._driver then self._removed = true -- 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) end self.object:remove() @@ -302,7 +302,7 @@ for b=1, #boat_ids do local boat = minetest.add_entity(pointed_thing.under, "mcl_boats:boat") boat:get_luaentity()._itemstring = itemstring 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() end return itemstack diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index f4205ff3c..75c914f1f 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -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 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 local check_pickup_achievements = function(object, player) @@ -54,7 +54,7 @@ end minetest.register_globalstep(function(dtime) 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 inv = player:get_inventory() 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 function minetest.handle_node_drops(pos, drops, digger) - local doTileDrops = minetest.setting_getbool("mcl_doTileDrops") or true - if minetest.setting_getbool("creative_mode") or doTileDrops == false then + local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops") or true + if minetest.settings:get_bool("creative_mode") or doTileDrops == false then return 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 }) -if minetest.setting_get("log_mods") then +if minetest.settings:get_bool("log_mods") then minetest.log("action", "mcl_item_entity loaded") end diff --git a/mods/ENVIRONMENT/weather_pack/weather_core.lua b/mods/ENVIRONMENT/weather_pack/weather_core.lua index fabd56b7c..912cf1c03 100644 --- a/mods/ENVIRONMENT/weather_pack/weather_core.lua +++ b/mods/ENVIRONMENT/weather_pack/weather_core.lua @@ -188,7 +188,7 @@ minetest.register_chatcommand("toggledownfall", { -- 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. -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 weather.allow_abm = false end diff --git a/mods/HELP/mcl_craftguide/init.lua b/mods/HELP/mcl_craftguide/init.lua index 924ee608b..4b60d69d5 100644 --- a/mods/HELP/mcl_craftguide/init.lua +++ b/mods/HELP/mcl_craftguide/init.lua @@ -5,7 +5,7 @@ local craftguide, datas, mt = {}, {}, minetest -- true: Only show recipes which include at least one of the items the player posesses -- false: Show all crafting recipes 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 end local get_recipe = mt.get_craft_recipe diff --git a/mods/HUD/mcl_death_messages/init.lua b/mods/HUD/mcl_death_messages/init.lua index db37805bf..f351983c8 100644 --- a/mods/HUD/mcl_death_messages/init.lua +++ b/mods/HUD/mcl_death_messages/init.lua @@ -114,7 +114,7 @@ local last_damages = { } minetest.register_on_dieplayer(function(player) -- 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 then local name = player:get_player_name() diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 536d44ccb..89ae703e6 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -98,7 +98,7 @@ local function init(player) local playername = player:get_player_name() local inv = minetest.create_detached_inventory("creative_"..playername, { 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 else return 0 @@ -108,7 +108,7 @@ local function init(player) return 0 end, 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 else return 0 @@ -121,7 +121,7 @@ end -- Create the trash field local trash = minetest.create_detached_inventory("trash", { 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() else return 0 @@ -363,7 +363,7 @@ end minetest.register_on_player_receive_fields(function(player, formname, fields) local page = nil - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then return end if formname ~= "" or fields.quit == "true" then @@ -479,7 +479,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) 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) -- Place infinite nodes, except for shulker boxes local group = minetest.get_item_group(itemstack:get_name(), "shulker_box") diff --git a/mods/HUD/mcl_inventory/init.lua b/mods/HUD/mcl_inventory/init.lua index c059f3c1e..820536d5f 100644 --- a/mods/HUD/mcl_inventory/init.lua +++ b/mods/HUD/mcl_inventory/init.lua @@ -51,7 +51,7 @@ local function return_fields(player, name) end 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 -- Stay on survival inventory plage if only the armor has been changed 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) if fields.quit then 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) end end @@ -161,7 +161,7 @@ minetest.register_on_joinplayer(function(player) end -- 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) end @@ -172,7 +172,7 @@ minetest.register_on_joinplayer(function(player) return_fields(player, "craft") end) -if minetest.setting_getbool("creative_mode") then +if minetest.settings:get_bool("creative_mode") then dofile(minetest.get_modpath("mcl_inventory").."/creative.lua") end diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index b6287b985..7ac456405 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -118,12 +118,12 @@ local dispenserdef = { -- Ignite air or fire if dropnode.name == "air" then 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 end elseif dropnode.name == "mcl_tnt:tnt" then 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 end end diff --git a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua index 58ca20f9b..3bd14ba47 100644 --- a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua @@ -103,7 +103,7 @@ end local on_rightclick = function(pos, node, player, itemstack, pointed_thing) -- Only allow access in Creative Mode - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then return 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 local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)} 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!") return end diff --git a/mods/ITEMS/itemframes/init.lua b/mods/ITEMS/itemframes/init.lua index 036420511..24774963a 100644 --- a/mods/ITEMS/itemframes/init.lua +++ b/mods/ITEMS/itemframes/init.lua @@ -77,7 +77,7 @@ end local drop_item = function(pos, node, meta) 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"))) minetest.add_item(pos, item) end @@ -120,7 +120,7 @@ minetest.register_node("itemframes:frame",{ -- itemdata holds the serialized itemstack in table form meta:set_string("itemdata", itemdata) update_item(pos,node) - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end end diff --git a/mods/ITEMS/mcl_beds/api.lua b/mods/ITEMS/mcl_beds/api.lua index 944a259c0..958c983db 100644 --- a/mods/ITEMS/mcl_beds/api.lua +++ b/mods/ITEMS/mcl_beds/api.lua @@ -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 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. " else beddesc = beddesc .. "By sleeping in a bed, you set the starting point for your next life. " 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." 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." @@ -118,7 +118,7 @@ function mcl_beds.register_bed(name, def) minetest.set_node(pos, {name = name .. "_bottom", 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() end return itemstack diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index 5f79ba43f..cbb2c3c09 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -1,7 +1,7 @@ local pi = math.pi local player_in_bed = 0 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 enable_respawn = true end @@ -22,7 +22,7 @@ local function get_look_yaw(pos) end 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 enable_night_skip = true end diff --git a/mods/ITEMS/mcl_buckets/init.lua b/mods/ITEMS/mcl_buckets/init.lua index 4f7e6a82b..fe3ee332d 100644 --- a/mods/ITEMS/mcl_buckets/init.lua +++ b/mods/ITEMS/mcl_buckets/init.lua @@ -77,7 +77,7 @@ function mcl_buckets.register_liquid(source, flowing, itemname, inventory_image, local place_liquid = function(pos, node, source, flowing, fullness) 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}) return elseif node.name == flowing then @@ -138,7 +138,7 @@ function mcl_buckets.register_liquid(source, flowing, itemname, inventory_image, end -- 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. -- Drop empty bucket otherwise. local new_bucket = ItemStack("mcl_buckets:bucket_empty") @@ -189,10 +189,10 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", { liquiddef = mcl_buckets.liquids[nn] local new_bucket 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 - 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)}) end @@ -206,7 +206,7 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", { elseif nn == "mcl_cauldrons:cauldron_3" then -- Take water out of full 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") end sound_take("mcl_core:water_source", pointed_thing.under) @@ -224,7 +224,7 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", { else minetest.add_item(user:getpos(), new_bucket) end - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end return itemstack diff --git a/mods/ITEMS/mcl_chests/init.lua b/mods/ITEMS/mcl_chests/init.lua index 00df97d88..99779182b 100644 --- a/mods/ITEMS/mcl_chests/init.lua +++ b/mods/ITEMS/mcl_chests/init.lua @@ -629,7 +629,7 @@ for color, desc in pairs(boxtypes) do local iinv_main = minetest.deserialize(imeta) ninv:set_list("main", iinv_main) 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 return nil else @@ -651,7 +651,7 @@ for color, desc in pairs(boxtypes) do local boxitem = ItemStack("mcl_chests:"..color.."_shulker_box") 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 minetest.add_item(pos, boxitem) end diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index 0a3160bbf..463cf8fdb 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -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}) - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end diff --git a/mods/ITEMS/mcl_compass/init.lua b/mods/ITEMS/mcl_compass/init.lua index 2106062d1..b033c2b47 100644 --- a/mods/ITEMS/mcl_compass/init.lua +++ b/mods/ITEMS/mcl_compass/init.lua @@ -1,6 +1,6 @@ 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) local players = minetest.get_connected_players() @@ -15,7 +15,7 @@ minetest.register_globalstep(function(dtime) end if has_compass(player) then 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 local numbers = string.split(s, ",") spawn.x = tonumber(numbers[1]) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 3d7550554..5a181069b 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -200,7 +200,7 @@ minetest.register_on_dignode(function(pos, node) local np={x=pos.x, y=pos.y+1, z=pos.z} while minetest.get_node(np).name==timber_nodenames[i] do 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]) end np={x=np.x, y=np.y+1, z=np.z} diff --git a/mods/ITEMS/mcl_doors/api_doors.lua b/mods/ITEMS/mcl_doors/api_doors.lua index 32d2aaccd..7605aea1e 100644 --- a/mods/ITEMS/mcl_doors/api_doors.lua +++ b/mods/ITEMS/mcl_doors/api_doors.lua @@ -135,7 +135,7 @@ function mcl_doors:register_door(name, def) meta = minetest.get_meta(pt2) 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() end return itemstack diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index fa173dac5..68219d7d0 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -282,7 +282,7 @@ minetest.register_craftitem("mcl_dye:white", { end -- 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() end return itemstack diff --git a/mods/ITEMS/mcl_farming/hoes.lua b/mods/ITEMS/mcl_farming/hoes.lua index 608583ba0..aad4ed7c5 100644 --- a/mods/ITEMS/mcl_farming/hoes.lua +++ b/mods/ITEMS/mcl_farming/hoes.lua @@ -42,7 +42,7 @@ minetest.register_tool("mcl_farming:hoe_wood", { end 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) end return itemstack @@ -92,7 +92,7 @@ minetest.register_tool("mcl_farming:hoe_stone", { end 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) end return itemstack @@ -137,7 +137,7 @@ minetest.register_tool("mcl_farming:hoe_iron", { end 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) end return itemstack @@ -190,7 +190,7 @@ minetest.register_tool("mcl_farming:hoe_gold", { end 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) end return itemstack @@ -244,7 +244,7 @@ minetest.register_tool("mcl_farming:hoe_diamond", { end 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) end return itemstack diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 5debb5ef8..486f93593 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -89,7 +89,7 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname) return end - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end return itemstack diff --git a/mods/ITEMS/mcl_fire/fire_charge.lua b/mods/ITEMS/mcl_fire/fire_charge.lua index 32e509b38..dc3af8dd0 100644 --- a/mods/ITEMS/mcl_fire/fire_charge.lua +++ b/mods/ITEMS/mcl_fire/fire_charge.lua @@ -18,12 +18,12 @@ minetest.register_craftitem("mcl_fire:fire_charge", { if pointed_thing.type == "node" then if minetest.get_node(pointed_thing.under).name == "mcl_tnt:tnt" then 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() end else 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() end end diff --git a/mods/ITEMS/mcl_fire/flint_and_steel.lua b/mods/ITEMS/mcl_fire/flint_and_steel.lua index 51fd7311e..8902c1604 100644 --- a/mods/ITEMS/mcl_fire/flint_and_steel.lua +++ b/mods/ITEMS/mcl_fire/flint_and_steel.lua @@ -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 minetest.sound_play(idef.sound.breaks, {pos=user:getpos(), gain=0.5}) 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 end return itemstack diff --git a/mods/ITEMS/mcl_fire/init.lua b/mods/ITEMS/mcl_fire/init.lua index 50728b661..7c542c73e 100644 --- a/mods/ITEMS/mcl_fire/init.lua +++ b/mods/ITEMS/mcl_fire/init.lua @@ -156,7 +156,7 @@ minetest.override_item("mcl_core:lava_source", { -- Sound -- -local flame_sound = minetest.setting_getbool("flame_sound") +local flame_sound = minetest.settings:get_bool("flame_sound") if flame_sound == nil then -- Enable if no setting present flame_sound = true @@ -292,11 +292,11 @@ minetest.register_abm({ -- 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 -- New setting not specified, check for old setting. -- 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 if not fire_enabled then diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 5b52b03d6..09c56c151 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -68,7 +68,7 @@ local go_fishing = function(itemstack, user, pointed_thing) if inv:room_for_item("main", item) then inv:add_item("main", item) end - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then local idef = itemstack:get_definition() itemstack:add_wear(65535/65) -- 65 uses if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then diff --git a/mods/ITEMS/mcl_flowerpots/nodes.lua b/mods/ITEMS/mcl_flowerpots/nodes.lua index 57074b29b..1e47ceb54 100644 --- a/mods/ITEMS/mcl_flowerpots/nodes.lua +++ b/mods/ITEMS/mcl_flowerpots/nodes.lua @@ -59,7 +59,7 @@ minetest.register_node("mcl_flowerpots:flower_pot", { local flower_node = row[2] if item == flower_node then 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() end end @@ -69,7 +69,7 @@ minetest.register_node("mcl_flowerpots:flower_pot", { local flower_node = row[2] if item == flower_node then 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() end end diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index 99cc1fe83..42af35376 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -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.set_node(bottom, {name="mcl_flowers:"..name}) 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() end end @@ -359,7 +359,7 @@ minetest.register_node("mcl_flowers:waterlily", { minetest.sound_play(idef.sounds.place, {pos=above, gain=1}) end - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end else diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index cd2546ae9..5a3188b64 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -97,7 +97,7 @@ Hoppers interact with containers the following way: else minetest.set_node(bpos, {name="mcl_hoppers:hopper", param2=0}) end - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then itemstack:take_item() end return itemstack diff --git a/mods/ITEMS/mcl_monster_eggs/init.lua b/mods/ITEMS/mcl_monster_eggs/init.lua index 5d892ae35..417c01309 100644 --- a/mods/ITEMS/mcl_monster_eggs/init.lua +++ b/mods/ITEMS/mcl_monster_eggs/init.lua @@ -6,7 +6,7 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP .. "/intllib.lua") 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") end end diff --git a/mods/ITEMS/mcl_nether/nether_wart.lua b/mods/ITEMS/mcl_nether/nether_wart.lua index a4d46bc2b..705fd059a 100644 --- a/mods/ITEMS/mcl_nether/nether_wart.lua +++ b/mods/ITEMS/mcl_nether/nether_wart.lua @@ -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.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() end return itemstack diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index a969d24c3..c4bcec3e0 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -350,7 +350,7 @@ minetest.register_node("mcl_signs:wall_sign", { text_entity:setyaw(sign_info.yaw) 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() end 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") -if minetest.setting_get("log_mods") then +if minetest.settings:get_bool("log_mods") then minetest.log("action", "[mcl_signs] loaded") end diff --git a/mods/ITEMS/mcl_sponges/init.lua b/mods/ITEMS/mcl_sponges/init.lua index 4130a7fb2..841aae6a1 100644 --- a/mods/ITEMS/mcl_sponges/init.lua +++ b/mods/ITEMS/mcl_sponges/init.lua @@ -61,7 +61,7 @@ minetest.register_node("mcl_sponges:sponge", { -- FIXME: pos is not always the right placement position because of pointed_thing if absorb(pos) then 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() end return itemstack diff --git a/mods/ITEMS/mcl_stairs/api.lua b/mods/ITEMS/mcl_stairs/api.lua index 349ce8139..77a0e2259 100644 --- a/mods/ITEMS/mcl_stairs/api.lua +++ b/mods/ITEMS/mcl_stairs/api.lua @@ -165,7 +165,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti on_place = function(itemstack, placer, pointed_thing) local under = minetest.get_node(pointed_thing.under) 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 local dir = vector.subtract(pointed_thing.above, pointed_thing.under) diff --git a/mods/ITEMS/mcl_throwing/arrow.lua b/mods/ITEMS/mcl_throwing/arrow.lua index 3cb3368e1..0bf12375b 100644 --- a/mods/ITEMS/mcl_throwing/arrow.lua +++ b/mods/ITEMS/mcl_throwing/arrow.lua @@ -117,7 +117,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) if self._lastpos.x~=nil then local def = minetest.registered_nodes[node.name] 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') end self.object:remove() diff --git a/mods/ITEMS/mcl_throwing/init.lua b/mods/ITEMS/mcl_throwing/init.lua index 3288ac4c6..f5841e772 100644 --- a/mods/ITEMS/mcl_throwing/init.lua +++ b/mods/ITEMS/mcl_throwing/init.lua @@ -53,7 +53,7 @@ end local player_shoot_arrow = function(itemstack, player, power, damage) local arrow_stack, arrow_stack_id = get_arrow(player) 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 return false end @@ -86,7 +86,7 @@ local powerup_function = function(nextbow) end -- 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() itemstack:replace(nextbow) itemstack:set_wear(wear) @@ -131,7 +131,7 @@ minetest.register_tool("mcl_throwing:bow_0", { itemstack:replace("mcl_throwing:bow") itemstack:set_wear(wear) 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) end end @@ -153,7 +153,7 @@ minetest.register_tool("mcl_throwing:bow_1", { itemstack:replace("mcl_throwing:bow") itemstack:set_wear(wear) 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) end end @@ -183,7 +183,7 @@ minetest.register_tool("mcl_throwing:bow_2", { damage = 4 end 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) end end diff --git a/mods/ITEMS/mcl_throwing/throwable.lua b/mods/ITEMS/mcl_throwing/throwable.lua index 4e51e94e0..047b072d6 100644 --- a/mods/ITEMS/mcl_throwing/throwable.lua +++ b/mods/ITEMS/mcl_throwing/throwable.lua @@ -2,7 +2,7 @@ -- Snowballs and other throwable items -- -local GRAVITY = tonumber(minetest.setting_get("movement_gravity")) +local GRAVITY = tonumber(minetest.settings:get("movement_gravity")) local entity_mapping = { ["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 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() - if not minetest.setting_getbool("creative_mode") then + if not minetest.settings:get_bool("creative_mode") then item:take_item() end return item diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index 7ab89c944..58901cac9 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -17,7 +17,7 @@ -- The hand local groupcaps -if minetest.setting_getbool("creative_mode") then +if minetest.settings:get_bool("creative_mode") then -- Instant breaking in creative mode groupcaps = { 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) above.y = above.y + 1 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 local toolname = itemstack:get_name() local def = minetest.registered_items[toolname] diff --git a/mods/ITEMS/minetest-3d_armor/wieldview/init.lua b/mods/ITEMS/minetest-3d_armor/wieldview/init.lua index 7a5a61994..9aef99e3c 100644 --- a/mods/ITEMS/minetest-3d_armor/wieldview/init.lua +++ b/mods/ITEMS/minetest-3d_armor/wieldview/init.lua @@ -1,13 +1,13 @@ 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 update_time = 2 - minetest.setting_set("wieldview_update_time", tostring(update_time)) + minetest.settings:set("wieldview_update_time", tostring(update_time)) 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 node_tiles = false - minetest.setting_set("wieldview_node_tiles", "false") + minetest.settings:set("wieldview_node_tiles", "false") end wieldview = { diff --git a/mods/PLAYER/mcl_death_drop/init.lua b/mods/PLAYER/mcl_death_drop/init.lua index d69290f05..6d0947e26 100644 --- a/mods/PLAYER/mcl_death_drop/init.lua +++ b/mods/PLAYER/mcl_death_drop/init.lua @@ -1,5 +1,5 @@ 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 -- Drop inventory, crafting grid and armor local inv = player:get_inventory() diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 8b5906430..a794fb1fa 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -26,13 +26,13 @@ mcl_hunger.SATURATION_INIT = 5 -- Initial saturation for new/respawning players mcl_hunger.active = false -if minetest.setting_getbool("enable_damage") then +if minetest.settings:get_bool("enable_damage") then mcl_hunger.active = true -- 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 -- 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 mcl_hunger.debug = false end