From 856b86858ebfa4af2c352b022188f82dcff7ed92 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sat, 1 Dec 2018 09:06:00 -0500 Subject: update basic_materials, biome_lib, technic, digilines, digistuff, gloopblocks, homedecor, moreblocks, pipeworks, prefab_redo --- technic/machines/LV/cnc.lua | 230 ---------------------- technic/machines/LV/cnc_api.lua | 369 ----------------------------------- technic/machines/LV/cnc_nodes.lua | 91 --------- technic/machines/LV/init.lua | 5 - technic/machines/register/cables.lua | 22 ++- 5 files changed, 17 insertions(+), 700 deletions(-) delete mode 100644 technic/machines/LV/cnc.lua delete mode 100644 technic/machines/LV/cnc_api.lua delete mode 100644 technic/machines/LV/cnc_nodes.lua (limited to 'technic/machines') diff --git a/technic/machines/LV/cnc.lua b/technic/machines/LV/cnc.lua deleted file mode 100644 index b8eb729..0000000 --- a/technic/machines/LV/cnc.lua +++ /dev/null @@ -1,230 +0,0 @@ --- Technic CNC v1.0 by kpoppel --- Based on the NonCubic Blocks MOD v1.4 by yves_de_beck - --- Idea: --- Somehow have a tabbed/paged panel if the number of shapes should expand --- beyond what is available in the panel today. --- I could imagine some form of API allowing modders to come with their own node --- box definitions and easily stuff it in the this machine for production. - -local S = technic.getter - - -minetest.register_craft({ - output = 'technic:cnc', - recipe = { - {'default:glass', 'technic:diamond_drill_head', 'default:glass'}, - {'technic:control_logic_unit', 'technic:machine_casing', 'basic_materials:motor'}, - {'technic:carbon_steel_ingot', 'technic:lv_cable', 'technic:carbon_steel_ingot'}, - }, -}) - - -local shape = {} -local onesize_products = { - slope = 2, - slope_edge = 1, - slope_inner_edge = 1, - pyramid = 2, - spike = 1, - cylinder = 2, - oblate_spheroid = 1, - sphere = 1, - stick = 8, - slope_upsdown = 2, - slope_edge_upsdown = 1, - slope_inner_edge_upsdown = 1, - cylinder_horizontal = 2, - slope_lying = 2, - onecurvededge = 1, - twocurvededge = 1, -} -local twosize_products = { - element_straight = 4, - element_end = 2, - element_cross = 1, - element_t = 1, - element_edge = 2, -} - -local cnc_formspec = - "size[9,11;]".. - "label[1,0;"..S("Choose Milling Program:").."]".. - "image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]".. - "image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]".. - "image_button[3,0.5;1,1;technic_cnc_slope_inner_edge.png;slope_inner_edge; ]".. - "image_button[4,0.5;1,1;technic_cnc_pyramid.png;pyramid; ]".. - "image_button[5,0.5;1,1;technic_cnc_spike.png;spike; ]".. - "image_button[6,0.5;1,1;technic_cnc_cylinder.png;cylinder; ]".. - "image_button[7,0.5;1,1;technic_cnc_oblate_spheroid.png;oblate_spheroid; ]".. - "image_button[8,0.5;1,1;technic_cnc_stick.png;stick; ]".. - - "image_button[1,1.5;1,1;technic_cnc_slope_upsdwn.png;slope_upsdown; ]".. - "image_button[2,1.5;1,1;technic_cnc_slope_edge_upsdwn.png;slope_edge_upsdown; ]".. - "image_button[3,1.5;1,1;technic_cnc_slope_inner_edge_upsdwn.png;slope_inner_edge_upsdown; ]".. - "image_button[4,1.5;1,1;technic_cnc_cylinder_horizontal.png;cylinder_horizontal; ]".. - "image_button[5,1.5;1,1;technic_cnc_sphere.png;sphere; ]".. - - "image_button[1,2.5;1,1;technic_cnc_slope_lying.png;slope_lying; ]".. - "image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]".. - "image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]".. - - "label[1,3.5;"..S("Slim Elements half / normal height:").."]".. - - "image_button[1,4;1,0.5;technic_cnc_full.png;full; ]".. - "image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]".. - "image_button[2,4;1,1;technic_cnc_element_straight.png;element_straight; ]".. - "image_button[3,4;1,1;technic_cnc_element_end.png;element_end; ]".. - "image_button[4,4;1,1;technic_cnc_element_cross.png;element_cross; ]".. - "image_button[5,4;1,1;technic_cnc_element_t.png;element_t; ]".. - "image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]".. - - "label[0, 5.5;"..S("In:").."]".. - "list[current_name;src;0.5,5.5;1,1;]".. - "label[4, 5.5;"..S("Out:").."]".. - "list[current_name;dst;5,5.5;4,1;]".. - - "list[current_player;main;0,7;8,4;]".. - "listring[current_name;dst]".. - "listring[current_player;main]".. - "listring[current_name;src]".. - "listring[current_player;main]" - -local size = 1; - --- The form handler is declared here because we need it in both the inactive and active modes --- in order to be able to change programs wile it is running. -local function form_handler(pos, formname, fields, sender) - -- REGISTER MILLING PROGRAMS AND OUTPUTS: - ------------------------------------------ - -- Program for half/full size - if fields["full"] then - size = 1 - return - end - - if fields["half"] then - size = 2 - return - end - - -- Resolve the node name and the number of items to make - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local inputstack = inv:get_stack("src", 1) - local inputname = inputstack:get_name() - local multiplier = 0 - for k, _ in pairs(fields) do - -- Set a multipier for the half/full size capable blocks - if twosize_products[k] ~= nil then - multiplier = size * twosize_products[k] - else - multiplier = onesize_products[k] - end - - if onesize_products[k] ~= nil or twosize_products[k] ~= nil then - meta:set_float( "cnc_multiplier", multiplier) - meta:set_string("cnc_user", sender:get_player_name()) - end - - if onesize_products[k] ~= nil or (twosize_products[k] ~= nil and size==2) then - meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k) - --print(inputname .. "_technic_cnc_" .. k) - break - end - - if twosize_products[k] ~= nil and size==1 then - meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k .. "_double") - --print(inputname .. "_technic_cnc_" .. k .. "_double") - break - end - end - return -end - --- Action code performing the transformation -local run = function(pos, node) - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local eu_input = meta:get_int("LV_EU_input") - local machine_name = S("%s CNC Machine"):format("LV") - local machine_node = "technic:cnc" - local demand = 450 - - local result = meta:get_string("cnc_product") - if inv:is_empty("src") or - (not minetest.registered_nodes[result]) or - (not inv:room_for_item("dst", result)) then - technic.swap_node(pos, machine_node) - meta:set_string("infotext", S("%s Idle"):format(machine_name)) - meta:set_string("cnc_product", "") - meta:set_int("LV_EU_demand", 0) - return - end - - if eu_input < demand then - technic.swap_node(pos, machine_node) - meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) - elseif eu_input >= demand then - technic.swap_node(pos, machine_node.."_active") - meta:set_string("infotext", S("%s Active"):format(machine_name)) - meta:set_int("src_time", meta:get_int("src_time") + 1) - if meta:get_int("src_time") >= 3 then -- 3 ticks per output - meta:set_int("src_time", 0) - srcstack = inv:get_stack("src", 1) - srcstack:take_item() - inv:set_stack("src", 1, srcstack) - inv:add_item("dst", result.." "..meta:get_int("cnc_multiplier")) - end - end - meta:set_int("LV_EU_demand", demand) -end - --- The actual block inactive state -minetest.register_node("technic:cnc", { - description = S("%s CNC Machine"):format("LV"), - tiles = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png", - "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"}, - groups = {cracky=2, technic_machine=1, technic_lv=1}, - connect_sides = {"bottom", "back", "left", "right"}, - paramtype2 = "facedir", - legacy_facedir_simple = true, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("infotext", S("%s CNC Machine"):format("LV")) - meta:set_float("technic_power_machine", 1) - meta:set_string("formspec", cnc_formspec) - local inv = meta:get_inventory() - inv:set_size("src", 1) - inv:set_size("dst", 4) - end, - can_dig = technic.machine_can_dig, - allow_metadata_inventory_put = technic.machine_inventory_put, - allow_metadata_inventory_take = technic.machine_inventory_take, - allow_metadata_inventory_move = technic.machine_inventory_move, - on_receive_fields = form_handler, - technic_run = run, -}) - --- Active state block -minetest.register_node("technic:cnc_active", { - description = S("%s CNC Machine"):format("LV"), - tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png", - "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"}, - groups = {cracky=2, technic_machine=1, technic_lv=1, not_in_creative_inventory=1}, - connect_sides = {"bottom", "back", "left", "right"}, - paramtype2 = "facedir", - drop = "technic:cnc", - legacy_facedir_simple = true, - can_dig = technic.machine_can_dig, - allow_metadata_inventory_put = technic.machine_inventory_put, - allow_metadata_inventory_take = technic.machine_inventory_take, - allow_metadata_inventory_move = technic.machine_inventory_move, - on_receive_fields = form_handler, - technic_run = run, - technic_disabled_machine_name = "technic:cnc", -}) - -technic.register_machine("LV", "technic:cnc", technic.receiver) -technic.register_machine("LV", "technic:cnc_active", technic.receiver) - diff --git a/technic/machines/LV/cnc_api.lua b/technic/machines/LV/cnc_api.lua deleted file mode 100644 index f5aae5c..0000000 --- a/technic/machines/LV/cnc_api.lua +++ /dev/null @@ -1,369 +0,0 @@ --- API for the technic CNC machine --- Again code is adapted from the NonCubic Blocks MOD v1.4 by yves_de_beck - -local S = technic.getter - -technic.cnc = {} - --- REGISTER NONCUBIC FORMS, CREATE MODELS AND RECIPES: ------------------------------------------------------- - --- Define slope boxes for the various nodes -------------------------------------------- -technic.cnc.programs = { - { suffix = "technic_cnc_stick", - model = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}, - desc = S("Stick") - }, - - { suffix = "technic_cnc_element_end_double", - model = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.5}, - desc = S("Element End Double") - }, - - { suffix = "technic_cnc_element_cross_double", - model = { - {0.3, -0.5, -0.3, 0.5, 0.5, 0.3}, - {-0.3, -0.5, -0.5, 0.3, 0.5, 0.5}, - {-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}}, - desc = S("Element Cross Double") - }, - - { suffix = "technic_cnc_element_t_double", - model = { - {-0.3, -0.5, -0.5, 0.3, 0.5, 0.3}, - {-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}, - {0.3, -0.5, -0.3, 0.5, 0.5, 0.3}}, - desc = S("Element T Double") - }, - - { suffix = "technic_cnc_element_edge_double", - model = { - {-0.3, -0.5, -0.5, 0.3, 0.5, 0.3}, - {-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}}, - desc = S("Element Edge Double") - }, - - { suffix = "technic_cnc_element_straight_double", - model = {-0.3, -0.5, -0.5, 0.3, 0.5, 0.5}, - desc = S("Element Straight Double") - }, - - { suffix = "technic_cnc_element_end", - model = {-0.3, -0.5, -0.3, 0.3, 0, 0.5}, - desc = S("Element End") - }, - - { suffix = "technic_cnc_element_cross", - model = { - {0.3, -0.5, -0.3, 0.5, 0, 0.3}, - {-0.3, -0.5, -0.5, 0.3, 0, 0.5}, - {-0.5, -0.5, -0.3, -0.3, 0, 0.3}}, - desc = S("Element Cross") - }, - - { suffix = "technic_cnc_element_t", - model = { - {-0.3, -0.5, -0.5, 0.3, 0, 0.3}, - {-0.5, -0.5, -0.3, -0.3, 0, 0.3}, - {0.3, -0.5, -0.3, 0.5, 0, 0.3}}, - desc = S("Element T") - }, - - { suffix = "technic_cnc_element_edge", - model = { - {-0.3, -0.5, -0.5, 0.3, 0, 0.3}, - {-0.5, -0.5, -0.3, -0.3, 0, 0.3}}, - desc = S("Element Edge") - }, - - { suffix = "technic_cnc_element_straight", - model = {-0.3, -0.5, -0.5, 0.3, 0, 0.5}, - desc = S("Element Straight") - }, - - { suffix = "technic_cnc_oblate_spheroid", - model = "technic_oblate_spheroid.obj", - desc = S("Oblate spheroid"), - cbox = { - type = "fixed", - fixed = { - { -6/16, 4/16, -6/16, 6/16, 8/16, 6/16 }, - { -8/16, -4/16, -8/16, 8/16, 4/16, 8/16 }, - { -6/16, -8/16, -6/16, 6/16, -4/16, 6/16 } - } - } - }, - - { suffix = "technic_cnc_sphere", - model = "technic_sphere.obj", - desc = S("Sphere") - }, - - { suffix = "technic_cnc_cylinder_horizontal", - model = "technic_cylinder_horizontal.obj", - desc = S("Horizontal Cylinder") - }, - - { suffix = "technic_cnc_cylinder", - model = "technic_cylinder.obj", - desc = S("Cylinder") - }, - - { suffix = "technic_cnc_twocurvededge", - model = "technic_two_curved_edge.obj", - desc = S("Two Curved Edge/Corner Block") - }, - - { suffix = "technic_cnc_onecurvededge", - model = "technic_one_curved_edge.obj", - desc = S("One Curved Edge Block") - }, - - { suffix = "technic_cnc_spike", - model = "technic_pyramid_spike.obj", - desc = S("Spike"), - cbox = { - type = "fixed", - fixed = { - { -2/16, 4/16, -2/16, 2/16, 8/16, 2/16 }, - { -4/16, 0, -4/16, 4/16, 4/16, 4/16 }, - { -6/16, -4/16, -6/16, 6/16, 0, 6/16 }, - { -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 } - } - } - }, - - { suffix = "technic_cnc_pyramid", - model = "technic_pyramid.obj", - desc = S("Pyramid"), - cbox = { - type = "fixed", - fixed = { - { -2/16, -2/16, -2/16, 2/16, 0, 2/16 }, - { -4/16, -4/16, -4/16, 4/16, -2/16, 4/16 }, - { -6/16, -6/16, -6/16, 6/16, -4/16, 6/16 }, - { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 } - } - } - }, - - { suffix = "technic_cnc_slope_inner_edge_upsdown", - model = "technic_innercorner_upsdown.obj", - desc = S("Slope Upside Down Inner Edge/Corner"), - sbox = { - type = "fixed", - fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } - }, - cbox = { - type = "fixed", - fixed = { - { 0.25, -0.25, -0.5, 0.5, -0.5, 0.5 }, - { -0.5, -0.25, 0.25, 0.5, -0.5, 0.5 }, - { 0, 0, -0.5, 0.5, -0.25, 0.5 }, - { -0.5, 0, 0, 0.5, -0.25, 0.5 }, - { -0.25, 0.25, -0.5, 0.5, 0, -0.25 }, - { -0.5, 0.25, -0.25, 0.5, 0, 0.5 }, - { -0.5, 0.5, -0.5, 0.5, 0.25, 0.5 } - } - } - }, - - { suffix = "technic_cnc_slope_edge_upsdown", - model = "technic_outercorner_upsdown.obj", - desc = S("Slope Upside Down Outer Edge/Corner"), - cbox = { - type = "fixed", - fixed = { - { -8/16, 8/16, -8/16, 8/16, 4/16, 8/16 }, - { -4/16, 4/16, -4/16, 8/16, 0, 8/16 }, - { 0, 0, 0, 8/16, -4/16, 8/16 }, - { 4/16, -4/16, 4/16, 8/16, -8/16, 8/16 } - } - } - }, - - { suffix = "technic_cnc_slope_inner_edge", - model = "technic_innercorner.obj", - desc = S("Slope Inner Edge/Corner"), - sbox = { - type = "fixed", - fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } - }, - cbox = { - type = "fixed", - fixed = { - { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, - { -0.5, -0.25, -0.25, 0.5, 0, 0.5 }, - { -0.25, -0.25, -0.5, 0.5, 0, -0.25 }, - { -0.5, 0, 0, 0.5, 0.25, 0.5 }, - { 0, 0, -0.5, 0.5, 0.25, 0.5 }, - { -0.5, 0.25, 0.25, 0.5, 0.5, 0.5 }, - { 0.25, 0.25, -0.5, 0.5, 0.5, 0.5 } - } - } - }, - - { suffix = "technic_cnc_slope_edge", - model = "technic_outercorner.obj", - desc = S("Slope Outer Edge/Corner"), - cbox = { - type = "fixed", - fixed = { - { 4/16, 4/16, 4/16, 8/16, 8/16, 8/16 }, - { 0, 0, 0, 8/16, 4/16, 8/16 }, - { -4/16, -4/16, -4/16, 8/16, 0, 8/16 }, - { -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 } - } - } - }, - - { suffix = "technic_cnc_slope_upsdown", - model = "technic_slope_upsdown.obj", - desc = S("Slope Upside Down"), - cbox = { - type = "fixed", - fixed = { - { -8/16, 8/16, -8/16, 8/16, 4/16, 8/16 }, - { -8/16, 4/16, -4/16, 8/16, 0, 8/16 }, - { -8/16, 0, 0, 8/16, -4/16, 8/16 }, - { -8/16, -4/16, 4/16, 8/16, -8/16, 8/16 } - } - } - }, - - { suffix = "technic_cnc_slope_lying", - model = "technic_slope_horizontal.obj", - desc = S("Slope Lying"), - cbox = { - type = "fixed", - fixed = { - { 4/16, -8/16, 4/16, 8/16, 8/16, 8/16 }, - { 0, -8/16, 0, 4/16, 8/16, 8/16 }, - { -4/16, -8/16, -4/16, 0, 8/16, 8/16 }, - { -8/16, -8/16, -8/16, -4/16, 8/16, 8/16 } - } - } - }, - - { suffix = "technic_cnc_slope", - model = "technic_slope.obj", - desc = S("Slope"), - cbox = { - type = "fixed", - fixed = { - { -8/16, 4/16, 4/16, 8/16, 8/16, 8/16 }, - { -8/16, 0, 0, 8/16, 4/16, 8/16 }, - { -8/16, -4/16, -4/16, 8/16, 0, 8/16 }, - { -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 } - } - } - }, - -} - --- Allow disabling certain programs for some node. Default is allowing all types for all nodes -technic.cnc.programs_disable = { - -- ["default:brick"] = {"technic_cnc_stick"}, -- Example: Disallow the stick for brick - -- ... - ["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"} -} - --- Generic function for registering all the different node types -function technic.cnc.register_program(recipeitem, suffix, model, groups, images, description, cbox, sbox) - - local dtype - local nodeboxdef - local meshdef - - if type(model) ~= "string" then -- assume a nodebox if it's a table or function call - dtype = "nodebox" - nodeboxdef = { - type = "fixed", - fixed = model - } - else - dtype = "mesh" - meshdef = model - end - - if cbox and not sbox then sbox = cbox end - - minetest.register_node(":"..recipeitem.."_"..suffix, { - description = description, - drawtype = dtype, - node_box = nodeboxdef, - mesh = meshdef, - tiles = images, - paramtype = "light", - paramtype2 = "facedir", - walkable = true, - groups = groups, - selection_box = sbox, - collision_box = cbox - }) -end - --- function to iterate over all the programs the CNC machine knows -function technic.cnc.register_all(recipeitem, groups, images, description) - for _, data in ipairs(technic.cnc.programs) do - -- Disable node creation for disabled node types for some material - local do_register = true - if technic.cnc.programs_disable[recipeitem] ~= nil then - for __, disable in ipairs(technic.cnc.programs_disable[recipeitem]) do - if disable == data.suffix then - do_register = false - end - end - end - -- Create the node if it passes the test - if do_register then - technic.cnc.register_program(recipeitem, data.suffix, data.model, - groups, images, description.." "..data.desc, data.cbox, data.sbox) - end - end -end - - --- REGISTER NEW TECHNIC_CNC_API's PART 2: technic.cnc..register_element_end(subname, recipeitem, groups, images, desc_element_xyz) ------------------------------------------------------------------------------------------------------------------------ -function technic.cnc.register_slope_edge_etc(recipeitem, groups, images, desc_slope, desc_slope_lying, desc_slope_upsdown, desc_slope_edge, desc_slope_inner_edge, desc_slope_upsdwn_edge, desc_slope_upsdwn_inner_edge, desc_pyramid, desc_spike, desc_onecurvededge, desc_twocurvededge, desc_cylinder, desc_cylinder_horizontal, desc_spheroid, desc_element_straight, desc_element_edge, desc_element_t, desc_element_cross, desc_element_end) - - technic.cnc.register_slope(recipeitem, groups, images, desc_slope) - technic.cnc.register_slope_lying(recipeitem, groups, images, desc_slope_lying) - technic.cnc.register_slope_upsdown(recipeitem, groups, images, desc_slope_upsdown) - technic.cnc.register_slope_edge(recipeitem, groups, images, desc_slope_edge) - technic.cnc.register_slope_inner_edge(recipeitem, groups, images, desc_slope_inner_edge) - technic.cnc.register_slope_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_edge) - technic.cnc.register_slope_inner_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_inner_edge) - technic.cnc.register_pyramid(recipeitem, groups, images, desc_pyramid) - technic.cnc.register_spike(recipeitem, groups, images, desc_spike) - technic.cnc.register_onecurvededge(recipeitem, groups, images, desc_onecurvededge) - technic.cnc.register_twocurvededge(recipeitem, groups, images, desc_twocurvededge) - technic.cnc.register_cylinder(recipeitem, groups, images, desc_cylinder) - technic.cnc.register_cylinder_horizontal(recipeitem, groups, images, desc_cylinder_horizontal) - technic.cnc.register_spheroid(recipeitem, groups, images, desc_spheroid) - technic.cnc.register_element_straight(recipeitem, groups, images, desc_element_straight) - technic.cnc.register_element_edge(recipeitem, groups, images, desc_element_edge) - technic.cnc.register_element_t(recipeitem, groups, images, desc_element_t) - technic.cnc.register_element_cross(recipeitem, groups, images, desc_element_cross) - technic.cnc.register_element_end(recipeitem, groups, images, desc_element_end) -end - --- REGISTER STICKS: noncubic.register_xyz(recipeitem, groups, images, desc_element_xyz) ------------------------------------------------------------------------------------------------------------- -function technic.cnc.register_stick_etc(recipeitem, groups, images, desc_stick) - technic.cnc.register_stick(recipeitem, groups, images, desc_stick) -end - -function technic.cnc.register_elements(recipeitem, groups, images, desc_element_straight_double, desc_element_edge_double, desc_element_t_double, desc_element_cross_double, desc_element_end_double) - technic.cnc.register_element_straight_double(recipeitem, groups, images, desc_element_straight_double) - technic.cnc.register_element_edge_double(recipeitem, groups, images, desc_element_edge_double) - technic.cnc.register_element_t_double(recipeitem, groups, images, desc_element_t_double) - technic.cnc.register_element_cross_double(recipeitem, groups, images, desc_element_cross_double) - technic.cnc.register_element_end_double(recipeitem, groups, images, desc_element_end_double) -end - diff --git a/technic/machines/LV/cnc_nodes.lua b/technic/machines/LV/cnc_nodes.lua deleted file mode 100644 index 05be9af..0000000 --- a/technic/machines/LV/cnc_nodes.lua +++ /dev/null @@ -1,91 +0,0 @@ --- REGISTER MATERIALS AND PROPERTIES FOR NONCUBIC ELEMENTS: ------------------------------------------------------------ - -local S = technic.getter - --- DIRT -------- -technic.cnc.register_all("default:dirt", - {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1}, - {"default_grass.png", "default_dirt.png", "default_grass.png"}, - S("Dirt")) --- WOOD -------- -technic.cnc.register_all("default:wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"default_wood.png"}, - S("Wooden")) --- STONE --------- -technic.cnc.register_all("default:stone", - {cracky=3, not_in_creative_inventory=1}, - {"default_stone.png"}, - S("Stone")) --- COBBLE ---------- -technic.cnc.register_all("default:cobble", - {cracky=3, not_in_creative_inventory=1}, - {"default_cobble.png"}, - S("Cobble")) --- BRICK --------- -technic.cnc.register_all("default:brick", - {cracky=3, not_in_creative_inventory=1}, - {"default_brick.png"}, - S("Brick")) - --- SANDSTONE ------------- -technic.cnc.register_all("default:sandstone", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_sandstone.png"}, - S("Sandstone")) - --- LEAVES ---------- -technic.cnc.register_all("default:leaves", - {snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1}, - {"default_leaves.png"}, - S("Leaves")) --- TREE -------- -technic.cnc.register_all("default:tree", - {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1}, - {"default_tree.png"}, - S("Tree")) - --- WROUGHT IRON ---------------- -technic.cnc.register_all("default:steelblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"technic_wrought_iron_block.png"}, - S("Wrought Iron")) - --- Bronze --------- -technic.cnc.register_all("default:bronzeblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"default_bronze_block.png"}, - S("Bronze")) - --- Stainless Steel --------- -technic.cnc.register_all("technic:stainless_steel_block", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"technic_stainless_steel_block.png"}, - S("Stainless Steel")) - --- Marble ------------- -technic.cnc.register_all("technic:marble", - {cracky=3, not_in_creative_inventory=1}, - {"technic_marble.png"}, - S("Marble")) - --- Granite ------------- -technic.cnc.register_all("technic:granite", - {cracky=1, not_in_creative_inventory=1}, - {"technic_granite.png"}, - S("Granite")) - diff --git a/technic/machines/LV/init.lua b/technic/machines/LV/init.lua index 30523c9..fde684d 100644 --- a/technic/machines/LV/init.lua +++ b/technic/machines/LV/init.lua @@ -22,8 +22,3 @@ dofile(path.."/extractor.lua") dofile(path.."/compressor.lua") dofile(path.."/music_player.lua") - -dofile(path.."/cnc.lua") -dofile(path.."/cnc_api.lua") -dofile(path.."/cnc_nodes.lua") - diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index 1e8cee9..924128e 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -117,6 +117,19 @@ local function clear_networks(pos) end end +local function item_place_override_node(itemstack, placer, pointed, node) + -- Call the default on_place function with a fake itemstack + local temp_itemstack = ItemStack(itemstack) + temp_itemstack:set_name(node.name) + local original_count = temp_itemstack:get_count() + temp_itemstack = + minetest.item_place(temp_itemstack, placer, pointed, node.param2) or + temp_itemstack + -- Remove the same number of items from the real itemstack + itemstack:take_item(original_count - temp_itemstack:get_count()) + return itemstack +end + function technic.register_cable(tier, size) local ltier = string.lower(tier) cable_tier["technic:"..ltier.."_cable"] = tier @@ -228,11 +241,10 @@ function technic.register_cable(tier, size) num = xyz[((fine_pointed[bigger] < 0 and "-") or "") .. bigger] end end - minetest.set_node(pointed_thing.above, {name = "technic:"..ltier.."_cable_plate_"..num}) - if not (creative and creative.is_enabled_for(placer)) then - itemstack:take_item() - end - return itemstack + return item_place_override_node( + itemstack, placer, pointed_thing, + {name = "technic:"..ltier.."_cable_plate_"..num} + ) end else def.groups.not_in_creative_inventory = 1 -- cgit v1.2.3