Replace deprecated function names, unify creative check

This commit is contained in:
SmallJoker 2018-06-23 14:56:27 +02:00
parent c43074f5c2
commit edd00f222c
3 changed files with 9 additions and 7 deletions

@ -303,6 +303,6 @@ end
function unified_inventory.is_creative(playername)
return minetest.check_player_privs(playername, {creative=true})
or minetest.setting_getbool("creative_mode")
or minetest.settings:get_bool("creative_mode")
end

@ -1,4 +1,4 @@
-- Unified Inventory for Minetest 0.4.8+
-- Unified Inventory for Minetest >= 0.4.16
local modpath = minetest.get_modpath(minetest.get_current_modname())
local worldpath = minetest.get_worldpath()
@ -44,10 +44,10 @@ unified_inventory = {
fgettext = function(...) return minetest.formspec_escape(mygettext(...)) end,
-- "Lite" mode
lite_mode = minetest.setting_getbool("unified_inventory_lite"),
lite_mode = minetest.settings:get_bool("unified_inventory_lite"),
-- Trash enabled
trash_enabled = (minetest.setting_getbool("unified_inventory_trash") ~= false),
trash_enabled = (minetest.settings:get_bool("unified_inventory_trash") ~= false),
pagecols = 8,
pagerows = 10,
@ -80,7 +80,7 @@ dofile(modpath.."/internal.lua")
dofile(modpath.."/callbacks.lua")
dofile(modpath.."/register.lua")
if minetest.setting_getbool("unified_inventory_bags") ~= false then
if minetest.settings:get_bool("unified_inventory_bags") ~= false then
dofile(modpath.."/bags.lua")
end

@ -290,6 +290,8 @@ unified_inventory.register_page("craftguide", {
alternates = #crafts
craft = crafts[alternate]
end
local has_creative = player_privs.give or player_privs.creative or
minetest.settings:get_bool("creative_mode")
formspec = formspec.."background[0.5,"..(formspecy + 0.2)..";8,3;ui_craftguide_form.png]"
formspec = formspec.."textarea["..craftresultx..","..craftresulty
@ -305,7 +307,7 @@ unified_inventory.register_page("craftguide", {
formspec = formspec.."image["..no_pos..","..formspecy..";1.1,1.1;ui_no.png]"
formspec = formspec..stack_image_button(item_pos, formspecy, 1.1, 1.1, "item_button_"
..other_dir[dir].."_", ItemStack(item_name))
if player_privs.give == true or player_privs.creative == true or minetest.setting_getbool("creative_mode") == true then
if has_creative then
formspec = formspec.."label[0,"..(formspecy + 2.10)..";" .. F("Give me:") .. "]"
.."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]"
.."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]"
@ -382,7 +384,7 @@ unified_inventory.register_page("craftguide", {
.."button[0.6,"..(formspecy + 1.5)..";0.7,0.5;craftguide_craft_10;10]"
.."button[1.3,"..(formspecy + 1.5)..";0.8,0.5;craftguide_craft_max;" .. F("All") .. "]"
end
if player_privs.give == true or player_privs.creative == true or minetest.setting_getbool("creative_mode") == true then
if has_creative then
formspec = formspec.."label[0,"..(formspecy + 2.1)..";" .. F("Give me:") .. "]"
.."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]"
.."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]"