summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2018-06-23 14:56:27 +0200
committerSmallJoker <mk939@ymail.com>2018-06-23 15:02:23 +0200
commitedd00f222c02f2e0f42f0c9bf52de74c41bf12b9 (patch)
tree1ea660608b5be87469d11c9265013c208429341c
parentc43074f5c27d982199860aad0eb69b01ae2d33aa (diff)
Replace deprecated function names, unify creative check
-rw-r--r--api.lua2
-rw-r--r--init.lua8
-rw-r--r--register.lua6
3 files changed, 9 insertions, 7 deletions
diff --git a/api.lua b/api.lua
index 2b63922..42fc167 100644
--- a/api.lua
+++ b/api.lua
@@ -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
diff --git a/init.lua b/init.lua
index 6929600..f76acb8 100644
--- a/init.lua
+++ b/init.lua
@@ -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
diff --git a/register.lua b/register.lua
index bd6a13b..a1901e7 100644
--- a/register.lua
+++ b/register.lua
@@ -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]"