From 7db8a5122fac2c4a83616d1e8cae8d5667f3c7c2 Mon Sep 17 00:00:00 2001
From: tenplus1 <kinsellaja@yahoo.com>
Date: Sun, 1 Mar 2015 11:20:12 +0000
Subject: [PATCH] Updated for 0.4.11 dev and above

---
 crystal.lua |  2 +-
 extra.lua   |  4 ++--
 fishing.lua |  2 +-
 init.lua    |  6 +++---
 sapling.lua |  2 +-
 water.lua   | 26 ++++++++++++++++++++++----
 6 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/crystal.lua b/crystal.lua
index 300f07d..de704f6 100644
--- a/crystal.lua
+++ b/crystal.lua
@@ -148,7 +148,7 @@ minetest.register_tool("ethereal:shovel_crystal", {
 
 				local inv = user:get_inventory()
 
-				minetest.env:remove_node(pointed_thing.under)
+				minetest.remove_node(pointed_thing.under)
 				nodeupdate(pos)
 				
 				inv:add_item("main", {name = nn})
diff --git a/extra.lua b/extra.lua
index f499643..57281fe 100644
--- a/extra.lua
+++ b/extra.lua
@@ -285,9 +285,9 @@ minetest.register_tool("ethereal:light_staff", {
 		local node = minetest.get_node(pos).name
 
 		if node == "default:stone" then
-			minetest.env:add_node(pos, {name="ethereal:glostone"})
+			minetest.add_node(pos, {name="ethereal:glostone"})
 		elseif node == "ethereal:glostone" then
-			minetest.env:add_node(pos, {name="default:stone"})
+			minetest.add_node(pos, {name="default:stone"})
 		end
 
 		if not minetest.setting_getbool("creative_mode") then
diff --git a/fishing.lua b/fishing.lua
index b47095d..4c831a0 100644
--- a/fishing.lua
+++ b/fishing.lua
@@ -49,7 +49,7 @@ minetest.register_craftitem("ethereal:fishing_rod_baited", {
 	liquids_pointable = true,
 	on_use = function (itemstack, user, pointed_thing)
 		if pointed_thing and pointed_thing.under then
-			local node = minetest.env:get_node(pointed_thing.under)
+			local node = minetest.get_node(pointed_thing.under)
 			if string.find(node.name, "default:water_source") then
 				if math.random(1, 100) < 5 then
 					local inv = user:get_inventory()
diff --git a/init.lua b/init.lua
index a5236bb..9e55296 100644
--- a/init.lua
+++ b/init.lua
@@ -1,6 +1,6 @@
 --[[
 
-	Minetest Ethereal Mod 1.14 (4th Feb 2015)
+	Minetest Ethereal Mod 1.14 (1st March 2015)
 
 	Created by ChinChow
 
@@ -54,8 +54,8 @@ dofile(minetest.get_modpath("ethereal").."/sealife.lua")
 dofile(minetest.get_modpath("ethereal").."/fences.lua")
 dofile(minetest.get_modpath("ethereal").."/gates.lua")
 dofile(minetest.get_modpath("ethereal").."/stairs.lua")
-dofile(minetest.get_modpath("ethereal").."/mapgen_v7s.lua")
---dofile(minetest.get_modpath("ethereal").."/mapgen_v7n.lua") -- 0.4.11 dev only
+--dofile(minetest.get_modpath("ethereal").."/mapgen_v7s.lua") -- 0.4.11 and below
+dofile(minetest.get_modpath("ethereal").."/mapgen_v7n.lua") -- 0.4.11 dev and above
 
 -- Xanadu server Only
 --dofile(minetest.get_modpath("ethereal").."/plantpack.lua")
diff --git a/sapling.lua b/sapling.lua
index addc5af..667a150 100644
--- a/sapling.lua
+++ b/sapling.lua
@@ -40,7 +40,7 @@ ethereal.register_sapling( "ethereal:acacia_sapling", "Acacia Sapling", "moretre
 
 ethereal.place_tree = function (pos, ofx, ofz, schem)
 	-- Remove Sapling and Place Tree Schematic
-	minetest.env:set_node(pos, {name="air"})
+	minetest.set_node(pos, {name="air"})
 	pos.x = pos.x - ofx
 	pos.z = pos.z - ofz
 	minetest.place_schematic(pos, minetest.get_modpath("ethereal").."/schematics/"..schem..".mts", "0", {}, false );
diff --git a/water.lua b/water.lua
index e066eec..a99b9af 100644
--- a/water.lua
+++ b/water.lua
@@ -66,9 +66,9 @@ minetest.register_abm({
 		local pos0 = {x=pos.x-1,y=pos.y-1,z=pos.z-1}
 		local pos1 = {x=pos.x+1,y=pos.y+1,z=pos.z+1}
 
-		local water = minetest.env:find_nodes_in_area(pos0, pos1, "default:water_source")
+		local water = minetest.find_nodes_in_area(pos0, pos1, "default:water_source")
 		if water then
-			minetest.env:set_node(water[1], {name="default:ice"})
+			minetest.set_node(water[1], {name="default:ice"})
 		end
 	end,
 })
@@ -118,12 +118,30 @@ minetest.register_abm({
 		local pos0 = {x=pos.x-1,y=pos.y-1,z=pos.z-1}
 		local pos1 = {x=pos.x+1,y=pos.y+1,z=pos.z+1}
 
-		local water = minetest.env:find_nodes_in_area(pos0, pos1, "group:water")
+		local water = minetest.find_nodes_in_area(pos0, pos1, "group:water")
 		if water then
 			for n = 1, #water do
-				minetest.env:set_node(water[n], {name="air"})
+				minetest.set_node(water[n], {name="air"})
 			end
 		end
 	end,
 })
 ]]
+--[[
+-- If torch next to water then drop torch
+minetest.register_abm({
+	nodenames = {"default:torch"},
+	neighbors = {"default:water_source", "default:water_flowing"},
+	interval = 1,
+	chance = 1,
+
+	action = function(pos, node)
+		local pos0 = {x=pos.x-1,y=pos.y,z=pos.z-1}
+		local pos1 = {x=pos.x+1,y=pos.y+1,z=pos.z+1}
+		if #minetest.find_nodes_in_area(pos0, pos1, {"default:water_source", "default:water_flowing"}) > 0 then
+			minetest.set_node(pos, {name="default:water_flowing"})
+			minetest.add_item(pos, {name = "default:torch"})
+		end
+	end,
+})
+]]
-- 
GitLab