kpoppel
2013-05-08 5940f5bda421add111a881b4df82b793121738a9
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,
@@ -160,50 +162,7 @@
        },
        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},
                        },
      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,
        })