mirror of
https://github.com/minetest-mods/technic.git
synced 2025-07-03 08:40:36 +02:00
Merge https://github.com/minetest-mods/technic into pandorabox
This commit is contained in:
@ -17,7 +17,7 @@ local cable_entry = "^technic_cable_connection_overlay.png"
|
||||
minetest.register_craft({
|
||||
output = "technic:forcefield_emitter_off",
|
||||
recipe = {
|
||||
{"default:mese", "technic:motor", "default:mese" },
|
||||
{"default:mese", "basic_materials:motor", "default:mese" },
|
||||
{"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"},
|
||||
{"default:mese", "technic:hv_cable", "default:mese" },
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ local cable_entry = "^technic_cable_connection_overlay.png"
|
||||
minetest.register_craft({
|
||||
recipe = {
|
||||
{"technic:carbon_plate", "pipeworks:filter", "technic:composite_plate"},
|
||||
{"technic:motor", "technic:machine_casing", "technic:diamond_drill_head"},
|
||||
{"basic_materials:motor", "technic:machine_casing", "technic:diamond_drill_head"},
|
||||
{"technic:carbon_steel_block", "technic:hv_cable", "technic:carbon_steel_block"}},
|
||||
output = "technic:quarry",
|
||||
})
|
||||
|
@ -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', 'technic: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)
|
||||
|
@ -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
|
||||
|
@ -4,10 +4,14 @@ minetest.register_alias("compressor", "technic:lv_compressor")
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_compressor',
|
||||
recipe = {
|
||||
{'default:stone', 'technic:motor', 'default:stone'},
|
||||
{'default:stone', 'basic_materials:motor', 'default:stone'},
|
||||
{'mesecons:piston', 'technic:machine_casing', 'mesecons:piston'},
|
||||
{'technic:fine_silver_wire', 'technic:lv_cable', 'technic:fine_silver_wire'},
|
||||
}
|
||||
{'basic_materials:silver_wire', 'technic:lv_cable', 'basic_materials:silver_wire'},
|
||||
},
|
||||
replacements = {
|
||||
{"basic_materials:silver_wire", "basic_materials:empty_spool"},
|
||||
{"basic_materials:silver_wire", "basic_materials:empty_spool"}
|
||||
},
|
||||
})
|
||||
|
||||
technic.register_compressor({tier = "LV", demand = {300}, speed = 1})
|
||||
|
@ -4,7 +4,7 @@ minetest.register_alias("extractor", "technic:lv_extractor")
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_extractor',
|
||||
recipe = {
|
||||
{'technic:treetap', 'technic:motor', 'technic:treetap'},
|
||||
{'technic:treetap', 'basic_materials:motor', 'technic:treetap'},
|
||||
{'technic:treetap', 'technic:machine_casing', 'technic:treetap'},
|
||||
{'', 'technic:lv_cable', ''},
|
||||
}
|
||||
|
@ -11,9 +11,13 @@ minetest.register_craft({
|
||||
output = 'technic:geothermal',
|
||||
recipe = {
|
||||
{'technic:granite', 'default:diamond', 'technic:granite'},
|
||||
{'technic:fine_copper_wire', 'technic:machine_casing', 'technic:fine_copper_wire'},
|
||||
{'basic_materials:copper_wire', 'technic:machine_casing', 'basic_materials:copper_wire'},
|
||||
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
|
||||
}
|
||||
},
|
||||
replacements = {
|
||||
{"basic_materials:copper_wire", "basic_materials:empty_spool"},
|
||||
{"basic_materials:copper_wire", "basic_materials:empty_spool"}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:geothermal", {
|
||||
|
@ -23,8 +23,6 @@ dofile(path.."/compressor.lua")
|
||||
|
||||
dofile(path.."/music_player.lua")
|
||||
|
||||
dofile(path.."/cnc.lua")
|
||||
dofile(path.."/cnc_api.lua")
|
||||
dofile(path.."/cnc_nodes.lua")
|
||||
|
||||
dofile(path.."/lamp.lua")
|
||||
dofile(path.."/lamp.lua")
|
||||
|
@ -9,9 +9,9 @@ minetest.register_craft({
|
||||
output = 'technic:solar_panel',
|
||||
recipe = {
|
||||
{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'},
|
||||
{'technic:fine_silver_wire', 'technic:lv_cable', 'mesecons_materials:glue'},
|
||||
|
||||
}
|
||||
{'basic_materials:silver_wire', 'technic:lv_cable', 'mesecons_materials:glue'},
|
||||
},
|
||||
replacements = { {"basic_materials:silver_wire", "basic_materials:empty_spool"}, },
|
||||
})
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
minetest.register_craft({
|
||||
output = "technic:mv_centrifuge",
|
||||
recipe = {
|
||||
{"technic:motor", "technic:copper_plate", "technic:diamond_drill_head"},
|
||||
{"basic_materials:motor", "technic:copper_plate", "technic:diamond_drill_head"},
|
||||
{"technic:copper_plate", "technic:machine_casing", "technic:copper_plate" },
|
||||
{"pipeworks:one_way_tube", "technic:mv_cable", "pipeworks:mese_filter" },
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = 'technic:wind_mill',
|
||||
recipe = {
|
||||
{'', 'technic:motor', ''},
|
||||
{'', 'basic_materials:motor', ''},
|
||||
{'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot'},
|
||||
{'', 'technic:mv_cable', ''},
|
||||
}
|
||||
|
@ -979,7 +979,7 @@ minetest.register_craft({
|
||||
output = 'technic:frame_111111',
|
||||
recipe = {
|
||||
{ '', 'default:stick', '' },
|
||||
{ 'default:stick', 'technic:brass_ingot', 'default:stick' },
|
||||
{ 'default:stick', 'basic_materials:brass_ingot', 'default:stick' },
|
||||
{ '', 'default:stick', '' },
|
||||
}
|
||||
})
|
||||
@ -988,7 +988,7 @@ minetest.register_craft({
|
||||
output = 'technic:frame_motor',
|
||||
recipe = {
|
||||
{ '', 'technic:frame_111111', '' },
|
||||
{ 'group:mesecon_conductor_craftable', 'technic:motor', 'group:mesecon_conductor_craftable' },
|
||||
{ 'group:mesecon_conductor_craftable', 'basic_materials:motor', 'group:mesecon_conductor_craftable' },
|
||||
{ '', 'technic:frame_111111', '' },
|
||||
}
|
||||
})
|
||||
@ -996,9 +996,9 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
output = 'technic:template 10',
|
||||
recipe = {
|
||||
{ '', 'technic:brass_ingot', '' },
|
||||
{ 'technic:brass_ingot', 'default:mese_crystal', 'technic:brass_ingot' },
|
||||
{ '', 'technic:brass_ingot', '' },
|
||||
{ '', 'basic_materials:brass_ingot', '' },
|
||||
{ 'basic_materials:brass_ingot', 'default:mese_crystal', 'basic_materials:brass_ingot' },
|
||||
{ '', 'basic_materials:brass_ingot', '' },
|
||||
}
|
||||
})
|
||||
|
||||
@ -1016,7 +1016,7 @@ minetest.register_craft({
|
||||
output = 'technic:template_motor',
|
||||
recipe = {
|
||||
{ '', 'technic:template', '' },
|
||||
{ 'group:mesecon_conductor_craftable', 'technic:motor', 'group:mesecon_conductor_craftable' },
|
||||
{ 'group:mesecon_conductor_craftable', 'basic_materials:motor', 'group:mesecon_conductor_craftable' },
|
||||
{ '', 'technic:template', '' },
|
||||
}
|
||||
})
|
||||
|
@ -21,7 +21,7 @@ local recipes = {
|
||||
{"technic:carbon_steel_dust 3", "technic:chromium_dust", "technic:stainless_steel_dust 4"},
|
||||
{"technic:carbon_steel_ingot 3", "technic:chromium_ingot", "technic:stainless_steel_ingot 4"},
|
||||
{"technic:copper_dust 2", "technic:zinc_dust", "technic:brass_dust 3"},
|
||||
{"default:copper_ingot 2", "technic:zinc_ingot", "technic:brass_ingot 3"},
|
||||
{"default:copper_ingot 2", "technic:zinc_ingot", "basic_materials:brass_ingot 3"},
|
||||
{"default:sand 2", "technic:coal_dust 2", "technic:silicon_wafer"},
|
||||
{"technic:silicon_wafer", "technic:gold_dust", "technic:doped_silicon_wafer"},
|
||||
-- from https://en.wikipedia.org/wiki/Carbon_black
|
||||
|
@ -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
|
||||
|
@ -98,7 +98,7 @@ local function register_dust(name, ingot)
|
||||
end
|
||||
|
||||
-- Sorted alphibeticaly
|
||||
register_dust("Brass", "technic:brass_ingot")
|
||||
register_dust("Brass", "basic_materials:brass_ingot")
|
||||
register_dust("Bronze", "default:bronze_ingot")
|
||||
register_dust("Carbon Steel", "technic:carbon_steel_ingot")
|
||||
register_dust("Cast Iron", "technic:cast_iron_ingot")
|
||||
|
@ -201,10 +201,11 @@ minetest.register_node("technic:supply_converter", {
|
||||
minetest.register_craft({
|
||||
output = 'technic:supply_converter 1',
|
||||
recipe = {
|
||||
{'technic:fine_gold_wire', 'technic:rubber', 'technic:doped_silicon_wafer'},
|
||||
{'basic_materials:gold_wire', 'technic:rubber', 'technic:doped_silicon_wafer'},
|
||||
{'technic:mv_transformer', 'technic:machine_casing', 'technic:lv_transformer'},
|
||||
{'technic:mv_cable', 'technic:rubber', 'technic:lv_cable'},
|
||||
}
|
||||
},
|
||||
replacements = { {"basic_materials:gold_wire", "basic_materials:empty_spool"}, },
|
||||
})
|
||||
|
||||
for tier, machines in pairs(technic.machines) do
|
||||
|
Reference in New Issue
Block a user