diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2017-10-09 12:16:07 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2017-10-09 12:16:07 +0100 |
commit | e630074a9f35cb0d79bcc8a9e174041a735ad72e (patch) | |
tree | 093dcf2ff840fc73360213d861734ab9948a2e27 /init.lua | |
parent | f7e56eebb0251ac2c9ec28c2b2f9aa2303ef3ad7 (diff) |
updated to newer 0.4.16 functions
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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
|