code:
-- 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_cnc.getter

local allow_metadata_inventory_put
local allow_metadata_inventory_take
local allow_metadata_inventory_move
local can_dig
local desc_tr = S("CNC Machine")

if technic_cnc.use_technic then
	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'},
		},
	})

	allow_metadata_inventory_put = technic.machine_inventory_put
	allow_metadata_inventory_take = technic.machine_inventory_take
	allow_metadata_inventory_move = technic.machine_inventory_move
	can_dig = technic.machine_can_dig
	desc_tr = S("%s CNC Machine"):format("LV")
else
	minetest.register_craft({
		output = 'technic:cnc',
		recipe = {
			{'default:glass',       'default:diamond',    'default:glass'},
			{'basic_materials:ic',  'default:steelblock', 'basic_materials:motor'},
			{'default:steel_ingot', 'default:mese',       'default:steel_ingot'},
		},
	})

	allow_metadata_inventory_put = function(pos, listname, index, stack, player)
		if minetest.is_protected(pos, player:get_player_name()) then
			return 0
		end
		return stack:get_count()
	end

	allow_metadata_inventory_take = function(pos, listname, index, stack, player)
		if minetest.is_protected(pos, player:get_player_name()) then
			return 0
		end
		return stack:get_count()
	end

	allow_metadata_inventory_move = function(pos, from_list, from_index,
	                                to_list, to_index, count, player)
		if minetest.is_protected(pos, player:get_player_name()) then
			return 0
		end
		return count
	end

	can_dig = function(pos, player)
		if player and minetest.is_protected(pos, player:get_player_name()) then return false end
		local meta = minetest.get_meta(pos);
		local inv = meta:get_inventory()
		return inv:is_empty("dst")
			and inv:is_empty("src")
			and default.can_interact_with_node(player, pos)
	end
end

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         = 2,
	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]"

-- 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)
	local meta       = minetest.get_meta(pos)

	-- REGISTER MILLING PROGRAMS AND OUTPUTS:
	------------------------------------------
	-- Program for half/full size
	if fields["full"] then
		meta:set_int("size", 1)
		return
	end

	if fields["half"] then
		meta:set_int("size", 2)
		return
	end

	-- Resolve the node name and the number of items to make
	local inv        = meta:get_inventory()
	local inputstack = inv:get_stack("src", 1)
	local inputname  = inputstack:get_name()
	local multiplier = 0
	local size       = meta:get_int("size")
	if size < 1 then size = 1 end

	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

	if not technic_cnc.use_technic then
		local result = meta:get_string("cnc_product")

		if not inv:is_empty("src")
		  and minetest.registered_nodes[result]
		  and inv:room_for_item("dst", result) then
			local 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
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 = desc_tr
	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)
			local 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 = desc_tr,
	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", desc_tr)
		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 = can_dig,
	allow_metadata_inventory_put = allow_metadata_inventory_put,
	allow_metadata_inventory_take = allow_metadata_inventory_take,
	allow_metadata_inventory_move = allow_metadata_inventory_move,
	on_receive_fields = form_handler,
	technic_run = technic_cnc.use_technic and run,
})

-- Active state block
if technic_cnc.use_technic then

	minetest.register_node(":technic:cnc_active", {
		description = desc_tr,
		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 = can_dig,
		allow_metadata_inventory_put = allow_metadata_inventory_put,
		allow_metadata_inventory_take = allow_metadata_inventory_take,
		allow_metadata_inventory_move = allow_metadata_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)
else
	minetest.register_alias("technic:cnc_active", "technic:cnc")
end


code:
-- REGISTER MATERIALS AND PROPERTIES FOR NONCUBIC ELEMENTS:
-----------------------------------------------------------

local S = technic_cnc.getter

-- DIRT
-------
technic_cnc.register_all("default:dirt",
                {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
                {"default_dirt.png"},
                S("Dirt"))
-- (DIRT WITH) GRASS
--------------------
technic_cnc.register_all("default:dirt_with_grass",
                {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
                {"default_grass.png"},
                S("Grassy 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"))

technic_cnc.register_all("default:junglewood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"default_junglewood.png"},
                S("Junglewood"))

technic_cnc.register_all("default:pine_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"default_pine_wood.png"},
                S("Pine"))

technic_cnc.register_all("default:acacia_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"default_acacia_wood.png"},
                S("Acacia"))

technic_cnc.register_all("default:aspen_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"default_aspen_wood.png"},
                S("Aspen"))

-- STONE
--------
technic_cnc.register_all("default:stone",
                {cracky=3, stone=1, not_in_creative_inventory=1},
                {"default_stone.png"},
                S("Stone"))

technic_cnc.register_all("default:stonebrick",
                {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1},
                {"default_stone_brick.png"},
                S("Stone Brick"))

technic_cnc.register_all("default:stone_block",
                {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1},
                {"default_stone_block.png"},
                S("Stone Block"))

technic_cnc.register_all("default:desert_stone",
                {cracky=3, stone=1, not_in_creative_inventory=1},
                {"default_desert_stone.png"},
                S("Desert Stone"))

technic_cnc.register_all("default:desert_stonebrick",
                {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1},
                {"default_desert_stone_brick.png"},
                S("Desert Stone Brick"))

technic_cnc.register_all("default:desert_stone_block",
                {crumbly=2, cracky=3, stone=1, not_in_creative_inventory=1},
                {"default_desert_stone_block.png"},
                S("Desert Stone Block"))

-- COBBLE
---------
technic_cnc.register_all("default:cobble",
                {cracky=3, stone=1, not_in_creative_inventory=1},
                {"default_cobble.png"},
                S("Cobble"))

technic_cnc.register_all("default:mossycobble",
                {cracky=3, stone=1, not_in_creative_inventory=1},
                {"default_mossycobble.png"},
                S("Mossy Cobblestone"))

technic_cnc.register_all("default:desert_cobble",
                {cracky=3, stone=1, not_in_creative_inventory=1},
                {"default_desert_cobble.png"},
                S("Desert 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"))

technic_cnc.register_all("default:sandstonebrick",
                {crumbly=2, cracky=3, not_in_creative_inventory=1},
                {"default_sandstone_brick.png"},
                S("Sandstone Brick"))

technic_cnc.register_all("default:sandstone_block",
                {crumbly=2, cracky=3, not_in_creative_inventory=1},
                {"default_sandstone_block.png"},
                S("Sandstone Block"))

technic_cnc.register_all("default:desert_sandstone",
                {crumbly=2, cracky=3, not_in_creative_inventory=1},
                {"default_desert_sandstone.png"},
                S("Desert Sandstone"))

technic_cnc.register_all("default:desert_sandstone_brick",
                {crumbly=2, cracky=3, not_in_creative_inventory=1},
                {"default_desert_sandstone_brick.png"},
                S("Desert Sandstone Brick"))

technic_cnc.register_all("default:desert_sandstone_block",
                {crumbly=2, cracky=3, not_in_creative_inventory=1},
                {"default_desert_sandstone_block.png"},
                S("Desert Sandstone Block"))

technic_cnc.register_all("default:silver_sandstone",
                {crumbly=2, cracky=3, not_in_creative_inventory=1},
                {"default_silver_sandstone.png"},
                S("Silver Sandstone"))

technic_cnc.register_all("default:silver_sandstone_brick",
                {crumbly=2, cracky=3, not_in_creative_inventory=1},
                {"default_silver_sandstone_brick.png"},
                S("Silver Sandstone Brick"))

technic_cnc.register_all("default:silver_sandstone_block",
                {crumbly=2, cracky=3, not_in_creative_inventory=1},
                {"default_silver_sandstone_block.png"},
                S("Silver Sandstone Block"))

-- 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"))

-- ICE
-------
technic_cnc.register_all("default:ice",
                {cracky=3, puts_out_fire=1, cools_lava=1, not_in_creative_inventory=1},
                {"default_ice.png"},
                S("Ice"))

-- OBSIDIAN
-----------
technic_cnc.register_all("default:obsidian_block",
                {cracky=1, level=2, not_in_creative_inventory=1},
                {"default_obsidian_block.png"},
                S("Obsidian"))

-- 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"))

-- Zinc
--------
technic_cnc.register_all("technic:zinc_block",
                {cracky=1, level=2, not_in_creative_inventory=1},
                {"technic_zinc_block.png"},
                S("Zinc"))

local steeltex = "default_steel_block.png"
local steelname = "Steel"

-- Cast Iron
------------
technic_cnc.register_all("technic:cast_iron_block",
                {cracky=1, level=2, not_in_creative_inventory=1},
                {"technic_cast_iron_block.png"},
                S("Cast Iron"))

if technic_cnc.technic_modpath then
	steeltex = "technic_wrought_iron_block.png"
	steelname = "Wrought Iron"

	-- 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"))

	-- Blast-resistant concrete
	---------------------------

	technic_cnc.register_all("technic:blast_resistant_concrete",
					{cracky=2, level=2, not_in_creative_inventory=1},
					{"technic_blast_resistant_concrete_block.png"},
					S("Blast-resistant concrete"))
end

technic_cnc.register_all("default:steelblock",
				{cracky=1, level=2, not_in_creative_inventory=1},
				{steeltex},
				S(steelname))

-- CONCRETE AND CEMENT
----------------------

technic_cnc.register_all("basic_materials:concrete_block",
				{cracky=2, level=2, not_in_creative_inventory=1},
				{"basic_materials_concrete_block.png"},
				S("Concrete"))

technic_cnc.register_all("basic_materials:cement_block",
				{cracky=2, level=2, not_in_creative_inventory=1},
				{"basic_materials_cement_block.png"},
				S("Cement"))

technic_cnc.register_all("basic_materials:brass_block",
				{cracky=1, level=2, not_in_creative_inventory=1},
				{"basic_materials_brass_block.png"},
				S("Brass block"))
-- Brass
--------
technic_cnc.register_all("technic:brass_block",
                {cracky=1, level=2, not_in_creative_inventory=1},
		{"basic_materials_brass_block.png"},
                S("Brass"))

-- Copper
---------
technic_cnc.register_all("default:copperblock",
                {cracky=1, level=2, not_in_creative_inventory=1},
                {"default_copper_block.png"},
                S("Copper"))

-- Tin
------
technic_cnc.register_all("default:tinblock",
                {cracky=1, level=2, not_in_creative_inventory=1},
                {"default_tin_block.png"},
                S("Tin"))

-- Gold
-------
technic_cnc.register_all("default:goldblock",
                {cracky=1, level=2, not_in_creative_inventory=1},
                {"default_gold_block.png"},
                S("Gold"))

if minetest.get_modpath("ethereal") then
	-- Glostone
	------------
	technic_cnc.register_all("ethereal:glostone",
			{cracky=1, not_in_creative_inventory=1, light_source=13},
			{"glostone.png"},
			S("Glo Stone"))

	-- Crystal block
	----------------
	technic_cnc.register_all("ethereal:crystal_block",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"crystal_block.png"},
                S("Crystal"))

	-- Misc. Wood types
	-------------------
	technic_cnc.register_all("ethereal:banana_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"banana_wood.png"},
                S("Banana Wood"))

	technic_cnc.register_all("ethereal:birch_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"moretrees_birch_wood.png"},
                S("Birch Wood"))

	technic_cnc.register_all("ethereal:frost_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"frost_wood.png"},
                S("Frost Wood"))

	technic_cnc.register_all("ethereal:palm_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"moretrees_palm_wood.png"},
                S("Palm Wood"))

	technic_cnc.register_all("ethereal:willow_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"willow_wood.png"},
                S("Willow Wood"))

	technic_cnc.register_all("ethereal:yellow_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"yellow_wood.png"},
                S("Healing Tree Wood"))

	technic_cnc.register_all("ethereal:redwood_wood",
                {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
                {"redwood_wood.png"},
                S("Redwood"))
end

if minetest.get_modpath("moreblocks") then
	-- Tiles
	------------
	technic_cnc.register_all("moreblocks:stone_tile",
			{stone=1, cracky=3, not_in_creative_inventory=1},
			{"moreblocks_stone_tile.png"},
			S("Stone Tile"))

	technic_cnc.register_all("moreblocks:split_stone_tile",
			{stone=1, cracky=3, not_in_creative_inventory=1},
			{"moreblocks_split_stone_tile.png"},
			S("Split Stone Tile"))

	technic_cnc.register_all("moreblocks:checker_stone_tile",
			{stone=1, cracky=3, not_in_creative_inventory=1},
			{"moreblocks_checker_stone_tile.png"},
			S("Checker Stone Tile"))

	technic_cnc.register_all("moreblocks:cactus_checker",
			{stone=1, cracky=3, not_in_creative_inventory=1},
			{"moreblocks_cactus_checker.png"},
			S("Cactus Checker"))

	-- Bricks
	------------
	technic_cnc.register_all("moreblocks:cactus_brick",
			{cracky=3, not_in_creative_inventory=1},
			{"moreblocks_cactus_brick.png"},
			S("Cactus Brick"))

	technic_cnc.register_all("moreblocks:grey_bricks",
			{cracky=3, not_in_creative_inventory=1},
			{"moreblocks_grey_bricks.png"},
			S("Grey Bricks"))

	-- Metals
	------------
	technic_cnc.register_all("moreblocks:copperpatina",
			{cracky=1, level=2, not_in_creative_inventory=1},
			{"moreblocks_copperpatina.png"},
			S("Copper Patina"))

	-- 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

repo_name: Desour/PlayMinetestServer

license: mit


code:
default
basic_materials
technic?


code:
local modpath = minetest.get_modpath("technic_cnc")

technic_cnc = {}

technic_cnc.technic_modpath = minetest.get_modpath("technic")

technic_cnc.use_technic = technic_cnc.technic_modpath
                          and minetest.settings:get_bool("technic_cnc_use_technic") ~= false

if rawget(_G, "intllib") then
	technic_cnc.getter = intllib.Getter()
else
	technic_cnc.getter = function(s,a,...)if a==nil then return s end a={a,...}return s:gsub("(@?)@(%(?)(%d+)(%)?)",function(e,o,n,c)if e==""then return a[tonumber(n)]..(o==""and c or"")else return"@"..o..n..c end end) end
end

dofile(modpath.."/cnc.lua")
dofile(modpath.."/cnc_api.lua")
dofile(modpath.."/cnc_materials.lua")


code:
## CNC
CNC Machine = CNC-Maschine
%s CNC Machine = %s CNC-Maschine
Cylinder = Zylinder
Element Cross = Halbes Kreuzelement
Element Cross Double = Kreuzelement
Element Edge = Halbes Eckelement
Element Edge Double = Eckelement
Element End = Halbes Endelement
Element End Double = Endelement
Element Straight = Halbes aufrechtes Element
Element Straight Double = Aufrechtes Element
Element T = Halbes T-Element
Element T Double = T-Element
Horizontal Cylinder = Liegender Zylinder
One Curved Edge Block = Block mit einer abgerundeten Kante
Pyramid = Pyramide
Slope = Schraege
Slope Edge = Schraege mit Ecke
Slope Inner Edge = Schraege mit Innenecke
Slope Lying = Liegende Schraege
Slope Upside Down = Umgedrehte Schraege
Slope Upside Down Edge = Umgedrehte Schraege mit Ecke
Slope Upside Down Inner Edge = Umgedrehte Schraege mit Innenecke
Sphere = Kugel
Spike = Spitze
Stick = Stange
Two Curved Edge Block = Block mit zwei abgerundeten Kanten
Brick = Ziegel:
Cobble = Pflasterstein:
Dirt = Erde:
Leaves = Laub:
Sandstone = Sandstein:
Stone = Stein:
Tree = Baumstamm:
Wooden = Holz:


code:
## CNC
CNC Machine = Maquina CNC
%s CNC Machine = Maquina CNC %s
Element Edge = Elemento Borde
Tree = Arbol
Element Cross Double = Elemento Cruz Doble
Spike = Pica
Element Edge Double = Elemento Borde Doble
Two Curved Edge Block = Dos Bloques de Borde Curvados
Pyramid = Piramide
Slope Upside Down Inner Edge = Borde Interno de Rampa Al Reves
Slope Upside Down Edge = Borde de Rampa Al Reves
Element Straight Double = Elemento Doble Recto
Sphere = Esfera
Element End Double = Doble Fin de Elemento
Element Straight = Recta de Elemento
Horizontal Cylinder = Cilindro Horizontal
Slope Inner Edge = Borde Interno de Rampa
One Curved Edge Block = Un Bloque de Borde Curvado
Element Cross = Cruce de Elementos
Stick = Varita
Element End = Fin de Elemento
Slope Lying = Rampa en Reposo
Slope Upside Down = Rampa Al Reves
Slope Edge = Borde de Rampa
Slope = Rampa
Element T = Elemento T
Cylinder = Cilindro
Cobble = Adoquines
Stone = Piedra
Brick = Ladrillo
Dirt = Tierra
Sandstone = Arenisca
Wooden = Madera
Leaves = Hojas


code:
## CNC
CNC Machine = Tornio CNC
%s CNC Machine = Tornio CNC %s
Cylinder = Cilindro
Element Cross = Elemento a croce
Element Cross Double = Elemento a croce doppio
Element Edge = Elemento bordo
Element Edge Double = Elemento bordo doppio
Element End = Elemento finale
Element End Double = Elemento finale doppio
Element Straight = Elemento dritto
Element Straight Double = Elemento dritto doppio
Element T = Elemento a T
Element T Double = Elemento a T doppio
Horizontal Cylinder = Cilindro orizzontale
One Curved Edge Block = Blocco con bordo curvo
Pyramid = Piramide
Slope = Inclinato
Slope Edge = Bordo inclinato
Slope Inner Edge = Bordo interno inclinato
Slope Lying = Pendenza bugiarda
Slope Upside Down = Pendenza capovolta
Slope Upside Down Edge = Bordo inclinato capovolto
Slope Upside Down Inner Edge = Bordo interno inclinato capovolto
Sphere = Sfera
Spike = Spuntone
Stick = Bastone
Two Curved Edge Block = Blocco con bordo a doppia curva
Brick = Mattone
Cobble = Ciottolato
Dirt = Terra
Leaves = Foglie
Sandstone = Arenaria
Stone = Pietra
Tree = Albero
Wooden = Legno


code:
## CNC
CNC Machine = Obrabiarka CNC
%s CNC Machine = %s Obrabiarka CNC
Cylinder = Walec
Element Cross = Część krzyżowa
Element Cross Double = Podwójna część krzyżowa
Element Edge = Krawędź części
Element Edge Double = Podwójna krawędź części
Element End = Końcowa część
Element End Double = Podwójna końcowa część
Element Straight = Prosta część
Element Straight Double = Podwójna prosta część
Element T = Część T
Element T Double = Podwójna część T
Horizontal Cylinder = Poziomy walec
One Curved Edge Block = Blok z zagiętą krawędzią
Pyramid = Ostrosłup
Slope = Spad
Slope Edge = Krawędź spadu
Slope Inner Edge = Wewnętrzna krawędź spadu
Slope Lying = Leżący spad
Slope Upside Down = Odwrócony spad
Slope Upside Down Edge = Krawędź odwróconego spadu
Slope Upside Down Inner Edge = Wewnętrzna krawędz odwróconego spadu
Sphere = Kula
Spike = Kolec
Stick = Patyk
Two Curved Edge Block = Blok z dwoma zagiętymi krawędziami
Brick = Cegła
Cobble = Bruk
Dirt = Ziemia
Leaves = Liście
Sandstone = Piaskowiec
Stone = Kamień
Tree = Drzewo
Wooden = Drewniany


code:
## CNC
CNC Machine =
%s CNC Machine =
Cylinder =
Element Cross =
Element Cross Double =
Element Edge =
Element Edge Double =
Element End =
Element End Double =
Element Straight =
Element Straight Double =
Element T =
Element T Double =
Horizontal Cylinder =
One Curved Edge Block =
Pyramid =
Slope =
Slope Edge =
Slope Inner Edge =
Slope Lying =
Slope Upside Down =
Slope Upside Down Edge =
Slope Upside Down Inner Edge =
Sphere =
Spike =
Stick =
Two Curved Edge Block =
Brick =
Cobble =
Dirt =
Leaves =
Sandstone =
Stone =
Tree =
Wooden =


code:
name = technic_cnc
depends = default, basic_materials
optional_depends = technic


code:
technic.config = technic.config or Settings(minetest.get_worldpath().."/technic.conf")

local conf_table = technic.config:to_table()

local defaults = {
	enable_granite_generation = "true",
	enable_marble_generation = "true",
	enable_rubber_tree_generation = "true",
}

for k, v in pairs(defaults) do
	if conf_table[k] == nil then
		technic.config:set(k, v)
	end
end


code:
local S = technic.worldgen.gettext

minetest.register_craftitem(":technic:uranium_lump", {
	description = S("Uranium Lump"),
	inventory_image = "technic_uranium_lump.png",
})
minetest.register_alias("technic:uranium", "technic:uranium_lump")

minetest.register_craftitem(":technic:uranium_ingot", {
	description = S("Uranium Ingot"),
	inventory_image = "technic_uranium_ingot.png",
	groups = {uranium_ingot=1},
})

minetest.register_craftitem(":technic:chromium_lump", {
	description = S("Chromium Lump"),
	inventory_image = "technic_chromium_lump.png",
})

minetest.register_craftitem(":technic:chromium_ingot", {
	description = S("Chromium Ingot"),
	inventory_image = "technic_chromium_ingot.png",
})

minetest.register_craftitem(":technic:zinc_lump", {
	description = S("Zinc Lump"),
	inventory_image = "technic_zinc_lump.png",
})

minetest.register_craftitem(":technic:zinc_ingot", {
	description = S("Zinc Ingot"),
	inventory_image = "technic_zinc_ingot.png",
})

minetest.register_craftitem(":technic:lead_lump", {
	description = S("Lead Lump"),
	inventory_image = "technic_lead_lump.png",
})

minetest.register_craftitem(":technic:lead_ingot", {
	description = S("Lead Ingot"),
	inventory_image = "technic_lead_ingot.png",
})

minetest.register_craftitem(":technic:sulfur_lump", {
	description = S("Sulfur Lump"),
	inventory_image = "technic_sulfur_lump.png",
})

minetest.register_alias("technic:wrought_iron_ingot", "default:steel_ingot")

minetest.override_item("default:steel_ingot", {
	description = S("Wrought Iron Ingot"),
	inventory_image = "technic_wrought_iron_ingot.png",
})

minetest.register_craftitem(":technic:cast_iron_ingot", {
	description = S("Cast Iron Ingot"),
	inventory_image = "technic_cast_iron_ingot.png",
})

minetest.register_craftitem(":technic:carbon_steel_ingot", {
	description = S("Carbon Steel Ingot"),
	inventory_image = "technic_carbon_steel_ingot.png",
})

minetest.register_craftitem(":technic:stainless_steel_ingot", {
	description = S("Stainless Steel Ingot"),
	inventory_image = "technic_stainless_steel_ingot.png",
})

local function register_block(block, ingot)
	minetest.register_craft({
		output = block,
		recipe = {
			{ingot, ingot, ingot},
			{ingot, ingot, ingot},
			{ingot, ingot, ingot},
		}
	})

	minetest.register_craft({
		output = ingot.." 9",
		recipe = {
			{block}
		}
	})
end

register_block("technic:uranium_block", "technic:uranium_ingot")
register_block("technic:chromium_block", "technic:chromium_ingot")
register_block("technic:zinc_block", "technic:zinc_ingot")
register_block("technic:lead_block", "technic:lead_ingot")
register_block("technic:cast_iron_block", "technic:cast_iron_ingot")
register_block("technic:carbon_steel_block", "technic:carbon_steel_ingot")
register_block("technic:stainless_steel_block", "technic:stainless_steel_ingot")
register_block("technic:sulfur_block", "technic:sulfur_lump")

minetest.register_craft({
	type = 'cooking',
	recipe = "technic:zinc_lump",
	output = "technic:zinc_ingot",
})

minetest.register_craft({
	type = 'cooking',
	recipe = "technic:chromium_lump",
	output = "technic:chromium_ingot",
})

minetest.register_craft({
	type = 'cooking',
	recipe = "technic:uranium_lump",
	output = "technic:uranium_ingot",
})

minetest.register_craft({
	type = 'cooking',
	recipe = "technic:lead_lump",
	output = "technic:lead_ingot",
})

minetest.register_craft({
	type = 'cooking',
	recipe = minetest.registered_aliases["technic:wrought_iron_ingot"],
	output = "technic:cast_iron_ingot",
})

minetest.register_craft({
	type = 'cooking',
	recipe = "technic:cast_iron_ingot",
	cooktime = 2,
	output = "technic:wrought_iron_ingot",
})

minetest.register_craft({
	type = 'cooking',
	recipe = "technic:carbon_steel_ingot",
	cooktime = 2,
	output = "technic:wrought_iron_ingot",
})

local function for_each_registered_item(action)
	local already_reg = {}
	for k, _ in pairs(minetest.registered_items) do
		table.insert(already_reg, k)
	end
	local really_register_craftitem = minetest.register_craftitem
	minetest.register_craftitem = function(name, def)
		really_register_craftitem(name, def)
		action(string.gsub(name, "^:", ""))
	end
	local really_register_tool = minetest.register_tool
	minetest.register_tool = function(name, def)
		really_register_tool(name, def)
		action(string.gsub(name, "^:", ""))
	end
	local really_register_node = minetest.register_node
	minetest.register_node = function(name, def)
		really_register_node(name, def)
		action(string.gsub(name, "^:", ""))
	end
	for _, name in ipairs(already_reg) do
		action(name)
	end
end

local steel_to_iron = {}
for _, i in ipairs({
	"default:axe_steel",
	"default:pick_steel",
	"default:shovel_steel",
	"default:sword_steel",
	"doors:door_steel",
	"farming:hoe_steel",
	"glooptest:hammer_steel",
	"glooptest:handsaw_steel",
	"glooptest:reinforced_crystal_glass",
	"mesecons_doors:op_door_steel",
	"mesecons_doors:sig_door_steel",
	"vessels:steel_bottle",
}) do
	steel_to_iron[i] = true
end

for_each_registered_item(function(item_name)
	local item_def = minetest.registered_items[item_name]
	if steel_to_iron[item_name] and string.find(item_def.description, "Steel") then
		minetest.override_item(item_name, { description = string.gsub(item_def.description, "Steel", S("Iron")) })
	end
end)


code:
default
basic_materials
intllib?
mg?
doors?
farming?
glooptest?
mesecons_doors?
vessels?


code:
local modpath = minetest.get_modpath("technic_worldgen")

technic = rawget(_G, "technic") or {}
technic.worldgen = {
	gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
}

dofile(modpath.."/config.lua")
dofile(modpath.."/nodes.lua")
dofile(modpath.."/oregen.lua")
dofile(modpath.."/crafts.lua")

-- Rubber trees, moretrees also supplies these
if not minetest.get_modpath("moretrees") then
	dofile(modpath.."/rubber.lua")
else
	-- older versions of technic provided rubber trees regardless
	minetest.register_alias("technic:rubber_sapling", "moretrees:rubber_tree_sapling")
	minetest.register_alias("technic:rubber_tree_empty", "moretrees:rubber_tree_trunk_empty")
end

-- mg suppport
if minetest.get_modpath("mg") then
	dofile(modpath.."/mg.lua")
end


code:
# German Translation for technic_worldgen
# Deutsche Übersetzung von technic_worldgen
# by Xanthin

## crafts.lua
Uranium Lump = Uranklumpen
Uranium Ingot = Uranbarren
Chromium Lump = Chromklumpen
Chromium Ingot = Chrombarren
Zinc Lump = Zinkklumpen
Zinc Ingot = Zinkbarren
Brass Ingot = Messingbarren
Wrought Iron Ingot = Schmiedeeisenbarren
Cast Iron Ingot = Gusseisenbarren
Carbon Steel Ingot = Kohlenstoffstahlbarren
Stainless Steel Ingot = Edelstahlbarren
Iron = Eisen

## nodes.lua
Uranium Ore = Uranerz
Chromium Ore = Chromerz
Zinc Ore = Zinkerz
Granite = Granit
Marble = Marmor
Marble Bricks = Marmorziegel
Uranium Block = Uranblock
Chromium Block = Chromblock
Zinc Block = Zinkblock
Wrought Iron Block = Schmiedeeisenblock
Cast Iron Block = Gusseisenblock
Carbon Steel Block = Kohlenstoffstahlblock
Stainless Steel Block = Edelstahlblock
Brass Block = Messingblock
Wrought Iron = Schmiedeeisen

## rubber.lua
Rubber Tree Sapling = Gummibaumsetzling
Rubber Tree = Gummibaum


code:
# technic_worldgen traducido por Carlos Barraza

###crafts.lua
Uranium Lump = Pepita de Uranio
Uranium Ingot = Lingote de Uranio
Chromium Lump = Pepita de Cromo
Chromium Ingot = Lingote de Cromo
Zinc Lump = Pepita de Zinc
Zinc Ingot = Lingote de Zinc
Brass Ingot = Lingote de Latón
Wrought Iron Ingot = Lingote de Hierro Forjado
Cast Iron Ingot = Lingote de Hierro Fundido
Carbon Steel Ingot = Lingote de Acero al Carbon
Stainless Steel Ingot = Lingote de Acero inoxidable
Iron = Lingote

###nodes.lua
Uranium Ore = Mineral de Uranio
Chromium Ore = Mineral de Cromo
Zinc Ore = Mineral de Zinc
Granite = Granito
Marble = Mármol
Marble Bricks = Ladrillos de Mármol
Uranium Block = Bloque de Uranio
Chromium Block = Bloque de Cromo
Zinc Block = Bloque de Zinc
Wrought Iron Block = Bloque de Hierro Forjado
Cast Iron Block = Bloque de Hierro Fundido
Carbon Steel Block = Bloque de Acero al Carbon
Stainless Steel Block = Bloque de Acero Inoxidable
Brass Block = Bloque de Latón
Wrought Iron = Hierro Forjado

###rubber.lua
Rubber Tree Sapling = Retoño de Árbol de Goma
Rubber Tree = Árbol de Goma


code:
# template.txt
# technic_worldgen translation template

###crafts.lua
Uranium Lump            = Morceau d'uranium
Uranium Ingot           = Lingot d'uranium
Chromium Lump           = Morceau de chrome
Chromium Ingot          = Lingot de chrome
Zinc Lump               = Morceau de zinc
Zinc Ingot              = Lingot de zinc
Brass Ingot             = Lingot de laiton
Wrought Iron Ingot      = Lingot de fer forgé
Cast Iron Ingot         = Lingot de fonte
Carbon Steel Ingot      = Lingot d'acier au carbone
Stainless Steel Ingot   = Lingot d'acier inoxydable
Iron                    = Fer

###nodes.lua
Uranium Ore             = Minerai d'uranium
Chromium Ore            = Minerai de chrome
Zinc Ore                = Minerai de zinc
Granite                 = Granite
Marble                  = Marbre
Marble Bricks           = Briques en marbre
Uranium Block           = Bloc d'uranium
Chromium Block          = Bloc de chrome
Zinc Block              = Bloc de zinc
Wrought Iron Block      = Bloc de fer forgé
Cast Iron Block         = Bloc de fonte
Carbon Steel Block      = Bloc d'acier au carbone
Stainless Steel Block   = Bloc d'acier inoxydable
Brass Block             = Bloc de laiton
Wrought Iron            = Fer forgé

###rubber.lua
Rubber Tree Sapling     = Pousse d'arbre à caoutchouc
Rubber Tree             = Arbre à caoutchouc


code:
# Polish Translation for technic_worldgen
# Polskie tłumaczenie technic_worldgen
# by mat9117

###crafts.lua
Uranium Lump = Bryłka uranu
Uranium Ingot = Sztabka uranu
Chromium Lump = Bryłka chromu
Chromium Ingot = Sztabka chromu
Zinc Lump = Bryłka cynku
Zinc Ingot = Sztabka cynku
Brass Ingot = Sztabka mosiądzu
Wrought Iron Ingot = Sztabka kutego żelaza
Cast Iron Ingot = Sztabka żelaziwa
Carbon Steel Ingot = Sztabka stali węglowej
Stainless Steel Ingot = Sztabka nierdzewnej stali
Iron = Żelazo

###nodes.lua
Uranium Ore = Ruda uranu
Chromium Ore = Ruda chromu
Zinc Ore = Ruda cynku
Granite = Granit
Marble = Marmur
Marble Bricks = Marmurowe cegły
Uranium Block = Blok uranu
Chromium Block = Blok chromu
Zinc Block = Blok cynku
Wrought Iron Block = Blok kutego żelaza
Cast Iron Block = Blok żelaziwa
Carbon Steel Block = Blok stali węglowej
Stainless Steel Block = Blok stali nierdzewnej
Brass Block = Blok mosiądzu
Wrought Iron = Kute żelazo

###rubber.lua
Rubber Tree Sapling = Sadzonka kauczukowca
Rubber Tree = Kauczukowiec


code:
# Braziliam portuguese translation for technic_worldgen
# Tradução portuguesa brasileira para technic_worldgen
# By Sires

###crafts.lua
Uranium Lump = Pedaço de Urânio
Uranium Ingot = Lingote de Urânio
Chromium Lump = Pedaço de Crômio
Chromium Ingot = Lingote de Crômio
Zinc Lump = Pedaço de Zinco
Zinc Ingot = Lingote de Zinco
Brass Ingot = Lingote de Latão
Wrought Iron Ingot = Lingote de Ferro Forjado
Cast Iron Ingot = Lingote de Ferro Fundido
Carbon Steel Ingot = Lingote de Aço Carbono
Stainless Steel Ingot =  Lingote de Ferro Inoxidável
Iron = Ferro

###nodes.lua
Uranium Ore = Minério de Urânio
Chromium Ore = Minério de Crômio
Zinc Ore = Minério de Zinco
Granite = Granito
Marble = Mármore
Marble Bricks = Tijolos de Mármore
Uranium Block = Bloco de Urânio
Chromium Block = Bloco de Crômio
Zinc Block = Bloco de Zinco
Wrought Iron Block = Bloco de Ferro Forjado
Cast Iron Block = Bloco de Ferro Fundido
Carbon Steel Block = Bloco de Aço Carbono
Stainless Steel Block = Bloco de Aço Inoxidável
Brass Block = Bloco de Latão
Wrought Iron = Ferro Forjado

###rubber.lua
Rubber Tree Sapling = Muda de Árvore de Borracha
Rubber Tree = Árvore de Borracha


code:
# template.txt
# technic_worldgen translation template

###crafts.lua
Uranium Lump =
Uranium Ingot =
Chromium Lump =
Chromium Ingot =
Zinc Lump =
Zinc Ingot =
Brass Ingot =
Wrought Iron Ingot =
Cast Iron Ingot =
Carbon Steel Ingot =
Stainless Steel Ingot =
Iron =

###nodes.lua
Uranium Ore =
Chromium Ore =
Zinc Ore =
Granite =
Marble =
Marble Bricks =
Uranium Block =
Chromium Block =
Zinc Block =
Wrought Iron Block =
Cast Iron Block =
Carbon Steel Block =
Stainless Steel Block =
Brass Block =
Wrought Iron =

###rubber.lua
Rubber Tree Sapling =
Rubber Tree =


code:
# Turkish translation
# mahmutelmas06@hotmail.com
# Türkçe çeviri

###crafts.lua
Uranium Lump = Uranyum yığını
Uranium Ingot = Uranyum külçesi
Chromium Lump = Krom yığını
Chromium Ingot = Krom külçesi
Zinc Lump = Çinko yığını
Zinc Ingot = Çünko külçesi
Brass Ingot = Pirinç yığını
Wrought Iron Ingot = İşlenmiş demir yığını
Cast Iron Ingot = Döküm demir yığını
Carbon Steel Ingot = Karbon çelik külçe
Stainless Steel Ingot =Paslanmaz çelik külçe
Iron = Demir

###nodes.lua
Uranium Ore = Uranyum madeni
Chromium Ore = Krom madeni
Zinc Ore = Çinko madeni
Granite = Granit
Marble = Mermer
Marble Bricks = Mermer tuğla
Uranium Block = Uranyum blok
Chromium Block = Karbon blok
Zinc Block = Çinko blok
Wrought Iron Block = İşlenmiş demir blok
Cast Iron Block = Döküm demir blok
Carbon Steel Block = Karbon çelik blok
Stainless Steel Block = Paslanmaz çelik blok
Brass Block = Pirinç blok
Wrought Iron = İşlenmiş demir

###rubber.lua
Rubber Tree Sapling = Kauçuk ağacı fidanı
Rubber Tree = Kauçuk ağacı


code:
mg.register_ore({
	name = "technic:mineral_uranium",
	wherein = "default:stone",
	seeddiff = 11,
	maxvdistance = 10.5,
	maxheight = -80,
	minheight = -300,
	sizen = 20,
	sizedev = 10,
	seglenghtn = 3,
	seglenghtdev = 1,
	segincln = 0.4,
	segincldev = 0.6,
	turnangle = 57,
	numperblock = 1,
	fork_chance = 0
})

mg.register_ore({
	name = "technic:mineral_chromium",
	wherein = "default:stone",
	seeddiff = 12,
	maxvdistance = 10.5,
	maxheight = -100,
	sizen = 50,
	sizedev = 20,
	seglenghtn = 8,
	seglenghtdev = 3,
	segincln = 0,
	segincldev = 0.6,
	turnangle = 57,
	forkturnangle = 57,
	numperblock = 2
})

mg.register_ore({
	name = "technic:mineral_zinc",
	wherein = "default:stone",
	seeddiff = 13,
	maxvdistance = 10.5,
	maxheight = 2,
	seglenghtn = 15,
	seglenghtdev = 6,
	segincln = 0,
	segincldev = 0.6,
	turnangle = 57,
	forkturnangle = 57,
	numperblock = 2
})

mg.register_ore({
	name = "technic:mineral_lead",
	wherein = "default:stone",
	seeddiff = 14,
	maxvdistance = 10.5,
	maxheight = 16,
	seglenghtn = 15,
	seglenghtdev = 6,
	segincln = 0,
	segincldev = 0.6,
	turnangle = 57,
	forkturnangle = 57,
	numperblock = 3
})

if technic.config:get_bool("enable_granite_generation") then
	mg.register_ore_sheet({
		name = "technic:granite",
		wherein = "default:stone",
		height_min = -31000,
		height_max = -150,
		tmin = 3,
		tmax = 6,
		threshhold = 0.4,
		noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70}
	})
end

if technic.config:get_bool("enable_marble_generation") then
	mg.register_ore_sheet({
		name = "technic:marble",
		wherein = "default:stone",
		height_min = -31000,
		height_max = -50,
		tmin = 3,
		tmax = 6,
		threshhold = 0.4,
		noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=23, octaves=3, persist=0.70}
	})
end


code:
name = technic_worldgen
depends = default, basic_materials
optional_depends = intllib, mg, doors, farming, glooptest, mesecons_doors, vessels


code:
local S = technic.worldgen.gettext

minetest.register_node( ":technic:mineral_uranium", {
	description = S("Uranium Ore"),
	tiles = { "default_stone.png^technic_mineral_uranium.png" },
	is_ground_content = true,
	groups = {cracky=3, radioactive=1},
	sounds = default.node_sound_stone_defaults(),
	drop = "technic:uranium_lump",
})

minetest.register_node( ":technic:mineral_chromium", {
	description = S("Chromium Ore"),
	tiles = { "default_stone.png^technic_mineral_chromium.png" },
	is_ground_content = true,
	groups = {cracky=3},
	sounds = default.node_sound_stone_defaults(),
	drop = "technic:chromium_lump",
})

minetest.register_node( ":technic:mineral_zinc", {
	description = S("Zinc Ore"),
	tiles = { "default_stone.png^technic_mineral_zinc.png" },
	is_ground_content = true,
	groups = {cracky=3},
	sounds = default.node_sound_stone_defaults(),
	drop = "technic:zinc_lump",
})

minetest.register_node( ":technic:mineral_lead", {
	description = S("Lead Ore"),
	tiles = { "default_stone.png^technic_mineral_lead.png" },
	is_ground_content = true,
	groups = {cracky=3},
	sounds = default.node_sound_stone_defaults(),
	drop = "technic:lead_lump",
})

minetest.register_node( ":technic:mineral_sulfur", {
	description = S("Sulfur Ore"),
	tiles = { "default_stone.png^technic_mineral_sulfur.png" },
	is_ground_content = true,
	groups = {cracky=3},
	sounds = default.node_sound_stone_defaults(),
	drop = "technic:sulfur_lump",
})

minetest.register_node( ":technic:granite", {
	description = S("Granite"),
	tiles = { "technic_granite.png" },
	is_ground_content = true,
	groups = {cracky=1},
	sounds = default.node_sound_stone_defaults(),
})

minetest.register_node( ":technic:marble", {
	description = S("Marble"),
	tiles = { "technic_marble.png" },
	is_ground_content = true,
	groups = {cracky=3, marble=1},
	sounds = default.node_sound_stone_defaults(),
})

minetest.register_node( ":technic:marble_bricks", {
	description = S("Marble Bricks"),
	tiles = { "technic_marble_bricks.png" },
	is_ground_content = true,
	groups = {cracky=3},
	sounds = default.node_sound_stone_defaults(),
})

minetest.register_node(":technic:uranium_block", {
	description = S("Uranium Block"),
	tiles = { "technic_uranium_block.png" },
	is_ground_content = true,
	groups = {uranium_block=1, cracky=1, level=2, radioactive=2},
	sounds = default.node_sound_stone_defaults()
})

minetest.register_node(":technic:chromium_block", {
	description = S("Chromium Block"),
	tiles = { "technic_chromium_block.png" },
	is_ground_content = true,
	groups = {cracky=1, level=2},
	sounds = default.node_sound_stone_defaults()
})

minetest.register_node(":technic:zinc_block", {
	description = S("Zinc Block"),
	tiles = { "technic_zinc_block.png" },
	is_ground_content = true,
	groups = {cracky=1, level=2},
	sounds = default.node_sound_stone_defaults()
})

minetest.register_node(":technic:lead_block", {
	description = S("Lead Block"),
	tiles = { "technic_lead_block.png" },
	is_ground_content = true,
	groups = {cracky=1, level=2},
	sounds = default.node_sound_stone_defaults()
})

minetest.register_alias("technic:wrought_iron_block", "default:steelblock")

minetest.override_item("default:steelblock", {
	description = S("Wrought Iron Block"),
	tiles = { "technic_wrought_iron_block.png" },
})

minetest.register_node(":technic:cast_iron_block", {
	description = S("Cast Iron Block"),
	tiles = { "technic_cast_iron_block.png" },
	is_ground_content = true,
	groups = {cracky=1, level=2},
	sounds = default.node_sound_stone_defaults()
})

minetest.register_node(":technic:carbon_steel_block", {
	description = S("Carbon Steel Block"),
	tiles = { "technic_carbon_steel_block.png" },
	is_ground_content = true,
	groups = {cracky=1, level=2},
	sounds = default.node_sound_stone_defaults()
})

minetest.register_node(":technic:stainless_steel_block", {
	description = S("Stainless Steel Block"),
	tiles = { "technic_stainless_steel_block.png" },
	is_ground_content = true,
	groups = {cracky=1, level=2},
	sounds = default.node_sound_stone_defaults()
})

minetest.register_node(":technic:sulfur_block", {
	description = S("Sulfur Block"),
	tiles = { "technic_sulfur_block.png" },
	is_ground_content = true,
	groups = {cracky = 3},
	sounds = default.node_sound_stone_defaults()
})

minetest.register_craft({
	output = 'technic:marble_bricks 4',
	recipe = {
		{'technic:marble','technic:marble'},
		{'technic:marble','technic:marble'}
	}
})

minetest.register_alias("technic:diamond_block", "default:diamondblock")
minetest.register_alias("technic:diamond", "default:diamond")
minetest.register_alias("technic:mineral_diamond", "default:stone_with_diamond")

local function for_each_registered_node(action)
	local really_register_node = minetest.register_node
	minetest.register_node = function(name, def)
		really_register_node(name, def)
		action(name:gsub("^:", ""), def)
	end
	for name, def in pairs(minetest.registered_nodes) do
		action(name, def)
	end
end

for_each_registered_node(function(node_name, node_def)
	if node_name ~= "default:steelblock" and
			node_name:find("steelblock", 1, true) and
			node_def.description:find("Steel", 1, true) then
		minetest.override_item(node_name, {
			description = node_def.description:gsub("Steel", S("Wrought Iron")),
		})
	end
	local tiles = node_def.tiles or node_def.tile_images
	if tiles then
		local new_tiles = {}
		local do_override = false
		if type(tiles) == "string" then
			tiles = {tiles}
		end
		for i, t in ipairs(tiles) do
			if type(t) == "string" and t == "default_steel_block.png" then
				do_override = true
				t = "technic_wrought_iron_block.png"
			end
			table.insert(new_tiles, t)
		end
		if do_override then
			minetest.override_item(node_name, {
				tiles = new_tiles
			})
		end
	end
end)


code:
local uranium_params = {
	offset = 0,
	scale = 1,
	spread = {x = 100, y = 100, z = 100},
	seed = 420,
	octaves = 3,
	persist = 0.7
}
local uranium_threshold = 0.55

local chromium_params = {
	offset = 0,
	scale = 1,
	spread = {x = 100, y = 100, z = 100},
	seed = 421,
	octaves = 3,
	persist = 0.7
}
local chromium_threshold = 0.55

local zinc_params = {
	offset = 0,
	scale = 1,
	spread = {x = 100, y = 100, z = 100},
	seed = 422,
	octaves = 3,
	persist = 0.7
}
local zinc_threshold = 0.5

local lead_params = {
	offset = 0,
	scale = 1,
	spread = {x = 100, y = 100, z = 100},
	seed = 423,
	octaves = 3,
	persist = 0.7
}
local lead_threshold = 0.3

minetest.register_ore({
	ore_type = "scatter",
	ore = "technic:mineral_uranium",
	wherein = "default:stone",
	clust_scarcity = 8*8*8,
	clust_num_ores = 4,
	clust_size = 3,
	y_min = -300,
	y_max = -80,
	noise_params = uranium_params,
	noise_threshold = uranium_threshold,
})

minetest.register_ore({
	ore_type = "scatter",
	ore = "technic:mineral_chromium",
	wherein = "default:stone",
	clust_scarcity = 8*8*8,
	clust_num_ores = 2,
	clust_size = 3,
	y_min = -200,
	y_max = -100,
	noise_params = chromium_params,
	noise_threshold = chromium_threshold,
})

minetest.register_ore({
	ore_type = "scatter",
	ore = "technic:mineral_chromium",
	wherein = "default:stone",
	clust_scarcity = 6*6*6,
	clust_num_ores = 2,
	clust_size = 3,
	y_min = -31000,
	y_max = -200,
	flags = "absheight",
	noise_params = chromium_params,
	noise_threshold = chromium_threshold,
})

minetest.register_ore({
	ore_type = "scatter",
	ore = "technic:mineral_zinc",
	wherein = "default:stone",
	clust_scarcity = 8*8*8,
	clust_num_ores = 5,
	clust_size = 7,
	y_min = -32,
	y_max = 2,
	noise_params = zinc_params,
	noise_threshold = zinc_threshold,
})

minetest.register_ore({
	ore_type = "scatter",
	ore = "technic:mineral_zinc",
	wherein = "default:stone",
	clust_scarcity = 6*6*6,
	clust_num_ores = 4,
	clust_size = 3,
	y_min = -31000,
	y_max = -32,
	flags = "absheight",
	noise_params = zinc_params,
	noise_threshold = zinc_threshold,
})

minetest.register_ore({
	ore_type = "scatter",
	ore = "technic:mineral_lead",
	wherein = "default:stone",
	clust_scarcity = 9*9*9,
	clust_num_ores = 5,
	clust_size = 3,
	y_min = -16,
	y_max = 16,
	noise_params = lead_params,
	noise_threshold = lead_threshold,
})

minetest.register_ore({
	ore_type = "scatter",
	ore = "technic:mineral_lead",
	wherein = "default:stone",
	clust_scarcity = 8*8*8,
	clust_num_ores = 5,
	clust_size = 3,
	y_min = -128,
	y_max = -16,
	noise_params = lead_params,
	noise_threshold = lead_threshold,
})

minetest.register_ore({
	ore_type = "scatter",
	ore = "technic:mineral_lead",
	wherein = "default:stone",
	clust_scarcity = 6*6*6,
	clust_num_ores = 5,
	clust_size = 3,
	y_min = -31000,
	y_max = -128,
	flags = "absheight",
	noise_params = lead_params,
	noise_threshold = lead_threshold,
})

-- Sulfur
local sulfur_buf = {}
local sulfur_noise

minetest.register_on_generated(function(minp, maxp)
	local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	local a = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
	vm:get_data(sulfur_buf)
	local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z)
	sulfur_noise = sulfur_noise or minetest.get_perlin(9876, 3, 0.5, 100)

	local c_lava = minetest.get_content_id("default:lava_source")
	local c_lava_flowing = minetest.get_content_id("default:lava_flowing")
	local c_stone = minetest.get_content_id("default:stone")
	local c_sulfur = minetest.get_content_id("technic:mineral_sulfur")

	local grid_size = 5
	for x = minp.x + math.floor(grid_size / 2), maxp.x, grid_size do
	for y = minp.y + math.floor(grid_size / 2), maxp.y, grid_size do
	for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do
		local c = sulfur_buf[a:index(x, y, z)]
		if (c == c_lava or c == c_lava_flowing)
		and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then
			for i in a:iter(
				math.max(minp.x, x - grid_size),
				math.max(minp.y, y - grid_size),
				math.max(minp.z, z - grid_size),
				math.min(maxp.x, x + grid_size),
				math.min(maxp.y, y + grid_size),
				math.min(maxp.z, z + grid_size)
			) do
				if sulfur_buf[i] == c_stone and pr:next(1, 10) <= 7 then
					sulfur_buf[i] = c_sulfur
				end
			end
		end
	end
	end
	end

	vm:set_data(sulfur_buf)
	vm:write_to_map(sulfur_buf)
end)

if technic.config:get_bool("enable_marble_generation") then
	minetest.register_ore({
		ore_type = "sheet",
		ore = "technic:marble",
		wherein = "default:stone",
		clust_scarcity = 1,
		clust_num_ores = 1,
		clust_size = 3,
		y_min = -31000,
		y_max = -50,
		noise_threshold = 0.4,
		noise_params = {
			offset = 0, scale = 15, spread = {x = 150, y = 150, z = 150},
			seed = 23, octaves = 3, persist = 0.70
		}
	})
end

if technic.config:get_bool("enable_granite_generation") then
	minetest.register_ore({
		ore_type = "sheet",
		ore = "technic:granite",
		wherein = "default:stone",
		clust_scarcity = 1,
		clust_num_ores = 1,
		clust_size = 4,
		y_min = -31000,
		y_max = -150,
		noise_threshold = 0.4,
		noise_params = {
			offset = 0, scale = 15, spread = {x = 130, y = 130, z = 130},
			seed = 24, octaves = 3, persist = 0.70
		}
	})
end


code:
-- Code of rubber tree by PilzAdam

local S = technic.worldgen.gettext

minetest.register_node(":moretrees:rubber_tree_sapling", {
	description = S("Rubber Tree Sapling"),
	drawtype = "plantlike",
	tiles = {"technic_rubber_sapling.png"},
	inventory_image = "technic_rubber_sapling.png",
	wield_image = "technic_rubber_sapling.png",
	paramtype = "light",
	walkable = false,
	groups = {dig_immediate=3, flammable=2, sapling=1},
	sounds = default.node_sound_defaults(),
})

minetest.register_craft({
	type = "fuel",
	recipe = "moretrees:rubber_tree_sapling",
	burntime = 10
})

minetest.register_node(":moretrees:rubber_tree_trunk", {
	description = S("Rubber Tree"),
	tiles = {"default_tree_top.png", "default_tree_top.png",
		"technic_rubber_tree_full.png"},
	groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1,
		flammable=2},
	sounds = default.node_sound_wood_defaults(),
})

minetest.register_node(":moretrees:rubber_tree_trunk_empty", {
	description = S("Rubber Tree"),
	tiles = {"default_tree_top.png", "default_tree_top.png",
		"technic_rubber_tree_empty.png"},
	groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1,
			flammable=2, not_in_creative_inventory=1},
	sounds = default.node_sound_wood_defaults(),
})

minetest.register_node(":moretrees:rubber_tree_leaves", {
	drawtype = "allfaces_optional",
	description = S("Rubber Tree Leaves"),
	tiles = {"technic_rubber_leaves.png"},
	paramtype = "light",
	groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
	drop = {
		max_items = 1,
		items = {{
			items = {"moretrees:rubber_tree_sapling"},
			rarity = 20,
		},
		{
			items = {"moretrees:rubber_tree_leaves"},
		}
		}
	},
	sounds = default.node_sound_leaves_defaults(),
})

technic.rubber_tree_model={
	axiom = "FFFFA",
	rules_a = "[&FFBFA]////[&BFFFA]////[&FBFFA]",
	rules_b = "[&FFA]////[&FFA]////[&FFA]",
	trunk = "moretrees:rubber_tree_trunk",
	leaves = "moretrees:rubber_tree_leaves",
	angle = 35,
	iterations = 3,
	random_level = 1,
	trunk_type = "double",
	thin_branches = true
}

minetest.register_abm({
	nodenames = {"moretrees:rubber_tree_sapling"},
	label = "Worldgen: grow rubber tree sapling",
	interval = 60,
	chance = 20,
	action = function(pos, node)
		minetest.remove_node(pos)
		minetest.spawn_tree(pos, technic.rubber_tree_model)
	end
})

if technic.config:get_bool("enable_rubber_tree_generation") then
	minetest.register_on_generated(function(minp, maxp, blockseed)
		if math.random(1, 100) > 5 then
			return
		end
		local tmp = {
				x = (maxp.x - minp.x) / 2 + minp.x,
				y = (maxp.y - minp.y) / 2 + minp.y,
				z = (maxp.z - minp.z) / 2 + minp.z}
		local pos = minetest.find_node_near(tmp, maxp.x - minp.x,
				{"default:dirt_with_grass"})
		if pos ~= nil then
			minetest.spawn_tree({x=pos.x, y=pos.y+1, z=pos.z}, technic.rubber_tree_model)
		end
	end)
end


code:
default
technic?
technic_chests?
technic_worldgen?
intllib?


code:
--[[
Wrench mod

Adds a wrench that allows the player to pickup nodes that contain an inventory
with items or metadata that needs perserving.
The wrench has the same tool capability as the normal hand.
To pickup a node simply right click on it. If the node contains a formspec,
you will need to shift+right click instead.
Because it enables arbitrary nesting of chests, and so allows the player
to carry an unlimited amount of material at once, this wrench is not
available to survival-mode players.
--]]

local LATEST_SERIALIZATION_VERSION = 1

wrench = {}

local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/support.lua")
dofile(modpath.."/technic.lua")

-- Boilerplate to support localized strings if intllib mod is installed.
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end

local function get_meta_type(name, metaname)
	local def = wrench.registered_nodes[name]
	return def and def.metas and def.metas[metaname] or nil
end

local function get_pickup_name(name)
	return "wrench:picked_up_"..(name:gsub(":", "_"))
end

local function restore(pos, placer, itemstack)
	local name = itemstack:get_name()
	local node = minetest.get_node(pos)
	local meta = minetest.get_meta(pos)
	local inv = meta:get_inventory()
	local data = itemstack:get_meta():get_string("data")
	data = (data ~= "" and data) or	itemstack:get_metadata()
	data = minetest.deserialize(data)
	if not data then
		minetest.remove_node(pos)
		minetest.log("error", placer:get_player_name().." wanted to place "..
				name.." at "..minetest.pos_to_string(pos)..
				", but it had no data.")
		minetest.log("verbose", "itemstack: "..itemstack:to_string())
		return true
	end
	minetest.set_node(pos, {name = data.name, param2 = node.param2})
	for name, value in pairs(data.metas) do
		local meta_type = get_meta_type(data.name, name)
		if meta_type == wrench.META_TYPE_INT then
			meta:set_int(name, value)
		elseif meta_type == wrench.META_TYPE_FLOAT then
			meta:set_float(name, value)
		elseif meta_type == wrench.META_TYPE_STRING then
			meta:set_string(name, value)
		end
	end
	local lists = data.lists
	for listname, list in pairs(lists) do
		inv:set_list(listname, list)
	end
	itemstack:take_item()
	return itemstack
end

for name, info in pairs(wrench.registered_nodes) do
	local olddef = minetest.registered_nodes[name]
	if olddef then
		local newdef = {}
		for key, value in pairs(olddef) do
			newdef[key] = value
		end
		newdef.stack_max = 1
		newdef.description = S("%s with items"):format(newdef.description)
		newdef.groups = {}
		newdef.groups.not_in_creative_inventory = 1
		newdef.on_construct = nil
		newdef.on_destruct = nil
		newdef.after_place_node = restore
		minetest.register_node(":"..get_pickup_name(name), newdef)
	end
end

minetest.register_tool("wrench:wrench", {
	description = S("Wrench"),
	inventory_image = "technic_wrench.png",
	tool_capabilities = {
		full_punch_interval = 0.9,
		max_drop_level = 0,
		groupcaps = {
			crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
			snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
			oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40},
						uses=0, maxlevel=3}
		},
		damage_groups = {fleshy=1},
	},
	on_place = function(itemstack, placer, pointed_thing)
		local pos = pointed_thing.under
		if not placer or not pos then
			return
		end
		local player_name = placer:get_player_name()
		if minetest.is_protected(pos, player_name) then
			minetest.record_protection_violation(pos, player_name)
			return
		end
		local name = minetest.get_node(pos).name
		local def = wrench.registered_nodes[name]
		if not def then
			return
		end

		local stack = ItemStack(get_pickup_name(name))
		local player_inv = placer:get_inventory()
		if not player_inv:room_for_item("main", stack) then
			return
		end
		local meta = minetest.get_meta(pos)
		if def.owned and not minetest.check_player_privs(placer, "protection_bypass") then
			local owner = meta:get_string("owner")
			if owner and owner ~= player_name then
				minetest.log("action", player_name..
					" tried to pick up an owned node belonging to "..
					owner.." at "..
					minetest.pos_to_string(pos))
				return
			end
		end

		local metadata = {}
		metadata.name = name
		metadata.version = LATEST_SERIALIZATION_VERSION

		local inv = meta:get_inventory()
		local lists = {}
		for _, listname in pairs(def.lists or {}) do
			local list = inv:get_list(listname)
			for i, stack in pairs(list) do
				list[i] = stack:to_string()
			end
			lists[listname] = list
		end
		metadata.lists = lists

		local item_meta = stack:get_meta()
		metadata.metas = {}
		for name, meta_type in pairs(def.metas or {}) do
			if meta_type == wrench.META_TYPE_INT then
				metadata.metas[name] = meta:get_int(name)
			elseif meta_type == wrench.META_TYPE_FLOAT then
				metadata.metas[name] = meta:get_float(name)
			elseif meta_type == wrench.META_TYPE_STRING then
				metadata.metas[name] = meta:get_string(name)
			end
		end

		item_meta:set_string("data", minetest.serialize(metadata))
		minetest.remove_node(pos)
		itemstack:add_wear(65535 / 20)
		player_inv:add_item("main", stack)
		return itemstack
	end,
})


code:
# German Translation for technic_wrench
# Deutsche Übersetzung von technic_wrench
# by Xanthin

Wrench = Schraubenschluessel
%s with items = %s mit Gegenstaenden


code:
# technic_wrench traducido por Carlos Barraza

Wrench = Llave Inglesa
%s with items = %s con elementos


code:
# technic_wrench translation template

Wrench        = Clé
%s with items = %s avec des objets


code:
# Polish Translation for technic_wrench
# Polskie tłumaczenie technic_wrench
# by mat9117

Wrench = Klucz
%s with items = %s z rzeczami


code:
# Braziliam portuguese translation for wrench
# Tradução portuguesa brasileira para wrench
# By Sires

Wrench = Chave Inglesa
%s with items = %s com items


code:
# technic_wrench translation template

Wrench =
%s with items =


code:
# Turkish translation by mahmutelmas06
#  mahmutelmas06@hotmail.com

Wrench = İngiliz anahtarı
%s with items = Araçlarla birlikte %s


code:
name = wrench
depends = default
optional_depends = technic, technic_chests, technic_worldgen, intllib


code:
--[[
supported_nodes
This table stores all nodes that are compatible with the wrench mod.
Syntax:
	[<node name>] = {
		lists = {"<inventory list name>"},
		metas = {["<meta name>"] = STRING,
			["<meta name>"] = INT,
			["<meta name>"] = FLOAT},
		owned = true,
		store_meta_always = true,
	}
	owned - nodes that are protected by owner requirements (Ex. locked chests)
	store_meta_always - when nodes are broken this ensures metadata and
	inventory is always stored (Ex. active state for machines)
--]]

wrench.META_TYPE_FLOAT = 1
wrench.META_TYPE_STRING = 2

local STRING, FLOAT  =
	wrench.META_TYPE_STRING,
	wrench.META_TYPE_FLOAT

wrench.registered_nodes = {
	["default:chest"] = {
		lists = {"main"},
	},
	["default:chest_locked"] = {
		lists = {"main"},
		metas = {owner = STRING,
			infotext = STRING},
		owned = true,
	},
	["default:furnace"] = {
		lists = {"fuel", "src", "dst"},
		metas = {infotext = STRING,
			fuel_totaltime = FLOAT,
			fuel_time = FLOAT,
			src_totaltime = FLOAT,
			src_time = FLOAT},
	},
	["default:furnace_active"] = {
		lists = {"fuel", "src", "dst"},
		metas = {infotext = STRING,
			fuel_totaltime = FLOAT,
			fuel_time = FLOAT,
			src_totaltime = FLOAT,
			src_time = FLOAT},
		store_meta_always = true,
	},
	["default:sign_wall"] = {
		metas = {infotext = STRING,
			text = STRING},
	},
}

function wrench:original_name(name)
	for key, value in pairs(self.registered_nodes) do
		if name == value.name then
			return key
		end
	end
end

function wrench:register_node(name, def)
	if minetest.registered_nodes[name] then
	    self.registered_nodes[name] = def
	end
end


code:
local INT, STRING, FLOAT  =
	wrench.META_TYPE_INT,
	wrench.META_TYPE_STRING,
	wrench.META_TYPE_FLOAT

wrench:register_node("technic:iron_chest", {
	lists = {"main"},
})
wrench:register_node("technic:iron_locked_chest", {
	lists = {"main"},
	metas = {infotext = STRING,
		owner = STRING},
	owned = true,
})
wrench:register_node("technic:copper_chest", {
	lists = {"main"},
})
wrench:register_node("technic:copper_locked_chest", {
	lists = {"main"},
	metas = {infotext = STRING,
		owner = STRING},
	owned = true,
})
wrench:register_node("technic:silver_chest", {
	lists = {"main"},
	metas = {infotext = STRING,
		formspec = STRING},
})
wrench:register_node("technic:silver_locked_chest", {
	lists = {"main"},
	metas = {infotext = STRING,
		owner = STRING,
		formspec = STRING},
	owned = true,
})
wrench:register_node("technic:gold_chest", {
	lists = {"main"},
	metas = {infotext = STRING,
		formspec = STRING},
})
wrench:register_node("technic:gold_locked_chest", {
	lists = {"main"},
	metas = {infotext = STRING,
		owner = STRING,
		formspec = STRING},
	owned = true,
})
wrench:register_node("technic:mithril_chest", {
	lists = {"main"},
	metas = {infotext = STRING,
		formspec = STRING},
})
wrench:register_node("technic:mithril_locked_chest", {
	lists = {"main"},
	metas = {infotext = STRING,
		owner = STRING,
		formspec = STRING},
	owned = true,
})
wrench:register_node("technic:lv_electric_furnace", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT},
})
wrench:register_node("technic:lv_electric_furnace_active", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_electric_furnace", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_electric_furnace_active", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:coal_alloy_furnace", {
	lists = {"fuel", "src", "dst"},
	metas = {infotext = STRING,
		fuel_totaltime = FLOAT,
		fuel_time = FLOAT,
		src_totaltime = FLOAT,
		src_time = FLOAT},
})
wrench:register_node("technic:coal_alloy_furnace_active", {
	lists = {"fuel", "src", "dst"},
	metas = {infotext = STRING,
		fuel_totaltime = FLOAT,
		fuel_time = FLOAT,
		src_totaltime = FLOAT,
		src_time = FLOAT},
})
wrench:register_node("technic:alloy_furnace", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:alloy_furnace_active", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_alloy_furnace", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_alloy_furnace_active", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:tool_workshop", {
	lists = {"src", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT},
})
wrench:register_node("technic:grinder", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT},
})
wrench:register_node("technic:grinder_active", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_grinder", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_grinder_active", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:extractor", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT},
})
wrench:register_node("technic:extractor_active", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_extractor", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_extractor_active", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:compressor", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT},
})
wrench:register_node("technic:compressor_active", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_compressor", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_compressor_active", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:cnc", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT,
		cnc_product = STRING},
})
wrench:register_node("technic:cnc_active", {
	lists = {"src", "dst"},
	metas = {infotext = STRING,
		formspec = STRING,
		LV_EU_demand = INT,
		LV_EU_input = INT,
		src_time = INT,
		cnc_product = STRING},
})
wrench:register_node("technic:mv_centrifuge", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})
wrench:register_node("technic:mv_centrifuge_active", {
	lists = {"src", "dst", "upgrade1", "upgrade2"},
	metas = {infotext = STRING,
		formspec = STRING,
		MV_EU_demand = INT,
		MV_EU_input = INT,
		tube_time = INT,
		src_time = INT},
})

local chest_mark_colors = {
	'_black',
	'_blue',
	'_brown',
	'_cyan',
	'_dark_green',
	'_dark_grey',
	'_green',
	'_grey',
	'_magenta',
	'_orange',
	'_pink',
	'_red',
	'_violet',
	'_white',
	'_yellow',
	'',
}

for i = 1, 15 do
	wrench:register_node("technic:gold_chest"..chest_mark_colors[i], {
		lists = {"main"},
		metas = {infotext = STRING,formspec = STRING},
	})
	wrench:register_node("technic:gold_locked_chest"..chest_mark_colors[i], {
		lists = {"main"},
		metas = {infotext = STRING,owner = STRING,formspec = STRING},
		owned = true,
	})
end

if minetest.get_modpath("technic") then
    for tier, _ in pairs(technic.machines) do
		local ltier = tier:lower()
		for i = 0, 8 do
			wrench:register_node("technic:"..ltier.."_battery_box"..i, {
				lists = {"src", "dst"},
				metas = {infotext = STRING,
					formspec = STRING,
					[tier.."_EU_demand"] = INT,
					[tier.."_EU_supply"] = INT,
					[tier.."_EU_input"] = INT,
					internal_EU_charge = INT,
					last_side_shown = INT},
			})
		end
	end
end


code:
Teleport Potion

This minetest mod adds both a teleportation potion and pad to the game

https://forum.minetest.net/viewtopic.php?f=9&t=9234

Change log:

- 1.2 - New teleport pad texture, code tweaks to work with minetest 5.x
- 1.1 - Using 0.4.16+ code changes, can only teleport players now, added MineClone2 crafts and spanish translation
- 1.0 - Added changes by maybe_dragon to bookmark teleport destination before using pads and potions
- 0.9 - Update to newer functions, requires Minetest 0.4.16 to work.
- 0.8 - Teleport pads now have arrows showing direction player will face after use
- 0.7 - Can now enter descriptions for teleport pads e.g. (0,12,0,Home)
- 0.6 - Tweaked and tidied code, added map_generation_limit's
- 0.5 - Added throwable potions
- 0.4 - Code tidy and particle effects added
- 0.3 - Added Teleport Pad
- 0.2 - Bug fixes
- 0.1 - Added SFX
- 0.0 - Initial release

Lucky Blocks: 4


code:
default?
intllib?
lucky_block?
mcl_core?


code: Adds craftable teleport potions (throwable) and teleport pads.


code:
--= Teleport Potion mod by TenPlus1 (SFX are license free)

-- Craft teleport potion or pad, use to bookmark location, place to open
-- portal or place pad, portals show a blue flame that you can walk into
-- before it closes (10 seconds), potions can also be thrown for local teleport.

-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP .. "/intllib.lua")

-- check for MineClone2
local mcl = minetest.get_modpath("mcl_core")

-- max teleport distance
local dist = tonumber(minetest.settings:get("map_generation_limit") or 31000)

-- creative check
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
local function is_creative(name)
	return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
end

local check_coordinates = function(str)

	if not str or str == "" then
		return nil
	end

	-- get coords from string
	local x, y, z = string.match(str, "^(-?%d+),(-?%d+),(-?%d+)$")

	-- check coords
	if x == nil or string.len(x) > 6
	or y == nil or string.len(y) > 6
	or z == nil or string.len(z) > 6 then
		return nil
	end

	-- convert string coords to numbers
	x = tonumber(x)
	y = tonumber(y)
	z = tonumber(z)

	-- are coords in map range ?
	if x > dist or x < -dist
	or y > dist or y < -dist
	or z > dist or z < -dist then
		return nil
	end

	-- return ok coords
	return {x = x, y = y, z = z}
end

-- particle effects
local function tp_effect(pos)
	minetest.add_particlespawner({
		amount = 20,
		time = 0.25,
		minpos = pos,
		maxpos = pos,
		minvel = {x = -2, y = 1, z = -2},
		maxvel = {x = 2,  y = 2,  z = 2},
		minacc = {x = 0, y = -2, z = 0},
		maxacc = {x = 0, y = -4, z = 0},
		minexptime = 0.1,
		maxexptime = 1,
		minsize = 0.5,
		maxsize = 1.5,
		texture = "particle.png",
		glow = 15,
	})
end

local teleport_destinations = {}

local function set_teleport_destination(playername, dest)
	teleport_destinations[playername] = dest
	tp_effect(dest)
	minetest.sound_play("portal_open", {
		pos = dest,
		gain = 1.0,
		max_hear_distance = 10
	}, true)
end

--------------------------------------------------------------------------------
--- Teleport portal
--------------------------------------------------------------------------------
minetest.register_node("teleport_potion:portal", {
	drawtype = "plantlike",
	tiles = {
		{name="portal.png",
			animation = {
				type = "vertical_frames",
				aspect_w = 16,
				aspect_h = 16,
				length = 1.0
			}
		}
	},
	light_source = 13,
	walkable = false,
	paramtype = "light",
	pointable = false,
	buildable_to = true,
	waving = 1,
	sunlight_propagates = true,
	damage_per_second = 1, -- walking into portal hurts player

	-- start timer when portal appears
	on_construct = function(pos)
		minetest.get_node_timer(pos):start(10)
	end,

	-- remove portal after 10 seconds
	on_timer = function(pos)

		minetest.sound_play("portal_close", {
			pos = pos,
			gain = 1.0,
			max_hear_distance = 10
		}, true)

		minetest.remove_node(pos)
	end,
	on_blast = function() end,
	drop = {},
})

-- Throwable potion
local function throw_potion(itemstack, player)

	local playerpos = player:get_pos()

	local obj = minetest.add_entity({
		x = playerpos.x,
		y = playerpos.y + 1.5,
		z = playerpos.z
	}, "teleport_potion:potion_entity")

	local dir = player:get_look_dir()
	local velocity = 20

	obj:set_velocity({
		x = dir.x * velocity,
		y = dir.y * velocity,
		z = dir.z * velocity
	})

	obj:set_acceleration({
		x = dir.x * -3,
		y = -9.5,
		z = dir.z * -3
	})

	obj:set_yaw(player:get_look_horizontal())
	obj:get_luaentity().player = player
end

local potion_entity = {
	physical = true,
	visual = "sprite",
	visual_size = {x = 1.0, y = 1.0},
	textures = {"potion.png"},
	collisionbox = {-0.1,-0.1,-0.1,0.1,0.1,0.1},
	lastpos = {},
	player = "",
}

potion_entity.on_step = function(self, dtime)

	if not self.player then
		self.object:remove()
		return
	end

	local pos = self.object:get_pos()

	if self.lastpos.x ~= nil then

		local vel = self.object:get_velocity()

		-- only when potion hits something physical
		if vel.x == 0
		or vel.y == 0
		or vel.z == 0 then

			if self.player ~= "" then

				-- round up coords to fix glitching through doors
				self.lastpos = vector.round(self.lastpos)

				self.player:set_pos(self.lastpos)

				minetest.sound_play("portal_close", {
					pos = self.lastpos,
					gain = 1.0,
					max_hear_distance = 5
				}, true)

				tp_effect(self.lastpos)
			end

			self.object:remove()

			return

		end
	end

	self.lastpos = pos
end

minetest.register_entity("teleport_potion:potion_entity", potion_entity)

--------------------------------------------------------------------------------
--- Teleport potion
--------------------------------------------------------------------------------
minetest.register_node("teleport_potion:potion", {
	tiles = {"potion.png"},
	drawtype = "signlike",
	paramtype = "light",
	paramtype2 = "wallmounted",
	walkable = false,
	sunlight_propagates = true,
	description = S("Teleport Potion (use to set destination; place to open portal)"),
	inventory_image = "potion.png",
	wield_image = "potion.png",
	groups = {dig_immediate = 3, vessel = 1},
	selection_box = {type = "wallmounted"},

	on_use = function(itemstack, user, pointed_thing)
		if pointed_thing.type == "node" then
			set_teleport_destination(user:get_player_name(), pointed_thing.above)
		else
			throw_potion(itemstack, user)
			if not is_creative(user:get_player_name()) then
				itemstack:take_item()
				return itemstack
			end
		end
	end,

	after_place_node = function(pos, placer, itemstack, pointed_thing)
		local name = placer:get_player_name()
		local dest = teleport_destinations[name]
		if dest then
			minetest.set_node(pos, {name = "teleport_potion:portal"})
			local meta = minetest.get_meta(pos)
			-- Set portal destination
			meta:set_int("x", dest.x)
			meta:set_int("y", dest.y)
			meta:set_int("z", dest.z)
			-- Portal open effect and sound
			tp_effect(pos)
			minetest.sound_play("portal_open", {
				pos = pos,
				gain = 1.0,
				max_hear_distance = 10
			})
		else
			minetest.chat_send_player(name, S("Potion failed!"))
			minetest.remove_node(pos)
			minetest.add_item(pos, "teleport_potion:potion")
		end
	end,
})

-- teleport potion recipe
if mcl then
minetest.register_craft({
	output = "teleport_potion:potion",
	recipe = {
		{"", "mcl_core:diamond", ""},
		{"mcl_core:diamond", "mcl_potions:glass_bottle", "mcl_core:diamond"},
		{"", "mcl_core:diamond", ""},
	},
})
else
minetest.register_craft({
	output = "teleport_potion:potion",
	recipe = {
		{"", "default:diamond", ""},
		{"default:diamond", "vessels:glass_bottle", "default:diamond"},
		{"", "default:diamond", ""},
	},
})
end

--------------------------------------------------------------------------------
--- Teleport pad
--------------------------------------------------------------------------------
local teleport_formspec_context = {}

minetest.register_node("teleport_potion:pad", {
	tiles = {"padd.png", "padd.png^[transformFY"},
	drawtype = "nodebox",
	paramtype = "light",
	paramtype2 = "facedir",
	legacy_wallmounted = true,
	walkable = true,
	sunlight_propagates = true,
	description = S("Teleport Pad (use to set destination; place to open portal)"),
	inventory_image = "padd.png",
	wield_image = "padd.png",
	light_source = 5,
	groups = {snappy = 3},
	node_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
	},
	selection_box = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
	},

	-- Save pointed nodes coordinates as destination for further portals
	on_use = function(itemstack, user, pointed_thing)
		if pointed_thing.type == "node" then
			set_teleport_destination(user:get_player_name(), pointed_thing.above)
		end
	end,

	-- Initialize teleport to saved location or the current position
	after_place_node = function(pos, placer, itemstack, pointed_thing)
		local meta = minetest.get_meta(pos)
		local name = placer:get_player_name()
		local dest = teleport_destinations[name]
		if not dest then
			dest = pos
		end
		-- Set coords
		meta:set_int("x", dest.x)
		meta:set_int("y", dest.y)
		meta:set_int("z", dest.z)

		meta:set_string("infotext", S("Pad Active (@1,@2,@3)",
				dest.x, dest.y, dest.z))

		minetest.sound_play("portal_open", {
			pos = pos,
			gain = 1.0,
			max_hear_distance = 10
		}, true)
	end,

	-- Show formspec depending on the players privileges.
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
		local name = clicker:get_player_name()

		if minetest.is_protected(pos, name) then
			minetest.record_protection_violation(pos, name)
			return
		end

		local meta = minetest.get_meta(pos)
		local coords = {
			x = meta:get_int("x"),
			y = meta:get_int("y"),
			z = meta:get_int("z")
		}
		local coords = coords.x .. "," .. coords.y .. "," .. coords.z
		local desc = meta:get_string("desc")
		formspec = "field[desc;" .. S("Description") .. ";"
				.. minetest.formspec_escape(desc) .. "]"
		-- Only allow privileged players to change coordinates
		if minetest.check_player_privs(name, "teleport") then
			formspec = formspec ..
					"field[coords;" .. S("Teleport coordinates") .. ";" .. coords .. "]"
		end

		teleport_formspec_context[name] = {
			pos = pos,
			coords = coords,
			desc = desc,
		}
		minetest.show_formspec(name, "teleport_potion:set_destination", formspec)
	end,
})

-- Check and set coordinates
minetest.register_on_player_receive_fields(function(player, formname, fields)
	if formname ~= "teleport_potion:set_destination" then
		return false
	end
	local name = player:get_player_name()
	local context = teleport_formspec_context[name]
	if not context then return false end
	teleport_formspec_context[name] = nil
	local meta = minetest.get_meta(context.pos)
	-- Coordinates were changed
	if fields.coords and fields.coords ~= context.coords then
		local coords = check_coordinates(fields.coords)
		if coords then
			meta:set_int("x", coords.x)
			meta:set_int("y", coords.y)
			meta:set_int("z", coords.z)
		else
			minetest.chat_send_player(name, S("Teleport Pad coordinates failed!"))
		end
	end
	-- Update infotext
	if fields.desc and fields.desc ~= "" then
		meta:set_string("desc", fields.desc)
		meta:set_string("infotext", S("Teleport to @1", fields.desc))
	else
		local coords = minetest.string_to_pos("(" .. context.coords .. ")")
		meta:set_string("infotext", S("Pad Active (@1,@2,@3)",
			coords.x, coords.y, coords.z))
	end
	return true
end)

-- teleport pad recipe
if mcl then
minetest.register_craft({
	output = "teleport_potion:pad",
	recipe = {
		{"teleport_potion:potion", "mcl_core:glass", "teleport_potion:potion"},
		{"mcl_core:glass", "mesecons:redstone", "mcl_core:glass"},
		{"teleport_potion:potion", "mcl_core:glass", "teleport_potion:potion"},
	},
})
else
minetest.register_craft({
	output = "teleport_potion:pad",
	recipe = {
		{"teleport_potion:potion", "default:glass", "teleport_potion:potion"},
		{"default:glass", "default:mese", "default:glass"},
		{"teleport_potion:potion", "default:glass", "teleport_potion:potion"}
	}
})
end

-- check portal & pad, teleport any entities on top
minetest.register_abm({
	label = "Potion/Pad teleportation",
	nodenames = {"teleport_potion:portal", "teleport_potion:pad"},
	interval = 2,
	chance = 1,
	catch_up = false,

	action = function(pos, node, active_object_count, active_object_count_wider)

		-- check objects inside pad/portal
		local objs = minetest.get_objects_inside_radius(pos, 1)

		if #objs == 0 then
			return
		end

		-- get coords from pad/portal
		local meta = minetest.get_meta(pos)

		if not meta then return end -- errorcheck

		local target_coords = {
			x = meta:get_int("x"),
			y = meta:get_int("y"),
			z = meta:get_int("z")
		}

		for n = 1, #objs do

			if objs[n]:is_player() then

				-- play sound on portal end
				minetest.sound_play("portal_close", {
					pos = pos,
					gain = 1.0,
					max_hear_distance = 5
				}, true)

				-- move player
				objs[n]:set_pos(target_coords)

				-- paricle effects on arrival
				tp_effect(target_coords)

				-- play sound on destination end
				minetest.sound_play("portal_close", {
					pos = target_coords,
					gain = 1.0,
					max_hear_distance = 5
				}, true)

				-- rotate player to look in pad placement direction
				local rot = node.param2
				local yaw = 0

				if rot == 0 or rot == 20 then
					yaw = 0 -- north
				elseif rot == 2 or rot == 22 then
					yaw = 3.14 -- south
				elseif rot == 1 or rot == 23 then
					yaw = 4.71 -- west
				elseif rot == 3 or rot == 21 then
					yaw = 1.57 -- east
				end

				objs[n]:set_look_yaw(yaw)
			end
		end
	end
})

-- add lucky blocks

-- Teleport Potion mod
if minetest.get_modpath("lucky_block") then
	lucky_block:add_blocks({
		{"dro", {"teleport_potion:potion"}, 2},
		{"tel"},
		{"dro", {"teleport_potion:pad"}, 1},
		{"lig"},
	})
end

print ("[MOD] Teleport Potion loaded")


code:
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.

-- Get the latest version of this file at:
--   https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua

local function format(str, ...)
	local args = { ... }
	local function repl(escape, open, num, close)
		if escape == "" then
			local replacement = tostring(args[tonumber(num)])
			if open == "" then
				replacement = replacement..close
			end
			return replacement
		else
			return "@"..open..num..close
		end
	end
	return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end

local gettext, ngettext
if minetest.get_modpath("intllib") then
	if intllib.make_gettext_pair then
		-- New method using gettext.
		gettext, ngettext = intllib.make_gettext_pair()
	else
		-- Old method using text files.
		gettext = intllib.Getter()
	end
end

-- Fill in missing functions.

gettext = gettext or function(msgid, ...)
	return format(msgid, ...)
end

ngettext = ngettext or function(msgid, msgid_plural, n, ...)
	return format(n==1 and msgid or msgid_plural, ...)
end

return gettext, ngettext


code:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-14 08:37+0200\n"
"PO-Revision-Date: 2016-05-27 08:38+0200\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.12\n"
"Last-Translator: Xanthin\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: de\n"

#: init.lua
msgid "Teleport Potion (place and right-click to enchant location)"
msgstr ""
"Teleportationstrank (platzieren und rechtsklicken,\n"
"um Standort zu verzaubern)"

#: init.lua
msgid "Enter teleport coords (e.g. 200,20,-200)"
msgstr "Koordinaten eingeben (z.B. 200,20,-200)"

#: init.lua
msgid "Right-click to enchant teleport location"
msgstr "Rechtsklick um Teleportationsort zu verzaubern"

#: init.lua
msgid "Potion failed!"
msgstr "Trank misslungen!"

#: init.lua
msgid "Teleport Pad (place and right-click to enchant location)"
msgstr ""
"Teleportationsfeld (platzieren und rechtsklicken,\n"
"um Standort zu verzaubern)"

#: init.lua
msgid "Enter teleport coords (e.g. 200,20,-200,Home)"
msgstr "Koordinaten eingeben (z.B. 200,20,-200,Haus)"

#: init.lua
msgid "Teleport to @1"
msgstr "Teleportiere nach @1"

#: init.lua
msgid "Pad Active (@1,@2,@3)"
msgstr "Feld aktiv (@1,@2,@3)"

#: init.lua
msgid "Teleport Pad coordinates failed!"
msgstr "Teleportationsfeldkoordinaten fehlgeschlagen!"


code:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-14 08:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: init.lua
msgid "Teleport Potion (place and right-click to enchant location)"
msgstr "Poción de teletransporte (colocar y hacer clic derecho para encantar la ubicación)"

#: init.lua
msgid "Enter teleport coords (e.g. 200,20,-200)"
msgstr "Inserta las coordenadas del teletransporte (Por ejemplo, 200,20, -200)"

#: init.lua
msgid "Right-click to enchant teleport location"
msgstr "Haga clic derecho para encantar la ubicación de teletransporte"

#: init.lua
msgid "Potion failed!"
msgstr "¡Poción fallida!"

#: init.lua
msgid "Teleport Pad (place and right-click to enchant location)"
msgstr "Teleport Pad (Colocalo y haz clic derecho para encantar la ubicación)"

#: init.lua
msgid "Enter teleport coords (e.g. 200,20,-200,Home)"
msgstr "Inserte las coordenadas del teletransporte (por ejemplo, 200,20, -200, Inicio)"

#: init.lua
msgid "Teleport to @1"
msgstr "Teletransportarse a @1"

#: init.lua
msgid "Pad Active (@1,@2,@3)"
msgstr "Pad activo"

#: init.lua
msgid "Teleport Pad coordinates failed!"
msgstr "¡Coordenadas del Teleport Pad erroneas!"


code:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-14 08:35+0200\n"
"PO-Revision-Date: 2017-05-14 08:37+0200\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.12\n"
"Last-Translator: Peppy <peppy@twang-factory.com>\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Language: fr\n"

#: init.lua
msgid "Teleport Potion (place and right-click to enchant location)"
msgstr "Potion de téléportation (poser puis clic-droit pour enchanter l'emplacement)"

#: init.lua
msgid "Enter teleport coords (e.g. 200,20,-200)"
msgstr "Saisissez les coordonnées de téléportation  (ex : 200,20,-200)"

#: init.lua
msgid "Right-click to enchant teleport location"
msgstr "Clic-droit pour enchanter l'emplacement de téléportation"

#: init.lua
msgid "Potion failed!"
msgstr "La potion n'a pas fonctionné !"

#: init.lua
msgid "Teleport Pad (place and right-click to enchant location)"
msgstr "Pad de téléportation (poser puis clic-droit pour enchanter l'emplacement)"

#: init.lua
msgid "Enter teleport coords (e.g. 200,20,-200,Home)"
msgstr "Saisissez les coordonnées de téléportation  (ex : 200,20,-200,Maison)"

#: init.lua
msgid "Teleport to @1"
msgstr "Téléportation vers @1"

#: init.lua
msgid "Pad Active (@1,@2,@3)"
msgstr "Pad activé (@1,@,2,@3)"

#: init.lua
msgid "Teleport Pad coordinates failed!"
msgstr "Les coordonnées du pad sont inchangées !"


code:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-14 08:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: init.lua
msgid "Teleport Potion (place and right-click to enchant location)"
msgstr ""

#: init.lua
msgid "Enter teleport coords (e.g. 200,20,-200)"
msgstr ""

#: init.lua
msgid "Right-click to enchant teleport location"
msgstr ""

#: init.lua
msgid "Potion failed!"
msgstr ""

#: init.lua
msgid "Teleport Pad (place and right-click to enchant location)"
msgstr ""

#: init.lua
msgid "Enter teleport coords (e.g. 200,20,-200,Home)"
msgstr ""

#: init.lua
msgid "Teleport to @1"
msgstr ""

#: init.lua
msgid "Pad Active (@1,@2,@3)"
msgstr ""

#: init.lua
msgid "Teleport Pad coordinates failed!"
msgstr ""


code: name = teleport_potion


code:
name: Build
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: apt
      run: sudo apt-get install -y luarocks
    - name: luacheck install
      run: luarocks install --local luacheck
    - name: luacheck run
      run: $HOME/.luarocks/bin/luacheck ./


code:
unused_args = false
allow_defined_top = true

globals = {
    "minetest",
}

read_globals = {
    string = {fields = {"split"}},
    table = {fields = {"copy", "getn"}},

    -- Builtin
    "vector", "ItemStack",
    "dump", "DIR_DELIM", "VoxelArea", "Settings",

    -- MTG
    "default", "sfinv", "creative",
}


code:
# minetest-toolranks [toolranks]

Minetest tool ranks mod

Tools gain levels for digging nodes. Higher level tools dig faster and take longer to wear out.

## Are you a mod developer?

Does one of your mods add new tools?
If so, to support this mod, add this code to your mod, after your tool's code:

```lua
if minetest.get_modpath("toolranks") then
    minetest.override_item("mymod:mytool", {
        original_description = "My Tool",
        description = toolranks.create_description("My Tool"),
        after_use = toolranks.new_afteruse
    })
    end
end
```

Or alternatively, you can use the helper function:

```lua
toolranks.add_tool("mymod:mytool")
```