From 55437f8c31a4015f1d2d6275ac4a4dc5f85a93e4 Mon Sep 17 00:00:00 2001
From: h-v-smacker <hans-von-smacker+github@gmail.com>
Date: Sat, 15 Sep 2018 06:13:24 +0300
Subject: glass cnc nodes

---
 technic/machines/LV/cnc_api.lua   | 23 ++++++++++++++-
 technic/machines/LV/cnc_nodes.lua | 61 +++++++++++++++++++++++++++------------
 2 files changed, 65 insertions(+), 19 deletions(-)

diff --git a/technic/machines/LV/cnc_api.lua b/technic/machines/LV/cnc_api.lua
index a838251..8ab405b 100644
--- a/technic/machines/LV/cnc_api.lua
+++ b/technic/machines/LV/cnc_api.lua
@@ -482,7 +482,18 @@ technic.cnc.programs_disable = {
 	["default:dirt"] = {"technic_cnc_oblate_spheroid", "technic_cnc_slope_upsdown", "technic_cnc_edge",
 	                    "technic_cnc_inner_edge", "technic_cnc_slope_edge_upsdown",
 	                    "technic_cnc_slope_inner_edge_upsdown", "technic_cnc_stick",
-	                    "technic_cnc_cylinder_horizontal"}
+	                    "technic_cnc_cylinder_horizontal"},
+
+}
+
+-- Allow enabling only few select programs
+technic.cnc.programs_enable = {
+	
+	["default:glass"] = {"technic_cnc_d45_slope_216", "technic_cnc_arch216"},
+	["default:obsidian_glass"] = {"technic_cnc_d45_slope_216", "technic_cnc_arch216"},
+	["moreblocks:clean_glass"] = {"technic_cnc_d45_slope_216", "technic_cnc_arch216"},
+	["moreblocks:coal_glass"] = {"technic_cnc_d45_slope_216", "technic_cnc_arch216"},
+	["moreblocks:iron_glass"] = {"technic_cnc_d45_slope_216", "technic_cnc_arch216"}
 }
 
 -- Generic function for registering all the different node types
@@ -533,6 +544,16 @@ function technic.cnc.register_all(recipeitem, groups, images, description)
 				end
 			end
 		end
+		
+		if technic.cnc.programs_enable[recipeitem] ~= nil then
+			do_register = false
+			for __, enable in ipairs(technic.cnc.programs_enable[recipeitem]) do
+				if enable == data.suffix then
+					do_register = true
+				end
+			end
+		end
+		
 		-- Create the node if it passes the test
 		if do_register then
 			technic.cnc.register_program(recipeitem, data.suffix, data.model,
diff --git a/technic/machines/LV/cnc_nodes.lua b/technic/machines/LV/cnc_nodes.lua
index e16b7f7..42117a1 100644
--- a/technic/machines/LV/cnc_nodes.lua
+++ b/technic/machines/LV/cnc_nodes.lua
@@ -15,6 +15,11 @@ technic.cnc.register_all("default:glass",
                 {"default_glass.png"},
                 S("Glass"))
 
+technic.cnc.register_all("default:obsidian_glass",
+                {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
+                {"default_obsidian_glass.png"},
+                S("Obsidian Glass"))
+
 -- WOOD
 -------
 technic.cnc.register_all("default:wood",
@@ -327,6 +332,27 @@ if minetest.get_modpath("ethereal") then
 		{"ethereal_bush.png"},
 		S("Bush"))
 	
+	-- if baked clay isn't added and barebones ethereal is used
+	
+	if not minetest.get_modpath("bakedclay") then
+		-- Clay
+		------------
+		technic.cnc.register_all("bakedclay:red",
+				{cracky=3, not_in_creative_inventory=1},
+				{"baked_clay_red.png"},
+				S("Red Clay"))
+		
+		technic.cnc.register_all("bakedclay:orange",
+				{cracky=3, not_in_creative_inventory=1},
+				{"baked_clay_orange.png"},
+				S("Orange Clay"))
+		
+		technic.cnc.register_all("bakedclay:grey",
+				{cracky=3, not_in_creative_inventory=1},
+				{"baked_clay_grey.png"},
+				S("Grey Clay"))
+	end
+	
 end
 
 
@@ -372,25 +398,24 @@ if minetest.get_modpath("moreblocks") then
 			{"moreblocks_copperpatina.png"},
 			S("Copper Patina"))
 	
-	if not minetest.get_modpath("bakedclay") then
-		-- Clay
-		------------
-		technic.cnc.register_all("bakedclay:red",
-				{cracky=3, not_in_creative_inventory=1},
-				{"baked_clay_red.png"},
-				S("Red Clay"))
-		
-		technic.cnc.register_all("bakedclay:orange",
-				{cracky=3, not_in_creative_inventory=1},
-				{"baked_clay_orange.png"},
-				S("Orange Clay"))
-		
-		technic.cnc.register_all("bakedclay:grey",
-				{cracky=3, not_in_creative_inventory=1},
-				{"baked_clay_grey.png"},
-				S("Grey Clay"))
-	end
+	-- Glass types
+	------------
 	
+	technic.cnc.register_all("moreblocks:clean_glass",
+                {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
+                {"moreblocks_clean_glass.png"},
+                S("Clean Glass"))
+	
+	technic.cnc.register_all("moreblocks:coal_glass",
+                {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
+                {"moreblocks_coal_glass.png"},
+                S("Coal Glass"))
+	
+	technic.cnc.register_all("moreblocks:iron_glass",
+                {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
+                {"moreblocks_iron_glass.png"},
+                S("Iron Glass"))
+
 end
 
 if minetest.get_modpath("pathv7") then
-- 
cgit v1.2.3