From c5e9480d99af35dd646e525bb20608cc0ca5c1ab Mon Sep 17 00:00:00 2001
From: Zefram <zefram@fysh.org>
Date: Wed, 23 Jul 2014 22:13:45 +0100
Subject: Config setting to nerf corium

For use on servers that have a mainly creative purpose, the setting
enable_corium_griefing=false will prevent corium from flowing far or
unpredictably and from destroying nodes other than water.  All reactor
meltdowns will stay contained.
---
 technic/config.lua                      |  1 +
 technic/machines/HV/nuclear_reactor.lua | 40 ++++++++++++++++++---------------
 2 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/technic/config.lua b/technic/config.lua
index 525c79f..1dfce66 100644
--- a/technic/config.lua
+++ b/technic/config.lua
@@ -13,6 +13,7 @@ local defaults = {
 	enable_marble_generation = "true",
 	enable_granite_generation = "true",
 	enable_wind_mill = "false",
+	enable_corium_griefing = "true",
 }
 
 for k, v in pairs(defaults) do
diff --git a/technic/machines/HV/nuclear_reactor.lua b/technic/machines/HV/nuclear_reactor.lua
index 80cf24d..003ca6b 100644
--- a/technic/machines/HV/nuclear_reactor.lua
+++ b/technic/machines/HV/nuclear_reactor.lua
@@ -351,30 +351,34 @@ minetest.register_abm({
 	end,
 })
 
+local griefing = technic.config:get_bool("enable_corium_griefing")
+
 minetest.register_abm({
 	nodenames = {"technic:corium_flowing"},
 	interval = 5,
-	chance = 10,
+	chance = (griefing and 10 or 1),
 	action = function (pos, node)
 		minetest.set_node(pos, {name="technic:chernobylite_block"})
 	end,
 })
 
-minetest.register_abm({
-	nodenames = { "technic:corium_source", "technic:corium_flowing" },
-	interval = 4,
-	chance = 4,
-	action = function (pos, node)
-		for _, offset in ipairs({
-			vector.new(1,0,0),
-			vector.new(-1,0,0),
-			vector.new(0,0,1),
-			vector.new(0,0,-1),
-			vector.new(0,-1,0),
-		}) do
-			if math.random(8) == 1 then
-				minetest.dig_node(vector.add(pos, offset))
+if griefing then
+	minetest.register_abm({
+		nodenames = { "technic:corium_source", "technic:corium_flowing" },
+		interval = 4,
+		chance = 4,
+		action = function (pos, node)
+			for _, offset in ipairs({
+				vector.new(1,0,0),
+				vector.new(-1,0,0),
+				vector.new(0,0,1),
+				vector.new(0,0,-1),
+				vector.new(0,-1,0),
+			}) do
+				if math.random(8) == 1 then
+					minetest.dig_node(vector.add(pos, offset))
+				end
 			end
-		end
-	end,
-})
+		end,
+	})
+end
-- 
cgit v1.2.3