summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2017-10-09 12:16:07 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2017-10-09 12:16:07 +0100
commite630074a9f35cb0d79bcc8a9e174041a735ad72e (patch)
tree093dcf2ff840fc73360213d861734ab9948a2e27 /init.lua
parentf7e56eebb0251ac2c9ec28c2b2f9aa2303ef3ad7 (diff)
updated to newer 0.4.16 functions
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index 6552f0d..9e8b175 100644
--- a/init.lua
+++ b/init.lua
@@ -6,6 +6,13 @@ local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP .. "/intllib.lua")
+-- creative check
+local creative_mode_cache = minetest.settings:get_bool("creative_mode")
+function is_creative(name)
+ return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
+end
+
+
-- default crops
local crops = {
{"farming:cotton_", 8, "farming:seed_cotton"},
@@ -347,7 +354,7 @@ minetest.register_craftitem("bonemeal:mulch", {
end
-- take item if not in creative
- if not minetest.setting_getbool("creative_mode") then
+ if not is_creative(user:get_player_name()) then
itemstack:take_item()
end
@@ -376,7 +383,7 @@ minetest.register_craftitem("bonemeal:bonemeal", {
end
-- take item if not in creative
- if not minetest.setting_getbool("creative_mode") then
+ if not is_creative(user:get_player_name()) then
itemstack:take_item()
end
@@ -406,7 +413,7 @@ minetest.register_craftitem("bonemeal:fertiliser", {
end
-- take item if not in creative
- if not minetest.setting_getbool("creative_mode") then
+ if not is_creative(user:get_player_name()) then
itemstack:take_item()
end