From fa180c3c45ebe068a5f620dcae63e275b8ed3854 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Mon, 9 Oct 2017 11:17:34 +0100 Subject: [PATCH] Updating to 0.4.16+ functions --- README.md | 4 ++++ bonemeal.lua | 9 ++------- extra.lua | 4 ++-- init.lua | 10 ++++++++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d48617d..3dea0be 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ Ethereal Mapgen mod for Minetest (works on all except v6) ## Changelog +### 1.24 + + - Updating code to newer functions, requires Minetest 0.4.16 and above + ### 1.23 - Added bonemeal support for bush sapling and acacia bush sapling diff --git a/bonemeal.lua b/bonemeal.lua index 1de4cbc..60f7ef3 100644 --- a/bonemeal.lua +++ b/bonemeal.lua @@ -295,18 +295,13 @@ minetest.register_craftitem("ethereal:bonemeal", { return end - if not minetest.setting_getbool("creative_mode") then + if not ethereal.check_creative(user:get_player_name()) then - local item = user:get_wielded_item() - - item:take_item() - user:set_wielded_item(item) + itemstack:take_item() end growth(pointed_thing) - itemstack:take_item() - return itemstack end end, diff --git a/extra.lua b/extra.lua index 13c0139..da056e9 100644 --- a/extra.lua +++ b/extra.lua @@ -107,7 +107,7 @@ minetest.register_node("ethereal:candle", { length = 1.0 } }, - }, + }, paramtype = "light", light_source = 11, sunlight_propagates = true, @@ -288,7 +288,7 @@ minetest.register_tool("ethereal:light_staff", { minetest.swap_node(pos, {name = "ethereal:glostone"}) - if not minetest.setting_getbool("creative_mode") then + if not ethereal.check_creative(user:get_player_name()) then itemstack:add_wear(65535 / 149) -- 150 uses end diff --git a/init.lua b/init.lua index 2d3e6f5..51f2ee0 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,6 @@ --[[ - Minetest Ethereal Mod (1st March 2017) + Minetest Ethereal Mod Created by ChinChow @@ -9,7 +9,7 @@ ]] ethereal = {} -- DO NOT change settings below, use the settings.conf file -ethereal.version = "1.22" +ethereal.version = "1.24" ethereal.leaftype = 0 -- 0 for 2D plantlike, 1 for 3D allfaces ethereal.leafwalk = false -- true for walkable leaves, false to fall through ethereal.cavedirt = true -- caves chop through dirt when true @@ -72,6 +72,12 @@ ethereal.intllib = S -- Falling node function ethereal.check_falling = minetest.check_for_falling or nodeupdate +-- creative check +local creative_mode_cache = minetest.settings:get_bool("creative_mode") +function ethereal.check_creative(name) + return creative_mode_cache or minetest.check_player_privs(name, {creative = true}) +end + dofile(path .. "/plantlife.lua") dofile(path .. "/mushroom.lua") dofile(path .. "/onion.lua")