updated to newer 0.4.16 functions

This commit is contained in:
TenPlus1 2017-10-09 12:16:07 +01:00
parent f7e56eebb0
commit e630074a9f
2 changed files with 12 additions and 4 deletions

View File

@ -22,8 +22,9 @@ Changelog:
- 0.1 - Initial release - 0.1 - Initial release
- 0.2 - Added global on_use function for bonemeal growth - 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.4 - Added Intllib support and fr.txt file
- 0.5 - Added support for default bush and acacia bush saplings - 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 Lucky Blocks: 2

View File

@ -6,6 +6,13 @@ local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP .. "/intllib.lua") 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 -- default crops
local crops = { local crops = {
{"farming:cotton_", 8, "farming:seed_cotton"}, {"farming:cotton_", 8, "farming:seed_cotton"},
@ -347,7 +354,7 @@ minetest.register_craftitem("bonemeal:mulch", {
end end
-- take item if not in creative -- 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() itemstack:take_item()
end end
@ -376,7 +383,7 @@ minetest.register_craftitem("bonemeal:bonemeal", {
end end
-- take item if not in creative -- 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() itemstack:take_item()
end end
@ -406,7 +413,7 @@ minetest.register_craftitem("bonemeal:fertiliser", {
end end
-- take item if not in creative -- 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() itemstack:take_item()
end end