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

View file

@ -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")

View file

@ -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