From 5940f5bda421add111a881b4df82b793121738a9 Mon Sep 17 00:00:00 2001
From: kpoppel <poulsen.kim@gmail.com>
Date: Wed, 08 May 2013 00:06:54 +0200
Subject: [PATCH] Slope box fixes. From Bas080.

---
 technic/cnc_api.lua |  109 ++++++++----------------------------------------------
 1 files changed, 16 insertions(+), 93 deletions(-)

diff --git a/technic/cnc_api.lua b/technic/cnc_api.lua
index 2d5dcfe..aecfadb 100644
--- a/technic/cnc_api.lua
+++ b/technic/cnc_api.lua
@@ -6,10 +6,6 @@
 ----------------------------------------
 technic_cnc_api.detail_level = 16 -- 16; 1-32
 
--- HERE YOU CAN DE/ACTIVATE BACKGROUND FOR CNC MENU:
---------------------------------------------------------
-technic_cnc_api.allow_menu_background = false
-
 -- REGISTER NONCUBIC FORMS, CREATE MODELS AND RECIPES:
 ------------------------------------------------------
 
@@ -146,6 +142,12 @@
 -- SLOPE INNER EDGE
 -------------------
 function technic_cnc_api.register_slope_inner_edge(recipeitem, groups, images, description)
+   local slopeboxedge = {}
+   local detail = technic_cnc_api.detail_level
+   for i = 0, detail-1 do
+      slopeboxedge[i+1]={(i/detail)-0.5, -0.5, -0.5, 0.5, (i/detail)-0.5+(1/detail), 0.5}
+      slopeboxedge[i+detail+1]={-0.5, -0.5, (i/detail)-0.5, 0.5, (i/detail)-0.5+(1/detail), 0.5}
+   end
 
 minetest.register_node(":" .. recipeitem .. "_technic_cnc_slope_inner_edge", {
         description = description,
@@ -159,51 +161,8 @@
                 fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
         },
         node_box = {
-                type = "fixed",
-                fixed = {
-                        -- PART 1
-                        {-0.5, -0.5, -0.5, 0.5, -0.45, 0.5},
-                        {-0.45, -0.5, -0.5, 0.5, -0.4, 0.5},
-                        {-0.4, -0.5, -0.5, 0.5, -0.35, 0.5},
-                        {-0.35, -0.5, -0.5, 0.5, -0.3, 0.5},
-                        {-0.3, -0.5, -0.5, 0.5, -0.25, 0.5},
-                        {-0.25, -0.5, -0.5, 0.5, -0.2, 0.5},
-                        {-0.2, -0.5, -0.5, 0.5, -0.15, 0.5},
-                        {-0.15, -0.5, -0.5, 0.5, -0.1, 0.5},
-                        {-0.1, -0.5, -0.5, 0.5, -0.05, 0.5},
-                        {-0.05, -0.5, -0.5, 0.5, 0, 0.5},
-                        {0, -0.5, -0.5, 0.5, 0.05, 0.5},
-                        {0.05, -0.5, -0.5, 0.5, 0.1, 0.5},
-                        {0.1, -0.5, -0.5, 0.5, 0.15, 0.5},
-                        {0.15, -0.5, -0.5, 0.5, 0.2, 0.5},
-                        {0.2, -0.5, -0.5, 0.5, 0.25, 0.5},
-                        {0.25, -0.5, -0.5, 0.5, 0.3, 0.5},
-                        {0.3, -0.5, -0.5, 0.5, 0.35, 0.5},
-                        {0.35, -0.5, -0.5, 0.5, 0.4, 0.5},
-                        {0.4, -0.5, -0.5, 0.5, 0.45, 0.5},
-                        {0.45, -0.5, -0.5, 0.5, 0.5, 0.5},
-                        -- PART 2
-                        {-0.5, -0.5, -0.45, 0.5, -0.45, 0.5},
-                        {-0.5, -0.5, -0.4, 0.5, -0.4, 0.5},
-                        {-0.5, -0.5, -0.35, 0.5, -0.35, 0.5},
-                        {-0.5, -0.5, -0.3, 0.5, -0.3, 0.5},
-                        {-0.5, -0.5, -0.25, 0.5, -0.25, 0.5},
-                        {-0.5, -0.5, -0.2, 0.5, -0.2, 0.5},
-                        {-0.5, -0.5, -0.15, 0.5, -0.15, 0.5},
-                        {-0.5, -0.5, -0.1, 0.5, -0.1, 0.5},
-                        {-0.5, -0.5, -0.05, 0.5, -0.05, 0.5},
-                        {-0.5, -0.5, 0, 0.5, 0, 0.5},
-                        {-0.5, -0.5, 0.05, 0.5, 0.05, 0.5},
-                        {-0.5, -0.5, 0.1, 0.5, 0.1, 0.5},
-                        {-0.5, -0.5, 0.15, 0.5, 0.15, 0.5},
-                        {-0.5, -0.5, 0.2, 0.5, 0.2, 0.5},
-                        {-0.5, -0.5, .25, 0.5, 0.25, 0.5},
-                        {-0.5, -0.5, 0.3, 0.5, 0.3, 0.5},
-                        {-0.5, -0.5, 0.35, 0.5, 0.35, 0.5},
-                        {-0.5, -0.5, 0.4, 0.5, 0.4, 0.5},
-                        {-0.5, -0.5, 0.45, 0.5, 0.45, 0.5},
-                        {-0.5, -0.5, 0.5, 0.5, 0.5, 0.5},
-                        },
+	   type = "fixed",
+	   fixed = slopeboxedge,
         },
         groups = groups,
         })
@@ -251,6 +210,13 @@
 return
 end
 
+local slopeboxedge = {}
+local detail = technic_cnc_api.detail_level
+for i = 0, detail-1 do
+  slopeboxedge[i+1]={0.5-(i/detail)-(1/detail), (i/detail)-0.5, -0.5, 0.5, (i/detail)-0.5+(1/detail), 0.5}
+  slopeboxedge[i+detail+1]={-0.5, (i/detail)-0.5, 0.5-(i/detail)-(1/detail), 0.5, (i/detail)-0.5+(1/detail), 0.5}
+end
+
 minetest.register_node(":" .. recipeitem .. "_technic_cnc_slope_inner_edge_upsdown", {
         description = description,
         drawtype = "nodebox",
@@ -264,50 +230,7 @@
         },
         node_box = {
                 type = "fixed",
-                fixed = {
-                        {0.45, -0.5, -0.5, 0.5, -0.45, 0.5},
-                        {0.4, -0.45, -0.5, 0.5, -0.4, 0.5},
-                        {0.35, -0.4, -0.5, 0.5, -0.35, 0.5},
-                        {0.3, -0.35, -0.5, 0.5, -0.3, 0.5},
-                        {0.25, -0.3, -0.5, 0.5, -0.25, 0.5},
-                        {0.2, -0.25, -0.5, 0.5, -0.2, 0.5},
-                        {0.15, -0.2, -0.5, 0.5, -0.15, 0.5},
-                        {0.1, -0.15, -0.5, 0.5, -0.1, 0.5},
-                        {0.05, -0.1, -0.5, 0.5, -0.05, 0.5},
-                        {0, -0.05, -0.5, 0.5, 0, 0.5},
-                        {-0.05, 0, -0.5, 0.5, 0.05, 0.5},
-                        {-0.1, 0.05, -0.5, 0.5, 0.1, 0.5},
-                        {-0.15, 0.1, -0.5, 0.5, 0.15, 0.5},
-                        {-0.2, 0.15, -0.5, 0.5, 0.2, 0.5},
-                        {-0.25, 0.2, -0.5, 0.5, 0.25, 0.5},
-                        {-0.3, 0.25, -0.5, 0.5, 0.3, 0.5},
-                        {-0.35, 0.3, -0.5, 0.5, 0.35, 0.5},
-                        {-0.4, 0.35, -0.5, 0.5, 0.4, 0.5},
-                        {-0.45, 0.4, -0.5, 0.5, 0.45, 0.5},
-                        {-0.5, 0.45, -0.5, 0.5, 0.5, 0.5},
-
-                        {-0.5, -0.5, 0.45, 0.5, -0.45, 0.5},
-                        {-0.5, -0.45, 0.4, 0.5, -0.4, 0.5},
-                        {-0.5, -0.4, 0.35, 0.5, -0.35, 0.5},
-                        {-0.5, -0.35, 0.3, 0.5, -0.3, 0.5},
-                        {-0.5, -0.3, 0.25, 0.5, -0.25, 0.5},
-                        {-0.5, -0.25, 0.2, 0.5, -0.2, 0.5},
-                        {-0.5, -0.2, 0.15, 0.5, -0.15, 0.5},
-                        {-0.5, -0.15, 0.1, 0.5, -0.1, 0.5},
-                        {-0.5, -0.1, 0.05, 0.5, -0.05, 0.5},
-                        {-0.5, -0.05, 0, 0.5, 0, 0.5},
-                        {-0.5, 0, -0.05, 0.5, 0.05, 0.5},
-                        {-0.5, 0.05, -0.1, 0.5, 0.1, 0.5},
-                        {-0.5, 0.1, -0.15, 0.5, 0.15, 0.5},
-                        {-0.5, 0.15, -0.2, 0.5, 0.2, 0.5},
-                        {-0.5, 0.2, -0.25, 0.5, 0.25, 0.5},
-                        {-0.5, 0.25, -0.3, 0.5, 0.3, 0.5},
-                        {-0.5, 0.3, -0.35, 0.5, 0.35, 0.5},
-                        {-0.5, 0.35, -0.4, 0.5, 0.4, 0.5},
-                        {-0.5, 0.4, -0.45, 0.5, 0.45, 0.5},
-                        {-0.5, 0.45, -0.5, 0.5, 0.5, 0.5},
-
-                        },
+                fixed = slopeboxedge,
         },
         groups = groups,
         })

--
Gitblit v1.8.0