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 | |
parent | f7e56eebb0251ac2c9ec28c2b2f9aa2303ef3ad7 (diff) |
updated to newer 0.4.16 functions
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | init.lua | 13 |
2 files changed, 12 insertions, 4 deletions
@@ -22,8 +22,9 @@ Changelog: - 0.1 - Initial release - 0.2 - Added global on_use function for bonemeal growth -- 0.3 - Added strength to on_use global for new items (mulch and fertiliser). +- 0.3 - Added strength to on_use global for new items (mulch and fertiliser) - 0.4 - Added Intllib support and fr.txt file - 0.5 - Added support for default bush and acacia bush saplings +- 0.6 - Using newer functions, Minetest 0.4.16 and above needed to run Lucky Blocks: 2 @@ -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
|