Merge 4b66e9f447c72bb03074170cfebbe9d411feb9cb into 9755127ffd92b2fc49676fbc6b446403965e005d

This commit is contained in:
Thomas--S 2017-03-29 22:04:51 +00:00 committed by GitHub
commit cc2735739b
99 changed files with 3327 additions and 3110 deletions

View File

@ -9,11 +9,11 @@ local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
for i = 0, 31 do for i = 0, 31 do
minetest.register_alias("technic:concrete_post"..i, minetest.register_alias("technic:concrete_post"..i,
"technic:concrete_post") "technic:concrete_post")
end end
for i = 32, 63 do for i = 32, 63 do
minetest.register_alias("technic:concrete_post"..i, minetest.register_alias("technic:concrete_post"..i,
"technic:concrete_post_with_platform") "technic:concrete_post_with_platform")
end end
local steel_ingot local steel_ingot
@ -26,43 +26,43 @@ end
minetest.register_craft({ minetest.register_craft({
output = 'technic:rebar 6', output = 'technic:rebar 6',
recipe = { recipe = {
{'','', steel_ingot}, { "", "", steel_ingot },
{'',steel_ingot,''}, { "", steel_ingot, "" },
{steel_ingot, '', ''}, { steel_ingot, "", "" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:concrete 5', output = 'technic:concrete 5',
recipe = { recipe = {
{'default:stone','technic:rebar','default:stone'}, { "default:stone", "technic:rebar", "default:stone" },
{'technic:rebar','default:stone','technic:rebar'}, { "technic:rebar", "default:stone", "technic:rebar" },
{'default:stone','technic:rebar','default:stone'}, { "default:stone", "technic:rebar", "default:stone" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:concrete_post_platform 6', output = 'technic:concrete_post_platform 6',
recipe = { recipe = {
{'technic:concrete','technic:concrete_post','technic:concrete'}, { "technic:concrete", "technic:concrete_post", "technic:concrete" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:concrete_post 12', output = 'technic:concrete_post 12',
recipe = { recipe = {
{'default:stone','technic:rebar','default:stone'}, { "default:stone", "technic:rebar", "default:stone" },
{'default:stone','technic:rebar','default:stone'}, { "default:stone", "technic:rebar", "default:stone" },
{'default:stone','technic:rebar','default:stone'}, { "default:stone", "technic:rebar", "default:stone" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:blast_resistant_concrete 5', output = 'technic:blast_resistant_concrete 5',
recipe = { recipe = {
{'technic:concrete','technic:composite_plate','technic:concrete'}, { "technic:concrete", "technic:composite_plate", "technic:concrete" },
{'technic:composite_plate','technic:concrete','technic:composite_plate'}, { "technic:composite_plate", "technic:concrete", "technic:composite_plate" },
{'technic:concrete','technic:composite_plate','technic:concrete'}, { "technic:concrete", "technic:composite_plate", "technic:concrete" },
} }
}) })
@ -73,49 +73,49 @@ minetest.register_craftitem(":technic:rebar", {
minetest.register_node(":technic:concrete", { minetest.register_node(":technic:concrete", {
description = S("Concrete Block"), description = S("Concrete Block"),
tiles = {"technic_concrete_block.png",}, tiles = { "technic_concrete_block.png", },
groups = {cracky=1, level=2, concrete=1}, groups = { cracky = 1, level = 2, concrete = 1 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
minetest.register_node(":technic:blast_resistant_concrete", { minetest.register_node(":technic:blast_resistant_concrete", {
description = S("Blast-resistant Concrete Block"), description = S("Blast-resistant Concrete Block"),
tiles = {"technic_blast_resistant_concrete_block.png",}, tiles = { "technic_blast_resistant_concrete_block.png", },
groups = {cracky=1, level=3, concrete=1}, groups = { cracky = 1, level = 3, concrete = 1 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_blast = function(pos, intensity) on_blast = function(pos, intensity)
if intensity > 9 then if intensity > 9 then
minetest.remove_node(pos) minetest.remove_node(pos)
return {"technic:blast_resistant_concrete"} return { "technic:blast_resistant_concrete" }
end end
end, end,
}) })
local box_platform = {-0.5, 0.3, -0.5, 0.5, 0.5, 0.5} local box_platform = { -0.5, 0.3, -0.5, 0.5, 0.5, 0.5 }
local box_post = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15} local box_post = { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 }
local box_front = {-0.1, -0.3, 0, 0.1, 0.3, -0.5} local box_front = { -0.1, -0.3, 0, 0.1, 0.3, -0.5 }
local box_back = {-0.1, -0.3, 0, 0.1, 0.3, 0.5} local box_back = { -0.1, -0.3, 0, 0.1, 0.3, 0.5 }
local box_left = {0, -0.3, -0.1, -0.5, 0.3, 0.1} local box_left = { 0, -0.3, -0.1, -0.5, 0.3, 0.1 }
local box_right = {0, -0.3, -0.1, 0.5, 0.3, 0.1} local box_right = { 0, -0.3, -0.1, 0.5, 0.3, 0.1 }
minetest.register_node(":technic:concrete_post_platform", { minetest.register_node(":technic:concrete_post_platform", {
description = S("Concrete Post Platform"), description = S("Concrete Post Platform"),
tiles = {"technic_concrete_block.png",}, tiles = { "technic_concrete_block.png", },
groups={cracky=1, level=2}, groups = { cracky = 1, level = 2 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
paramtype = "light", paramtype = "light",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {box_platform} fixed = { box_platform }
}, },
on_place = function (itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
if node.name ~= "technic:concrete_post" then if node.name ~= "technic:concrete_post" then
return minetest.item_place_node(itemstack, placer, pointed_thing) return minetest.item_place_node(itemstack, placer, pointed_thing)
end end
minetest.set_node(pointed_thing.under, {name="technic:concrete_post_with_platform"}) minetest.set_node(pointed_thing.under, { name = "technic:concrete_post_with_platform" })
itemstack:take_item() itemstack:take_item()
placer:set_wielded_item(itemstack) placer:set_wielded_item(itemstack)
return itemstack return itemstack
@ -133,21 +133,21 @@ for platform = 0, 1 do
minetest.register_node(":technic:concrete_post"..(platform == 1 and "_with_platform" or ""), { minetest.register_node(":technic:concrete_post"..(platform == 1 and "_with_platform" or ""), {
description = S("Concrete Post"), description = S("Concrete Post"),
tiles = {"technic_concrete_block.png"}, tiles = { "technic_concrete_block.png" },
groups = {cracky=1, level=2, concrete_post=1, not_in_creative_inventory=platform}, groups = { cracky = 1, level = 2, concrete_post = 1, not_in_creative_inventory = platform },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drop = (platform == 1 and "technic:concrete_post_platform" or drop = (platform == 1 and "technic:concrete_post_platform" or
"technic:concrete_post"), "technic:concrete_post"),
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
drawtype = "nodebox", drawtype = "nodebox",
connects_to = {"group:concrete", "group:concrete_post"}, connects_to = { "group:concrete", "group:concrete_post" },
node_box = { node_box = {
type = "connected", type = "connected",
fixed = {box_post, (platform == 1 and box_platform or nil)}, fixed = { box_post, (platform == 1 and box_platform or nil) },
connect_front = box_front, connect_front = box_front,
connect_back = box_back, connect_back = box_back,
connect_left = box_left, connect_left = box_left,
connect_right = box_right, connect_right = box_right,
}, },
after_dig_node = after_dig_node, after_dig_node = after_dig_node,

View File

@ -10,139 +10,146 @@ if minetest.get_modpath("moreblocks") then
-- chrome seems to be too hard of a metal to be actually sawable -- chrome seems to be too hard of a metal to be actually sawable
stairsplus:register_all("technic", "marble", "technic:marble", { stairsplus:register_all("technic", "marble", "technic:marble", {
description=S("Marble"), description = S("Marble"),
groups={cracky=3, not_in_creative_inventory=1}, groups = { cracky = 3, not_in_creative_inventory = 1 },
tiles={"technic_marble.png"}, tiles = { "technic_marble.png" },
}) })
stairsplus:register_all("technic", "marble_bricks", "technic:marble_bricks", { stairsplus:register_all("technic", "marble_bricks", "technic:marble_bricks", {
description=S("Marble Bricks"), description = S("Marble Bricks"),
groups={cracky=3, not_in_creative_inventory=1}, groups = { cracky = 3, not_in_creative_inventory = 1 },
tiles={"technic_marble_bricks.png"}, tiles = { "technic_marble_bricks.png" },
}) })
stairsplus:register_all("technic", "granite", "technic:granite", { stairsplus:register_all("technic", "granite", "technic:granite", {
description=S("Granite"), description = S("Granite"),
groups={cracky=1, not_in_creative_inventory=1}, groups = { cracky = 1, not_in_creative_inventory = 1 },
tiles={"technic_granite.png"}, tiles = { "technic_granite.png" },
}) })
stairsplus:register_all("technic", "concrete", "technic:concrete", { stairsplus:register_all("technic", "concrete", "technic:concrete", {
description=S("Concrete"), description = S("Concrete"),
groups={cracky=3, not_in_creative_inventory=1}, groups = { cracky = 3, not_in_creative_inventory = 1 },
tiles={"technic_concrete_block.png"}, tiles = { "technic_concrete_block.png" },
}) })
stairsplus:register_all("technic", "zinc_block", "technic:zinc_block", { stairsplus:register_all("technic", "zinc_block", "technic:zinc_block", {
description=S("Zinc Block"), description = S("Zinc Block"),
groups={cracky=1, not_in_creative_inventory=1}, groups = { cracky = 1, not_in_creative_inventory = 1 },
tiles={"technic_zinc_block.png"}, tiles = { "technic_zinc_block.png" },
}) })
stairsplus:register_all("technic", "cast_iron_block", "technic:cast_iron_block", { stairsplus:register_all("technic", "cast_iron_block", "technic:cast_iron_block", {
description=S("Cast Iron Block"), description = S("Cast Iron Block"),
groups={cracky=1, not_in_creative_inventory=1}, groups = { cracky = 1, not_in_creative_inventory = 1 },
tiles={"technic_cast_iron_block.png"}, tiles = { "technic_cast_iron_block.png" },
}) })
stairsplus:register_all("technic", "carbon_steel_block", "technic:carbon_steel_block", { stairsplus:register_all("technic", "carbon_steel_block", "technic:carbon_steel_block", {
description=S("Carbon Steel Block"), description = S("Carbon Steel Block"),
groups={cracky=1, not_in_creative_inventory=1}, groups = { cracky = 1, not_in_creative_inventory = 1 },
tiles={"technic_carbon_steel_block.png"}, tiles = { "technic_carbon_steel_block.png" },
}) })
stairsplus:register_all("technic", "stainless_steel_block", "technic:stainless_steel_block", { stairsplus:register_all("technic", "stainless_steel_block", "technic:stainless_steel_block", {
description=S("Stainless Steel Block"), description = S("Stainless Steel Block"),
groups={cracky=1, not_in_creative_inventory=1}, groups = { cracky = 1, not_in_creative_inventory = 1 },
tiles={"technic_stainless_steel_block.png"}, tiles = { "technic_stainless_steel_block.png" },
}) })
stairsplus:register_all("technic", "brass_block", "technic:brass_block", { stairsplus:register_all("technic", "brass_block", "technic:brass_block", {
description=S("Brass Block"), description = S("Brass Block"),
groups={cracky=1, not_in_creative_inventory=1}, groups = { cracky = 1, not_in_creative_inventory = 1 },
tiles={"technic_brass_block.png"}, tiles = { "technic_brass_block.png" },
}) })
function register_technic_stairs_alias(modname, origname, newmod, newname) function register_technic_stairs_alias(modname, origname, newmod, newname)
minetest.register_alias(modname .. ":slab_" .. origname, newmod..":slab_" .. newname) minetest.register_alias(modname..":slab_"..origname, newmod..":slab_"..newname)
minetest.register_alias(modname .. ":slab_" .. origname .. "_inverted", newmod..":slab_" .. newname .. "_inverted") minetest.register_alias(modname..":slab_"..origname.."_inverted", newmod..":slab_"..newname.."_inverted")
minetest.register_alias(modname .. ":slab_" .. origname .. "_wall", newmod..":slab_" .. newname .. "_wall") minetest.register_alias(modname..":slab_"..origname.."_wall", newmod..":slab_"..newname.."_wall")
minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter", newmod..":slab_" .. newname .. "_quarter") minetest.register_alias(modname..":slab_"..origname.."_quarter", newmod..":slab_"..newname.."_quarter")
minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_inverted", newmod..":slab_" .. newname .. "_quarter_inverted") minetest.register_alias(modname..":slab_"..origname.."_quarter_inverted", newmod..":slab_"..newname.."_quarter_inverted")
minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_wall", newmod..":slab_" .. newname .. "_quarter_wall") minetest.register_alias(modname..":slab_"..origname.."_quarter_wall", newmod..":slab_"..newname.."_quarter_wall")
minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter", newmod..":slab_" .. newname .. "_three_quarter") minetest.register_alias(modname..":slab_"..origname.."_three_quarter", newmod..":slab_"..newname.."_three_quarter")
minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_inverted", newmod..":slab_" .. newname .. "_three_quarter_inverted") minetest.register_alias(modname..":slab_"..origname.."_three_quarter_inverted", newmod..":slab_"..newname.."_three_quarter_inverted")
minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_wall", newmod..":slab_" .. newname .. "_three_quarter_wall") minetest.register_alias(modname..":slab_"..origname.."_three_quarter_wall", newmod..":slab_"..newname.."_three_quarter_wall")
minetest.register_alias(modname .. ":stair_" .. origname, newmod..":stair_" .. newname) minetest.register_alias(modname..":stair_"..origname, newmod..":stair_"..newname)
minetest.register_alias(modname .. ":stair_" .. origname .. "_inverted", newmod..":stair_" .. newname .. "_inverted") minetest.register_alias(modname..":stair_"..origname.."_inverted", newmod..":stair_"..newname.."_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall", newmod..":stair_" .. newname .. "_wall") minetest.register_alias(modname..":stair_"..origname.."_wall", newmod..":stair_"..newname.."_wall")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", newmod..":stair_" .. newname .. "_wall_half") minetest.register_alias(modname..":stair_"..origname.."_wall_half", newmod..":stair_"..newname.."_wall_half")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", newmod..":stair_" .. newname .. "_wall_half_inverted") minetest.register_alias(modname..":stair_"..origname.."_wall_half_inverted", newmod..":stair_"..newname.."_wall_half_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_half", newmod..":stair_" .. newname .. "_half") minetest.register_alias(modname..":stair_"..origname.."_half", newmod..":stair_"..newname.."_half")
minetest.register_alias(modname .. ":stair_" .. origname .. "_half_inverted", newmod..":stair_" .. newname .. "_half_inverted") minetest.register_alias(modname..":stair_"..origname.."_half_inverted", newmod..":stair_"..newname.."_half_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half", newmod..":stair_" .. newname .. "_right_half") minetest.register_alias(modname..":stair_"..origname.."_right_half", newmod..":stair_"..newname.."_right_half")
minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half_inverted", newmod..":stair_" .. newname .. "_right_half_inverted") minetest.register_alias(modname..":stair_"..origname.."_right_half_inverted", newmod..":stair_"..newname.."_right_half_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", newmod..":stair_" .. newname .. "_wall_half") minetest.register_alias(modname..":stair_"..origname.."_wall_half", newmod..":stair_"..newname.."_wall_half")
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", newmod..":stair_" .. newname .. "_wall_half_inverted") minetest.register_alias(modname..":stair_"..origname.."_wall_half_inverted", newmod..":stair_"..newname.."_wall_half_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_inner", newmod..":stair_" .. newname .. "_inner") minetest.register_alias(modname..":stair_"..origname.."_inner", newmod..":stair_"..newname.."_inner")
minetest.register_alias(modname .. ":stair_" .. origname .. "_inner_inverted", newmod..":stair_" .. newname .. "_inner_inverted") minetest.register_alias(modname..":stair_"..origname.."_inner_inverted", newmod..":stair_"..newname.."_inner_inverted")
minetest.register_alias(modname .. ":stair_" .. origname .. "_outer", newmod..":stair_" .. newname .. "_outer") minetest.register_alias(modname..":stair_"..origname.."_outer", newmod..":stair_"..newname.."_outer")
minetest.register_alias(modname .. ":stair_" .. origname .. "_outer_inverted", newmod..":stair_" .. newname .. "_outer_inverted") minetest.register_alias(modname..":stair_"..origname.."_outer_inverted", newmod..":stair_"..newname.."_outer_inverted")
minetest.register_alias(modname .. ":panel_" .. origname .. "_bottom", newmod..":panel_" .. newname .. "_bottom") minetest.register_alias(modname..":panel_"..origname.."_bottom", newmod..":panel_"..newname.."_bottom")
minetest.register_alias(modname .. ":panel_" .. origname .. "_top", newmod..":panel_" .. newname .. "_top") minetest.register_alias(modname..":panel_"..origname.."_top", newmod..":panel_"..newname.."_top")
minetest.register_alias(modname .. ":panel_" .. origname .. "_vertical", newmod..":panel_" .. newname .. "_vertical") minetest.register_alias(modname..":panel_"..origname.."_vertical", newmod..":panel_"..newname.."_vertical")
minetest.register_alias(modname .. ":micro_" .. origname .. "_bottom", newmod..":micro_" .. newname .. "_bottom") minetest.register_alias(modname..":micro_"..origname.."_bottom", newmod..":micro_"..newname.."_bottom")
minetest.register_alias(modname .. ":micro_" .. origname .. "_top", newmod..":micro_" .. newname .. "_top") minetest.register_alias(modname..":micro_"..origname.."_top", newmod..":micro_"..newname.."_top")
end end
register_technic_stairs_alias("stairsplus", "concrete", "technic", "concrete") register_technic_stairs_alias("stairsplus", "concrete", "technic", "concrete")
register_technic_stairs_alias("stairsplus", "marble", "technic", "marble") register_technic_stairs_alias("stairsplus", "marble", "technic", "marble")
register_technic_stairs_alias("stairsplus", "granite", "technic", "granite") register_technic_stairs_alias("stairsplus", "granite", "technic", "granite")
register_technic_stairs_alias("stairsplus", "marble_bricks", "technic", "marble_bricks") register_technic_stairs_alias("stairsplus", "marble_bricks", "technic", "marble_bricks")
end end
local iclip_def = { local iclip_def = {
description = "Insulator/cable clip", description = "Insulator/cable clip",
drawtype = "mesh", drawtype = "mesh",
mesh = "technic_insulator_clip.obj", mesh = "technic_insulator_clip.obj",
tiles = {"technic_insulator_clip.png"}, tiles = { "technic_insulator_clip.png" },
is_ground_content = false, is_ground_content = false,
groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1 }, groups = { choppy = 1, snappy = 1, oddly_breakable_by_hand = 1 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
} }
local iclipfence_def = { local iclipfence_def = {
description = "Insulator/cable clip", description = "Insulator/cable clip",
tiles = {"technic_insulator_clip.png"}, tiles = { "technic_insulator_clip.png" },
is_ground_content = false, is_ground_content = false,
paramtype = "light", paramtype = "light",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "connected", type = "connected",
fixed = { fixed = {
{ -0.25, 0.75, -0.25, 0.25, 1.25, 0.25 }, -- the clip on top { -0.25, 0.75, -0.25, 0.25, 1.25, 0.25 }, -- the clip on top
{ -0.125, 0.6875, -0.125, 0.125, 0.75, 0.125 }, { -0.125, 0.6875, -0.125, 0.125, 0.75, 0.125 },
{ -0.1875, 0.625, -0.1875, 0.1875, 0.6875, 0.1875 }, { -0.1875, 0.625, -0.1875, 0.1875, 0.6875, 0.1875 },
{ -0.125, 0.5625, -0.125, 0.125, 0.625, 0.125 }, { -0.125, 0.5625, -0.125, 0.125, 0.625, 0.125 },
{ -0.1875, 0.5, -0.1875, 0.1875, 0.5625, 0.1875 }, { -0.1875, 0.5, -0.1875, 0.1875, 0.5625, 0.1875 },
{ -0.125, 0.4375, -0.125, 0.125, 0.5, 0.125 }, { -0.125, 0.4375, -0.125, 0.125, 0.5, 0.125 },
{ -0.1875, 0.375, -0.1875, 0.1875, 0.4375, 0.1875 }, { -0.1875, 0.375, -0.1875, 0.1875, 0.4375, 0.1875 },
{ -0.125, -0.5, -0.125, 0.125, 0.375, 0.125 }, -- the post, slightly short { -0.125, -0.5, -0.125, 0.125, 0.375, 0.125 }, -- the post, slightly short
}, },
-- connect_top = -- connect_top =
-- connect_bottom = -- connect_bottom =
connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8}, connect_front = {
{-1/16,-5/16,-1/2,1/16,-3/16,-1/8}}, { -1/16, 3/16, -1/2, 1/16, 5/16, -1/8 },
connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16}, { -1/16, -5/16, -1/2, 1/16, -3/16, -1/8 }
{-1/2,-5/16,-1/16,-1/8,-3/16,1/16}}, },
connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2}, connect_left = {
{-1/16,-5/16,1/8,1/16,-3/16,1/2}}, { -1/2, 3/16, -1/16, -1/8, 5/16, 1/16 },
connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16}, { -1/2, -5/16, -1/16, -1/8, -3/16, 1/16 }
{1/8,-5/16,-1/16,1/2,-3/16,1/16}}, },
connect_back = {
{ -1/16, 3/16, 1/8, 1/16, 5/16, 1/2 },
{ -1/16, -5/16, 1/8, 1/16, -3/16, 1/2 }
},
connect_right = {
{ 1/8, 3/16, -1/16, 1/2, 5/16, 1/16 },
{ 1/8, -5/16, -1/16, 1/2, -3/16, 1/16 }
},
}, },
connects_to = {"group:fence", "group:wood", "group:tree"}, connects_to = { "group:fence", "group:wood", "group:tree" },
groups = {fence=1, choppy=1, snappy=1, oddly_breakable_by_hand=1 }, groups = { fence = 1, choppy = 1, snappy = 1, oddly_breakable_by_hand = 1 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
} }
@ -154,14 +161,14 @@ if minetest.get_modpath("unifieddyes") then
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing) unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end end
iclip_def.after_dig_node = unifieddyes.after_dig_node iclip_def.after_dig_node = unifieddyes.after_dig_node
iclip_def.groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1} iclip_def.groups = { choppy = 1, snappy = 1, oddly_breakable_by_hand = 1, ud_param2_colorable = 1 }
iclipfence_def.paramtype2 = "color" iclipfence_def.paramtype2 = "color"
iclipfence_def.palette = "unifieddyes_palette_extended.png" iclipfence_def.palette = "unifieddyes_palette_extended.png"
iclipfence_def.on_construct = unifieddyes.on_construct iclipfence_def.on_construct = unifieddyes.on_construct
iclipfence_def.after_place_node = unifieddyes.recolor_on_place iclipfence_def.after_place_node = unifieddyes.recolor_on_place
iclipfence_def.after_dig_node = unifieddyes.after_dig_node iclipfence_def.after_dig_node = unifieddyes.after_dig_node
iclipfence_def.groups = {fence=1, choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1} iclipfence_def.groups = { fence = 1, choppy = 1, snappy = 1, oddly_breakable_by_hand = 1, ud_param2_colorable = 1 }
iclipfence_def.place_param2 = 171 -- medium amber, low saturation, closest color to default:wood iclipfence_def.place_param2 = 171 -- medium amber, low saturation, closest color to default:wood
end end
@ -171,17 +178,17 @@ minetest.register_node(":technic:insulator_clip_fencepost", iclipfence_def)
minetest.register_craft({ minetest.register_craft({
output = "technic:insulator_clip", output = "technic:insulator_clip",
recipe = { recipe = {
{ "", "dye:white", ""}, { "", "dye:white", "" },
{ "", "technic:raw_latex", ""}, { "", "technic:raw_latex", "" },
{ "technic:raw_latex", "default:stone", "technic:raw_latex"}, { "technic:raw_latex", "default:stone", "technic:raw_latex" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = "technic:insulator_clip_fencepost 2", output = "technic:insulator_clip_fencepost 2",
recipe = { recipe = {
{ "", "dye:white", ""}, { "", "dye:white", "" },
{ "", "technic:raw_latex", ""}, { "", "technic:raw_latex", "" },
{ "technic:raw_latex", "default:fence_wood", "technic:raw_latex"}, { "technic:raw_latex", "default:fence_wood", "technic:raw_latex" },
} }
}) })

View File

@ -4,153 +4,153 @@ local mesecons_materials = minetest.get_modpath("mesecons_materials")
-- tubes crafting recipes -- tubes crafting recipes
minetest.register_craft({ minetest.register_craft({
output = 'pipeworks:accelerator_tube_1', output = "pipeworks:accelerator_tube_1",
recipe = {
{'technic:copper_coil', 'pipeworks:tube_1', 'technic:copper_coil'},
}
})
minetest.register_craft({
output = 'pipeworks:teleport_tube_1',
recipe = {
{'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'},
{'pipeworks:tube_1', 'technic:control_logic_unit', 'pipeworks:tube_1'},
{'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'},
}
})
minetest.register_craft({
output = 'technic:diamond_drill_head',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot'}, { "technic:copper_coil", "pipeworks:tube_1", "technic:copper_coil" },
{'default:diamond', '', 'default:diamond'},
{'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:green_energy_crystal', output = "pipeworks:teleport_tube_1",
recipe = { recipe = {
{'default:gold_ingot', 'technic:battery', 'dye:green'}, { "default:mese_crystal", "technic:copper_coil", "default:mese_crystal" },
{'technic:battery', 'technic:red_energy_crystal', 'technic:battery'}, { "pipeworks:tube_1", "technic:control_logic_unit", "pipeworks:tube_1" },
{'dye:green', 'technic:battery', 'default:gold_ingot'}, { "default:mese_crystal", "technic:copper_coil", "default:mese_crystal" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:blue_energy_crystal', output = "technic:diamond_drill_head",
recipe = { recipe = {
{'moreores:mithril_ingot', 'technic:battery', 'dye:blue'}, { "technic:stainless_steel_ingot", "default:diamond", "technic:stainless_steel_ingot" },
{'technic:battery', 'technic:green_energy_crystal', 'technic:battery'}, { "default:diamond", "", "default:diamond" },
{'dye:blue', 'technic:battery', 'moreores:mithril_ingot'}, { "technic:stainless_steel_ingot", "default:diamond", "technic:stainless_steel_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:red_energy_crystal', output = "technic:green_energy_crystal",
recipe = { recipe = {
{'moreores:silver_ingot', 'technic:battery', 'dye:red'}, { "default:gold_ingot", "technic:battery", "dye:green" },
{'technic:battery', 'default:diamondblock', 'technic:battery'}, { "technic:battery", "technic:red_energy_crystal", "technic:battery" },
{'dye:red', 'technic:battery', 'moreores:silver_ingot'}, { "dye:green", "technic:battery", "default:gold_ingot" },
}
})
minetest.register_craft({
output = "technic:blue_energy_crystal",
recipe = {
{ "moreores:mithril_ingot", "technic:battery", "dye:blue" },
{ "technic:battery", "technic:green_energy_crystal", "technic:battery" },
{ "dye:blue", "technic:battery", "moreores:mithril_ingot" },
}
})
minetest.register_craft({
output = "technic:red_energy_crystal",
recipe = {
{ "moreores:silver_ingot", "technic:battery", "dye:red" },
{ "technic:battery", "default:diamondblock", "technic:battery" },
{ "dye:red", "technic:battery", "moreores:silver_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:fine_copper_wire 2', output = 'technic:fine_copper_wire 2',
recipe = { recipe = {
{'', 'default:copper_ingot', ''}, { "", "default:copper_ingot", "" },
{'', 'default:copper_ingot', ''}, { "", "default:copper_ingot", "" },
{'', 'default:copper_ingot', ''}, { "", "default:copper_ingot", "" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:fine_gold_wire 2', output = 'technic:fine_gold_wire 2',
recipe = { recipe = {
{'', 'default:gold_ingot', ''}, { "", "default:gold_ingot", "" },
{'', 'default:gold_ingot', ''}, { "", "default:gold_ingot", "" },
{'', 'default:gold_ingot', ''}, { "", "default:gold_ingot", "" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:fine_silver_wire 2', output = 'technic:fine_silver_wire 2',
recipe = { recipe = {
{'', 'moreores:silver_ingot', ''}, { "", "moreores:silver_ingot", "" },
{'', 'moreores:silver_ingot', ''}, { "", "moreores:silver_ingot", "" },
{'', 'moreores:silver_ingot', ''}, { "", "moreores:silver_ingot", "" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:copper_coil 1', output = 'technic:copper_coil 1',
recipe = { recipe = {
{'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire'}, { "technic:fine_copper_wire", "technic:wrought_iron_ingot", "technic:fine_copper_wire" },
{'technic:wrought_iron_ingot', '', 'technic:wrought_iron_ingot'}, { "technic:wrought_iron_ingot", "", "technic:wrought_iron_ingot" },
{'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire'}, { "technic:fine_copper_wire", "technic:wrought_iron_ingot", "technic:fine_copper_wire" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:motor', output = "technic:motor",
recipe = { recipe = {
{'technic:carbon_steel_ingot', 'technic:copper_coil', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "technic:copper_coil", "technic:carbon_steel_ingot" },
{'technic:carbon_steel_ingot', 'technic:copper_coil', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "technic:copper_coil", "technic:carbon_steel_ingot" },
{'technic:carbon_steel_ingot', 'default:copper_ingot', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "default:copper_ingot", "technic:carbon_steel_ingot" },
} }
}) })
local isolation = mesecons_materials and "mesecons_materials:fiber" or "technic:rubber" local isolation = mesecons_materials and "mesecons_materials:fiber" or "technic:rubber"
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_transformer', output = "technic:lv_transformer",
recipe = { recipe = {
{isolation, 'technic:wrought_iron_ingot', isolation}, { isolation, "technic:wrought_iron_ingot", isolation },
{'technic:copper_coil', 'technic:wrought_iron_ingot', 'technic:copper_coil'}, { "technic:copper_coil", "technic:wrought_iron_ingot", "technic:copper_coil" },
{'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'}, { "technic:wrought_iron_ingot", "technic:wrought_iron_ingot", "technic:wrought_iron_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_transformer', output = "technic:mv_transformer",
recipe = { recipe = {
{isolation, 'technic:carbon_steel_ingot', isolation}, { isolation, "technic:carbon_steel_ingot", isolation },
{'technic:copper_coil', 'technic:carbon_steel_ingot', 'technic:copper_coil'}, { "technic:copper_coil", "technic:carbon_steel_ingot", "technic:copper_coil" },
{'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "technic:carbon_steel_ingot", "technic:carbon_steel_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:hv_transformer', output = "technic:hv_transformer",
recipe = { recipe = {
{isolation, 'technic:stainless_steel_ingot', isolation}, { isolation, "technic:stainless_steel_ingot", isolation },
{'technic:copper_coil', 'technic:stainless_steel_ingot', 'technic:copper_coil'}, { "technic:copper_coil", "technic:stainless_steel_ingot", "technic:copper_coil" },
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:stainless_steel_ingot", "technic:stainless_steel_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:control_logic_unit', output = "technic:control_logic_unit",
recipe = { recipe = {
{'', 'technic:fine_gold_wire', ''}, { "", "technic:fine_gold_wire", "" },
{'default:copper_ingot', 'technic:silicon_wafer', 'default:copper_ingot'}, { "default:copper_ingot", "technic:silicon_wafer", "default:copper_ingot" },
{'', 'technic:chromium_ingot', ''}, { "", "technic:chromium_ingot", "" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:mixed_metal_ingot 9', output = 'technic:mixed_metal_ingot 9',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:stainless_steel_ingot", "technic:stainless_steel_ingot" },
{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, { "default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot" },
{'moreores:tin_ingot', 'moreores:tin_ingot', 'moreores:tin_ingot'}, { "moreores:tin_ingot", "moreores:tin_ingot", "moreores:tin_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:carbon_cloth', output = "technic:carbon_cloth",
recipe = { recipe = {
{'technic:graphite', 'technic:graphite', 'technic:graphite'} { "technic:graphite", "technic:graphite", "technic:graphite" }
} }
}) })
@ -168,16 +168,16 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "default:bronze_ingot 0", output = "default:bronze_ingot 0",
recipe = {"default:copper_ingot", "default:steel_ingot"} recipe = { "default:copper_ingot", "default:steel_ingot" }
}) })
-- Accelerator tube -- Accelerator tube
minetest.register_craft({ minetest.register_craft({
output = "pipeworks:accelerator_tube_1 0", output = "pipeworks:accelerator_tube_1 0",
recipe = { recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" }, { "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
}, },
}) })
@ -185,16 +185,16 @@ minetest.register_craft({
minetest.register_craft({ minetest.register_craft({
output = "pipeworks:teleport_tube_1 0", output = "pipeworks:teleport_tube_1 0",
recipe = { recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "default:desert_stone", "default:mese", "default:desert_stone" }, { "default:desert_stone", "default:mese", "default:desert_stone" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" } { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = "default:dirt 2", output = "default:dirt 2",
type = "shapeless", type = "shapeless",
replacements = {{"bucket:bucket_water","bucket:bucket_empty"}}, replacements = { { "bucket:bucket_water", "bucket:bucket_empty" } },
recipe = { recipe = {
"technic:stone_dust", "technic:stone_dust",
"group:leaves", "group:leaves",

View File

@ -147,7 +147,7 @@ function technic.trace_node_ray_fat(pos, dir, range)
end end
-- Step in whichever direction we're most off course in. -- Step in whichever direction we're most off course in.
local sx, sy, sz -- Whether we've already stepped along each axis local sx, sy, sz -- Whether we've already stepped along each axis
if dx > dy then if dx > dy then
if dx > dz then if dx > dz then
sx = true sx = true
@ -172,7 +172,7 @@ function technic.trace_node_ray_fat(pos, dir, range)
-- We can just use fixed integer keys here because the -- We can just use fixed integer keys here because the
-- table will be completely cleared before we reach this -- table will be completely cleared before we reach this
-- code block again. -- code block again.
local dlen = math.sqrt(dx*dx + dy*dy + dz*dz) local dlen = math.sqrt(dx * dx + dy * dy + dz * dz)
-- Normalized axis deltas -- Normalized axis deltas
local dxn, dyn, dzn = dx / dlen, dy / dlen, dz / dlen local dxn, dyn, dzn = dx / dlen, dy / dlen, dz / dlen
if not sx and dxn > 0.5 then if not sx and dxn > 0.5 then

View File

@ -16,7 +16,7 @@ technic.modpath = modpath
if rawget(_G, "intllib") then if rawget(_G, "intllib") then
technic.getter = intllib.Getter() technic.getter = intllib.Getter()
else else
technic.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 technic.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 end
local S = technic.getter local S = technic.getter

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
minetest.register_craftitem("technic:silicon_wafer", { minetest.register_craftitem("technic:silicon_wafer", {
@ -6,7 +5,7 @@ minetest.register_craftitem("technic:silicon_wafer", {
inventory_image = "technic_silicon_wafer.png", inventory_image = "technic_silicon_wafer.png",
}) })
minetest.register_craftitem( "technic:doped_silicon_wafer", { minetest.register_craftitem("technic:doped_silicon_wafer", {
description = S("Doped Silicon Wafer"), description = S("Doped Silicon Wafer"),
inventory_image = "technic_doped_silicon_wafer.png", inventory_image = "technic_doped_silicon_wafer.png",
}) })
@ -16,15 +15,14 @@ minetest.register_craftitem("technic:uranium_fuel", {
inventory_image = "technic_uranium_fuel.png", inventory_image = "technic_uranium_fuel.png",
}) })
minetest.register_craftitem( "technic:diamond_drill_head", { minetest.register_craftitem("technic:diamond_drill_head", {
description = S("Diamond Drill Head"), description = S("Diamond Drill Head"),
inventory_image = "technic_diamond_drill_head.png", inventory_image = "technic_diamond_drill_head.png",
}) })
minetest.register_tool("technic:blue_energy_crystal", { minetest.register_tool("technic:blue_energy_crystal", {
description = S("Blue Energy Crystal"), description = S("Blue Energy Crystal"),
inventory_image = minetest.inventorycube( inventory_image = minetest.inventorycube("technic_diamond_block_blue.png",
"technic_diamond_block_blue.png",
"technic_diamond_block_blue.png", "technic_diamond_block_blue.png",
"technic_diamond_block_blue.png"), "technic_diamond_block_blue.png"),
wear_represents = "technic_RE_charge", wear_represents = "technic_RE_charge",
@ -32,15 +30,14 @@ minetest.register_tool("technic:blue_energy_crystal", {
tool_capabilities = { tool_capabilities = {
max_drop_level = 0, max_drop_level = 0,
groupcaps = { groupcaps = {
fleshy = {times={}, uses=10000, maxlevel=0} fleshy = { times = {}, uses = 10000, maxlevel = 0 }
} }
} }
}) })
minetest.register_tool("technic:green_energy_crystal", { minetest.register_tool("technic:green_energy_crystal", {
description = S("Green Energy Crystal"), description = S("Green Energy Crystal"),
inventory_image = minetest.inventorycube( inventory_image = minetest.inventorycube("technic_diamond_block_green.png",
"technic_diamond_block_green.png",
"technic_diamond_block_green.png", "technic_diamond_block_green.png",
"technic_diamond_block_green.png"), "technic_diamond_block_green.png"),
wear_represents = "technic_RE_charge", wear_represents = "technic_RE_charge",
@ -48,15 +45,14 @@ minetest.register_tool("technic:green_energy_crystal", {
tool_capabilities = { tool_capabilities = {
max_drop_level = 0, max_drop_level = 0,
groupcaps = { groupcaps = {
fleshy = {times={}, uses=10000, maxlevel=0} fleshy = { times = {}, uses = 10000, maxlevel = 0 }
} }
} }
}) })
minetest.register_tool("technic:red_energy_crystal", { minetest.register_tool("technic:red_energy_crystal", {
description = S("Red Energy Crystal"), description = S("Red Energy Crystal"),
inventory_image = minetest.inventorycube( inventory_image = minetest.inventorycube("technic_diamond_block_red.png",
"technic_diamond_block_red.png",
"technic_diamond_block_red.png", "technic_diamond_block_red.png",
"technic_diamond_block_red.png"), "technic_diamond_block_red.png"),
wear_represents = "technic_RE_charge", wear_represents = "technic_RE_charge",
@ -64,7 +60,7 @@ minetest.register_tool("technic:red_energy_crystal", {
tool_capabilities = { tool_capabilities = {
max_drop_level = 0, max_drop_level = 0,
groupcaps = { groupcaps = {
fleshy = {times={}, uses=10000, maxlevel=0} fleshy = { times = {}, uses = 10000, maxlevel = 0 }
} }
} }
}) })
@ -105,12 +101,12 @@ minetest.register_craftitem("technic:mv_transformer", {
inventory_image = "technic_mv_transformer.png", inventory_image = "technic_mv_transformer.png",
}) })
minetest.register_craftitem( "technic:hv_transformer", { minetest.register_craftitem("technic:hv_transformer", {
description = S("High Voltage Transformer"), description = S("High Voltage Transformer"),
inventory_image = "technic_hv_transformer.png", inventory_image = "technic_hv_transformer.png",
}) })
minetest.register_craftitem( "technic:control_logic_unit", { minetest.register_craftitem("technic:control_logic_unit", {
description = S("Control Logic Unit"), description = S("Control Logic Unit"),
inventory_image = "technic_control_logic_unit.png", inventory_image = "technic_control_logic_unit.png",
}) })
@ -147,11 +143,11 @@ minetest.register_craftitem("technic:carbon_cloth", {
minetest.register_node("technic:machine_casing", { minetest.register_node("technic:machine_casing", {
description = S("Machine Casing"), description = S("Machine Casing"),
groups = {cracky=2}, groups = { cracky = 2 },
sunlight_propagates = true, sunlight_propagates = true,
paramtype = "light", paramtype = "light",
drawtype = "allfaces", drawtype = "allfaces",
tiles = {"technic_machine_casing.png"}, tiles = { "technic_machine_casing.png" },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
@ -162,9 +158,9 @@ for p = 0, 35 do
local block = "technic:uranium"..psuffix.."_block" local block = "technic:uranium"..psuffix.."_block"
local ov = p == 7 and minetest.override_item or nil; local ov = p == 7 and minetest.override_item or nil;
(ov or minetest.register_craftitem)(ingot, { (ov or minetest.register_craftitem)(ingot, {
description = string.format(S("%.1f%%-Fissile Uranium Ingot"), p/10), description = string.format(S("%.1f%%-Fissile Uranium Ingot"), p / 10),
inventory_image = "technic_uranium_ingot.png", inventory_image = "technic_uranium_ingot.png",
groups = {uranium_ingot=1, not_in_creative_inventory=nici}, groups = { uranium_ingot = 1, not_in_creative_inventory = nici },
}); });
-- Note on radioactivity of blocks: -- Note on radioactivity of blocks:
-- Source: <http://www.wise-uranium.org/rup.html> -- Source: <http://www.wise-uranium.org/rup.html>
@ -197,27 +193,32 @@ for p = 0, 35 do
-- uranium ore has radioactive=1. This yields radioactive=1.0 -- uranium ore has radioactive=1. This yields radioactive=1.0
-- for a fully-depleted uranium block and radioactive=2.6 for -- for a fully-depleted uranium block and radioactive=2.6 for
-- a 3.5%-fissile uranium block. -- a 3.5%-fissile uranium block.
local radioactivity = math.floor(math.sqrt((1+5.55*p/35) * 18 / (1+5.55*7/35)) + 0.5); local radioactivity = math.floor(math.sqrt((1 + 5.55 * p / 35) * 18 / (1 + 5.55 * 7 / 35)) + 0.5);
(ov or minetest.register_node)(block, { (ov or minetest.register_node)(block, {
description = string.format(S("%.1f%%-Fissile Uranium Block"), p/10), description = string.format(S("%.1f%%-Fissile Uranium Block"), p / 10),
tiles = {"technic_uranium_block.png"}, tiles = { "technic_uranium_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {uranium_block=1, not_in_creative_inventory=nici, groups = {
cracky=1, level=2, radioactive=radioactivity}, uranium_block = 1,
not_in_creative_inventory = nici,
cracky = 1,
level = 2,
radioactive = radioactivity
},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}); });
if not ov then if not ov then
minetest.register_craft({ minetest.register_craft({
output = block, output = block,
recipe = { recipe = {
{ingot, ingot, ingot}, { ingot, ingot, ingot },
{ingot, ingot, ingot}, { ingot, ingot, ingot },
{ingot, ingot, ingot}, { ingot, ingot, ingot },
}, },
}) })
minetest.register_craft({ minetest.register_craft({
output = ingot.." 9", output = ingot.." 9",
recipe = {{block}}, recipe = { { block } },
}) })
end end
end end

View File

@ -1,10 +1,9 @@
-- Aliases to convert from legacy node/item names -- Aliases to convert from legacy node/item names
technic.legacy_nodenames = { technic.legacy_nodenames = {
["technic:alloy_furnace"] = "technic:lv_alloy_furnace", ["technic:alloy_furnace"] = "technic:lv_alloy_furnace",
["technic:alloy_furnace_active"] = "technic:lv_alloy_furnace_active", ["technic:alloy_furnace_active"] = "technic:lv_alloy_furnace_active",
["technic:battery_box"] = "technic:lv_battery_box0", ["technic:battery_box"] = "technic:lv_battery_box0",
["technic:battery_box1"] = "technic:lv_battery_box1", ["technic:battery_box1"] = "technic:lv_battery_box1",
["technic:battery_box2"] = "technic:lv_battery_box2", ["technic:battery_box2"] = "technic:lv_battery_box2",
["technic:battery_box3"] = "technic:lv_battery_box3", ["technic:battery_box3"] = "technic:lv_battery_box3",
@ -13,17 +12,17 @@ technic.legacy_nodenames = {
["technic:battery_box6"] = "technic:lv_battery_box6", ["technic:battery_box6"] = "technic:lv_battery_box6",
["technic:battery_box7"] = "technic:lv_battery_box7", ["technic:battery_box7"] = "technic:lv_battery_box7",
["technic:battery_box8"] = "technic:lv_battery_box8", ["technic:battery_box8"] = "technic:lv_battery_box8",
["technic:electric_furnace"] = "technic:lv_electric_furnace", ["technic:electric_furnace"] = "technic:lv_electric_furnace",
["technic:electric_furnace_active"] = "technic:lv_electric_furnace_active", ["technic:electric_furnace_active"] = "technic:lv_electric_furnace_active",
["technic:grinder"] = "technic:lv_grinder", ["technic:grinder"] = "technic:lv_grinder",
["technic:grinder_active"] = "technic:lv_grinder_active", ["technic:grinder_active"] = "technic:lv_grinder_active",
["technic:extractor"] = "technic:lv_extractor", ["technic:extractor"] = "technic:lv_extractor",
["technic:extractor_active"] = "technic:lv_extractor_active", ["technic:extractor_active"] = "technic:lv_extractor_active",
["technic:compressor"] = "technic:lv_compressor", ["technic:compressor"] = "technic:lv_compressor",
["technic:compressor_active"] = "technic:lv_compressor_active", ["technic:compressor_active"] = "technic:lv_compressor_active",
["technic:hv_battery_box"] = "technic:hv_battery_box0", ["technic:hv_battery_box"] = "technic:hv_battery_box0",
["technic:mv_battery_box"] = "technic:mv_battery_box0", ["technic:mv_battery_box"] = "technic:mv_battery_box0",
["technic:generator"] = "technic:lv_generator", ["technic:generator"] = "technic:lv_generator",
["technic:generator_active"] = "technic:lv_generator_active", ["technic:generator_active"] = "technic:lv_generator_active",
["technic:iron_dust"] = "technic:wrought_iron_dust", ["technic:iron_dust"] = "technic:wrought_iron_dust",
["technic:enriched_uranium"] = "technic:uranium35_ingot", ["technic:enriched_uranium"] = "technic:uranium35_ingot",

View File

@ -2,20 +2,20 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:hv_battery_box0', output = 'technic:hv_battery_box0',
recipe = { recipe = {
{'technic:mv_battery_box0', 'technic:mv_battery_box0', 'technic:mv_battery_box0'}, { 'technic:mv_battery_box0', 'technic:mv_battery_box0', 'technic:mv_battery_box0' },
{'technic:mv_battery_box0', 'technic:hv_transformer', 'technic:mv_battery_box0'}, { 'technic:mv_battery_box0', "technic:hv_transformer", 'technic:mv_battery_box0' },
{'', 'technic:hv_cable', ''}, { "", "technic:hv_cable", "" },
} }
}) })
technic.register_battery_box({ technic.register_battery_box({
tier = "HV", tier = "HV",
max_charge = 1000000, max_charge = 1000000,
charge_rate = 100000, charge_rate = 100000,
discharge_rate = 400000, discharge_rate = 400000,
charge_step = 10000, charge_step = 10000,
discharge_step = 40000, discharge_step = 40000,
upgrade = 1, upgrade = 1,
tube = 1, tube = 1,
}) })

View File

@ -1,10 +1,9 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:hv_cable 3', output = 'technic:hv_cable 3',
recipe = { recipe = {
{'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'}, { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{'technic:mv_cable', 'technic:mv_cable', 'technic:mv_cable'}, { "technic:mv_cable", "technic:mv_cable", "technic:mv_cable" },
{'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'}, { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
} }
}) })

View File

@ -6,16 +6,16 @@
-- How expensive is the generator? -- How expensive is the generator?
-- Leaves room for upgrades lowering the power drain? -- Leaves room for upgrades lowering the power drain?
local forcefield_power_drain = 10 local forcefield_power_drain = 10
local S = technic.getter local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = "technic:forcefield_emitter_off", output = "technic:forcefield_emitter_off",
recipe = { recipe = {
{"default:mese", "technic:motor", "default:mese" }, { "default:mese", "technic:motor", "default:mese" },
{"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"}, { "technic:deployer_off", "technic:machine_casing", "technic:deployer_off" },
{"default:mese", "technic:hv_cable", "default:mese" }, { "default:mese", "technic:hv_cable", "default:mese" },
} }
}) })
@ -42,41 +42,40 @@ local function update_forcefield(pos, meta, active, first)
local shape = meta:get_int("shape") local shape = meta:get_int("shape")
local range = meta:get_int("range") local range = meta:get_int("range")
local vm = VoxelManip() local vm = VoxelManip()
local MinEdge, MaxEdge = vm:read_from_map(vector.subtract(pos, range), local MinEdge, MaxEdge = vm:read_from_map(vector.subtract(pos, range), vector.add(pos, range))
vector.add(pos, range)) local area = VoxelArea:new({ MinEdge = MinEdge, MaxEdge = MaxEdge })
local area = VoxelArea:new({MinEdge = MinEdge, MaxEdge = MaxEdge})
local data = vm:get_data() local data = vm:get_data()
local c_air = minetest.get_content_id("air") local c_air = minetest.get_content_id("air")
local c_field = minetest.get_content_id("technic:forcefield") local c_field = minetest.get_content_id("technic:forcefield")
for z = -range, range do for z = -range, range do
for y = -range, range do for y = -range, range do
local vi = area:index(pos.x + (-range), pos.y + y, pos.z + z) local vi = area:index(pos.x + (-range), pos.y + y, pos.z + z)
for x = -range, range do for x = -range, range do
local relevant local relevant
if shape == 0 then if shape == 0 then
local squared = x * x + y * y + z * z local squared = x * x + y * y + z * z
relevant = relevant =
squared <= range * range + range and squared <= range * range + range and
squared >= (range - 1) * (range - 1) + (range - 1) squared >= (range - 1) * (range - 1) + (range - 1)
else else
relevant = relevant =
x == -range or x == range or x == -range or x == range or
y == -range or y == range or y == -range or y == range or
z == -range or z == range z == -range or z == range
end end
if relevant then if relevant then
local cid = data[vi] local cid = data[vi]
if active and replaceable_cids[cid] then if active and replaceable_cids[cid] then
data[vi] = c_field data[vi] = c_field
elseif not active and cid == c_field then elseif not active and cid == c_field then
data[vi] = c_air data[vi] = c_air
end
end
vi = vi + 1
end end
end end
vi = vi + 1
end
end
end end
vm:set_data(data) vm:set_data(data)
@ -91,7 +90,7 @@ end
local function set_forcefield_formspec(meta) local function set_forcefield_formspec(meta)
local formspec = "size[5,2.25]".. local formspec = "size[5,2.25]"..
"field[0.3,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]" "field[0.3,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]"
-- The names for these toggle buttons are explicit about which -- The names for these toggle buttons are explicit about which
-- state they'll switch to, so that multiple presses (arising -- state they'll switch to, so that multiple presses (arising
-- from the ambiguity between lag and a missed press) only make -- from the ambiguity between lag and a missed press) only make
@ -152,7 +151,7 @@ local mesecons = {
local function run(pos, node) local function run(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local eu_input = meta:get_int("HV_EU_input") local eu_input = meta:get_int("HV_EU_input")
local enabled = meta:get_int("enabled") ~= 0 and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0) local enabled = meta:get_int("enabled") ~= 0 and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0)
local machine_name = S("%s Forcefield Emitter"):format("HV") local machine_name = S("%s Forcefield Emitter"):format("HV")
@ -194,8 +193,8 @@ end
minetest.register_node("technic:forcefield_emitter_off", { minetest.register_node("technic:forcefield_emitter_off", {
description = S("%s Forcefield Emitter"):format("HV"), description = S("%s Forcefield Emitter"):format("HV"),
tiles = {"technic_forcefield_emitter_off.png"}, tiles = { "technic_forcefield_emitter_off.png" },
groups = {cracky = 1, technic_machine = 1, technic_hv = 1}, groups = { cracky = 1, technic_machine = 1, technic_hv = 1 },
on_receive_fields = forcefield_receive_fields, on_receive_fields = forcefield_receive_fields,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -214,9 +213,13 @@ minetest.register_node("technic:forcefield_emitter_off", {
minetest.register_node("technic:forcefield_emitter_on", { minetest.register_node("technic:forcefield_emitter_on", {
description = S("%s Forcefield Emitter"):format("HV"), description = S("%s Forcefield Emitter"):format("HV"),
tiles = {"technic_forcefield_emitter_on.png"}, tiles = { "technic_forcefield_emitter_on.png" },
groups = {cracky = 1, technic_machine = 1, technic_hv = 1, groups = {
not_in_creative_inventory=1}, cracky = 1,
technic_machine = 1,
technic_hv = 1,
not_in_creative_inventory = 1
},
drop = "technic:forcefield_emitter_off", drop = "technic:forcefield_emitter_off",
on_receive_fields = forcefield_receive_fields, on_receive_fields = forcefield_receive_fields,
on_destruct = function(pos) on_destruct = function(pos)
@ -225,7 +228,7 @@ minetest.register_node("technic:forcefield_emitter_on", {
end, end,
mesecons = mesecons, mesecons = mesecons,
technic_run = run, technic_run = run,
technic_on_disable = function (pos, node) technic_on_disable = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
update_forcefield(pos, meta, false) update_forcefield(pos, meta, false)
technic.swap_node(pos, "technic:forcefield_emitter_off") technic.swap_node(pos, "technic:forcefield_emitter_off")
@ -236,20 +239,22 @@ minetest.register_node("technic:forcefield", {
description = S("%s Forcefield"):format("HV"), description = S("%s Forcefield"):format("HV"),
sunlight_propagates = true, sunlight_propagates = true,
drawtype = "glasslike", drawtype = "glasslike",
groups = {not_in_creative_inventory=1}, groups = { not_in_creative_inventory = 1 },
paramtype = "light", paramtype = "light",
light_source = 15, light_source = LIGHT_MAX,
diggable = false, diggable = false,
drop = '', drop = "",
tiles = {{ tiles = {
name = "technic_forcefield_animated.png", {
animation = { name = "technic_forcefield_animated.png",
type = "vertical_frames", animation = {
aspect_w = 16, type = "vertical_frames",
aspect_h = 16, aspect_w = 16,
length = 1.0, aspect_h = 16,
}, length = 1.0,
}}, },
}
},
}) })
@ -257,6 +262,6 @@ if minetest.get_modpath("mesecons_mvps") then
mesecon.register_mvps_stopper("technic:forcefield") mesecon.register_mvps_stopper("technic:forcefield")
end end
technic.register_machine("HV", "technic:forcefield_emitter_on", technic.receiver) technic.register_machine("HV", "technic:forcefield_emitter_on", technic.receiver)
technic.register_machine("HV", "technic:forcefield_emitter_off", technic.receiver) technic.register_machine("HV", "technic:forcefield_emitter_off", technic.receiver)

View File

@ -1,13 +1,13 @@
minetest.register_alias("hv_generator", "technic:hv_generator") minetest.register_alias("hv_generator", "technic:hv_generator")
minetest.register_craft({ minetest.register_craft({
output = 'technic:hv_generator', output = "technic:hv_generator",
recipe = { recipe = {
{'technic:carbon_plate', 'technic:mv_generator', 'technic:composite_plate'}, { "technic:carbon_plate", "technic:mv_generator", "technic:composite_plate" },
{'pipeworks:tube_1', 'technic:hv_transformer', 'pipeworks:tube_1'}, { "pipeworks:tube_1", "technic:hv_transformer", "pipeworks:tube_1" },
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:hv_cable", "technic:stainless_steel_ingot" },
} }
}) })
technic.register_generator({tier="HV", tube=1, supply=1200}) technic.register_generator({ tier = "HV", tube = 1, supply = 1200 })

View File

@ -1,4 +1,3 @@
technic.register_tier("HV", "High Voltage") technic.register_tier("HV", "High Voltage")
local path = technic.modpath.."/machines/HV" local path = technic.modpath.."/machines/HV"

View File

@ -9,9 +9,9 @@ shield to work. This is checked now and then and if the casing is not
intact the reactor will melt down! intact the reactor will melt down!
--]] --]]
local burn_ticks = 7 * 24 * 60 * 60 -- Seconds local burn_ticks = 7 * 24 * 60 * 60 -- Seconds
local power_supply = 100000 -- EUs local power_supply = 100000 -- EUs
local fuel_type = "technic:uranium_fuel" -- The reactor burns this local fuel_type = "technic:uranium_fuel" -- The reactor burns this
local S = technic.getter local S = technic.getter
@ -20,39 +20,38 @@ local reactor_desc = S("@1 Nuclear Reactor Core", S("HV")),
-- FIXME: Recipe should make more sense like a rod recepticle, steam chamber, HV generator? -- FIXME: Recipe should make more sense like a rod recepticle, steam chamber, HV generator?
minetest.register_craft({ minetest.register_craft({
output = 'technic:hv_nuclear_reactor_core', output = "technic:hv_nuclear_reactor_core",
recipe = { recipe = {
{'technic:carbon_plate', 'default:obsidian_glass', 'technic:carbon_plate'}, { "technic:carbon_plate", "default:obsidian_glass", "technic:carbon_plate" },
{'technic:composite_plate', 'technic:machine_casing', 'technic:composite_plate'}, { "technic:composite_plate", "technic:machine_casing", "technic:composite_plate" },
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:hv_cable", "technic:stainless_steel_ingot" },
} }
}) })
local reactor_formspec = local reactor_formspec = "invsize[8,9;]"..
"invsize[8,9;]".. "label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]".. "list[current_name;src;2,1;3,2;]"..
"list[current_name;src;2,1;3,2;]".. "list[current_player;main;0,5;8,4;]"..
"list[current_player;main;0,5;8,4;]".. "listring[]"
"listring[]"
-- "Boxy sphere" -- "Boxy sphere"
local node_box = { local node_box = {
{-0.353, -0.353, -0.353, 0.353, 0.353, 0.353}, -- Box { -0.353, -0.353, -0.353, 0.353, 0.353, 0.353 }, -- Box
{-0.495, -0.064, -0.064, 0.495, 0.064, 0.064}, -- Circle +-x { -0.495, -0.064, -0.064, 0.495, 0.064, 0.064 }, -- Circle +-x
{-0.483, -0.128, -0.128, 0.483, 0.128, 0.128}, { -0.483, -0.128, -0.128, 0.483, 0.128, 0.128 },
{-0.462, -0.191, -0.191, 0.462, 0.191, 0.191}, { -0.462, -0.191, -0.191, 0.462, 0.191, 0.191 },
{-0.433, -0.249, -0.249, 0.433, 0.249, 0.249}, { -0.433, -0.249, -0.249, 0.433, 0.249, 0.249 },
{-0.397, -0.303, -0.303, 0.397, 0.303, 0.303}, { -0.397, -0.303, -0.303, 0.397, 0.303, 0.303 },
{-0.305, -0.396, -0.305, 0.305, 0.396, 0.305}, -- Circle +-y { -0.305, -0.396, -0.305, 0.305, 0.396, 0.305 }, -- Circle +-y
{-0.250, -0.432, -0.250, 0.250, 0.432, 0.250}, { -0.250, -0.432, -0.250, 0.250, 0.432, 0.250 },
{-0.191, -0.461, -0.191, 0.191, 0.461, 0.191}, { -0.191, -0.461, -0.191, 0.191, 0.461, 0.191 },
{-0.130, -0.482, -0.130, 0.130, 0.482, 0.130}, { -0.130, -0.482, -0.130, 0.130, 0.482, 0.130 },
{-0.066, -0.495, -0.066, 0.066, 0.495, 0.066}, { -0.066, -0.495, -0.066, 0.066, 0.495, 0.066 },
{-0.064, -0.064, -0.495, 0.064, 0.064, 0.495}, -- Circle +-z { -0.064, -0.064, -0.495, 0.064, 0.064, 0.495 }, -- Circle +-z
{-0.128, -0.128, -0.483, 0.128, 0.128, 0.483}, { -0.128, -0.128, -0.483, 0.128, 0.128, 0.483 },
{-0.191, -0.191, -0.462, 0.191, 0.191, 0.462}, { -0.191, -0.191, -0.462, 0.191, 0.191, 0.462 },
{-0.249, -0.249, -0.433, 0.249, 0.249, 0.433}, { -0.249, -0.249, -0.433, 0.249, 0.249, 0.433 },
{-0.303, -0.303, -0.397, 0.303, 0.303, 0.397}, { -0.303, -0.303, -0.397, 0.303, 0.303, 0.397 },
} }
local SS_OFF = 0 local SS_OFF = 0
@ -65,18 +64,18 @@ local function siren_set_state(pos, state)
local siren = reactor_siren[hpos] local siren = reactor_siren[hpos]
if not siren then if not siren then
if state == SS_OFF then return end if state == SS_OFF then return end
siren = {state=SS_OFF} siren = { state = SS_OFF }
reactor_siren[hpos] = siren reactor_siren[hpos] = siren
end end
if state == SS_DANGER and siren.state ~= SS_DANGER then if state == SS_DANGER and siren.state ~= SS_DANGER then
if siren.handle then minetest.sound_stop(siren.handle) end if siren.handle then minetest.sound_stop(siren.handle) end
siren.handle = minetest.sound_play("technic_hv_nuclear_reactor_siren_danger_loop", siren.handle = minetest.sound_play("technic_hv_nuclear_reactor_siren_danger_loop",
{pos=pos, gain=1.5, loop=true, max_hear_distance=48}) { pos = pos, gain = 1.5, loop = true, max_hear_distance = 48 })
siren.state = SS_DANGER siren.state = SS_DANGER
elseif state == SS_CLEAR then elseif state == SS_CLEAR then
if siren.handle then minetest.sound_stop(siren.handle) end if siren.handle then minetest.sound_stop(siren.handle) end
local clear_handle = minetest.sound_play("technic_hv_nuclear_reactor_siren_clear", local clear_handle = minetest.sound_play("technic_hv_nuclear_reactor_siren_clear",
{pos=pos, gain=1.5, loop=false, max_hear_distance=48}) { pos = pos, gain = 1.5, loop = false, max_hear_distance = 48 })
siren.handle = clear_handle siren.handle = clear_handle
siren.state = SS_CLEAR siren.state = SS_CLEAR
minetest.after(10, function() minetest.after(10, function()
@ -148,7 +147,7 @@ local function reactor_structure_badness(pos)
local pos2 = vector.add(pos, 3) local pos2 = vector.add(pos, 3)
local MinEdge, MaxEdge = vm:read_from_map(pos1, pos2) local MinEdge, MaxEdge = vm:read_from_map(pos1, pos2)
local data = vm:get_data() local data = vm:get_data()
local area = VoxelArea:new({MinEdge=MinEdge, MaxEdge=MaxEdge}) local area = VoxelArea:new({ MinEdge = MinEdge, MaxEdge = MaxEdge })
local c_blast_concrete = minetest.get_content_id("technic:blast_resistant_concrete") local c_blast_concrete = minetest.get_content_id("technic:blast_resistant_concrete")
local c_lead = minetest.get_content_id("technic:lead_block") local c_lead = minetest.get_content_id("technic:lead_block")
@ -159,48 +158,48 @@ local function reactor_structure_badness(pos)
local blast_layer, steel_layer, lead_layer, water_layer = 0, 0, 0, 0 local blast_layer, steel_layer, lead_layer, water_layer = 0, 0, 0, 0
for z = pos1.z, pos2.z do for z = pos1.z, pos2.z do
for y = pos1.y, pos2.y do for y = pos1.y, pos2.y do
for x = pos1.x, pos2.x do for x = pos1.x, pos2.x do
local cid = data[area:index(x, y, z)] local cid = data[area:index(x, y, z)]
if x == pos1.x or x == pos2.x or if x == pos1.x or x == pos2.x or
y == pos1.y or y == pos2.y or y == pos1.y or y == pos2.y or
z == pos1.z or z == pos2.z then z == pos1.z or z == pos2.z then
if cid == c_blast_concrete then if cid == c_blast_concrete then
blast_layer = blast_layer + 1 blast_layer = blast_layer + 1
end end
elseif x == pos1.x+1 or x == pos2.x-1 or elseif x == pos1.x + 1 or x == pos2.x - 1 or
y == pos1.y+1 or y == pos2.y-1 or y == pos1.y + 1 or y == pos2.y - 1 or
z == pos1.z+1 or z == pos2.z-1 then z == pos1.z + 1 or z == pos2.z - 1 then
if cid == c_lead then if cid == c_lead then
lead_layer = lead_layer + 1 lead_layer = lead_layer + 1
elseif cid == c_steel then elseif cid == c_steel then
steel_layer = steel_layer + 1 steel_layer = steel_layer + 1
end end
elseif x == pos1.x+2 or x == pos2.x-2 or elseif x == pos1.x + 2 or x == pos2.x - 2 or
y == pos1.y+2 or y == pos2.y-2 or y == pos1.y + 2 or y == pos2.y - 2 or
z == pos1.z+2 or z == pos2.z-2 then z == pos1.z + 2 or z == pos2.z - 2 then
if cid == c_water_source or cid == c_water_flowing then if cid == c_water_source or cid == c_water_flowing then
water_layer = water_layer + 1 water_layer = water_layer + 1
end end
end
end
end
end
if steel_layer >= 96 then
for z = pos1.z+1, pos2.z-1 do
for y = pos1.y+1, pos2.y-1 do
for x = pos1.x+1, pos2.x-1 do
local vi = area:index(x, y, z)
if x == pos1.x+1 or x == pos2.x-1 or
y == pos1.y+1 or y == pos2.y-1 or
z == pos1.z+1 or z == pos2.z-1 then
if data[vi] == c_steel then
data[vi] = c_lead
end end
end end
end end
end end
if steel_layer >= 96 then
for z = pos1.z + 1, pos2.z - 1 do
for y = pos1.y + 1, pos2.y - 1 do
for x = pos1.x + 1, pos2.x - 1 do
local vi = area:index(x, y, z)
if x == pos1.x + 1 or x == pos2.x - 1 or
y == pos1.y + 1 or y == pos2.y - 1 or
z == pos1.z + 1 or z == pos2.z - 1 then
if data[vi] == c_steel then
data[vi] = c_lead
end
end
end
end
end end
vm:set_data(data) vm:set_data(data)
vm:write_to_map() vm:write_to_map()
@ -216,15 +215,15 @@ end
local function melt_down_reactor(pos) local function melt_down_reactor(pos)
minetest.log("action", "A reactor melted down at "..minetest.pos_to_string(pos)) minetest.log("action", "A reactor melted down at "..minetest.pos_to_string(pos))
minetest.set_node(pos, {name="technic:corium_source"}) minetest.set_node(pos, { name = "technic:corium_source" })
end end
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:hv_nuclear_reactor_core_active"}, nodenames = { "technic:hv_nuclear_reactor_core_active" },
interval = 4, interval = 4,
chance = 1, chance = 1,
action = function (pos, node) action = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local badness = reactor_structure_badness(pos) local badness = reactor_structure_badness(pos)
local accum_badness = meta:get_int("structure_accumulated_badness") local accum_badness = meta:get_int("structure_accumulated_badness")
@ -289,8 +288,8 @@ end
minetest.register_node("technic:hv_nuclear_reactor_core", { minetest.register_node("technic:hv_nuclear_reactor_core", {
description = reactor_desc, description = reactor_desc,
tiles = {"technic_hv_nuclear_reactor_core.png"}, tiles = { "technic_hv_nuclear_reactor_core.png" },
groups = {cracky=1, technic_machine=1, technic_hv=1}, groups = { cracky = 1, technic_machine = 1, technic_hv = 1 },
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drawtype = "nodebox", drawtype = "nodebox",
@ -316,14 +315,19 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
}) })
minetest.register_node("technic:hv_nuclear_reactor_core_active", { minetest.register_node("technic:hv_nuclear_reactor_core_active", {
tiles = {"technic_hv_nuclear_reactor_core.png"}, tiles = { "technic_hv_nuclear_reactor_core.png" },
groups = {cracky=1, technic_machine=1, technic_hv=1, groups = {
radioactive=4, not_in_creative_inventory=1}, cracky = 1,
technic_machine = 1,
technic_hv = 1,
radioactive = 4,
not_in_creative_inventory = 1
},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drop = "technic:hv_nuclear_reactor_core", drop = "technic:hv_nuclear_reactor_core",
drawtype = "nodebox", drawtype = "nodebox",
light_source = 14, light_source = LIGHT_MAX,
paramtype = "light", paramtype = "light",
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -338,8 +342,8 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
technic_run = run, technic_run = run,
technic_on_disable = function(pos, node) technic_on_disable = function(pos, node)
local timer = minetest.get_node_timer(pos) local timer = minetest.get_node_timer(pos)
timer:start(1) timer:start(1)
end, end,
on_timer = function(pos, node) on_timer = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -362,6 +366,6 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
end, end,
}) })
technic.register_machine("HV", "technic:hv_nuclear_reactor_core", technic.producer) technic.register_machine("HV", "technic:hv_nuclear_reactor_core", technic.producer)
technic.register_machine("HV", "technic:hv_nuclear_reactor_core_active", technic.producer) technic.register_machine("HV", "technic:hv_nuclear_reactor_core_active", technic.producer)

View File

@ -1,53 +1,50 @@
local S = technic.getter local S = technic.getter
minetest.register_craft({ minetest.register_craft({
recipe = { recipe = {
{"technic:carbon_plate", "pipeworks:filter", "technic:composite_plate"}, { "technic:carbon_plate", "pipeworks:filter", "technic:composite_plate" },
{"technic:motor", "technic:machine_casing", "technic:diamond_drill_head"}, { "technic:motor", "technic:machine_casing", "technic:diamond_drill_head" },
{"technic:carbon_steel_block", "technic:hv_cable", "technic:carbon_steel_block"}}, { "technic:carbon_steel_block", "technic:hv_cable", "technic:carbon_steel_block" }
},
output = "technic:quarry", output = "technic:quarry",
}) })
local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes
local quarry_max_depth = 100 local quarry_max_depth = 100
local quarry_demand = 10000 local quarry_demand = 10000
local quarry_eject_dir = vector.new(0, 1, 0) local quarry_eject_dir = vector.new(0, 1, 0)
local function set_quarry_formspec(meta) local function set_quarry_formspec(meta)
local radius = meta:get_int("size") local radius = meta:get_int("size")
local formspec = "size[6,4.3]".. local formspec = "size[6,4.3]"..
"list[context;cache;0,1;4,3;]".. "list[context;cache;0,1;4,3;]"..
"item_image[4.8,0;1,1;technic:quarry]".. "item_image[4.8,0;1,1;technic:quarry]"..
"label[0,0.2;"..S("%s Quarry"):format("HV").."]".. "label[0,0.2;"..S("%s Quarry"):format("HV").."]"..
"field[4.3,3.5;2,1;size;"..S("Radius:")..";"..radius.."]" "field[4.3,3.5;2,1;size;"..S("Radius:")..";"..radius.."]"
if meta:get_int("enabled") == 0 then if meta:get_int("enabled") == 0 then
formspec = formspec.."button[4,1;2,1;enable;"..S("Disabled").."]" formspec = formspec.."button[4,1;2,1;enable;"..S("Disabled").."]"
else else
formspec = formspec.."button[4,1;2,1;disable;"..S("Enabled").."]" formspec = formspec.."button[4,1;2,1;disable;"..S("Enabled").."]"
end end
local diameter = radius*2 + 1 local diameter = radius * 2 + 1
local nd = meta:get_int("dug") local nd = meta:get_int("dug")
local rel_y = quarry_dig_above_nodes - math.floor(nd / (diameter*diameter)) local rel_y = quarry_dig_above_nodes - math.floor(nd / (diameter * diameter))
formspec = formspec.."label[0,4;"..minetest.formspec_escape( formspec = formspec.."label[0,4;"..minetest.formspec_escape(nd == 0 and S("Digging not started") or
nd == 0 and S("Digging not started") or
(rel_y < -quarry_max_depth and S("Digging finished") or (rel_y < -quarry_max_depth and S("Digging finished") or
(meta:get_int("purge_on") == 1 and S("Purging cache") or (meta:get_int("purge_on") == 1 and S("Purging cache") or
S("Digging %d m "..(rel_y > 0 and "above" or "below").." machine") S("Digging %d m "..(rel_y > 0 and "above" or "below").." machine"):format(math.abs(rel_y))))).."]"
:format(math.abs(rel_y))))
).."]"
formspec = formspec.."button[4,2;2,1;restart;"..S("Restart").."]" formspec = formspec.."button[4,2;2,1;restart;"..S("Restart").."]"
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
end end
local function set_quarry_demand(meta) local function set_quarry_demand(meta)
local radius = meta:get_int("size") local radius = meta:get_int("size")
local diameter = radius*2 + 1 local diameter = radius * 2 + 1
local machine_name = S("%s Quarry"):format("HV") local machine_name = S("%s Quarry"):format("HV")
if meta:get_int("enabled") == 0 or meta:get_int("purge_on") == 1 then if meta:get_int("enabled") == 0 or meta:get_int("purge_on") == 1 then
meta:set_string("infotext", S(meta:get_int("purge_on") == 1 and "%s purging cache" or "%s Disabled"):format(machine_name)) meta:set_string("infotext", S(meta:get_int("purge_on") == 1 and "%s purging cache" or "%s Disabled"):format(machine_name))
meta:set_int("HV_EU_demand", 0) meta:set_int("HV_EU_demand", 0)
elseif meta:get_int("dug") == diameter*diameter * (quarry_dig_above_nodes+1+quarry_max_depth) then elseif meta:get_int("dug") == diameter * diameter * (quarry_dig_above_nodes + 1 + quarry_max_depth) then
meta:set_string("infotext", S("%s Finished"):format(machine_name)) meta:set_string("infotext", S("%s Finished"):format(machine_name))
meta:set_int("HV_EU_demand", 0) meta:set_int("HV_EU_demand", 0)
else else
@ -79,7 +76,7 @@ local function quarry_handle_purge(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local i = 0 local i = 0
for _,stack in ipairs(inv:get_list("cache")) do for _, stack in ipairs(inv:get_list("cache")) do
i = i + 1 i = i + 1
if stack then if stack then
local item = stack:to_table() local item = stack:to_table()
@ -109,32 +106,32 @@ local function quarry_run(pos, node)
if meta:get_int("enabled") and meta:get_int("HV_EU_input") >= quarry_demand and meta:get_int("purge_on") == 0 then if meta:get_int("enabled") and meta:get_int("HV_EU_input") >= quarry_demand and meta:get_int("purge_on") == 0 then
local pdir = minetest.facedir_to_dir(node.param2) local pdir = minetest.facedir_to_dir(node.param2)
local qdir = pdir.x == 1 and vector.new(0,0,-1) or local qdir = pdir.x == 1 and vector.new(0, 0, -1) or
(pdir.z == -1 and vector.new(-1,0,0) or (pdir.z == -1 and vector.new(-1, 0, 0) or
(pdir.x == -1 and vector.new(0,0,1) or (pdir.x == -1 and vector.new(0, 0, 1) or
vector.new(1,0,0))) vector.new(1, 0, 0)))
local radius = meta:get_int("size") local radius = meta:get_int("size")
local diameter = radius*2 + 1 local diameter = radius * 2 + 1
local startpos = vector.add(vector.add(vector.add(pos, local startpos = vector.add(vector.add(vector.add(pos,
vector.new(0, quarry_dig_above_nodes, 0)), vector.new(0, quarry_dig_above_nodes, 0)),
pdir), pdir),
vector.multiply(qdir, -radius)) vector.multiply(qdir, -radius))
local endpos = vector.add(vector.add(vector.add(startpos, local endpos = vector.add(vector.add(vector.add(startpos,
vector.new(0, -quarry_dig_above_nodes-quarry_max_depth, 0)), vector.new(0, -quarry_dig_above_nodes - quarry_max_depth, 0)),
vector.multiply(pdir, diameter-1)), vector.multiply(pdir, diameter - 1)),
vector.multiply(qdir, diameter-1)) vector.multiply(qdir, diameter - 1))
local vm = VoxelManip() local vm = VoxelManip()
local minpos, maxpos = vm:read_from_map(startpos, endpos) local minpos, maxpos = vm:read_from_map(startpos, endpos)
local area = VoxelArea:new({MinEdge=minpos, MaxEdge=maxpos}) local area = VoxelArea:new({ MinEdge = minpos, MaxEdge = maxpos })
local data = vm:get_data() local data = vm:get_data()
local c_air = minetest.get_content_id("air") local c_air = minetest.get_content_id("air")
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local nd = meta:get_int("dug") local nd = meta:get_int("dug")
while nd ~= diameter*diameter * (quarry_dig_above_nodes+1+quarry_max_depth) do while nd ~= diameter * diameter * (quarry_dig_above_nodes + 1 + quarry_max_depth) do
local ry = math.floor(nd / (diameter*diameter)) local ry = math.floor(nd / (diameter * diameter))
local ndl = nd % (diameter*diameter) local ndl = nd % (diameter * diameter)
if ry % 2 == 1 then if ry % 2 == 1 then
ndl = diameter*diameter - 1 - ndl ndl = diameter * diameter - 1 - ndl
end end
local rq = math.floor(ndl / diameter) local rq = math.floor(ndl / diameter)
local rp = ndl % diameter local rp = ndl % diameter
@ -150,15 +147,15 @@ local function quarry_run(pos, node)
local dignode local dignode
if can_dig then if can_dig then
dignode = technic.get_or_load_node(digpos) or minetest.get_node(digpos) dignode = technic.get_or_load_node(digpos) or minetest.get_node(digpos)
local dignodedef = minetest.registered_nodes[dignode.name] or {diggable=false} local dignodedef = minetest.registered_nodes[dignode.name] or { diggable = false }
if not dignodedef.diggable or (dignodedef.can_dig and not dignodedef.can_dig(digpos, nil)) then if not dignodedef.diggable or (dignodedef.can_dig and not dignodedef.can_dig(digpos, nil)) then
can_dig = false can_dig = false
end end
end end
if can_dig then if can_dig then
for ay = startpos.y, digpos.y+1, -1 do for ay = startpos.y, digpos.y + 1, -1 do
local checkpos = {x=digpos.x, y=ay, z=digpos.z} local checkpos = { x = digpos.x, y = ay, z = digpos.z }
local checknode = technic.get_or_load_node(checkpos) or minetest.get_node(checkpos) local checknode = technic.get_or_load_node(checkpos) or minetest.get_node(checkpos)
if checknode.name ~= "air" then if checknode.name ~= "air" then
can_dig = false can_dig = false
@ -181,7 +178,7 @@ local function quarry_run(pos, node)
break break
end end
end end
if nd == diameter*diameter * (quarry_dig_above_nodes+1+quarry_max_depth) then if nd == diameter * diameter * (quarry_dig_above_nodes + 1 + quarry_max_depth) then
-- if a quarry is finished, we enable purge mode -- if a quarry is finished, we enable purge mode
meta:set_int("purge_on", 1) meta:set_int("purge_on", 1)
end end
@ -201,23 +198,25 @@ end
local function send_move_error(player) local function send_move_error(player)
minetest.chat_send_player(player:get_player_name(), minetest.chat_send_player(player:get_player_name(),
S("Manually taking/removing from cache by hand is not possible. ".. S("Manually taking/removing from cache by hand is not possible. "..
"If you can't wait, restart or disable the quarry to start automatic purge.")) "If you can't wait, restart or disable the quarry to start automatic purge."))
return 0 return 0
end end
minetest.register_node("technic:quarry", { minetest.register_node("technic:quarry", {
description = S("%s Quarry"):format("HV"), description = S("%s Quarry"):format("HV"),
tiles = {"technic_carbon_steel_block.png", "technic_carbon_steel_block.png", tiles = {
"technic_carbon_steel_block.png", "technic_carbon_steel_block.png", "technic_carbon_steel_block.png", "technic_carbon_steel_block.png",
"technic_carbon_steel_block.png^default_tool_mesepick.png", "technic_carbon_steel_block.png"}, "technic_carbon_steel_block.png", "technic_carbon_steel_block.png",
"technic_carbon_steel_block.png^default_tool_mesepick.png", "technic_carbon_steel_block.png"
},
inventory_image = minetest.inventorycube("technic_carbon_steel_block.png", inventory_image = minetest.inventorycube("technic_carbon_steel_block.png",
"technic_carbon_steel_block.png^default_tool_mesepick.png", "technic_carbon_steel_block.png^default_tool_mesepick.png",
"technic_carbon_steel_block.png"), "technic_carbon_steel_block.png"),
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2, tubedevice=1, technic_machine=1, technic_hv=1}, groups = { cracky = 2, tubedevice = 1, technic_machine = 1, technic_hv = 1 },
connect_sides = {"bottom", "front", "left", "right"}, connect_sides = { "bottom", "front", "left", "right" },
tube = { tube = {
connect_sides = {top = 1}, connect_sides = { top = 1 },
-- lower priority than other tubes, so that quarries will prefer any -- lower priority than other tubes, so that quarries will prefer any
-- other tube to another quarry, which could lead to server freezes -- other tube to another quarry, which could lead to server freezes
-- in certain quarry placements (2x2 for example would never eject) -- in certain quarry placements (2x2 for example would never eject)
@ -241,7 +240,7 @@ minetest.register_node("technic:quarry", {
meta:set_string("owner", placer:get_player_name()) meta:set_string("owner", placer:get_player_name())
pipeworks.scan_for_tube_objects(pos) pipeworks.scan_for_tube_objects(pos)
end, end,
can_dig = function(pos,player) can_dig = function(pos, player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:is_empty("cache") return inv:is_empty("cache")

View File

@ -4,11 +4,11 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:solar_array_hv 1', output = 'technic:solar_array_hv 1',
recipe = { recipe = {
{'technic:solar_array_mv', 'technic:solar_array_mv', 'technic:solar_array_mv'}, { "technic:solar_array_mv", "technic:solar_array_mv", "technic:solar_array_mv" },
{'technic:carbon_plate', 'technic:hv_transformer', 'technic:composite_plate'}, { "technic:carbon_plate", "technic:hv_transformer", "technic:composite_plate" },
{'', 'technic:hv_cable', ''}, { "", "technic:hv_cable", "" },
} }
}) })
technic.register_solar_array({tier="HV", power=100}) technic.register_solar_array({ tier = "HV", power = 100 })

View File

@ -2,13 +2,13 @@
-- FIXME: kpoppel: I'd like to introduce an induction heating element here... -- FIXME: kpoppel: I'd like to introduce an induction heating element here...
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_alloy_furnace', output = "technic:lv_alloy_furnace",
recipe = { recipe = {
{'default:brick', 'default:brick', 'default:brick'}, { "default:brick", "default:brick", "default:brick" },
{'default:brick', 'technic:machine_casing', 'default:brick'}, { "default:brick", "technic:machine_casing", "default:brick" },
{'default:brick', 'technic:lv_cable', 'default:brick'}, { "default:brick", "technic:lv_cable", "default:brick" },
} }
}) })
technic.register_alloy_furnace({tier = "LV", speed = 1, demand = {300}}) technic.register_alloy_furnace({ tier = "LV", speed = 1, demand = { 300 } })

View File

@ -1,19 +1,18 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_battery_box0', output = 'technic:lv_battery_box0',
recipe = { recipe = {
{'group:wood', 'group:wood', 'group:wood'}, { "group:wood", "group:wood", "group:wood" },
{'technic:battery', 'technic:machine_casing', 'technic:battery'}, { "technic:battery", "technic:machine_casing", "technic:battery" },
{'technic:battery', 'technic:lv_cable', 'technic:battery'}, { "technic:battery", "technic:lv_cable", "technic:battery" },
} }
}) })
technic.register_battery_box({ technic.register_battery_box({
tier = "LV", tier = "LV",
max_charge = 40000, max_charge = 40000,
charge_rate = 1000, charge_rate = 1000,
discharge_rate = 4000, discharge_rate = 4000,
charge_step = 500, charge_step = 500,
discharge_step = 800, discharge_step = 800,
}) })

View File

@ -1,12 +1,11 @@
minetest.register_alias("lv_cable", "technic:lv_cable") minetest.register_alias("lv_cable", "technic:lv_cable")
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_cable 6', output = 'technic:lv_cable 6',
recipe = { recipe = {
{'default:paper', 'default:paper', 'default:paper'}, { "default:paper", "default:paper", "default:paper" },
{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, { "default:copper_ingot", "default:copper_ingot", "default:copper_ingot" },
{'default:paper', 'default:paper', 'default:paper'}, { "default:paper", "default:paper", "default:paper" },
} }
}) })

View File

@ -11,84 +11,84 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:cnc', output = "technic:cnc",
recipe = { recipe = {
{'default:glass', 'technic:diamond_drill_head', 'default:glass'}, { "default:glass", "technic:diamond_drill_head", "default:glass" },
{'technic:control_logic_unit', 'technic:machine_casing', 'technic:motor'}, { "technic:control_logic_unit", "technic:machine_casing", "technic:motor" },
{'technic:carbon_steel_ingot', 'technic:lv_cable', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "technic:lv_cable", "technic:carbon_steel_ingot" },
}, },
}) })
local shape = {} local shape = {}
local onesize_products = { local onesize_products = {
slope = 2, slope = 2,
slope_edge = 1, slope_edge = 1,
slope_inner_edge = 1, slope_inner_edge = 1,
pyramid = 2, pyramid = 2,
spike = 1, spike = 1,
cylinder = 2, cylinder = 2,
oblate_spheroid = 1, oblate_spheroid = 1,
sphere = 1, sphere = 1,
stick = 8, stick = 8,
slope_upsdown = 2, slope_upsdown = 2,
slope_edge_upsdown = 1, slope_edge_upsdown = 1,
slope_inner_edge_upsdown = 1, slope_inner_edge_upsdown = 1,
cylinder_horizontal = 2, cylinder_horizontal = 2,
slope_lying = 2, slope_lying = 2,
onecurvededge = 1, onecurvededge = 1,
twocurvededge = 1, twocurvededge = 1,
} }
local twosize_products = { local twosize_products = {
element_straight = 4, element_straight = 4,
element_end = 2, element_end = 2,
element_cross = 1, element_cross = 1,
element_t = 1, element_t = 1,
element_edge = 2, element_edge = 2,
} }
local cnc_formspec = local cnc_formspec =
"invsize[9,11;]".. "invsize[9,11;]"..
"label[1,0;"..S("Choose Milling Program:").."]".. "label[1,0;"..S("Choose Milling Program:").."]"..
"image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]".. "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[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[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[4,0.5;1,1;technic_cnc_pyramid.png;pyramid; ]"..
"image_button[5,0.5;1,1;technic_cnc_spike.png;spike; ]".. "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[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[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[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[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[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[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[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[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[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[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]"..
"image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]".. "image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]"..
"label[1,3.5;"..S("Slim Elements half / normal height:").."]".. "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;1,0.5;technic_cnc_full.png;full; ]"..
"image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]".. "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[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[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[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[5,4;1,1;technic_cnc_element_t.png;element_t; ]"..
"image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]".. "image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]"..
"label[0, 5.5;"..S("In:").."]".. "label[0, 5.5;"..S("In:").."]"..
"list[current_name;src;0.5,5.5;1,1;]".. "list[current_name;src;0.5,5.5;1,1;]"..
"label[4, 5.5;"..S("Out:").."]".. "label[4, 5.5;"..S("Out:").."]"..
"list[current_name;dst;5,5.5;4,1;]".. "list[current_name;dst;5,5.5;4,1;]"..
"list[current_player;main;0,7;8,4;]".. "list[current_player;main;0,7;8,4;]"..
"listring[current_name;dst]".. "listring[current_name;dst]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;src]".. "listring[current_name;src]"..
"listring[current_player;main]" "listring[current_player;main]"
local size = 1; local size = 1;
@ -109,10 +109,10 @@ local function form_handler(pos, formname, fields, sender)
end end
-- Resolve the node name and the number of items to make -- Resolve the node name and the number of items to make
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local inputstack = inv:get_stack("src", 1) local inputstack = inv:get_stack("src", 1)
local inputname = inputstack:get_name() local inputname = inputstack:get_name()
local multiplier = 0 local multiplier = 0
for k, _ in pairs(fields) do for k, _ in pairs(fields) do
-- Set a multipier for the half/full size capable blocks -- Set a multipier for the half/full size capable blocks
@ -123,19 +123,19 @@ local function form_handler(pos, formname, fields, sender)
end end
if onesize_products[k] ~= nil or twosize_products[k] ~= nil then if onesize_products[k] ~= nil or twosize_products[k] ~= nil then
meta:set_float( "cnc_multiplier", multiplier) meta:set_float("cnc_multiplier", multiplier)
meta:set_string("cnc_user", sender:get_player_name()) meta:set_string("cnc_user", sender:get_player_name())
end end
if onesize_products[k] ~= nil or (twosize_products[k] ~= nil and size==2) then if onesize_products[k] ~= nil or (twosize_products[k] ~= nil and size == 2) then
meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k) meta:set_string("cnc_product", inputname.."_technic_cnc_"..k)
--print(inputname .. "_technic_cnc_" .. k) --print(inputname.."_technic_cnc_"..k)
break break
end end
if twosize_products[k] ~= nil and size==1 then if twosize_products[k] ~= nil and size == 1 then
meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k .. "_double") meta:set_string("cnc_product", inputname.."_technic_cnc_"..k.."_double")
--print(inputname .. "_technic_cnc_" .. k .. "_double") --print(inputname.."_technic_cnc_"..k.."_double")
break break
end end
end end
@ -144,17 +144,17 @@ end
-- Action code performing the transformation -- Action code performing the transformation
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local eu_input = meta:get_int("LV_EU_input") local eu_input = meta:get_int("LV_EU_input")
local machine_name = S("%s CNC Machine"):format("LV") local machine_name = S("%s CNC Machine"):format("LV")
local machine_node = "technic:cnc" local machine_node = "technic:cnc"
local demand = 450 local demand = 450
local result = meta:get_string("cnc_product") local result = meta:get_string("cnc_product")
if inv:is_empty("src") or if inv:is_empty("src") or
(not minetest.registered_nodes[result]) or (not minetest.registered_nodes[result]) or
(not inv:room_for_item("dst", result)) then (not inv:room_for_item("dst", result)) then
technic.swap_node(pos, machine_node) technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name)) meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_string("cnc_product", "") meta:set_string("cnc_product", "")
@ -183,11 +183,13 @@ end
-- The actual block inactive state -- The actual block inactive state
minetest.register_node("technic:cnc", { minetest.register_node("technic:cnc", {
description = S("%s CNC Machine"):format("LV"), description = S("%s CNC Machine"):format("LV"),
tiles = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png", tiles = {
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"}, "technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
groups = {cracky=2, technic_machine=1, technic_lv=1}, "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"
connect_sides = {"bottom", "back", "left", "right"}, },
paramtype2 = "facedir", groups = { cracky = 2, technic_machine = 1, technic_lv = 1 },
connect_sides = { "bottom", "back", "left", "right" },
paramtype2 = "facedir",
legacy_facedir_simple = true, legacy_facedir_simple = true,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -209,10 +211,12 @@ minetest.register_node("technic:cnc", {
-- Active state block -- Active state block
minetest.register_node("technic:cnc_active", { minetest.register_node("technic:cnc_active", {
description = S("%s CNC Machine"):format("LV"), description = S("%s CNC Machine"):format("LV"),
tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png", tiles = {
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"}, "technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
groups = {cracky=2, technic_machine=1, technic_lv=1, not_in_creative_inventory=1}, "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"
connect_sides = {"bottom", "back", "left", "right"}, },
groups = { cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1 },
connect_sides = { "bottom", "back", "left", "right" },
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "technic:cnc", drop = "technic:cnc",
legacy_facedir_simple = true, legacy_facedir_simple = true,
@ -225,6 +229,6 @@ minetest.register_node("technic:cnc_active", {
technic_disabled_machine_name = "technic:cnc", technic_disabled_machine_name = "technic:cnc",
}) })
technic.register_machine("LV", "technic:cnc", technic.receiver) technic.register_machine("LV", "technic:cnc", technic.receiver)
technic.register_machine("LV", "technic:cnc_active", technic.receiver) technic.register_machine("LV", "technic:cnc_active", technic.receiver)

View File

@ -11,136 +11,161 @@ technic.cnc = {}
-- Define slope boxes for the various nodes -- Define slope boxes for the various nodes
------------------------------------------- -------------------------------------------
technic.cnc.programs = { technic.cnc.programs = {
{ suffix = "technic_cnc_stick", {
model = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}, suffix = "technic_cnc_stick",
desc = S("Stick") model = { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 },
desc = S("Stick")
}, },
{ suffix = "technic_cnc_element_end_double", {
model = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.5}, suffix = "technic_cnc_element_end_double",
desc = S("Element End Double") model = { -0.3, -0.5, -0.3, 0.3, 0.5, 0.5 },
desc = S("Element End Double")
}, },
{ suffix = "technic_cnc_element_cross_double", {
suffix = "technic_cnc_element_cross_double",
model = { model = {
{0.3, -0.5, -0.3, 0.5, 0.5, 0.3}, { 0.3, -0.5, -0.3, 0.5, 0.5, 0.3 },
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.5}, { -0.3, -0.5, -0.5, 0.3, 0.5, 0.5 },
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}}, { -0.5, -0.5, -0.3, -0.3, 0.5, 0.3 }
desc = S("Element Cross Double") },
desc = S("Element Cross Double")
}, },
{ suffix = "technic_cnc_element_t_double", {
suffix = "technic_cnc_element_t_double",
model = { model = {
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.3}, { -0.3, -0.5, -0.5, 0.3, 0.5, 0.3 },
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}, { -0.5, -0.5, -0.3, -0.3, 0.5, 0.3 },
{0.3, -0.5, -0.3, 0.5, 0.5, 0.3}}, { 0.3, -0.5, -0.3, 0.5, 0.5, 0.3 }
desc = S("Element T Double") },
desc = S("Element T Double")
}, },
{ suffix = "technic_cnc_element_edge_double", {
suffix = "technic_cnc_element_edge_double",
model = { model = {
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.3}, { -0.3, -0.5, -0.5, 0.3, 0.5, 0.3 },
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}}, { -0.5, -0.5, -0.3, -0.3, 0.5, 0.3 }
desc = S("Element Edge Double") },
desc = S("Element Edge Double")
}, },
{ suffix = "technic_cnc_element_straight_double", {
model = {-0.3, -0.5, -0.5, 0.3, 0.5, 0.5}, suffix = "technic_cnc_element_straight_double",
desc = S("Element Straight Double") model = { -0.3, -0.5, -0.5, 0.3, 0.5, 0.5 },
desc = S("Element Straight Double")
}, },
{ suffix = "technic_cnc_element_end", {
model = {-0.3, -0.5, -0.3, 0.3, 0, 0.5}, suffix = "technic_cnc_element_end",
desc = S("Element End") model = { -0.3, -0.5, -0.3, 0.3, 0, 0.5 },
desc = S("Element End")
}, },
{ suffix = "technic_cnc_element_cross", {
suffix = "technic_cnc_element_cross",
model = { model = {
{0.3, -0.5, -0.3, 0.5, 0, 0.3}, { 0.3, -0.5, -0.3, 0.5, 0, 0.3 },
{-0.3, -0.5, -0.5, 0.3, 0, 0.5}, { -0.3, -0.5, -0.5, 0.3, 0, 0.5 },
{-0.5, -0.5, -0.3, -0.3, 0, 0.3}}, { -0.5, -0.5, -0.3, -0.3, 0, 0.3 }
desc = S("Element Cross") },
desc = S("Element Cross")
}, },
{ suffix = "technic_cnc_element_t", {
suffix = "technic_cnc_element_t",
model = { model = {
{-0.3, -0.5, -0.5, 0.3, 0, 0.3}, { -0.3, -0.5, -0.5, 0.3, 0, 0.3 },
{-0.5, -0.5, -0.3, -0.3, 0, 0.3}, { -0.5, -0.5, -0.3, -0.3, 0, 0.3 },
{0.3, -0.5, -0.3, 0.5, 0, 0.3}}, { 0.3, -0.5, -0.3, 0.5, 0, 0.3 }
desc = S("Element T") },
desc = S("Element T")
}, },
{ suffix = "technic_cnc_element_edge", {
suffix = "technic_cnc_element_edge",
model = { model = {
{-0.3, -0.5, -0.5, 0.3, 0, 0.3}, { -0.3, -0.5, -0.5, 0.3, 0, 0.3 },
{-0.5, -0.5, -0.3, -0.3, 0, 0.3}}, { -0.5, -0.5, -0.3, -0.3, 0, 0.3 }
desc = S("Element Edge") },
desc = S("Element Edge")
}, },
{ suffix = "technic_cnc_element_straight", {
model = {-0.3, -0.5, -0.5, 0.3, 0, 0.5}, suffix = "technic_cnc_element_straight",
desc = S("Element Straight") model = { -0.3, -0.5, -0.5, 0.3, 0, 0.5 },
desc = S("Element Straight")
}, },
{ suffix = "technic_cnc_oblate_spheroid", {
suffix = "technic_cnc_oblate_spheroid",
model = "technic_oblate_spheroid.obj", model = "technic_oblate_spheroid.obj",
desc = S("Oblate spheroid"), desc = S("Oblate spheroid"),
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -6/16, 4/16, -6/16, 6/16, 8/16, 6/16 }, { -6/16, 4/16, -6/16, 6/16, 8/16, 6/16 },
{ -8/16, -4/16, -8/16, 8/16, 4/16, 8/16 }, { -8/16, -4/16, -8/16, 8/16, 4/16, 8/16 },
{ -6/16, -8/16, -6/16, 6/16, -4/16, 6/16 } { -6/16, -8/16, -6/16, 6/16, -4/16, 6/16 }
} }
} }
}, },
{ suffix = "technic_cnc_sphere", {
suffix = "technic_cnc_sphere",
model = "technic_sphere.obj", model = "technic_sphere.obj",
desc = S("Sphere") desc = S("Sphere")
}, },
{ suffix = "technic_cnc_cylinder_horizontal", {
suffix = "technic_cnc_cylinder_horizontal",
model = "technic_cylinder_horizontal.obj", model = "technic_cylinder_horizontal.obj",
desc = S("Horizontal Cylinder") desc = S("Horizontal Cylinder")
}, },
{ suffix = "technic_cnc_cylinder", {
suffix = "technic_cnc_cylinder",
model = "technic_cylinder.obj", model = "technic_cylinder.obj",
desc = S("Cylinder") desc = S("Cylinder")
}, },
{ suffix = "technic_cnc_twocurvededge", {
suffix = "technic_cnc_twocurvededge",
model = "technic_two_curved_edge.obj", model = "technic_two_curved_edge.obj",
desc = S("Two Curved Edge/Corner Block") desc = S("Two Curved Edge/Corner Block")
}, },
{ suffix = "technic_cnc_onecurvededge", {
suffix = "technic_cnc_onecurvededge",
model = "technic_one_curved_edge.obj", model = "technic_one_curved_edge.obj",
desc = S("One Curved Edge Block") desc = S("One Curved Edge Block")
}, },
{ suffix = "technic_cnc_spike", {
suffix = "technic_cnc_spike",
model = "technic_pyramid_spike.obj", model = "technic_pyramid_spike.obj",
desc = S("Spike"), desc = S("Spike"),
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -2/16, 4/16, -2/16, 2/16, 8/16, 2/16 }, { -2/16, 4/16, -2/16, 2/16, 8/16, 2/16 },
{ -4/16, 0, -4/16, 4/16, 4/16, 4/16 }, { -4/16, 0, -4/16, 4/16, 4/16, 4/16 },
{ -6/16, -4/16, -6/16, 6/16, 0, 6/16 }, { -6/16, -4/16, -6/16, 6/16, 0, 6/16 },
{ -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 } { -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 }
} }
} }
}, },
{ suffix = "technic_cnc_pyramid", {
suffix = "technic_cnc_pyramid",
model = "technic_pyramid.obj", model = "technic_pyramid.obj",
desc = S("Pyramid"), desc = S("Pyramid"),
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -2/16, -2/16, -2/16, 2/16, 0, 2/16 }, { -2/16, -2/16, -2/16, 2/16, 0, 2/16 },
{ -4/16, -4/16, -4/16, 4/16, -2/16, 4/16 }, { -4/16, -4/16, -4/16, 4/16, -2/16, 4/16 },
{ -6/16, -6/16, -6/16, 6/16, -4/16, 6/16 }, { -6/16, -6/16, -6/16, 6/16, -4/16, 6/16 },
{ -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 } { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }
@ -148,128 +173,136 @@ technic.cnc.programs = {
} }
}, },
{ suffix = "technic_cnc_slope_inner_edge_upsdown", {
suffix = "technic_cnc_slope_inner_edge_upsdown",
model = "technic_innercorner_upsdown.obj", model = "technic_innercorner_upsdown.obj",
desc = S("Slope Upside Down Inner Edge/Corner"), desc = S("Slope Upside Down Inner Edge/Corner"),
sbox = { sbox = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
}, },
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ 0.25, -0.25, -0.5, 0.5, -0.5, 0.5 }, { 0.25, -0.25, -0.5, 0.5, -0.5, 0.5 },
{ -0.5, -0.25, 0.25, 0.5, -0.5, 0.5 }, { -0.5, -0.25, 0.25, 0.5, -0.5, 0.5 },
{ 0, 0, -0.5, 0.5, -0.25, 0.5 }, { 0, 0, -0.5, 0.5, -0.25, 0.5 },
{ -0.5, 0, 0, 0.5, -0.25, 0.5 }, { -0.5, 0, 0, 0.5, -0.25, 0.5 },
{ -0.25, 0.25, -0.5, 0.5, 0, -0.25 }, { -0.25, 0.25, -0.5, 0.5, 0, -0.25 },
{ -0.5, 0.25, -0.25, 0.5, 0, 0.5 }, { -0.5, 0.25, -0.25, 0.5, 0, 0.5 },
{ -0.5, 0.5, -0.5, 0.5, 0.25, 0.5 } { -0.5, 0.5, -0.5, 0.5, 0.25, 0.5 }
} }
} }
}, },
{ suffix = "technic_cnc_slope_edge_upsdown", {
suffix = "technic_cnc_slope_edge_upsdown",
model = "technic_outercorner_upsdown.obj", model = "technic_outercorner_upsdown.obj",
desc = S("Slope Upside Down Outer Edge/Corner"), desc = S("Slope Upside Down Outer Edge/Corner"),
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -8/16, 8/16, -8/16, 8/16, 4/16, 8/16 }, { -8/16, 8/16, -8/16, 8/16, 4/16, 8/16 },
{ -4/16, 4/16, -4/16, 8/16, 0, 8/16 }, { -4/16, 4/16, -4/16, 8/16, 0, 8/16 },
{ 0, 0, 0, 8/16, -4/16, 8/16 }, { 0, 0, 0, 8/16, -4/16, 8/16 },
{ 4/16, -4/16, 4/16, 8/16, -8/16, 8/16 } { 4/16, -4/16, 4/16, 8/16, -8/16, 8/16 }
} }
} }
}, },
{ suffix = "technic_cnc_slope_inner_edge", {
suffix = "technic_cnc_slope_inner_edge",
model = "technic_innercorner.obj", model = "technic_innercorner.obj",
desc = S("Slope Inner Edge/Corner"), desc = S("Slope Inner Edge/Corner"),
sbox = { sbox = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
}, },
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 },
{ -0.5, -0.25, -0.25, 0.5, 0, 0.5 }, { -0.5, -0.25, -0.25, 0.5, 0, 0.5 },
{ -0.25, -0.25, -0.5, 0.5, 0, -0.25 }, { -0.25, -0.25, -0.5, 0.5, 0, -0.25 },
{ -0.5, 0, 0, 0.5, 0.25, 0.5 }, { -0.5, 0, 0, 0.5, 0.25, 0.5 },
{ 0, 0, -0.5, 0.5, 0.25, 0.5 }, { 0, 0, -0.5, 0.5, 0.25, 0.5 },
{ -0.5, 0.25, 0.25, 0.5, 0.5, 0.5 }, { -0.5, 0.25, 0.25, 0.5, 0.5, 0.5 },
{ 0.25, 0.25, -0.5, 0.5, 0.5, 0.5 } { 0.25, 0.25, -0.5, 0.5, 0.5, 0.5 }
} }
} }
}, },
{ suffix = "technic_cnc_slope_edge", {
suffix = "technic_cnc_slope_edge",
model = "technic_outercorner.obj", model = "technic_outercorner.obj",
desc = S("Slope Outer Edge/Corner"), desc = S("Slope Outer Edge/Corner"),
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ 4/16, 4/16, 4/16, 8/16, 8/16, 8/16 }, { 4/16, 4/16, 4/16, 8/16, 8/16, 8/16 },
{ 0, 0, 0, 8/16, 4/16, 8/16 }, { 0, 0, 0, 8/16, 4/16, 8/16 },
{ -4/16, -4/16, -4/16, 8/16, 0, 8/16 }, { -4/16, -4/16, -4/16, 8/16, 0, 8/16 },
{ -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 } { -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 }
} }
} }
}, },
{ suffix = "technic_cnc_slope_upsdown", {
suffix = "technic_cnc_slope_upsdown",
model = "technic_slope_upsdown.obj", model = "technic_slope_upsdown.obj",
desc = S("Slope Upside Down"), desc = S("Slope Upside Down"),
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -8/16, 8/16, -8/16, 8/16, 4/16, 8/16 }, { -8/16, 8/16, -8/16, 8/16, 4/16, 8/16 },
{ -8/16, 4/16, -4/16, 8/16, 0, 8/16 }, { -8/16, 4/16, -4/16, 8/16, 0, 8/16 },
{ -8/16, 0, 0, 8/16, -4/16, 8/16 }, { -8/16, 0, 0, 8/16, -4/16, 8/16 },
{ -8/16, -4/16, 4/16, 8/16, -8/16, 8/16 } { -8/16, -4/16, 4/16, 8/16, -8/16, 8/16 }
} }
} }
}, },
{ suffix = "technic_cnc_slope_lying", {
suffix = "technic_cnc_slope_lying",
model = "technic_slope_horizontal.obj", model = "technic_slope_horizontal.obj",
desc = S("Slope Lying"), desc = S("Slope Lying"),
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ 4/16, -8/16, 4/16, 8/16, 8/16, 8/16 }, { 4/16, -8/16, 4/16, 8/16, 8/16, 8/16 },
{ 0, -8/16, 0, 4/16, 8/16, 8/16 }, { 0, -8/16, 0, 4/16, 8/16, 8/16 },
{ -4/16, -8/16, -4/16, 0, 8/16, 8/16 }, { -4/16, -8/16, -4/16, 0, 8/16, 8/16 },
{ -8/16, -8/16, -8/16, -4/16, 8/16, 8/16 } { -8/16, -8/16, -8/16, -4/16, 8/16, 8/16 }
} }
} }
}, },
{ suffix = "technic_cnc_slope", {
suffix = "technic_cnc_slope",
model = "technic_slope.obj", model = "technic_slope.obj",
desc = S("Slope"), desc = S("Slope"),
cbox = { cbox = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{ -8/16, 4/16, 4/16, 8/16, 8/16, 8/16 }, { -8/16, 4/16, 4/16, 8/16, 8/16, 8/16 },
{ -8/16, 0, 0, 8/16, 4/16, 8/16 }, { -8/16, 0, 0, 8/16, 4/16, 8/16 },
{ -8/16, -4/16, -4/16, 8/16, 0, 8/16 }, { -8/16, -4/16, -4/16, 8/16, 0, 8/16 },
{ -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 } { -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 }
} }
} }
}, },
} }
-- Allow disabling certain programs for some node. Default is allowing all types for all nodes -- Allow disabling certain programs for some node. Default is allowing all types for all nodes
technic.cnc.programs_disable = { technic.cnc.programs_disable = {
-- ["default:brick"] = {"technic_cnc_stick"}, -- Example: Disallow the stick for brick -- ["default:brick"] = {"technic_cnc_stick"}, -- Example: Disallow the stick for brick
-- ... -- ...
["default:dirt"] = {"technic_cnc_oblate_spheroid", "technic_cnc_slope_upsdown", "technic_cnc_edge", ["default:dirt"] = {
"technic_cnc_inner_edge", "technic_cnc_slope_edge_upsdown", "technic_cnc_oblate_spheroid", "technic_cnc_slope_upsdown", "technic_cnc_edge",
"technic_cnc_slope_inner_edge_upsdown", "technic_cnc_stick", "technic_cnc_inner_edge", "technic_cnc_slope_edge_upsdown",
"technic_cnc_cylinder_horizontal"} "technic_cnc_slope_inner_edge_upsdown", "technic_cnc_stick",
"technic_cnc_cylinder_horizontal"
}
} }
-- Generic function for registering all the different node types -- Generic function for registering all the different node types
@ -282,7 +315,7 @@ function technic.cnc.register_program(recipeitem, suffix, model, groups, images,
if type(model) ~= "string" then -- assume a nodebox if it's a table or function call if type(model) ~= "string" then -- assume a nodebox if it's a table or function call
dtype = "nodebox" dtype = "nodebox"
nodeboxdef = { nodeboxdef = {
type = "fixed", type = "fixed",
fixed = model fixed = model
} }
else else
@ -293,15 +326,15 @@ function technic.cnc.register_program(recipeitem, suffix, model, groups, images,
if cbox and not sbox then sbox = cbox end if cbox and not sbox then sbox = cbox end
minetest.register_node(":"..recipeitem.."_"..suffix, { minetest.register_node(":"..recipeitem.."_"..suffix, {
description = description, description = description,
drawtype = dtype, drawtype = dtype,
node_box = nodeboxdef, node_box = nodeboxdef,
mesh = meshdef, mesh = meshdef,
tiles = images, tiles = images,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
groups = groups, groups = groups,
selection_box = sbox, selection_box = sbox,
collision_box = cbox collision_box = cbox
}) })
@ -322,7 +355,7 @@ function technic.cnc.register_all(recipeitem, groups, images, description)
-- Create the node if it passes the test -- Create the node if it passes the test
if do_register then if do_register then
technic.cnc.register_program(recipeitem, data.suffix, data.model, technic.cnc.register_program(recipeitem, data.suffix, data.model,
groups, images, description.." "..data.desc, data.cbox, data.sbox) groups, images, description.." "..data.desc, data.cbox, data.sbox)
end end
end end
end end
@ -332,38 +365,38 @@ end
----------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------
function technic.cnc.register_slope_edge_etc(recipeitem, groups, images, desc_slope, desc_slope_lying, desc_slope_upsdown, desc_slope_edge, desc_slope_inner_edge, desc_slope_upsdwn_edge, desc_slope_upsdwn_inner_edge, desc_pyramid, desc_spike, desc_onecurvededge, desc_twocurvededge, desc_cylinder, desc_cylinder_horizontal, desc_spheroid, desc_element_straight, desc_element_edge, desc_element_t, desc_element_cross, desc_element_end) function technic.cnc.register_slope_edge_etc(recipeitem, groups, images, desc_slope, desc_slope_lying, desc_slope_upsdown, desc_slope_edge, desc_slope_inner_edge, desc_slope_upsdwn_edge, desc_slope_upsdwn_inner_edge, desc_pyramid, desc_spike, desc_onecurvededge, desc_twocurvededge, desc_cylinder, desc_cylinder_horizontal, desc_spheroid, desc_element_straight, desc_element_edge, desc_element_t, desc_element_cross, desc_element_end)
technic.cnc.register_slope(recipeitem, groups, images, desc_slope) technic.cnc.register_slope(recipeitem, groups, images, desc_slope)
technic.cnc.register_slope_lying(recipeitem, groups, images, desc_slope_lying) technic.cnc.register_slope_lying(recipeitem, groups, images, desc_slope_lying)
technic.cnc.register_slope_upsdown(recipeitem, groups, images, desc_slope_upsdown) technic.cnc.register_slope_upsdown(recipeitem, groups, images, desc_slope_upsdown)
technic.cnc.register_slope_edge(recipeitem, groups, images, desc_slope_edge) technic.cnc.register_slope_edge(recipeitem, groups, images, desc_slope_edge)
technic.cnc.register_slope_inner_edge(recipeitem, groups, images, desc_slope_inner_edge) technic.cnc.register_slope_inner_edge(recipeitem, groups, images, desc_slope_inner_edge)
technic.cnc.register_slope_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_edge) technic.cnc.register_slope_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_edge)
technic.cnc.register_slope_inner_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_inner_edge) technic.cnc.register_slope_inner_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_inner_edge)
technic.cnc.register_pyramid(recipeitem, groups, images, desc_pyramid) technic.cnc.register_pyramid(recipeitem, groups, images, desc_pyramid)
technic.cnc.register_spike(recipeitem, groups, images, desc_spike) technic.cnc.register_spike(recipeitem, groups, images, desc_spike)
technic.cnc.register_onecurvededge(recipeitem, groups, images, desc_onecurvededge) technic.cnc.register_onecurvededge(recipeitem, groups, images, desc_onecurvededge)
technic.cnc.register_twocurvededge(recipeitem, groups, images, desc_twocurvededge) technic.cnc.register_twocurvededge(recipeitem, groups, images, desc_twocurvededge)
technic.cnc.register_cylinder(recipeitem, groups, images, desc_cylinder) technic.cnc.register_cylinder(recipeitem, groups, images, desc_cylinder)
technic.cnc.register_cylinder_horizontal(recipeitem, groups, images, desc_cylinder_horizontal) technic.cnc.register_cylinder_horizontal(recipeitem, groups, images, desc_cylinder_horizontal)
technic.cnc.register_spheroid(recipeitem, groups, images, desc_spheroid) technic.cnc.register_spheroid(recipeitem, groups, images, desc_spheroid)
technic.cnc.register_element_straight(recipeitem, groups, images, desc_element_straight) technic.cnc.register_element_straight(recipeitem, groups, images, desc_element_straight)
technic.cnc.register_element_edge(recipeitem, groups, images, desc_element_edge) technic.cnc.register_element_edge(recipeitem, groups, images, desc_element_edge)
technic.cnc.register_element_t(recipeitem, groups, images, desc_element_t) technic.cnc.register_element_t(recipeitem, groups, images, desc_element_t)
technic.cnc.register_element_cross(recipeitem, groups, images, desc_element_cross) technic.cnc.register_element_cross(recipeitem, groups, images, desc_element_cross)
technic.cnc.register_element_end(recipeitem, groups, images, desc_element_end) technic.cnc.register_element_end(recipeitem, groups, images, desc_element_end)
end end
-- REGISTER STICKS: noncubic.register_xyz(recipeitem, groups, images, desc_element_xyz) -- REGISTER STICKS: noncubic.register_xyz(recipeitem, groups, images, desc_element_xyz)
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
function technic.cnc.register_stick_etc(recipeitem, groups, images, desc_stick) function technic.cnc.register_stick_etc(recipeitem, groups, images, desc_stick)
technic.cnc.register_stick(recipeitem, groups, images, desc_stick) technic.cnc.register_stick(recipeitem, groups, images, desc_stick)
end end
function technic.cnc.register_elements(recipeitem, groups, images, desc_element_straight_double, desc_element_edge_double, desc_element_t_double, desc_element_cross_double, desc_element_end_double) function technic.cnc.register_elements(recipeitem, groups, images, desc_element_straight_double, desc_element_edge_double, desc_element_t_double, desc_element_cross_double, desc_element_end_double)
technic.cnc.register_element_straight_double(recipeitem, groups, images, desc_element_straight_double) technic.cnc.register_element_straight_double(recipeitem, groups, images, desc_element_straight_double)
technic.cnc.register_element_edge_double(recipeitem, groups, images, desc_element_edge_double) technic.cnc.register_element_edge_double(recipeitem, groups, images, desc_element_edge_double)
technic.cnc.register_element_t_double(recipeitem, groups, images, desc_element_t_double) technic.cnc.register_element_t_double(recipeitem, groups, images, desc_element_t_double)
technic.cnc.register_element_cross_double(recipeitem, groups, images, desc_element_cross_double) technic.cnc.register_element_cross_double(recipeitem, groups, images, desc_element_cross_double)
technic.cnc.register_element_end_double(recipeitem, groups, images, desc_element_end_double) technic.cnc.register_element_end_double(recipeitem, groups, images, desc_element_end_double)
end end

View File

@ -6,86 +6,86 @@ local S = technic.getter
-- DIRT -- DIRT
------- -------
technic.cnc.register_all("default:dirt", technic.cnc.register_all("default:dirt",
{snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1}, { snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1 },
{"default_grass.png", "default_dirt.png", "default_grass.png"}, { "default_grass.png", "default_dirt.png", "default_grass.png" },
S("Dirt")) S("Dirt"))
-- WOOD -- WOOD
------- -------
technic.cnc.register_all("default:wood", technic.cnc.register_all("default:wood",
{snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1 },
{"default_wood.png"}, { "default_wood.png" },
S("Wooden")) S("Wooden"))
-- STONE -- STONE
-------- --------
technic.cnc.register_all("default:stone", technic.cnc.register_all("default:stone",
{cracky=3, not_in_creative_inventory=1}, { cracky = 3, not_in_creative_inventory = 1 },
{"default_stone.png"}, { "default_stone.png" },
S("Stone")) S("Stone"))
-- COBBLE -- COBBLE
--------- ---------
technic.cnc.register_all("default:cobble", technic.cnc.register_all("default:cobble",
{cracky=3, not_in_creative_inventory=1}, { cracky = 3, not_in_creative_inventory = 1 },
{"default_cobble.png"}, { "default_cobble.png" },
S("Cobble")) S("Cobble"))
-- BRICK -- BRICK
-------- --------
technic.cnc.register_all("default:brick", technic.cnc.register_all("default:brick",
{cracky=3, not_in_creative_inventory=1}, { cracky = 3, not_in_creative_inventory = 1 },
{"default_brick.png"}, { "default_brick.png" },
S("Brick")) S("Brick"))
-- SANDSTONE -- SANDSTONE
------------ ------------
technic.cnc.register_all("default:sandstone", technic.cnc.register_all("default:sandstone",
{crumbly=2, cracky=3, not_in_creative_inventory=1}, { crumbly = 2, cracky = 3, not_in_creative_inventory = 1 },
{"default_sandstone.png"}, { "default_sandstone.png" },
S("Sandstone")) S("Sandstone"))
-- LEAVES -- LEAVES
--------- ---------
technic.cnc.register_all("default:leaves", technic.cnc.register_all("default:leaves",
{snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1}, { snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1 },
{"default_leaves.png"}, { "default_leaves.png" },
S("Leaves")) S("Leaves"))
-- TREE -- TREE
------- -------
technic.cnc.register_all("default: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}, { snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1, not_in_creative_inventory = 1 },
{"default_tree.png"}, { "default_tree.png" },
S("Tree")) S("Tree"))
-- WROUGHT IRON -- WROUGHT IRON
--------------- ---------------
technic.cnc.register_all("default:steelblock", technic.cnc.register_all("default:steelblock",
{cracky=1, level=2, not_in_creative_inventory=1}, { cracky = 1, level = 2, not_in_creative_inventory = 1 },
{"technic_wrought_iron_block.png"}, { "technic_wrought_iron_block.png" },
S("Wrought Iron")) S("Wrought Iron"))
-- Bronze -- Bronze
-------- --------
technic.cnc.register_all("default:bronzeblock", technic.cnc.register_all("default:bronzeblock",
{cracky=1, level=2, not_in_creative_inventory=1}, { cracky = 1, level = 2, not_in_creative_inventory = 1 },
{"default_bronze_block.png"}, { "default_bronze_block.png" },
S("Bronze")) S("Bronze"))
-- Stainless Steel -- Stainless Steel
-------- --------
technic.cnc.register_all("technic:stainless_steel_block", technic.cnc.register_all("technic:stainless_steel_block",
{cracky=1, level=2, not_in_creative_inventory=1}, { cracky = 1, level = 2, not_in_creative_inventory = 1 },
{"technic_stainless_steel_block.png"}, { "technic_stainless_steel_block.png" },
S("Stainless Steel")) S("Stainless Steel"))
-- Marble -- Marble
------------ ------------
technic.cnc.register_all("technic:marble", technic.cnc.register_all("technic:marble",
{cracky=3, not_in_creative_inventory=1}, { cracky = 3, not_in_creative_inventory = 1 },
{"technic_marble.png"}, { "technic_marble.png" },
S("Marble")) S("Marble"))
-- Granite -- Granite
------------ ------------
technic.cnc.register_all("technic:granite", technic.cnc.register_all("technic:granite",
{cracky=1, not_in_creative_inventory=1}, { cracky = 1, not_in_creative_inventory = 1 },
{"technic_granite.png"}, { "technic_granite.png" },
S("Granite")) S("Granite"))

View File

@ -1,13 +1,12 @@
minetest.register_alias("compressor", "technic:lv_compressor") minetest.register_alias("compressor", "technic:lv_compressor")
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_compressor', output = "technic:lv_compressor",
recipe = { recipe = {
{'default:stone', 'technic:motor', 'default:stone'}, { "default:stone", "technic:motor", "default:stone" },
{'mesecons:piston', 'technic:machine_casing', 'mesecons:piston'}, { "mesecons:piston", "technic:machine_casing", "mesecons:piston" },
{'technic:fine_silver_wire', 'technic:lv_cable', 'technic:fine_silver_wire'}, { "technic:fine_silver_wire", "technic:lv_cable", "technic:fine_silver_wire" },
} }
}) })
technic.register_compressor({tier = "LV", demand = {300}, speed = 1}) technic.register_compressor({ tier = "LV", demand = { 300 }, speed = 1 })

View File

@ -3,14 +3,14 @@
-- FIXME: kpoppel I'd like to introduce an induction heating element here also -- FIXME: kpoppel I'd like to introduce an induction heating element here also
minetest.register_craft({ minetest.register_craft({
output = 'technic:electric_furnace', output = "technic:electric_furnace",
recipe = { recipe = {
{'default:cobble', 'default:cobble', 'default:cobble'}, { "default:cobble", "default:cobble", "default:cobble" },
{'default:cobble', 'technic:machine_casing', 'default:cobble'}, { "default:cobble", "technic:machine_casing", "default:cobble" },
{'default:cobble', 'technic:lv_cable', 'default:cobble'}, { "default:cobble", "technic:lv_cable", "default:cobble" },
} }
}) })
technic.register_electric_furnace({tier="LV", demand={300}, speed = 2}) technic.register_electric_furnace({ tier = "LV", demand = { 300 }, speed = 2 })

View File

@ -1,13 +1,12 @@
minetest.register_alias("extractor", "technic:lv_extractor") minetest.register_alias("extractor", "technic:lv_extractor")
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_extractor', output = "technic:lv_extractor",
recipe = { recipe = {
{'technic:treetap', 'technic:motor', 'technic:treetap'}, { "technic:treetap", "technic:motor", "technic:treetap" },
{'technic:treetap', 'technic:machine_casing', 'technic:treetap'}, { "technic:treetap", "technic:machine_casing", "technic:treetap" },
{'', 'technic:lv_cable', ''}, { "", "technic:lv_cable", "" },
} }
}) })
technic.register_extractor({tier = "LV", demand = {300}, speed = 1}) technic.register_extractor({ tier = "LV", demand = { 300 }, speed = 1 })

View File

@ -6,13 +6,13 @@
minetest.register_alias("lv_generator", "technic:lv_generator") minetest.register_alias("lv_generator", "technic:lv_generator")
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_generator', output = "technic:lv_generator",
recipe = { recipe = {
{'default:stone', 'default:furnace', 'default:stone'}, { "default:stone", "default:furnace", "default:stone" },
{'default:stone', 'technic:machine_casing', 'default:stone'}, { "default:stone", "technic:machine_casing", "default:stone" },
{'default:stone', 'technic:lv_cable', 'default:stone'}, { "default:stone", "technic:lv_cable", "default:stone" },
} }
}) })
technic.register_generator({tier="LV", supply=200}) technic.register_generator({ tier = "LV", supply = 200 })

View File

@ -8,11 +8,11 @@ minetest.register_alias("geothermal", "technic:geothermal")
local S = technic.getter local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:geothermal', output = "technic:geothermal",
recipe = { recipe = {
{'technic:granite', 'default:diamond', 'technic:granite'}, { "technic:granite", "default:diamond", "technic:granite" },
{'technic:fine_copper_wire', 'technic:machine_casing', 'technic:fine_copper_wire'}, { "technic:fine_copper_wire", "technic:machine_casing", "technic:fine_copper_wire" },
{'technic:granite', 'technic:lv_cable', 'technic:granite'}, { "technic:granite", "technic:lv_cable", "technic:granite" },
} }
}) })
@ -23,16 +23,16 @@ minetest.register_craftitem("technic:geothermal", {
local check_node_around = function(pos) local check_node_around = function(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node.name == "default:water_source" or node.name == "default:water_flowing" then return 1 end if node.name == "default:water_source" or node.name == "default:water_flowing" then return 1 end
if node.name == "default:lava_source" or node.name == "default:lava_flowing" then return 2 end if node.name == "default:lava_source" or node.name == "default:lava_flowing" then return 2 end
return 0 return 0
end end
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local water_nodes = 0 local water_nodes = 0
local lava_nodes = 0 local lava_nodes = 0
local production_level = 0 local production_level = 0
local eu_supply = 0 local eu_supply = 0
-- Correct positioning is water on one side and lava on the other. -- Correct positioning is water on one side and lava on the other.
-- The two cannot be adjacent because the lava the turns into obsidian or rock. -- The two cannot be adjacent because the lava the turns into obsidian or rock.
@ -41,24 +41,24 @@ local run = function(pos, node)
-- W|L -- W|L
local positions = { local positions = {
{x=pos.x+1, y=pos.y, z=pos.z}, { x = pos.x + 1, y = pos.y, z = pos.z },
{x=pos.x+1, y=pos.y-1, z=pos.z}, { x = pos.x + 1, y = pos.y - 1, z = pos.z },
{x=pos.x-1, y=pos.y, z=pos.z}, { x = pos.x - 1, y = pos.y, z = pos.z },
{x=pos.x-1, y=pos.y-1, z=pos.z}, { x = pos.x - 1, y = pos.y - 1, z = pos.z },
{x=pos.x, y=pos.y, z=pos.z+1}, { x = pos.x, y = pos.y, z = pos.z + 1 },
{x=pos.x, y=pos.y-1, z=pos.z+1}, { x = pos.x, y = pos.y - 1, z = pos.z + 1 },
{x=pos.x, y=pos.y, z=pos.z-1}, { x = pos.x, y = pos.y, z = pos.z - 1 },
{x=pos.x, y=pos.y-1, z=pos.z-1}, { x = pos.x, y = pos.y - 1, z = pos.z - 1 },
} }
for _, p in pairs(positions) do for _, p in pairs(positions) do
local check = check_node_around(p) local check = check_node_around(p)
if check == 1 then water_nodes = water_nodes + 1 end if check == 1 then water_nodes = water_nodes + 1 end
if check == 2 then lava_nodes = lava_nodes + 1 end if check == 2 then lava_nodes = lava_nodes + 1 end
end end
if water_nodes == 1 and lava_nodes == 1 then production_level = 25; eu_supply = 50 end if water_nodes == 1 and lava_nodes == 1 then production_level = 25; eu_supply = 50 end
if water_nodes == 2 and lava_nodes == 1 then production_level = 50; eu_supply = 100 end if water_nodes == 2 and lava_nodes == 1 then production_level = 50; eu_supply = 100 end
if water_nodes == 1 and lava_nodes == 2 then production_level = 75; eu_supply = 200 end if water_nodes == 1 and lava_nodes == 2 then production_level = 75; eu_supply = 200 end
if water_nodes == 2 and lava_nodes == 2 then production_level = 100; eu_supply = 300 end if water_nodes == 2 and lava_nodes == 2 then production_level = 100; eu_supply = 300 end
if production_level > 0 then if production_level > 0 then
@ -69,7 +69,7 @@ local run = function(pos, node)
S("Geothermal %s Generator"):format("LV").." ("..production_level.."%)") S("Geothermal %s Generator"):format("LV").." ("..production_level.."%)")
if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then
technic.swap_node (pos, "technic:geothermal_active") technic.swap_node(pos, "technic:geothermal_active")
return return
end end
if production_level == 0 then if production_level == 0 then
@ -80,10 +80,17 @@ end
minetest.register_node("technic:geothermal", { minetest.register_node("technic:geothermal", {
description = S("Geothermal %s Generator"):format("LV"), description = S("Geothermal %s Generator"):format("LV"),
tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png", tiles = {
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, "technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"
technic_machine=1, technic_lv=1}, },
groups = {
snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
technic_lv = 1
},
paramtype2 = "facedir", paramtype2 = "facedir",
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
@ -97,17 +104,25 @@ minetest.register_node("technic:geothermal", {
minetest.register_node("technic:geothermal_active", { minetest.register_node("technic:geothermal_active", {
description = S("Geothermal %s Generator"):format("LV"), description = S("Geothermal %s Generator"):format("LV"),
tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png", tiles = {
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"}, "technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, groups = {
technic_machine=1, technic_lv=1, not_in_creative_inventory=1}, snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
technic_lv = 1,
not_in_creative_inventory = 1
},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drop = "technic:geothermal", drop = "technic:geothermal",
technic_run = run, technic_run = run,
}) })
technic.register_machine("LV", "technic:geothermal", technic.producer) technic.register_machine("LV", "technic:geothermal", technic.producer)
technic.register_machine("LV", "technic:geothermal_active", technic.producer) technic.register_machine("LV", "technic:geothermal_active", technic.producer)

View File

@ -1,13 +1,12 @@
minetest.register_alias("grinder", "technic:lv_grinder") minetest.register_alias("grinder", "technic:lv_grinder")
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_grinder', output = "technic:lv_grinder",
recipe = { recipe = {
{'default:desert_stone', 'default:diamond', 'default:desert_stone'}, { "default:desert_stone", "default:diamond", "default:desert_stone" },
{'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'}, { "default:desert_stone", "technic:machine_casing", "default:desert_stone" },
{'technic:granite', 'technic:lv_cable', 'technic:granite'}, { "technic:granite", "technic:lv_cable", "technic:granite" },
} }
}) })
technic.register_grinder({tier="LV", demand={200}, speed=1}) technic.register_grinder({ tier = "LV", demand = { 200 }, speed = 1 })

View File

@ -1,4 +1,3 @@
technic.register_tier("LV", "Low Voltage") technic.register_tier("LV", "Low Voltage")
local path = technic.modpath.."/machines/LV" local path = technic.modpath.."/machines/LV"

View File

@ -5,11 +5,11 @@ local S = technic.getter
minetest.register_alias("music_player", "technic:music_player") minetest.register_alias("music_player", "technic:music_player")
minetest.register_craft({ minetest.register_craft({
output = 'technic:music_player', output = "technic:music_player",
recipe = { recipe = {
{'technic:chromium_ingot', 'default:diamond', 'technic:chromium_ingot'}, { "technic:chromium_ingot", "default:diamond", "technic:chromium_ingot" },
{'default:diamond', 'technic:machine_casing', 'default:diamond'}, { "default:diamond", "technic:machine_casing", "default:diamond" },
{'default:mossycobble', 'technic:lv_cable', 'default:mossycobble'}, { "default:mossycobble", "technic:lv_cable", "default:mossycobble" },
} }
}) })
@ -17,19 +17,19 @@ local music_handles = {}
local function play_track(pos, track) local function play_track(pos, track)
return minetest.sound_play("technic_track"..tostring(track), return minetest.sound_play("technic_track"..tostring(track),
{pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,}) { pos = pos, gain = 1.0, loop = true, max_hear_distance = 72, })
end end
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local eu_input = meta:get_int("LV_EU_input") local eu_input = meta:get_int("LV_EU_input")
local machine_name = S("%s Music Player"):format("LV") local machine_name = S("%s Music Player"):format("LV")
local machine_node = "technic:music_player" local machine_node = "technic:music_player"
local demand = 150 local demand = 150
local current_track = meta:get_int("current_track") local current_track = meta:get_int("current_track")
local pos_hash = minetest.hash_node_position(pos) local pos_hash = minetest.hash_node_position(pos)
local music_handle = music_handles[pos_hash] local music_handle = music_handles[pos_hash]
-- Setup meta data if it does not exist. -- Setup meta data if it does not exist.
if not eu_input then if not eu_input then
@ -71,32 +71,38 @@ end
local function set_display(meta) local function set_display(meta)
meta:set_string("formspec", meta:set_string("formspec",
"size[4,4.5]".. "size[4,4.5]"..
"item_image[0,0;1,1;technic:music_player]".. "item_image[0,0;1,1;technic:music_player]"..
"label[1,0;"..S("%s Music Player"):format("LV").."]".. "label[1,0;"..S("%s Music Player"):format("LV").."]"..
"button[0,1;1,1;track1;1]".. "button[0,1;1,1;track1;1]"..
"button[1,1;1,1;track2;2]".. "button[1,1;1,1;track2;2]"..
"button[2,1;1,1;track3;3]".. "button[2,1;1,1;track3;3]"..
"button[0,2;1,1;track4;4]".. "button[0,2;1,1;track4;4]"..
"button[1,2;1,1;track5;5]".. "button[1,2;1,1;track5;5]"..
"button[2,2;1,1;track6;6]".. "button[2,2;1,1;track6;6]"..
"button[0,3;1,1;track7;7]".. "button[0,3;1,1;track7;7]"..
"button[1,3;1,1;track8;8]".. "button[1,3;1,1;track8;8]"..
"button[2,3;1,1;track9;9]".. "button[2,3;1,1;track9;9]"..
"button[3,1;1,1;stop;Stop]".. "button[3,1;1,1;stop;Stop]"..
"label[0,4;"..minetest.formspec_escape( "label[0,4;"..minetest.formspec_escape(meta:get_int("active") == 0 and
meta:get_int("active") == 0 and S("Stopped") or
S("Stopped") or S("Current track %s"):format(meta:get_int("current_track"))).."]")
S("Current track %s"):format(meta:get_int("current_track"))).."]")
end end
minetest.register_node("technic:music_player", { minetest.register_node("technic:music_player", {
description = S("%s Music Player"):format("LV"), description = S("%s Music Player"):format("LV"),
tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png", tiles = {
"technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"}, "technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, "technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"
technic_machine=1, technic_lv=1}, },
connect_sides = {"bottom"}, groups = {
snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
technic_lv = 1
},
connect_sides = { "bottom" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -8,11 +8,11 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:solar_array_lv 1', output = 'technic:solar_array_lv 1',
recipe = { recipe = {
{'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel'}, { "technic:solar_panel", "technic:solar_panel", "technic:solar_panel" },
{'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "technic:lv_transformer", "technic:carbon_steel_ingot" },
{'', 'technic:lv_cable', ''}, { "", "technic:lv_cable", "" },
} }
}) })
technic.register_solar_array({tier="LV", power=10}) technic.register_solar_array({ tier = "LV", power = 10 })

View File

@ -6,11 +6,10 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:solar_panel', output = "technic:solar_panel",
recipe = { recipe = {
{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'}, { "technic:doped_silicon_wafer", "technic:doped_silicon_wafer", "technic:doped_silicon_wafer" },
{'technic:fine_silver_wire', 'technic:lv_cable', 'mesecons_materials:glue'}, { "technic:fine_silver_wire", "technic:lv_cable", "mesecons_materials:glue" },
} }
}) })
@ -22,7 +21,7 @@ local run = function(pos, node)
-- As there is no way to determine if light is sunlight that is just a shame. -- As there is no way to determine if light is sunlight that is just a shame.
-- To take care of some of it solar panels do not work outside daylight hours or if -- To take care of some of it solar panels do not work outside daylight hours or if
-- built below 0m -- built below 0m
local pos1 = {x=pos.x, y=pos.y+1, z=pos.z} local pos1 = { x = pos.x, y = pos.y + 1, z = pos.z }
local machine_name = S("Small Solar %s Generator"):format("LV") local machine_name = S("Small Solar %s Generator"):format("LV")
local light = minetest.get_node_light(pos1, nil) local light = minetest.get_node_light(pos1, nil)
@ -30,7 +29,7 @@ local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if light == nil then light = 0 end if light == nil then light = 0 end
-- turn on panel only during day time and if sufficient light -- turn on panel only during day time and if sufficient light
-- I know this is counter intuitive when cheating by using other light sources underground. -- I know this is counter intuitive when cheating by using other light sources underground.
if light >= 12 and time_of_day >= 0.24 and time_of_day <= 0.76 and pos.y > -10 then if light >= 12 and time_of_day >= 0.24 and time_of_day <= 0.76 and pos.y > -10 then
local charge_to_give = math.floor((light + pos1.y) * 3) local charge_to_give = math.floor((light + pos1.y) * 3)
charge_to_give = math.max(charge_to_give, 0) charge_to_give = math.max(charge_to_give, 0)
@ -44,20 +43,27 @@ local run = function(pos, node)
end end
minetest.register_node("technic:solar_panel", { minetest.register_node("technic:solar_panel", {
tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png", tiles = {
"technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"}, "technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, "technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"
technic_machine=1, technic_lv=1}, },
connect_sides = {"bottom"}, groups = {
snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
technic_lv = 1
},
connect_sides = { "bottom" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
description = S("Small Solar %s Generator"):format("LV"), description = S("Small Solar %s Generator"):format("LV"),
active = false, active = false,
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
is_ground_content = true, is_ground_content = true,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
}, },
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -7,37 +7,37 @@ local S = technic.getter
minetest.register_alias("water_mill", "technic:water_mill") minetest.register_alias("water_mill", "technic:water_mill")
minetest.register_craft({ minetest.register_craft({
output = 'technic:water_mill', output = "technic:water_mill",
recipe = { recipe = {
{'technic:marble', 'default:diamond', 'technic:marble'}, { "technic:marble", "default:diamond", "technic:marble" },
{'group:wood', 'technic:machine_casing', 'group:wood'}, { "group:wood", "technic:machine_casing", "group:wood" },
{'technic:marble', 'technic:lv_cable', 'technic:marble'}, { "technic:marble", "technic:lv_cable", "technic:marble" },
} }
}) })
local function check_node_around_mill(pos) local function check_node_around_mill(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node.name == "default:water_flowing" if node.name == "default:water_flowing"
or node.name == "default:river_water_flowing" then or node.name == "default:river_water_flowing" then
return node.param2 -- returns approx. water flow, if any return node.param2 -- returns approx. water flow, if any
end end
return false return false
end end
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local water_flow = 0 local water_flow = 0
local lava_nodes = 0 local lava_nodes = 0
local production_level = 0 local production_level = 0
local eu_supply = 0 local eu_supply = 0
local max_output = 35 * 45 -- four param2's at 15 makes 60, cap it lower for "overload protection" local max_output = 35 * 45 -- four param2's at 15 makes 60, cap it lower for "overload protection"
-- (plus we want the gen to report 100% if three sides have full flow) -- (plus we want the gen to report 100% if three sides have full flow)
local positions = { local positions = {
{x=pos.x+1, y=pos.y, z=pos.z}, { x = pos.x + 1, y = pos.y, z = pos.z },
{x=pos.x-1, y=pos.y, z=pos.z}, { x = pos.x - 1, y = pos.y, z = pos.z },
{x=pos.x, y=pos.y, z=pos.z+1}, { x = pos.x, y = pos.y, z = pos.z + 1 },
{x=pos.x, y=pos.y, z=pos.z-1}, { x = pos.x, y = pos.y, z = pos.z - 1 },
} }
for _, p in pairs(positions) do for _, p in pairs(positions) do
@ -58,8 +58,8 @@ local run = function(pos, node)
S("Hydro %s Generator"):format("LV").." ("..production_level.."%)") S("Hydro %s Generator"):format("LV").." ("..production_level.."%)")
if production_level > 0 and if production_level > 0 and
minetest.get_node(pos).name == "technic:water_mill" then minetest.get_node(pos).name == "technic:water_mill" then
technic.swap_node (pos, "technic:water_mill_active") technic.swap_node(pos, "technic:water_mill_active")
meta:set_int("LV_EU_supply", 0) meta:set_int("LV_EU_supply", 0)
return return
end end
@ -70,12 +70,19 @@ end
minetest.register_node("technic:water_mill", { minetest.register_node("technic:water_mill", {
description = S("Hydro %s Generator"):format("LV"), description = S("Hydro %s Generator"):format("LV"),
tiles = {"technic_water_mill_top.png", "technic_machine_bottom.png", tiles = {
"technic_water_mill_side.png", "technic_water_mill_side.png", "technic_water_mill_top.png", "technic_machine_bottom.png",
"technic_water_mill_side.png", "technic_water_mill_side.png"}, "technic_water_mill_side.png", "technic_water_mill_side.png",
"technic_water_mill_side.png", "technic_water_mill_side.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, groups = {
technic_machine=1, technic_lv=1}, snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
technic_lv = 1
},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
@ -88,12 +95,20 @@ minetest.register_node("technic:water_mill", {
minetest.register_node("technic:water_mill_active", { minetest.register_node("technic:water_mill_active", {
description = S("Hydro %s Generator"):format("LV"), description = S("Hydro %s Generator"):format("LV"),
tiles = {"technic_water_mill_top_active.png", "technic_machine_bottom.png", tiles = {
"technic_water_mill_side.png", "technic_water_mill_side.png", "technic_water_mill_top_active.png", "technic_machine_bottom.png",
"technic_water_mill_side.png", "technic_water_mill_side.png"}, "technic_water_mill_side.png", "technic_water_mill_side.png",
"technic_water_mill_side.png", "technic_water_mill_side.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, groups = {
technic_machine=1, technic_lv=1, not_in_creative_inventory=1}, snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
technic_lv = 1,
not_in_creative_inventory = 1
},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drop = "technic:water_mill", drop = "technic:water_mill",
@ -101,6 +116,6 @@ minetest.register_node("technic:water_mill_active", {
technic_disabled_machine_name = "technic:water_mill", technic_disabled_machine_name = "technic:water_mill",
}) })
technic.register_machine("LV", "technic:water_mill", technic.producer) technic.register_machine("LV", "technic:water_mill", technic.producer)
technic.register_machine("LV", "technic:water_mill_active", technic.producer) technic.register_machine("LV", "technic:water_mill_active", technic.producer)

View File

@ -1,14 +1,14 @@
-- MV alloy furnace -- MV alloy furnace
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_alloy_furnace', output = "technic:mv_alloy_furnace",
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_alloy_furnace', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:lv_alloy_furnace", "technic:stainless_steel_ingot" },
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, { "pipeworks:tube_1", "technic:mv_transformer", "pipeworks:tube_1" },
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mv_cable", "technic:stainless_steel_ingot" },
} }
}) })
technic.register_alloy_furnace({tier = "MV", speed = 1.5, upgrade = 1, tube = 1, demand = {3000, 2000, 1000}}) technic.register_alloy_furnace({ tier = "MV", speed = 1.5, upgrade = 1, tube = 1, demand = { 3000, 2000, 1000 } })

View File

@ -3,20 +3,20 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_battery_box0', output = 'technic:mv_battery_box0',
recipe = { recipe = {
{'technic:lv_battery_box0', 'technic:lv_battery_box0', 'technic:lv_battery_box0'}, { 'technic:lv_battery_box0', 'technic:lv_battery_box0', 'technic:lv_battery_box0' },
{'technic:lv_battery_box0', 'technic:mv_transformer', 'technic:lv_battery_box0'}, { 'technic:lv_battery_box0', "technic:mv_transformer", 'technic:lv_battery_box0' },
{'', 'technic:mv_cable', ''}, { "", "technic:mv_cable", "" },
} }
}) })
technic.register_battery_box({ technic.register_battery_box({
tier = "MV", tier = "MV",
max_charge = 200000, max_charge = 200000,
charge_rate = 20000, charge_rate = 20000,
discharge_rate = 80000, discharge_rate = 80000,
charge_step = 2000, charge_step = 2000,
discharge_step = 8000, discharge_step = 8000,
upgrade = 1, upgrade = 1,
tube = 1, tube = 1,
}) })

View File

@ -1,12 +1,11 @@
minetest.register_alias("mv_cable", "technic:mv_cable") minetest.register_alias("mv_cable", "technic:mv_cable")
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_cable 3', output = 'technic:mv_cable 3',
recipe ={ recipe = {
{'technic:rubber', 'technic:rubber', 'technic:rubber'}, { "technic:rubber", "technic:rubber", "technic:rubber" },
{'technic:lv_cable', 'technic:lv_cable', 'technic:lv_cable'}, { "technic:lv_cable", "technic:lv_cable", "technic:lv_cable" },
{'technic:rubber', 'technic:rubber', 'technic:rubber'}, { "technic:rubber", "technic:rubber", "technic:rubber" },
} }
}) })

View File

@ -1,9 +1,9 @@
minetest.register_craft({ minetest.register_craft({
output = "technic:mv_centrifuge", output = "technic:mv_centrifuge",
recipe = { recipe = {
{"technic:motor", "technic:copper_plate", "technic:diamond_drill_head"}, { "technic:motor", "technic:copper_plate", "technic:diamond_drill_head" },
{"technic:copper_plate", "technic:machine_casing", "technic:copper_plate" }, { "technic:copper_plate", "technic:machine_casing", "technic:copper_plate" },
{"pipeworks:one_way_tube", "technic:mv_cable", "pipeworks:mese_filter" }, { "pipeworks:one_way_tube", "technic:mv_cable", "pipeworks:mese_filter" },
} }
}) })

View File

@ -1,12 +1,12 @@
-- MV compressor -- MV compressor
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_compressor', output = "technic:mv_compressor",
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_compressor', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:lv_compressor", "technic:stainless_steel_ingot" },
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, { "pipeworks:tube_1", "technic:mv_transformer", "pipeworks:tube_1" },
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mv_cable", "technic:stainless_steel_ingot" },
} }
}) })
technic.register_compressor({tier = "MV", demand = {800, 600, 400}, speed = 2, upgrade = 1, tube = 1}) technic.register_compressor({ tier = "MV", demand = { 800, 600, 400 }, speed = 2, upgrade = 1, tube = 1 })

View File

@ -6,13 +6,13 @@
-- FIXME: kpoppel I'd like to introduce an induction heating element here also -- FIXME: kpoppel I'd like to introduce an induction heating element here also
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_electric_furnace', output = "technic:mv_electric_furnace",
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:lv_electric_furnace", "technic:stainless_steel_ingot" },
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, { "pipeworks:tube_1", "technic:mv_transformer", "pipeworks:tube_1" },
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mv_cable", "technic:stainless_steel_ingot" },
} }
}) })
technic.register_electric_furnace({tier="MV", upgrade=1, tube=1, demand={2000, 1000, 500}, speed=4}) technic.register_electric_furnace({ tier = "MV", upgrade = 1, tube = 1, demand = { 2000, 1000, 500 }, speed = 4 })

View File

@ -1,12 +1,12 @@
-- MV extractor -- MV extractor
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_extractor', output = "technic:mv_extractor",
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_extractor', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:lv_extractor", "technic:stainless_steel_ingot" },
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, { "pipeworks:tube_1", "technic:mv_transformer", "pipeworks:tube_1" },
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mv_cable", "technic:stainless_steel_ingot" },
} }
}) })
technic.register_extractor({tier = "MV", demand = {800, 600, 400}, speed = 2, upgrade = 1, tube = 1}) technic.register_extractor({ tier = "MV", demand = { 800, 600, 400 }, speed = 2, upgrade = 1, tube = 1 })

View File

@ -1,13 +1,13 @@
minetest.register_alias("generator_mv", "technic:generator_mv") minetest.register_alias("generator_mv", "technic:generator_mv")
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_generator', output = "technic:mv_generator",
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_generator', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:lv_generator", "technic:stainless_steel_ingot" },
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, { "pipeworks:tube_1", "technic:mv_transformer", "pipeworks:tube_1" },
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mv_cable", "technic:stainless_steel_ingot" },
} }
}) })
technic.register_generator({tier="MV", tube=1, supply=600}) technic.register_generator({ tier = "MV", tube = 1, supply = 600 })

View File

@ -1,13 +1,13 @@
-- MV grinder -- MV grinder
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_grinder', output = "technic:mv_grinder",
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_grinder', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:lv_grinder", "technic:stainless_steel_ingot" },
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, { "pipeworks:tube_1", "technic:mv_transformer", "pipeworks:tube_1" },
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mv_cable", "technic:stainless_steel_ingot" },
} }
}) })
technic.register_grinder({tier="MV", demand={600, 450, 300}, speed=2, upgrade=1, tube=1}) technic.register_grinder({ tier = "MV", demand = { 600, 450, 300 }, speed = 2, upgrade = 1, tube = 1 })

View File

@ -1,4 +1,3 @@
technic.register_tier("MV", "Medium Voltage") technic.register_tier("MV", "Medium Voltage")
local path = technic.modpath.."/machines/MV" local path = technic.modpath.."/machines/MV"

View File

@ -9,48 +9,48 @@ if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua") dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function (s) return s end S = function(s) return s end
end end
function technic_homedecor_node_is_owned(pos, placer) function technic_homedecor_node_is_owned(pos, placer)
local ownername = false local ownername = false
if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod
if HasOwner(pos, placer) then if HasOwner(pos, placer) then
if not IsPlayerNodeOwner(pos, placer:get_player_name()) then if not IsPlayerNodeOwner(pos, placer:get_player_name()) then
if type(getLastOwner) == "function" then -- ...is an old version if type(getLastOwner) == "function" then -- ...is an old version
ownername = getLastOwner(pos) ownername = getLastOwner(pos)
elseif type(GetNodeOwnerName) == "function" then -- ...is a recent version elseif type(GetNodeOwnerName) == "function" then -- ...is a recent version
ownername = GetNodeOwnerName(pos) ownername = GetNodeOwnerName(pos)
else else
ownername = S("someone") ownername = S("someone")
end end
end end
end end
elseif type(isprotect) == "function" then -- glomie's protection mod elseif type(isprotect) == "function" then -- glomie's protection mod
if not isprotect(5, pos, placer) then if not isprotect(5, pos, placer) then
ownername = S("someone") ownername = S("someone")
end end
elseif type(protector) == "table" and type(protector.can_dig) == "function" then -- Zeg9's protection mod elseif type(protector) == "table" and type(protector.can_dig) == "function" then -- Zeg9's protection mod
if not protector.can_dig(5, pos, placer) then if not protector.can_dig(5, pos, placer) then
ownername = S("someone") ownername = S("someone")
end end
end end
if ownername ~= false then if ownername ~= false then
minetest.chat_send_player(placer:get_player_name(), S("Sorry, %s owns that spot."):format(ownername) ) minetest.chat_send_player(placer:get_player_name(), S("Sorry, %s owns that spot."):format(ownername))
return true return true
else else
return false return false
end end
end end
local dirs1 = {20, 23, 22, 21} local dirs1 = { 20, 23, 22, 21 }
local dirs2 = {9, 18, 7, 12} local dirs2 = { 9, 18, 7, 12 }
local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_thing) local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_thing)
if not technic_homedecor_node_is_owned(pointed_thing.under, placer) if not technic_homedecor_node_is_owned(pointed_thing.under, placer)
and not technic_homedecor_node_is_owned(pointed_thing.above, placer) then and not technic_homedecor_node_is_owned(pointed_thing.above, placer) then
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
@ -63,7 +63,7 @@ local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_t
local wield_name = itemstack:get_name() local wield_name = itemstack:get_name()
if not minetest.registered_nodes[pname] if not minetest.registered_nodes[pname]
or not minetest.registered_nodes[pname].on_rightclick then or not minetest.registered_nodes[pname].on_rightclick then
local iswall = (above.x ~= under.x) or (above.z ~= under.z) local iswall = (above.x ~= under.x) or (above.z ~= under.z)
local isceiling = (above.x == under.x) and (above.z == under.z) and (pitch > 0) local isceiling = (above.x == under.x) and (above.z == under.z) and (pitch > 0)
@ -77,11 +77,11 @@ local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_t
if not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end if not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end
if iswall then if iswall then
minetest.add_node(pos1, {name = wield_name, param2 = dirs2[fdir+1] }) -- place wall variant minetest.add_node(pos1, { name = wield_name, param2 = dirs2[fdir + 1] }) -- place wall variant
elseif isceiling then elseif isceiling then
minetest.add_node(pos1, {name = wield_name, param2 = 20 }) -- place upside down variant minetest.add_node(pos1, { name = wield_name, param2 = 20 }) -- place upside down variant
else else
minetest.add_node(pos1, {name = wield_name, param2 = 0 }) -- place right side up minetest.add_node(pos1, { name = wield_name, param2 = 0 }) -- place right side up
end end
if not homedecor_expect_infinite_stacks then if not homedecor_expect_infinite_stacks then
@ -96,7 +96,7 @@ local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_t
end end
-- Yellow -- Half node -- Yellow -- Half node
minetest.register_node('technic:homedecor_glowlight_half_yellow', { minetest.register_node("technic:homedecor_glowlight_half_yellow", {
description = S("Yellow Glowlight (thick)"), description = S("Yellow Glowlight (thick)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -107,35 +107,33 @@ minetest.register_node('technic:homedecor_glowlight_half_yellow', {
'technic_homedecor_glowlight_thick_yellow_sides.png', 'technic_homedecor_glowlight_thick_yellow_sides.png',
'technic_homedecor_glowlight_thick_yellow_sides.png' 'technic_homedecor_glowlight_thick_yellow_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3 }, groups = { snappy = 3 },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thick)") technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thick)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_half_yellow_active") technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_half_yellow_active")
end end
}) })
minetest.register_node('technic:homedecor_glowlight_half_yellow_active', { minetest.register_node("technic:homedecor_glowlight_half_yellow_active", {
description = S("Yellow Glowlight (thick)"), description = S("Yellow Glowlight (thick)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -146,38 +144,36 @@ minetest.register_node('technic:homedecor_glowlight_half_yellow_active', {
'technic_homedecor_glowlight_thick_yellow_sides.png', 'technic_homedecor_glowlight_thick_yellow_sides.png',
'technic_homedecor_glowlight_thick_yellow_sides.png' 'technic_homedecor_glowlight_thick_yellow_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
light_source = LIGHT_MAX, light_source = LIGHT_MAX,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3, not_in_creative_inventory = 1 },
groups = { snappy = 3, not_in_creative_inventory=1}, drop = "technic:homedecor_glowlight_half_yellow",
drop="technic:homedecor_glowlight_half_yellow",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thick)") technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thick)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_half_yellow") technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_half_yellow")
end end
}) })
-- Yellow -- Quarter node -- Yellow -- Quarter node
minetest.register_node('technic:homedecor_glowlight_quarter_yellow', { minetest.register_node("technic:homedecor_glowlight_quarter_yellow", {
description = S("Yellow Glowlight (thin)"), description = S("Yellow Glowlight (thin)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -188,35 +184,33 @@ minetest.register_node('technic:homedecor_glowlight_quarter_yellow', {
'technic_homedecor_glowlight_thin_yellow_sides.png', 'technic_homedecor_glowlight_thin_yellow_sides.png',
'technic_homedecor_glowlight_thin_yellow_sides.png' 'technic_homedecor_glowlight_thin_yellow_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3 }, groups = { snappy = 3 },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thin)") technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thin)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_quarter_yellow_active") technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_quarter_yellow_active")
end end
}) })
minetest.register_node('technic:homedecor_glowlight_quarter_yellow_active', { minetest.register_node("technic:homedecor_glowlight_quarter_yellow_active", {
description = S("Yellow Glowlight (thin)"), description = S("Yellow Glowlight (thin)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -227,39 +221,37 @@ minetest.register_node('technic:homedecor_glowlight_quarter_yellow_active', {
'technic_homedecor_glowlight_thin_yellow_sides.png', 'technic_homedecor_glowlight_thin_yellow_sides.png',
'technic_homedecor_glowlight_thin_yellow_sides.png' 'technic_homedecor_glowlight_thin_yellow_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
light_source = LIGHT_MAX-1, light_source = LIGHT_MAX - 1,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3, not_in_creative_inventory = 1 },
groups = { snappy = 3, not_in_creative_inventory=1}, drop = "technic:homedecor_glowlight_quarter_yellow",
drop="technic:homedecor_glowlight_quarter_yellow",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thin)") technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thin)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_quarter_yellow") technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_quarter_yellow")
end end
}) })
-- White -- half node -- White -- half node
minetest.register_node('technic:homedecor_glowlight_half_white', { minetest.register_node("technic:homedecor_glowlight_half_white", {
description = S("White Glowlight (thick)"), description = S("White Glowlight (thick)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -270,35 +262,33 @@ minetest.register_node('technic:homedecor_glowlight_half_white', {
'technic_homedecor_glowlight_thick_white_sides.png', 'technic_homedecor_glowlight_thick_white_sides.png',
'technic_homedecor_glowlight_thick_white_sides.png' 'technic_homedecor_glowlight_thick_white_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3 }, groups = { snappy = 3 },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 100, "White Glowlight (thick)") technic.inductive_on_construct(pos, 100, "White Glowlight (thick)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_half_white_active") technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_half_white_active")
end end
}) })
minetest.register_node('technic:homedecor_glowlight_half_white_active', { minetest.register_node("technic:homedecor_glowlight_half_white_active", {
description = S("White Glowlight (thick)"), description = S("White Glowlight (thick)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -309,38 +299,36 @@ minetest.register_node('technic:homedecor_glowlight_half_white_active', {
'technic_homedecor_glowlight_thick_white_sides.png', 'technic_homedecor_glowlight_thick_white_sides.png',
'technic_homedecor_glowlight_thick_white_sides.png' 'technic_homedecor_glowlight_thick_white_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
light_source = LIGHT_MAX, light_source = LIGHT_MAX,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3, not_in_creative_inventory = 1 },
groups = { snappy = 3, not_in_creative_inventory=1}, drop = "technic:homedecor_glowlight_half_white",
drop="technic:homedecor_glowlight_half_white",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 100, "White Glowlight (thick)") technic.inductive_on_construct(pos, 100, "White Glowlight (thick)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_half_white") technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_half_white")
end end
}) })
-- White -- Quarter node -- White -- Quarter node
minetest.register_node('technic:homedecor_glowlight_quarter_white', { minetest.register_node("technic:homedecor_glowlight_quarter_white", {
description = S("White Glowlight (thin)"), description = S("White Glowlight (thin)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -351,35 +339,33 @@ minetest.register_node('technic:homedecor_glowlight_quarter_white', {
'technic_homedecor_glowlight_thin_white_sides.png', 'technic_homedecor_glowlight_thin_white_sides.png',
'technic_homedecor_glowlight_thin_white_sides.png' 'technic_homedecor_glowlight_thin_white_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3 }, groups = { snappy = 3 },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 100, "White Glowlight (thin)") technic.inductive_on_construct(pos, 100, "White Glowlight (thin)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_quarter_white_active") technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_quarter_white_active")
end end
}) })
minetest.register_node('technic:homedecor_glowlight_quarter_white_active', { minetest.register_node("technic:homedecor_glowlight_quarter_white_active", {
description = S("White Glowlight (thin)"), description = S("White Glowlight (thin)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -390,38 +376,36 @@ minetest.register_node('technic:homedecor_glowlight_quarter_white_active', {
'technic_homedecor_glowlight_thin_white_sides.png', 'technic_homedecor_glowlight_thin_white_sides.png',
'technic_homedecor_glowlight_thin_white_sides.png' 'technic_homedecor_glowlight_thin_white_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 } fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
light_source = LIGHT_MAX-1, light_source = LIGHT_MAX - 1,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3, not_in_creative_inventory = 1 },
groups = { snappy = 3, not_in_creative_inventory=1}, drop = "technic:homedecor_glowlight_quarter_white",
drop="technic:homedecor_glowlight_quarter_white",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 100, "White Glowlight (thin)") technic.inductive_on_construct(pos, 100, "White Glowlight (thin)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_quarter_white") technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_quarter_white")
end end
}) })
-- Glowlight "cubes" - yellow -- Glowlight "cubes" - yellow
minetest.register_node('technic:homedecor_glowlight_small_cube_yellow', { minetest.register_node("technic:homedecor_glowlight_small_cube_yellow", {
description = S("Yellow Glowlight (small cube)"), description = S("Yellow Glowlight (small cube)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -432,35 +416,33 @@ minetest.register_node('technic:homedecor_glowlight_small_cube_yellow', {
'technic_homedecor_glowlight_cube_yellow_sides.png', 'technic_homedecor_glowlight_cube_yellow_sides.png',
'technic_homedecor_glowlight_cube_yellow_sides.png' 'technic_homedecor_glowlight_cube_yellow_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3 }, groups = { snappy = 3 },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 50, "Yellow Glowlight (small cube)") technic.inductive_on_construct(pos, 50, "Yellow Glowlight (small cube)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_off(pos, 50, "technic:homedecor_glowlight_small_cube_yellow_active") technic.inductive_on_punch_off(pos, 50, "technic:homedecor_glowlight_small_cube_yellow_active")
end end
}) })
minetest.register_node('technic:homedecor_glowlight_small_cube_yellow_active', { minetest.register_node("technic:homedecor_glowlight_small_cube_yellow_active", {
description = S("Yellow Glowlight (small cube)"), description = S("Yellow Glowlight (small cube)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -471,38 +453,36 @@ minetest.register_node('technic:homedecor_glowlight_small_cube_yellow_active', {
'technic_homedecor_glowlight_cube_yellow_sides.png', 'technic_homedecor_glowlight_cube_yellow_sides.png',
'technic_homedecor_glowlight_cube_yellow_sides.png' 'technic_homedecor_glowlight_cube_yellow_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
light_source = LIGHT_MAX-1, light_source = LIGHT_MAX - 1,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3, not_in_creative_inventory = 1 },
groups = { snappy = 3, not_in_creative_inventory=1}, drop = "technic:homedecor_glowlight_small_cube_yellow",
drop="technic:homedecor_glowlight_small_cube_yellow",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 50, "Yellow Glowlight (small cube)") technic.inductive_on_construct(pos, 50, "Yellow Glowlight (small cube)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_small_cube_yellow") technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_small_cube_yellow")
end end
}) })
-- Glowlight "cubes" - white -- Glowlight "cubes" - white
minetest.register_node('technic:homedecor_glowlight_small_cube_white', { minetest.register_node("technic:homedecor_glowlight_small_cube_white", {
description = S("White Glowlight (small cube)"), description = S("White Glowlight (small cube)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -513,35 +493,33 @@ minetest.register_node('technic:homedecor_glowlight_small_cube_white', {
'technic_homedecor_glowlight_cube_white_sides.png', 'technic_homedecor_glowlight_cube_white_sides.png',
'technic_homedecor_glowlight_cube_white_sides.png' 'technic_homedecor_glowlight_cube_white_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3 }, groups = { snappy = 3 },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 50, "White Glowlight (small cube)") technic.inductive_on_construct(pos, 50, "White Glowlight (small cube)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_off(pos, 50, "technic:homedecor_glowlight_small_cube_white_active") technic.inductive_on_punch_off(pos, 50, "technic:homedecor_glowlight_small_cube_white_active")
end end
}) })
minetest.register_node('technic:homedecor_glowlight_small_cube_white_active', { minetest.register_node("technic:homedecor_glowlight_small_cube_white_active", {
description = S("White Glowlight (small cube)"), description = S("White Glowlight (small cube)"),
drawtype = "nodebox", drawtype = "nodebox",
tiles = { tiles = {
@ -552,34 +530,32 @@ minetest.register_node('technic:homedecor_glowlight_small_cube_white_active', {
'technic_homedecor_glowlight_cube_white_sides.png', 'technic_homedecor_glowlight_cube_white_sides.png',
'technic_homedecor_glowlight_cube_white_sides.png' 'technic_homedecor_glowlight_cube_white_sides.png'
}, },
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
}, },
sunlight_propagates = false, sunlight_propagates = false,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
walkable = true, walkable = true,
light_source = LIGHT_MAX-1, light_source = LIGHT_MAX - 1,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
groups = { snappy = 3, not_in_creative_inventory = 1 },
groups = { snappy = 3, not_in_creative_inventory=1}, drop = "technic:homedecor_glowlight_small_cube_white",
drop="technic:homedecor_glowlight_small_cube_white",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing) technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end, end,
on_construct = function(pos) on_construct = function(pos)
technic.inductive_on_construct(pos, 50, "White Glowlight (small cube)") technic.inductive_on_construct(pos, 50, "White Glowlight (small cube)")
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_small_cube_white") technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_small_cube_white")
end end
}) })
technic.register_inductive_machine("technic:homedecor_glowlight_half_yellow") technic.register_inductive_machine("technic:homedecor_glowlight_half_yellow")

View File

@ -16,9 +16,9 @@ local power_radius = 12
minetest.register_craft({ minetest.register_craft({
output = 'technic:power_radiator 1', output = 'technic:power_radiator 1',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mv_transformer", "technic:stainless_steel_ingot" },
{'technic:copper_coil', 'technic:machine_casing', 'technic:copper_coil'}, { "technic:copper_coil", "technic:machine_casing", "technic:copper_coil" },
{'technic:rubber', 'technic:mv_cable', 'technic:rubber'}, { "technic:rubber", "technic:mv_cable", "technic:rubber" },
} }
}) })
@ -44,10 +44,10 @@ technic.inductive_on_construct = function(pos, eu_demand, infotext)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", infotext) meta:set_string("infotext", infotext)
meta:set_int("technic_inductive_power_machine", 1) meta:set_int("technic_inductive_power_machine", 1)
meta:set_int("EU_demand", eu_demand) -- The power demand of this appliance meta:set_int("EU_demand", eu_demand) -- The power demand of this appliance
meta:set_int("EU_charge", 0) -- The actual power draw of this appliance meta:set_int("EU_charge", 0) -- The actual power draw of this appliance
meta:set_string("has_supply", "") -- Register whether we are powered or not. For use with several radiators. meta:set_string("has_supply", "") -- Register whether we are powered or not. For use with several radiators.
meta:set_int("active", 0) -- If the appliance can be turned on and off by using it use this. meta:set_int("active", 0) -- If the appliance can be turned on and off by using it use this.
end end
technic.inductive_on_punch_off = function(pos, eu_charge, swapnode) technic.inductive_on_punch_off = function(pos, eu_charge, swapnode)
@ -55,7 +55,7 @@ technic.inductive_on_punch_off = function(pos, eu_charge, swapnode)
if meta:get_string("has_supply") ~= "" then if meta:get_string("has_supply") ~= "" then
technic.swap_node(pos, swapnode) technic.swap_node(pos, swapnode)
meta:set_int("active", 1) meta:set_int("active", 1)
meta:set_int("EU_charge",eu_charge) meta:set_int("EU_charge", eu_charge)
--print("-----------") --print("-----------")
--print("Turn on:") --print("Turn on:")
--print("EU_charge: "..meta:get_int("EU_charge")) --print("EU_charge: "..meta:get_int("EU_charge"))
@ -68,7 +68,7 @@ technic.inductive_on_punch_on = function(pos, eu_charge, swapnode)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
technic.swap_node(pos, swapnode) technic.swap_node(pos, swapnode)
meta:set_int("active", 0) meta:set_int("active", 0)
meta:set_int("EU_charge",eu_charge) meta:set_int("EU_charge", eu_charge)
--print("-----------") --print("-----------")
--print("Turn off:") --print("Turn off:")
--print("EU_charge: "..meta:get_int("EU_charge")) --print("EU_charge: "..meta:get_int("EU_charge"))
@ -81,9 +81,8 @@ local shutdown_inductive_appliances = function(pos)
local rad = power_radius local rad = power_radius
-- If the radiator is removed. turn off all appliances in region -- If the radiator is removed. turn off all appliances in region
-- If another radiator is near it will turn on the appliances again -- If another radiator is near it will turn on the appliances again
local positions = minetest.find_nodes_in_area( local positions = minetest.find_nodes_in_area({ x = pos.x - rad, y = pos.y - rad, z = pos.z - rad },
{x=pos.x-rad, y=pos.y-rad, z=pos.z-rad}, { x = pos.x + rad, y = pos.y + rad, z = pos.z + rad },
{x=pos.x+rad, y=pos.y+rad, z=pos.z+rad},
technic.inductive_nodes) technic.inductive_nodes)
for _, pos1 in pairs(positions) do for _, pos1 in pairs(positions) do
local meta1 = minetest.get_meta(pos1) local meta1 = minetest.get_meta(pos1)
@ -105,9 +104,8 @@ local toggle_on_off_inductive_appliances = function(pos, node, puncher)
if pos == nil then return end if pos == nil then return end
-- The supply radius -- The supply radius
local rad = power_radius local rad = power_radius
local positions = minetest.find_nodes_in_area( local positions = minetest.find_nodes_in_area({ x = pos.x - rad, y = pos.y - rad, z = pos.z - rad },
{x=pos.x-rad, y=pos.y-rad, z=pos.z-rad}, { x = pos.x + rad, y = pos.y + rad, z = pos.z + rad },
{x=pos.x+rad, y=pos.y+rad, z=pos.z+rad},
technic.inductive_nodes) technic.inductive_nodes)
for _, pos1 in pairs(positions) do for _, pos1 in pairs(positions) do
local meta1 = minetest.get_meta(pos1) local meta1 = minetest.get_meta(pos1)
@ -119,21 +117,23 @@ end
minetest.register_node("technic:power_radiator", { minetest.register_node("technic:power_radiator", {
description = "MV Power Radiator", description = "MV Power Radiator",
tiles = {"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", tiles = {
"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"
},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
is_ground_content = true, is_ground_content = true,
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
}, },
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int("MV_EU_demand",1) -- Demand on the primary side when idle meta:set_int("MV_EU_demand", 1) -- Demand on the primary side when idle
meta:set_int("connected_EU_demand",0) -- Potential demand of connected appliances meta:set_int("connected_EU_demand", 0) -- Potential demand of connected appliances
meta:set_string("infotext", "MV Power Radiator") meta:set_string("infotext", "MV Power Radiator")
end, end,
on_dig = function(pos, node, digger) on_dig = function(pos, node, digger)
@ -146,12 +146,12 @@ minetest.register_node("technic:power_radiator", {
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:power_radiator"}, nodenames = { "technic:power_radiator" },
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local eu_input = meta:get_int("MV_EU_input") local eu_input = meta:get_int("MV_EU_input")
local eu_demand = meta:get_int("MV_EU_demand") local eu_demand = meta:get_int("MV_EU_demand")
-- Power off automatically if no longer connected to a switching station -- Power off automatically if no longer connected to a switching station
@ -163,12 +163,12 @@ minetest.register_abm({
-- meta:set_int("active", 1) -- used for setting textures someday maybe -- meta:set_int("active", 1) -- used for setting textures someday maybe
shutdown_inductive_appliances(pos) shutdown_inductive_appliances(pos)
meta:set_int("connected_EU_demand", 0) meta:set_int("connected_EU_demand", 0)
meta:set_int("MV_EU_demand",1) meta:set_int("MV_EU_demand", 1)
elseif eu_input == eu_demand then elseif eu_input == eu_demand then
-- Powered and ready -- Powered and ready
-- The maximum EU sourcing a single radiator can provide. -- The maximum EU sourcing a single radiator can provide.
local max_charge = 30000 -- == the max EU demand of the radiator local max_charge = 30000 -- == the max EU demand of the radiator
local connected_EU_demand = meta:get_int("connected_EU_demand") local connected_EU_demand = meta:get_int("connected_EU_demand")
-- Efficiency factor -- Efficiency factor
@ -176,14 +176,13 @@ minetest.register_abm({
-- The supply radius -- The supply radius
local rad = power_radius local rad = power_radius
local meta1 = nil local meta1 = nil
local pos1 = {} local pos1 = {}
local used_charge = 0 local used_charge = 0
-- Index all nodes within supply range -- Index all nodes within supply range
local positions = minetest.find_nodes_in_area( local positions = minetest.find_nodes_in_area({ x = pos.x - rad, y = pos.y - rad, z = pos.z - rad },
{x=pos.x-rad, y=pos.y-rad, z=pos.z-rad}, { x = pos.x + rad, y = pos.y + rad, z = pos.z + rad },
{x=pos.x+rad, y=pos.y+rad, z=pos.z+rad},
technic.inductive_nodes) technic.inductive_nodes)
for _, pos1 in pairs(positions) do for _, pos1 in pairs(positions) do
local meta1 = minetest.get_meta(pos1) local meta1 = minetest.get_meta(pos1)
@ -203,8 +202,8 @@ minetest.register_abm({
used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor) used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor)
end end
meta:set_string("infotext", "MV Power Radiator is powered (" meta:set_string("infotext", "MV Power Radiator is powered ("
..math.floor(used_charge / max_charge * 100) .. math.floor(used_charge / max_charge * 100)
.."% of maximum power)"); .. "% of maximum power)");
if used_charge == 0 then if used_charge == 0 then
meta:set_int("MV_EU_demand", 1) -- Still idle meta:set_int("MV_EU_demand", 1) -- Still idle
else else

View File

@ -1,14 +1,13 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:solar_array_mv 1', output = 'technic:solar_array_mv 1',
recipe = { recipe = {
{'technic:solar_array_lv', 'technic:solar_array_lv', 'technic:solar_array_lv'}, { "technic:solar_array_lv", "technic:solar_array_lv", "technic:solar_array_lv" },
{'technic:carbon_steel_ingot', 'technic:mv_transformer', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "technic:mv_transformer", "technic:carbon_steel_ingot" },
{'', 'technic:mv_cable', ''}, { "", "technic:mv_cable", "" },
} }
}) })
technic.register_solar_array({tier="MV", power=30}) technic.register_solar_array({ tier = "MV", power = 30 })
-- compatibility alias for upgrading from old versions of technic -- compatibility alias for upgrading from old versions of technic
minetest.register_alias("technic:solar_panel_mv", "technic:solar_array_mv") minetest.register_alias("technic:solar_panel_mv", "technic:solar_array_mv")

View File

@ -6,36 +6,36 @@ minetest.register_alias("tool_workshop", "technic:tool_workshop")
local S = technic.getter local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:tool_workshop', output = "technic:tool_workshop",
recipe = { recipe = {
{'group:wood', 'default:diamond', 'group:wood'}, { "group:wood", "default:diamond", "group:wood" },
{'mesecons_pistons:piston_sticky_off', 'technic:machine_casing', 'technic:carbon_cloth'}, { "mesecons_pistons:piston_sticky_off", "technic:machine_casing", "technic:carbon_cloth" },
{'default:obsidian', 'technic:mv_cable', 'default:obsidian'}, { "default:obsidian", "technic:mv_cable", "default:obsidian" },
} }
}) })
local workshop_demand = {5000, 3500, 2000} local workshop_demand = { 5000, 3500, 2000 }
local workshop_formspec = local workshop_formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"list[current_name;src;3,1;1,1;]".. "list[current_name;src;3,1;1,1;]"..
"label[0,0;"..S("%s Tool Workshop"):format("MV").."]".. "label[0,0;"..S("%s Tool Workshop"):format("MV").."]"..
"list[current_name;upgrade1;1,3;1,1;]".. "list[current_name;upgrade1;1,3;1,1;]"..
"list[current_name;upgrade2;2,3;1,1;]".. "list[current_name;upgrade2;2,3;1,1;]"..
"label[1,4;"..S("Upgrade Slots").."]".. "label[1,4;"..S("Upgrade Slots").."]"..
"list[current_player;main;0,5;8,4;]".. "list[current_player;main;0,5;8,4;]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;src]".. "listring[current_name;src]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;upgrade1]".. "listring[current_name;upgrade1]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;upgrade2]".. "listring[current_name;upgrade2]"..
"listring[current_player;main]" "listring[current_player;main]"
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local eu_input = meta:get_int("MV_EU_input") local eu_input = meta:get_int("MV_EU_input")
local machine_name = S("%s Tool Workshop"):format("MV") local machine_name = S("%s Tool Workshop"):format("MV")
local machine_node = "technic:tool_workshop" local machine_node = "technic:tool_workshop"
@ -54,12 +54,12 @@ local run = function(pos, node)
local itemdef = minetest.registered_items[srcstack:get_name()] local itemdef = minetest.registered_items[srcstack:get_name()]
if itemdef and if itemdef and
(not itemdef.wear_represents or (not itemdef.wear_represents or
itemdef.wear_represents == "mechanical_wear") and itemdef.wear_represents == "mechanical_wear") and
srcstack:get_wear() ~= 0 then srcstack:get_wear() ~= 0 then
repairable = true repairable = true
end end
end end
technic.handle_machine_pipeworks(pos, tube_upgrade, function (pos, x_velocity, z_velocity) technic.handle_machine_pipeworks(pos, tube_upgrade, function(pos, x_velocity, z_velocity)
if not repairable then if not repairable then
technic.send_items(pos, x_velocity, z_velocity, "src") technic.send_items(pos, x_velocity, z_velocity, "src")
end end
@ -70,24 +70,33 @@ local run = function(pos, node)
return return
end end
if eu_input < workshop_demand[EU_upgrade+1] then if eu_input < workshop_demand[EU_upgrade + 1] then
meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= workshop_demand[EU_upgrade+1] then elseif eu_input >= workshop_demand[EU_upgrade + 1] then
meta:set_string("infotext", S("%s Active"):format(machine_name)) meta:set_string("infotext", S("%s Active"):format(machine_name))
srcstack:add_wear(-1000) srcstack:add_wear(-1000)
inv:set_stack("src", 1, srcstack) inv:set_stack("src", 1, srcstack)
end end
meta:set_int("MV_EU_demand", workshop_demand[EU_upgrade+1]) meta:set_int("MV_EU_demand", workshop_demand[EU_upgrade + 1])
end end
minetest.register_node("technic:tool_workshop", { minetest.register_node("technic:tool_workshop", {
description = S("%s Tool Workshop"):format("MV"), description = S("%s Tool Workshop"):format("MV"),
paramtype2 = "facedir", paramtype2 = "facedir",
tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png", tiles = {
"technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"}, "technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, "technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"
technic_machine=1, technic_mv=1, tubedevice=1, tubedevice_receiver=1}, },
connect_sides = {"bottom", "back", "left", "right"}, groups = {
snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
technic_mv = 1,
tubedevice = 1,
tubedevice_receiver = 1
},
connect_sides = { "bottom", "back", "left", "right" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -102,13 +111,13 @@ minetest.register_node("technic:tool_workshop", {
allow_metadata_inventory_put = technic.machine_inventory_put, allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take, allow_metadata_inventory_take = technic.machine_inventory_take,
tube = { tube = {
can_insert = function (pos, node, stack, direction) can_insert = function(pos, node, stack, direction)
return minetest.get_meta(pos):get_inventory():room_for_item("src", stack) return minetest.get_meta(pos):get_inventory():room_for_item("src", stack)
end, end,
insert_object = function (pos, node, stack, direction) insert_object = function(pos, node, stack, direction)
return minetest.get_meta(pos):get_inventory():add_item("src", stack) return minetest.get_meta(pos):get_inventory():add_item("src", stack)
end, end,
connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1}, connect_sides = { left = 1, right = 1, back = 1, top = 1, bottom = 1 },
}, },
technic_run = run, technic_run = run,
after_place_node = pipeworks.after_place, after_place_node = pipeworks.after_place,

View File

@ -1,30 +1,29 @@
local S = technic.getter local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:wind_mill_frame 5', output = 'technic:wind_mill_frame 5',
recipe = { recipe = {
{'technic:carbon_steel_ingot', '', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "", "technic:carbon_steel_ingot" },
{'', 'technic:carbon_steel_ingot', ''}, { "", "technic:carbon_steel_ingot", "" },
{'technic:carbon_steel_ingot', '', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "", "technic:carbon_steel_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:wind_mill', output = "technic:wind_mill",
recipe = { recipe = {
{'', 'technic:motor', ''}, { "", "technic:motor", "" },
{'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "technic:carbon_steel_block", "technic:carbon_steel_ingot" },
{'', 'technic:mv_cable', ''}, { "", "technic:mv_cable", "" },
} }
}) })
minetest.register_node("technic:wind_mill_frame", { minetest.register_node("technic:wind_mill_frame", {
description = S("Wind Mill Frame"), description = S("Wind Mill Frame"),
drawtype = "glasslike_framed", drawtype = "glasslike_framed",
tiles = {"technic_carbon_steel_block.png", "default_glass.png"}, tiles = { "technic_carbon_steel_block.png", "default_glass.png" },
sunlight_propagates = true, sunlight_propagates = true,
groups = {cracky=3}, groups = { cracky = 3 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
paramtype = "light", paramtype = "light",
}) })
@ -33,7 +32,7 @@ local function check_wind_mill(pos)
if pos.y < 30 then if pos.y < 30 then
return false return false
end end
pos = {x=pos.x, y=pos.y, z=pos.z} pos = { x = pos.x, y = pos.y, z = pos.z }
for i = 1, 20 do for i = 1, 20 do
pos.y = pos.y - 1 pos.y = pos.y - 1
local node = minetest.get_node_or_nil(pos) local node = minetest.get_node_or_nil(pos)
@ -67,20 +66,20 @@ end
minetest.register_node("technic:wind_mill", { minetest.register_node("technic:wind_mill", {
description = S("Wind %s Generator"):format("MV"), description = S("Wind %s Generator"):format("MV"),
tiles = {"technic_carbon_steel_block.png"}, tiles = { "technic_carbon_steel_block.png" },
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=1, technic_machine=1, technic_mv=1}, groups = { cracky = 1, technic_machine = 1, technic_mv = 1 },
connect_sides = {"top", "bottom", "back", "left", "right"}, connect_sides = { "top", "bottom", "back", "left", "right" },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, -- Main box { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }, -- Main box
{-0.1, -0.1, -0.5, 0.1, 0.1, -0.6}, -- Shaft { -0.1, -0.1, -0.5, 0.1, 0.1, -0.6 }, -- Shaft
{-0.1, -1, -0.6, 0.1, 1, -0.7}, -- Vertical blades { -0.1, -1, -0.6, 0.1, 1, -0.7 }, -- Vertical blades
{-1, -0.1, -0.6, 1, 0.1, -0.7}, -- Horizontal blades { -1, -0.1, -0.6, 1, 0.1, -0.7 }, -- Horizontal blades
} }
}, },
on_construct = function(pos) on_construct = function(pos)

View File

@ -8,9 +8,9 @@ local function compute_forceload_positions(pos, meta)
local maxpos = vector.add(pos, vector.new(radius, radius, radius)) local maxpos = vector.add(pos, vector.new(radius, radius, radius))
local minbpos = {} local minbpos = {}
local maxbpos = {} local maxbpos = {}
for _, coord in ipairs({"x","y","z"}) do for _, coord in ipairs({ "x", "y", "z" }) do
minbpos[coord] = math.floor(minpos[coord] / 16) * 16 minbpos[coord] = math.floor(minpos[coord]/16) * 16
maxbpos[coord] = math.floor(maxpos[coord] / 16) * 16 maxbpos[coord] = math.floor(maxpos[coord]/16) * 16
end end
local flposes = {} local flposes = {}
for x = minbpos.x, maxbpos.x, 16 do for x = minbpos.x, maxbpos.x, 16 do
@ -51,46 +51,46 @@ local function set_display(pos, meta)
meta:set_string("infotext", S(meta:get_int("enabled") ~= 0 and "%s Enabled" or "%s Disabled"):format(desc)) meta:set_string("infotext", S(meta:get_int("enabled") ~= 0 and "%s Enabled" or "%s Disabled"):format(desc))
meta:set_string("formspec", meta:set_string("formspec",
"size[5,3.5]".. "size[5,3.5]"..
"item_image[0,0;1,1;technic:admin_anchor]".. "item_image[0,0;1,1;technic:admin_anchor]"..
"label[1,0;"..minetest.formspec_escape(desc).."]".. "label[1,0;"..minetest.formspec_escape(desc).."]"..
"label[0,1;"..minetest.formspec_escape(S("Owner:").." "..meta:get_string("owner")).."]".. "label[0,1;"..minetest.formspec_escape(S("Owner:").." "..meta:get_string("owner")).."]"..
(meta:get_int("locked") == 0 and (meta:get_int("locked") == 0 and
"button[3,1;2,1;lock;"..minetest.formspec_escape(S("Unlocked")).."]" or "button[3,1;2,1;lock;"..minetest.formspec_escape(S("Unlocked")).."]" or
"button[3,1;2,1;unlock;"..minetest.formspec_escape(S("Locked")).."]").. "button[3,1;2,1;unlock;"..minetest.formspec_escape(S("Locked")).."]")..
"field[0.25,2.3;1,1;radius;"..minetest.formspec_escape(S("Radius:"))..";"..meta:get_int("radius").."]".. "field[0.25,2.3;1,1;radius;"..minetest.formspec_escape(S("Radius:"))..";"..meta:get_int("radius").."]"..
(meta:get_int("enabled") == 0 and (meta:get_int("enabled") == 0 and
"button[3,2;2,1;enable;"..minetest.formspec_escape(S("Disabled")).."]" or "button[3,2;2,1;enable;"..minetest.formspec_escape(S("Disabled")).."]" or
"button[3,2;2,1;disable;"..minetest.formspec_escape(S("Enabled")).."]").. "button[3,2;2,1;disable;"..minetest.formspec_escape(S("Enabled")).."]")..
"label[0,3;"..minetest.formspec_escape(S("Keeping %d/%d map blocks loaded"):format(#currently_forceloaded_positions(meta), #compute_forceload_positions(pos, meta))).."]") "label[0,3;"..minetest.formspec_escape(S("Keeping %d/%d map blocks loaded"):format(#currently_forceloaded_positions(meta), #compute_forceload_positions(pos, meta))).."]")
end end
minetest.register_node("technic:admin_anchor", { minetest.register_node("technic:admin_anchor", {
description = desc, description = desc,
drawtype = "normal", drawtype = "normal",
tiles = {"technic_admin_anchor.png"}, tiles = { "technic_admin_anchor.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=3, not_in_creative_inventory=1}, groups = { cracky = 3, not_in_creative_inventory = 1 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
after_place_node = function (pos, placer) after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if placer and placer:is_player() then if placer and placer:is_player() then
meta:set_string("owner", placer:get_player_name()) meta:set_string("owner", placer:get_player_name())
end end
set_display(pos, meta) set_display(pos, meta)
end, end,
can_dig = function (pos, player) can_dig = function(pos, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
return meta:get_int("locked") == 0 or (player and player:is_player() and player:get_player_name() == meta:get_string("owner")) return meta:get_int("locked") == 0 or (player and player:is_player() and player:get_player_name() == meta:get_string("owner"))
end, end,
on_destruct = function (pos) on_destruct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
forceload_off(meta) forceload_off(meta)
end, end,
on_receive_fields = function (pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if (meta:get_int("locked") ~= 0 or fields.lock) and if (meta:get_int("locked") ~= 0 or fields.lock) and
not (sender and sender:is_player() and not (sender and sender:is_player() and
sender:get_player_name() == meta:get_string("owner")) then sender:get_player_name() == meta:get_string("owner")) then
return return
end end
if fields.unlock then meta:set_int("locked", 0) end if fields.unlock then meta:set_int("locked", 0) end

View File

@ -1,40 +1,41 @@
-- Fuel driven alloy furnace. This uses no EUs: -- Fuel driven alloy furnace. This uses no EUs:
local S = technic.getter local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:coal_alloy_furnace', output = "technic:coal_alloy_furnace",
recipe = { recipe = {
{'default:brick', 'default:brick', 'default:brick'}, { "default:brick", "default:brick", "default:brick" },
{'default:brick', '', 'default:brick'}, { "default:brick", "", "default:brick" },
{'default:brick', 'default:brick', 'default:brick'}, { "default:brick", "default:brick", "default:brick" },
} }
}) })
local machine_name = S("Fuel-Fired Alloy Furnace") local machine_name = S("Fuel-Fired Alloy Furnace")
local formspec = local formspec =
"size[8,9]".. "size[8,9]"..
"label[0,0;"..machine_name.."]".. "label[0,0;"..machine_name.."]"..
"image[2,2;1,1;default_furnace_fire_bg.png]".. "image[2,2;1,1;default_furnace_fire_bg.png]"..
"list[current_name;fuel;2,3;1,1;]".. "list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;2,1;]".. "list[current_name;src;2,1;2,1;]"..
"list[current_name;dst;5,1;2,2;]".. "list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]".. "list[current_player;main;0,5;8,4;]"..
"listring[current_name;dst]".. "listring[current_name;dst]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;src]".. "listring[current_name;src]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;fuel]".. "listring[current_name;fuel]"..
"listring[current_player;main]" "listring[current_player;main]"
minetest.register_node("technic:coal_alloy_furnace", { minetest.register_node("technic:coal_alloy_furnace", {
description = machine_name, description = machine_name,
tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png", tiles = {
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png",
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"}, "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png",
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2}, groups = { cracky = 2 },
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = function(pos) on_construct = function(pos)
@ -54,13 +55,15 @@ minetest.register_node("technic:coal_alloy_furnace", {
minetest.register_node("technic:coal_alloy_furnace_active", { minetest.register_node("technic:coal_alloy_furnace_active", {
description = machine_name, description = machine_name,
tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png", tiles = {
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.png",
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front_active.png"}, "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_side.png",
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front_active.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = 8, light_source = 8,
drop = "technic:coal_alloy_furnace", drop = "technic:coal_alloy_furnace",
groups = {cracky=2, not_in_creative_inventory=1}, groups = { cracky = 2, not_in_creative_inventory = 1 },
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
can_dig = technic.machine_can_dig, can_dig = technic.machine_can_dig,
@ -70,12 +73,12 @@ minetest.register_node("technic:coal_alloy_furnace_active", {
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:coal_alloy_furnace", "technic:coal_alloy_furnace_active"}, nodenames = { "technic:coal_alloy_furnace", "technic:coal_alloy_furnace_active" },
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
if inv:get_size("src") == 1 then -- Old furnace -> convert it if inv:get_size("src") == 1 then -- Old furnace -> convert it
inv:set_size("src", 2) inv:set_size("src", 2)
@ -86,10 +89,11 @@ minetest.register_abm({
local recipe = nil local recipe = nil
for i, name in pairs({ for i, name in pairs({
"fuel_totaltime", "fuel_totaltime",
"fuel_time", "fuel_time",
"src_totaltime", "src_totaltime",
"src_time"}) do "src_time"
}) do
if not meta:get_float(name) then if not meta:get_float(name) then
meta:set_float(name, 0.0) meta:set_float(name, 0.0)
end end
@ -124,20 +128,20 @@ minetest.register_abm({
meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..percent.."%)") meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..percent.."%)")
technic.swap_node(pos, "technic:coal_alloy_furnace_active") technic.swap_node(pos, "technic:coal_alloy_furnace_active")
meta:set_string("formspec", meta:set_string("formspec",
"size[8,9]".. "size[8,9]"..
"label[0,0;"..machine_name.."]".. "label[0,0;"..machine_name.."]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100 - percent)..":default_furnace_fire_fg.png]".. (100 - percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]".. "list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;2,1;]".. "list[current_name;src;2,1;2,1;]"..
"list[current_name;dst;5,1;2,2;]".. "list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]".. "list[current_player;main;0,5;8,4;]"..
"listring[current_name;dst]".. "listring[current_name;dst]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;src]".. "listring[current_name;src]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;fuel]".. "listring[current_name;fuel]"..
"listring[current_player;main]") "listring[current_player;main]")
return return
end end
@ -158,7 +162,7 @@ minetest.register_abm({
local fuellist = inv:get_list("fuel") local fuellist = inv:get_list("fuel")
if fuellist then if fuellist then
fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) fuel, afterfuel = minetest.get_craft_result({ method = "fuel", width = 1, items = fuellist })
end end
if fuel.time <= 0 then if fuel.time <= 0 then

View File

@ -1,13 +1,12 @@
local S = technic.getter local S = technic.getter
local function deploy_node(inv, slot_name, pos, node, machine_node) local function deploy_node(inv, slot_name, pos, node, machine_node)
if node.name ~= "air" then if node.name ~= "air" then
if node.name == "ignore" or if node.name == "ignore" or
node.name == "default:lava_source" or node.name == "default:lava_source" or
node.name == "default:lava_flowing" or node.name == "default:lava_flowing" or
node.name == "default:water_source" or node.name == "default:water_source" or
node.name == "default:water_flowing" then node.name == "default:water_flowing" then
return return
end end
local drops = minetest.get_node_drops(node.name, "") local drops = minetest.get_node_drops(node.name, "")
@ -46,7 +45,7 @@ local function deploy_node(inv, slot_name, pos, node, machine_node)
-- Fake pointed_thing -- Fake pointed_thing
type = "node", type = "node",
above = pos, above = pos,
under = {x=pos.x, y=pos.y-1, z=pos.z}, under = { x = pos.x, y = pos.y - 1, z = pos.z },
}) })
if ok then if ok then
inv:set_stack(slot_name, 1, stk or stack) inv:set_stack(slot_name, 1, stk or stack)
@ -67,21 +66,18 @@ end
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = 'technic:constructor_mk1_off 1', output = 'technic:constructor_mk1_off 1',
recipe = {'technic:nodebreaker_off', 'technic:deployer_off'}, recipe = { "technic:nodebreaker_off", "technic:deployer_off" },
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = 'technic:constructor_mk2_off 1', output = 'technic:constructor_mk2_off 1',
recipe = {'technic:constructor_mk1_off', 'technic:constructor_mk1_off'}, recipe = { "technic:constructor_mk1_off", "technic:constructor_mk1_off" },
}) })
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = 'technic:constructor_mk3_off 1', output = 'technic:constructor_mk3_off 1',
recipe = {'technic:constructor_mk2_off', 'technic:constructor_mk2_off'}, recipe = { "technic:constructor_mk2_off", "technic:constructor_mk2_off" },
}) })
local function make_on(mark, length) local function make_on(mark, length)
@ -111,7 +107,7 @@ end
local function make_off(mark) local function make_off(mark)
return function(pos, node) return function(pos, node)
if node.name == "technic:constructor_mk"..mark.."_on" then if node.name == "technic:constructor_mk"..mark.."_on" then
technic.swap_node(pos,"technic:constructor_mk"..mark.."_off") technic.swap_node(pos, "technic:constructor_mk"..mark.."_off")
nodeupdate(pos) nodeupdate(pos)
end end
end end
@ -121,26 +117,28 @@ end
local function make_constructor(mark, length) local function make_constructor(mark, length)
minetest.register_node("technic:constructor_mk"..mark.."_off", { minetest.register_node("technic:constructor_mk"..mark.."_off", {
description = S("Constructor Mk%d"):format(mark), description = S("Constructor Mk%d"):format(mark),
tiles = {"technic_constructor_mk"..mark.."_top_off.png", tiles = {
"technic_constructor_mk"..mark.."_top_off.png",
"technic_constructor_mk"..mark.."_bottom_off.png", "technic_constructor_mk"..mark.."_bottom_off.png",
"technic_constructor_mk"..mark.."_side2_off.png", "technic_constructor_mk"..mark.."_side2_off.png",
"technic_constructor_mk"..mark.."_side1_off.png", "technic_constructor_mk"..mark.."_side1_off.png",
"technic_constructor_back.png", "technic_constructor_back.png",
"technic_constructor_front_off.png"}, "technic_constructor_front_off.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, mesecon = 2}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, mesecon = 2 },
mesecons = {effector = {action_on = make_on(mark, length)}}, mesecons = { effector = { action_on = make_on(mark, length) } },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local formspec = "size[8,9;]".. local formspec = "size[8,9;]"..
"label[0,0;"..S("Constructor Mk%d"):format(mark).."]".. "label[0,0;"..S("Constructor Mk%d"):format(mark).."]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"
for i = 1, length do for i = 1, length do
formspec = formspec formspec = formspec
.."label[5,"..(i - 1)..";"..S("Slot %d"):format(i).."]" .. "label[5,"..(i - 1)..";"..S("Slot %d"):format(i).."]"
.."list[current_name;slot"..i .. "list[current_name;slot"..i
..";6,"..(i - 1)..";1,1;]" .. ";6,"..(i - 1)..";1,1;]"
end end
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
meta:set_string("infotext", S("Constructor Mk%d"):format(mark)) meta:set_string("infotext", S("Constructor Mk%d"):format(mark))
@ -165,17 +163,24 @@ local function make_constructor(mark, length)
}) })
minetest.register_node("technic:constructor_mk"..mark.."_on", { minetest.register_node("technic:constructor_mk"..mark.."_on", {
tiles = {"technic_constructor_mk"..mark.."_top_on.png", tiles = {
"technic_constructor_mk"..mark.."_top_on.png",
"technic_constructor_mk"..mark.."_bottom_on.png", "technic_constructor_mk"..mark.."_bottom_on.png",
"technic_constructor_mk"..mark.."_side2_on.png", "technic_constructor_mk"..mark.."_side2_on.png",
"technic_constructor_mk"..mark.."_side1_on.png", "technic_constructor_mk"..mark.."_side1_on.png",
"technic_constructor_back.png", "technic_constructor_back.png",
"technic_constructor_front_on.png"}, "technic_constructor_front_on.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "technic:constructor_mk"..mark.."_off", drop = "technic:constructor_mk"..mark.."_off",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, groups = {
mesecon=2, not_in_creative_inventory=1}, snappy = 2,
mesecons= {effector = {action_off = make_off(mark)}}, choppy = 2,
oddly_breakable_by_hand = 2,
mesecon = 2,
not_in_creative_inventory = 1
},
mesecons = { effector = { action_off = make_off(mark) } },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
allow_metadata_inventory_put = technic.machine_inventory_put, allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take, allow_metadata_inventory_take = technic.machine_inventory_take,

File diff suppressed because it is too large Load Diff

View File

@ -1,91 +1,91 @@
local S = technic.getter local S = technic.getter
local function inject_items (pos) local function inject_items(pos)
local meta=minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local mode=meta:get_string("mode") local mode = meta:get_string("mode")
if mode=="single items" then if mode == "single items" then
local i=0 local i = 0
for _,stack in ipairs(inv:get_list("main")) do for _, stack in ipairs(inv:get_list("main")) do
i=i+1 i = i + 1
if stack then if stack then
local item0=stack:to_table() local item0 = stack:to_table()
if item0 then if item0 then
item0["count"] = "1" item0["count"] = "1"
technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0) technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0)
stack:take_item(1) stack:take_item(1)
inv:set_stack("main", i, stack) inv:set_stack("main", i, stack)
return return
end
end end
end end
end end
if mode=="whole stacks" then end
local i=0 if mode == "whole stacks" then
for _,stack in ipairs(inv:get_list("main")) do local i = 0
i=i+1 for _, stack in ipairs(inv:get_list("main")) do
if stack then i = i + 1
local item0=stack:to_table() if stack then
local item0 = stack:to_table()
if item0 then if item0 then
technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0) technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0)
stack:clear() stack:clear()
inv:set_stack("main", i, stack) inv:set_stack("main", i, stack)
return return
end
end end
end end
end end
end
end end
minetest.register_craft({ minetest.register_craft({
output = 'technic:injector 1', output = 'technic:injector 1',
recipe = { recipe = {
{'', 'technic:control_logic_unit',''}, { "", "technic:control_logic_unit", "" },
{'', 'default:chest',''}, { "", "default:chest", "" },
{'', 'pipeworks:tube_1',''}, { "", "pipeworks:tube_1", "" },
} }
}) })
local function set_injector_formspec(meta) local function set_injector_formspec(meta)
local is_stack = meta:get_string("mode") == "whole stacks" local is_stack = meta:get_string("mode") == "whole stacks"
meta:set_string("formspec", meta:set_string("formspec",
"invsize[8,9;]".. "invsize[8,9;]"..
"item_image[0,0;1,1;technic:injector]".. "item_image[0,0;1,1;technic:injector]"..
"label[1,0;"..S("Self-Contained Injector").."]".. "label[1,0;"..S("Self-Contained Injector").."]"..
(is_stack and (is_stack and
"button[0,1;2,1;mode_item;"..S("Stackwise").."]" or "button[0,1;2,1;mode_item;"..S("Stackwise").."]" or
"button[0,1;2,1;mode_stack;"..S("Itemwise").."]").. "button[0,1;2,1;mode_stack;"..S("Itemwise").."]")..
"list[current_name;main;0,2;8,2;]".. "list[current_name;main;0,2;8,2;]"..
"list[current_player;main;0,5;8,4;]".. "list[current_player;main;0,5;8,4;]"..
"listring[]") "listring[]")
end end
minetest.register_node("technic:injector", { minetest.register_node("technic:injector", {
description = S("Self-Contained Injector"), description = S("Self-Contained Injector"),
tiles = {"technic_injector_top.png", "technic_injector_bottom.png", "technic_injector_side.png", tiles = {
"technic_injector_side.png", "technic_injector_side.png", "technic_injector_side.png"}, "technic_injector_top.png", "technic_injector_bottom.png", "technic_injector_side.png",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1}, "technic_injector_side.png", "technic_injector_side.png", "technic_injector_side.png"
},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1 },
tube = { tube = {
can_insert = function(pos, node, stack, direction) can_insert = function(pos, node, stack, direction)
return minetest.get_meta(pos):get_inventory():room_for_item("main",stack) return minetest.get_meta(pos):get_inventory():room_for_item("main", stack)
end, end,
insert_object = function(pos, node, stack, direction) insert_object = function(pos, node, stack, direction)
return minetest.get_meta(pos):get_inventory():add_item("main",stack) return minetest.get_meta(pos):get_inventory():add_item("main", stack)
end, end,
connect_sides = {left=1, right=1, front=1, back=1, top=1, bottom=1}, connect_sides = { left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1 },
}, },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Self-Contained Injector")) meta:set_string("infotext", S("Self-Contained Injector"))
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("main", 8*4) inv:set_size("main", 8 * 4)
meta:set_string("mode","single items") meta:set_string("mode", "single items")
set_injector_formspec(meta) set_injector_formspec(meta)
end, end,
can_dig = function(pos,player) can_dig = function(pos, player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:is_empty("main") return inv:is_empty("main")
@ -104,7 +104,7 @@ minetest.register_node("technic:injector", {
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:injector"}, nodenames = { "technic:injector" },
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)

View File

@ -7,15 +7,15 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = "technic:power_monitor", output = "technic:power_monitor",
recipe = { recipe = {
{"", "", ""}, { "", "", "" },
{"", "technic:machine_casing", "default:copper_ingot"}, { "", "technic:machine_casing", "default:copper_ingot" },
{"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"} { "technic:lv_cable", "technic:lv_cable", "technic:lv_cable" }
} }
}) })
minetest.register_node("technic:power_monitor",{ minetest.register_node("technic:power_monitor", {
description = S("Power Monitor"), description = S("Power Monitor"),
tiles = { tiles = {
"technic_power_monitor_sides.png", "technic_power_monitor_sides.png",
"technic_power_monitor_bottom_back.png", "technic_power_monitor_bottom_back.png",
"technic_power_monitor_sides.png", "technic_power_monitor_sides.png",
@ -24,8 +24,8 @@ minetest.register_node("technic:power_monitor",{
"technic_power_monitor_front.png" "technic_power_monitor_front.png"
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1, technic_machine=1}, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, technic_all_tiers = 1, technic_machine = 1 },
connect_sides = {"bottom", "back"}, connect_sides = { "bottom", "back" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -34,28 +34,28 @@ minetest.register_node("technic:power_monitor",{
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:power_monitor"}, nodenames = { "technic:power_monitor" },
label = "Power Monitor", label = "Power Monitor",
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local network_hash = technic.cables[minetest.hash_node_position(pos)] local network_hash = technic.cables[minetest.hash_node_position(pos)]
local network = network_hash and minetest.get_position_from_hash(network_hash) local network = network_hash and minetest.get_position_from_hash(network_hash)
local sw_pos = network and {x=network.x,y=network.y+1,z=network.z} local sw_pos = network and { x = network.x, y = network.y + 1, z = network.z }
local timeout = 0 local timeout = 0
for tier in pairs(technic.machines) do for tier in pairs(technic.machines) do
timeout = math.max(meta:get_int(tier.."_EU_timeout"),timeout) timeout = math.max(meta:get_int(tier.."_EU_timeout"), timeout)
end end
if timeout > 0 and sw_pos and minetest.get_node(sw_pos).name == "technic:switching_station" then if timeout > 0 and sw_pos and minetest.get_node(sw_pos).name == "technic:switching_station" then
local sw_meta = minetest.get_meta(sw_pos) local sw_meta = minetest.get_meta(sw_pos)
local supply = sw_meta:get_int("supply") local supply = sw_meta:get_int("supply")
local demand = sw_meta:get_int("demand") local demand = sw_meta:get_int("demand")
meta:set_string("infotext", meta:set_string("infotext",
S("Power Monitor. Supply: @1 Demand: @2", S("Power Monitor. Supply: @1 Demand: @2",
technic.pretty_num(supply), technic.pretty_num(demand))) technic.pretty_num(supply), technic.pretty_num(demand)))
else else
meta:set_string("infotext",S("Power Monitor Has No Network")) meta:set_string("infotext", S("Power Monitor Has No Network"))
end end
end, end,
}) })

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
function technic.register_alloy_furnace(data) function technic.register_alloy_furnace(data)

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
technic.register_recipe_type("alloy", { technic.register_recipe_type("alloy", {
@ -12,24 +11,24 @@ function technic.register_alloy_recipe(data)
end end
local recipes = { local recipes = {
{"technic:copper_dust 3", "technic:tin_dust", "technic:bronze_dust 4"}, { "technic:copper_dust 3", "technic:tin_dust", "technic:bronze_dust 4" },
{"default:copper_ingot 3", "moreores:tin_ingot", "default:bronze_ingot 4"}, { "default:copper_ingot 3", "moreores:tin_ingot", "default:bronze_ingot 4" },
{"technic:wrought_iron_dust", "technic:coal_dust", "technic:carbon_steel_dust", 3}, { "technic:wrought_iron_dust", "technic:coal_dust", "technic:carbon_steel_dust", 3 },
{"technic:wrought_iron_ingot", "technic:coal_dust", "technic:carbon_steel_ingot", 3}, { "technic:wrought_iron_ingot", "technic:coal_dust", "technic:carbon_steel_ingot", 3 },
{"technic:carbon_steel_dust", "technic:coal_dust", "technic:cast_iron_dust", 3}, { "technic:carbon_steel_dust", "technic:coal_dust", "technic:cast_iron_dust", 3 },
{"technic:carbon_steel_ingot", "technic:coal_dust", "technic:cast_iron_ingot", 3}, { "technic:carbon_steel_ingot", "technic:coal_dust", "technic:cast_iron_ingot", 3 },
{"technic:carbon_steel_dust 3", "technic:chromium_dust", "technic:stainless_steel_dust 4"}, { "technic:carbon_steel_dust 3", "technic:chromium_dust", "technic:stainless_steel_dust 4" },
{"technic:carbon_steel_ingot 3", "technic:chromium_ingot", "technic:stainless_steel_ingot 4"}, { "technic:carbon_steel_ingot 3", "technic:chromium_ingot", "technic:stainless_steel_ingot 4" },
{"technic:copper_dust 2", "technic:zinc_dust", "technic:brass_dust 3"}, { "technic:copper_dust 2", "technic:zinc_dust", "technic:brass_dust 3" },
{"default:copper_ingot 2", "technic:zinc_ingot", "technic:brass_ingot 3"}, { "default:copper_ingot 2", "technic:zinc_ingot", "technic:brass_ingot 3" },
{"default:sand 2", "technic:coal_dust 2", "technic:silicon_wafer"}, { "default:sand 2", "technic:coal_dust 2", "technic:silicon_wafer" },
{"technic:silicon_wafer", "technic:gold_dust", "technic:doped_silicon_wafer"}, { "technic:silicon_wafer", "technic:gold_dust", "technic:doped_silicon_wafer" },
-- from https://en.wikipedia.org/wiki/Carbon_black -- from https://en.wikipedia.org/wiki/Carbon_black
-- The highest volume use of carbon black is as a reinforcing filler in rubber products, especially tires. -- The highest volume use of carbon black is as a reinforcing filler in rubber products, especially tires.
-- "[Compounding a] pure gum vulcanizate … with 50% of its weight of carbon black improves its tensile strength and wear resistance …" -- "[Compounding a] pure gum vulcanizate … with 50% of its weight of carbon black improves its tensile strength and wear resistance …"
{"technic:raw_latex 4", "technic:coal_dust 2", "technic:rubber 6", 2}, { "technic:raw_latex 4", "technic:coal_dust 2", "technic:rubber 6", 2 },
} }
for _, data in pairs(recipes) do for _, data in pairs(recipes) do
technic.register_alloy_recipe({input = {data[1], data[2]}, output = data[3], time = data[4]}) technic.register_alloy_recipe({ input = { data[1], data[2] }, output = data[3], time = data[4] })
end end

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
technic.register_power_tool("technic:battery", 10000) technic.register_power_tool("technic:battery", 10000)
@ -7,11 +6,11 @@ technic.register_power_tool("technic:green_energy_crystal", 150000)
technic.register_power_tool("technic:blue_energy_crystal", 450000) technic.register_power_tool("technic:blue_energy_crystal", 450000)
minetest.register_craft({ minetest.register_craft({
output = 'technic:battery', output = "technic:battery",
recipe = { recipe = {
{'group:wood', 'default:copper_ingot', 'group:wood'}, { "group:wood", "default:copper_ingot", "group:wood" },
{'group:wood', 'moreores:tin_ingot', 'group:wood'}, { "group:wood", "moreores:tin_ingot", "group:wood" },
{'group:wood', 'default:copper_ingot', 'group:wood'}, { "group:wood", "default:copper_ingot", "group:wood" },
} }
}) })
@ -24,7 +23,7 @@ minetest.register_tool("technic:battery", {
charge = 0, charge = 0,
max_drop_level = 0, max_drop_level = 0,
groupcaps = { groupcaps = {
fleshy = {times={}, uses=10000, maxlevel=0} fleshy = { times = {}, uses = 10000, maxlevel = 0 }
} }
} }
}) })
@ -54,7 +53,7 @@ local tube = {
return inv:room_for_item("dst", stack) return inv:room_for_item("dst", stack)
end end
end, end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, connect_sides = { left = 1, right = 1, back = 1, top = 1, bottom = 1 },
} }
function technic.register_battery_box(data) function technic.register_battery_box(data)
@ -62,35 +61,35 @@ function technic.register_battery_box(data)
local ltier = string.lower(tier) local ltier = string.lower(tier)
local formspec = local formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"image[1,1;1,2;technic_power_meter_bg.png]".. "image[1,1;1,2;technic_power_meter_bg.png]"..
"list[current_name;src;3,1;1,1;]".. "list[current_name;src;3,1;1,1;]"..
"image[4,1;1,1;technic_battery_reload.png]".. "image[4,1;1,1;technic_battery_reload.png]"..
"list[current_name;dst;5,1;1,1;]".. "list[current_name;dst;5,1;1,1;]"..
"label[0,0;"..S("%s Battery Box"):format(tier).."]".. "label[0,0;"..S("%s Battery Box"):format(tier).."]"..
"label[3,0;"..S("Charge").."]".. "label[3,0;"..S("Charge").."]"..
"label[5,0;"..S("Discharge").."]".. "label[5,0;"..S("Discharge").."]"..
"label[1,3;"..S("Power level").."]".. "label[1,3;"..S("Power level").."]"..
"list[current_player;main;0,5;8,4;]".. "list[current_player;main;0,5;8,4;]"..
"listring[current_name;dst]".. "listring[current_name;dst]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;src]".. "listring[current_name;src]"..
"listring[current_player;main]" "listring[current_player;main]"
if data.upgrade then if data.upgrade then
formspec = formspec.. formspec = formspec..
"list[current_name;upgrade1;3.5,3;1,1;]".. "list[current_name;upgrade1;3.5,3;1,1;]"..
"list[current_name;upgrade2;4.5,3;1,1;]".. "list[current_name;upgrade2;4.5,3;1,1;]"..
"label[3.5,4;"..S("Upgrade Slots").."]".. "label[3.5,4;"..S("Upgrade Slots").."]"..
"listring[current_name;upgrade1]".. "listring[current_name;upgrade1]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;upgrade2]".. "listring[current_name;upgrade2]"..
"listring[current_player;main]" "listring[current_player;main]"
end end
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local eu_input = meta:get_int(tier.."_EU_input") local eu_input = meta:get_int(tier.."_EU_input")
local current_charge = meta:get_int("internal_EU_charge") local current_charge = meta:get_int("internal_EU_charge")
local EU_upgrade, tube_upgrade = 0, 0 local EU_upgrade, tube_upgrade = 0, 0
@ -109,29 +108,29 @@ function technic.register_battery_box(data)
-- Charging/discharging tools here -- Charging/discharging tools here
local tool_full, tool_empty local tool_full, tool_empty
current_charge, tool_full = technic.charge_tools(meta, current_charge, tool_full = technic.charge_tools(meta,
current_charge, data.charge_step) current_charge, data.charge_step)
current_charge, tool_empty = technic.discharge_tools(meta, current_charge, tool_empty = technic.discharge_tools(meta,
current_charge, data.discharge_step, current_charge, data.discharge_step,
max_charge) max_charge)
if data.tube then if data.tube then
local inv = meta:get_inventory() local inv = meta:get_inventory()
technic.handle_machine_pipeworks(pos, tube_upgrade, technic.handle_machine_pipeworks(pos, tube_upgrade,
function(pos, x_velocity, z_velocity) function(pos, x_velocity, z_velocity)
if tool_full and not inv:is_empty("src") then if tool_full and not inv:is_empty("src") then
technic.send_items(pos, x_velocity, z_velocity, "src") technic.send_items(pos, x_velocity, z_velocity, "src")
elseif tool_empty and not inv:is_empty("dst") then elseif tool_empty and not inv:is_empty("dst") then
technic.send_items(pos, x_velocity, z_velocity, "dst") technic.send_items(pos, x_velocity, z_velocity, "dst")
end end
end) end)
end end
-- We allow batteries to charge on less than the demand -- We allow batteries to charge on less than the demand
meta:set_int(tier.."_EU_demand", meta:set_int(tier.."_EU_demand",
math.min(data.charge_rate, max_charge - current_charge)) math.min(data.charge_rate, max_charge - current_charge))
meta:set_int(tier.."_EU_supply", meta:set_int(tier.."_EU_supply",
math.min(data.discharge_rate, current_charge)) math.min(data.discharge_rate, current_charge))
meta:set_int("internal_EU_charge", current_charge) meta:set_int("internal_EU_charge", current_charge)
-- Select node textures -- Select node textures
local charge_count = math.ceil((current_charge / max_charge) * 8) local charge_count = math.ceil((current_charge / max_charge) * 8)
@ -139,19 +138,19 @@ function technic.register_battery_box(data)
charge_count = math.max(charge_count, 0) charge_count = math.max(charge_count, 0)
local last_count = meta:get_float("last_side_shown") local last_count = meta:get_float("last_side_shown")
if charge_count ~= last_count then if charge_count ~= last_count then
technic.swap_node(pos,"technic:"..ltier.."_battery_box"..charge_count) technic.swap_node(pos, "technic:"..ltier.."_battery_box"..charge_count)
meta:set_float("last_side_shown", charge_count) meta:set_float("last_side_shown", charge_count)
end end
local charge_percent = math.floor(current_charge / max_charge * 100) local charge_percent = math.floor(current_charge / max_charge * 100)
meta:set_string("formspec", meta:set_string("formspec",
formspec.. formspec..
"image[1,1;1,2;technic_power_meter_bg.png" "image[1,1;1,2;technic_power_meter_bg.png"
.."^[lowpart:"..charge_percent .. "^[lowpart:"..charge_percent
..":technic_power_meter_fg.png]") .. ":technic_power_meter_fg.png]")
local infotext = S("@1 Battery Box: @2/@3", tier, local infotext = S("@1 Battery Box: @2/@3", tier,
technic.pretty_num(current_charge), technic.pretty_num(max_charge)) technic.pretty_num(current_charge), technic.pretty_num(max_charge))
if eu_input == 0 then if eu_input == 0 then
infotext = S("%s Idle"):format(infotext) infotext = S("%s Idle"):format(infotext)
end end
@ -159,8 +158,13 @@ function technic.register_battery_box(data)
end end
for i = 0, 8 do for i = 0, 8 do
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, local groups = {
technic_machine=1, ["technic_"..ltier]=1} snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
["technic_"..ltier] = 1
}
if i ~= 0 then if i ~= 0 then
groups.not_in_creative_inventory = 1 groups.not_in_creative_inventory = 1
end end
@ -172,14 +176,16 @@ function technic.register_battery_box(data)
minetest.register_node("technic:"..ltier.."_battery_box"..i, { minetest.register_node("technic:"..ltier.."_battery_box"..i, {
description = S("%s Battery Box"):format(tier), description = S("%s Battery Box"):format(tier),
tiles = {"technic_"..ltier.."_battery_box_top.png", tiles = {
"technic_"..ltier.."_battery_box_bottom.png", "technic_"..ltier.."_battery_box_top.png",
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png", "technic_"..ltier.."_battery_box_bottom.png",
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png", "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png", "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"}, "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"
},
groups = groups, groups = groups,
connect_sides = {"bottom"}, connect_sides = { "bottom" },
tube = data.tube and tube or nil, tube = data.tube and tube or nil,
paramtype2 = "facedir", paramtype2 = "facedir",
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
@ -193,7 +199,7 @@ function technic.register_battery_box(data)
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
meta:set_int(tier.."_EU_demand", 0) meta:set_int(tier.."_EU_demand", 0)
meta:set_int(tier.."_EU_supply", 0) meta:set_int(tier.."_EU_supply", 0)
meta:set_int(tier.."_EU_input", 0) meta:set_int(tier.."_EU_input", 0)
meta:set_float("internal_EU_charge", 0) meta:set_float("internal_EU_charge", 0)
inv:set_size("src", 1) inv:set_size("src", 1)
inv:set_size("dst", 1) inv:set_size("dst", 1)
@ -215,8 +221,9 @@ function technic.register_battery_box(data)
for i = 0, 8 do for i = 0, 8 do
technic.register_machine(tier, "technic:"..ltier.."_battery_box"..i, technic.battery) technic.register_machine(tier, "technic:"..ltier.."_battery_box"..i, technic.battery)
end end
end
end -- End registration -- End registration
function technic.charge_tools(meta, batt_charge, charge_step) function technic.charge_tools(meta, batt_charge, charge_step)
@ -237,7 +244,7 @@ function technic.charge_tools(meta, batt_charge, charge_step)
end end
-- Do the charging -- Do the charging
local item_max_charge = technic.power_tools[tool_name] local item_max_charge = technic.power_tools[tool_name]
local tool_charge = src_meta.charge local tool_charge = src_meta.charge
if tool_charge >= item_max_charge then if tool_charge >= item_max_charge then
return batt_charge, true return batt_charge, true
elseif batt_charge <= 0 then elseif batt_charge <= 0 then
@ -274,7 +281,7 @@ function technic.discharge_tools(meta, batt_charge, charge_step, max_charge)
-- Do the discharging -- Do the discharging
local item_max_charge = technic.power_tools[toolname] local item_max_charge = technic.power_tools[toolname]
local tool_charge = src_meta.charge local tool_charge = src_meta.charge
if tool_charge <= 0 then if tool_charge <= 0 then
return batt_charge, true return batt_charge, true
elseif batt_charge >= max_charge then elseif batt_charge >= max_charge then

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
local cable_tier = {} local cable_tier = {}
@ -14,23 +13,24 @@ end
local function check_connections(pos) local function check_connections(pos)
-- Build a table of all machines -- Build a table of all machines
local machines = {} local machines = {}
for tier,list in pairs(technic.machines) do for tier, list in pairs(technic.machines) do
for k,v in pairs(list) do for k, v in pairs(list) do
machines[k] = v machines[k] = v
end end
end end
local connections = {} local connections = {}
local positions = { local positions = {
{x=pos.x+1, y=pos.y, z=pos.z}, { x = pos.x + 1, y = pos.y, z = pos.z },
{x=pos.x-1, y=pos.y, z=pos.z}, { x = pos.x - 1, y = pos.y, z = pos.z },
{x=pos.x, y=pos.y+1, z=pos.z}, { x = pos.x, y = pos.y + 1, z = pos.z },
{x=pos.x, y=pos.y-1, z=pos.z}, { x = pos.x, y = pos.y - 1, z = pos.z },
{x=pos.x, y=pos.y, z=pos.z+1}, { x = pos.x, y = pos.y, z = pos.z + 1 },
{x=pos.x, y=pos.y, z=pos.z-1}} { x = pos.x, y = pos.y, z = pos.z - 1 }
for _,connected_pos in pairs(positions) do }
for _, connected_pos in pairs(positions) do
local name = minetest.get_node(connected_pos).name local name = minetest.get_node(connected_pos).name
if machines[name] or technic.get_cable_tier(name) then if machines[name] or technic.get_cable_tier(name) then
table.insert(connections,connected_pos) table.insert(connections, connected_pos)
end end
end end
return connections return connections
@ -43,7 +43,7 @@ local function clear_networks(pos)
local positions = check_connections(pos) local positions = check_connections(pos)
if #positions < 1 then return end if #positions < 1 then return end
local dead_end = #positions == 1 local dead_end = #positions == 1
for _,connected_pos in pairs(positions) do for _, connected_pos in pairs(positions) do
local net = technic.cables[minetest.hash_node_position(connected_pos)] local net = technic.cables[minetest.hash_node_position(connected_pos)]
if net and technic.networks[net] then if net and technic.networks[net] then
if dead_end and placed then if dead_end and placed then
@ -64,22 +64,22 @@ local function clear_networks(pos)
technic.cables[minetest.hash_node_position(pos)] = network_id technic.cables[minetest.hash_node_position(pos)] = network_id
pos.visited = 1 pos.visited = 1
if technic.is_tier_cable(name, tier) then if technic.is_tier_cable(name, tier) then
table.insert(network.all_nodes,pos) table.insert(network.all_nodes, pos)
elseif technic.machines[tier][node.name] then elseif technic.machines[tier][node.name] then
meta:set_string(tier.."_network",minetest.pos_to_string(sw_pos)) meta:set_string(tier.."_network", minetest.pos_to_string(sw_pos))
if technic.machines[tier][node.name] == technic.producer then if technic.machines[tier][node.name] == technic.producer then
table.insert(network.PR_nodes,pos) table.insert(network.PR_nodes, pos)
elseif technic.machines[tier][node.name] == technic.receiver then elseif technic.machines[tier][node.name] == technic.receiver then
table.insert(network.RE_nodes,pos) table.insert(network.RE_nodes, pos)
elseif technic.machines[tier][node.name] == technic.producer_receiver then elseif technic.machines[tier][node.name] == technic.producer_receiver then
table.insert(network.PR_nodes,pos) table.insert(network.PR_nodes, pos)
table.insert(network.RE_nodes,pos) table.insert(network.RE_nodes, pos)
elseif technic.machines[tier][node.name] == "SPECIAL" and elseif technic.machines[tier][node.name] == "SPECIAL" and
(pos.x ~= sw_pos.x or pos.y ~= sw_pos.y or pos.z ~= sw_pos.z) and (pos.x ~= sw_pos.x or pos.y ~= sw_pos.y or pos.z ~= sw_pos.z) and
from_below then from_below then
table.insert(network.SP_nodes,pos) table.insert(network.SP_nodes, pos)
elseif technic.machines[tier][node.name] == technic.battery then elseif technic.machines[tier][node.name] == technic.battery then
table.insert(network.BA_nodes,pos) table.insert(network.BA_nodes, pos)
end end
end end
elseif dead_end and not placed then elseif dead_end and not placed then
@ -94,12 +94,12 @@ local function clear_networks(pos)
-- Search for and remove machine -- Search for and remove machine
technic.cables[minetest.hash_node_position(pos)] = nil technic.cables[minetest.hash_node_position(pos)] = nil
for tblname,table in pairs(network) do for tblname, table in pairs(network) do
if tblname ~= "tier" then if tblname ~= "tier" then
for machinenum,machine in pairs(table) do for machinenum, machine in pairs(table) do
if machine.x == pos.x if machine.x == pos.x
and machine.y == pos.y and machine.y == pos.y
and machine.z == pos.z then and machine.z == pos.z then
table[machinenum] = nil table[machinenum] = nil
end end
end end
@ -107,7 +107,7 @@ local function clear_networks(pos)
end end
else else
-- Not a dead end, so the whole network needs to be recalculated -- Not a dead end, so the whole network needs to be recalculated
for _,v in pairs(technic.networks[net].all_nodes) do for _, v in pairs(technic.networks[net].all_nodes) do
local pos1 = minetest.hash_node_position(v) local pos1 = minetest.hash_node_position(v)
technic.cables[pos1] = nil technic.cables[pos1] = nil
end end
@ -121,22 +121,22 @@ function technic.register_cable(tier, size)
local ltier = string.lower(tier) local ltier = string.lower(tier)
cable_tier["technic:"..ltier.."_cable"] = tier cable_tier["technic:"..ltier.."_cable"] = tier
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2} local groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 }
local node_box = { local node_box = {
type = "connected", type = "connected",
fixed = {-size, -size, -size, size, size, size}, fixed = { -size, -size, -size, size, size, size },
connect_top = {-size, -size, -size, size, 0.5, size}, -- y+ connect_top = { -size, -size, -size, size, 0.5, size }, -- y+
connect_bottom = {-size, -0.5, -size, size, size, size}, -- y- connect_bottom = { -size, -0.5, -size, size, size, size }, -- y-
connect_front = {-size, -size, -0.5, size, size, size}, -- z- connect_front = { -size, -size, -0.5, size, size, size }, -- z-
connect_back = {-size, -size, size, size, size, 0.5 }, -- z+ connect_back = { -size, -size, size, size, size, 0.5 }, -- z+
connect_left = {-0.5, -size, -size, size, size, size}, -- x- connect_left = { -0.5, -size, -size, size, size, size }, -- x-
connect_right = {-size, -size, -size, 0.5, size, size}, -- x+ connect_right = { -size, -size, -size, 0.5, size, size }, -- x+
} }
minetest.register_node("technic:"..ltier.."_cable", { minetest.register_node("technic:"..ltier.."_cable", {
description = S("%s Cable"):format(tier), description = S("%s Cable"):format(tier),
tiles = {"technic_"..ltier.."_cable.png"}, tiles = { "technic_"..ltier.."_cable.png" },
inventory_image = "technic_"..ltier.."_cable_wield.png", inventory_image = "technic_"..ltier.."_cable_wield.png",
wield_image = "technic_"..ltier.."_cable_wield.png", wield_image = "technic_"..ltier.."_cable_wield.png",
groups = groups, groups = groups,
@ -146,8 +146,10 @@ function technic.register_cable(tier, size)
sunlight_propagates = true, sunlight_propagates = true,
drawtype = "nodebox", drawtype = "nodebox",
node_box = node_box, node_box = node_box,
connects_to = {"technic:"..ltier.."_cable", connects_to = {
"group:technic_"..ltier, "group:technic_all_tiers"}, "technic:"..ltier.."_cable",
"group:technic_"..ltier, "group:technic_all_tiers"
},
on_construct = clear_networks, on_construct = clear_networks,
on_destruct = clear_networks, on_destruct = clear_networks,
}) })

View File

@ -11,18 +11,19 @@ function technic.register_separating_recipe(data)
end end
local recipes = { local recipes = {
{ "technic:bronze_dust 4", "technic:copper_dust 3", "technic:tin_dust" }, { "technic:bronze_dust 4", "technic:copper_dust 3", "technic:tin_dust" },
{ "technic:stainless_steel_dust 4", "technic:wrought_iron_dust 3", "technic:chromium_dust" }, { "technic:stainless_steel_dust 4", "technic:wrought_iron_dust 3", "technic:chromium_dust" },
{ "technic:brass_dust 3", "technic:copper_dust 2", "technic:zinc_dust" }, { "technic:brass_dust 3", "technic:copper_dust 2", "technic:zinc_dust" },
{ "technic:chernobylite_dust", "default:sand", "technic:uranium3_dust" }, { "technic:chernobylite_dust", "default:sand", "technic:uranium3_dust" },
{ "default:dirt 4", "default:sand", "default:gravel", "default:clay_lump 2" }, { "default:dirt 4", "default:sand", "default:gravel", "default:clay_lump 2" },
} }
local function uranium_dust(p) local function uranium_dust(p)
return "technic:uranium"..(p == 7 and "" or p).."_dust" return "technic:uranium"..(p == 7 and "" or p).."_dust"
end end
for p = 1, 34 do for p = 1, 34 do
table.insert(recipes, { uranium_dust(p).." 2", uranium_dust(p-1), uranium_dust(p+1) }) table.insert(recipes, { uranium_dust(p).." 2", uranium_dust(p - 1), uranium_dust(p + 1) })
end end
if minetest.get_modpath("bushes_classic") then if minetest.get_modpath("bushes_classic") then

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
-- handles the machine upgrades every tick -- handles the machine upgrades every tick
@ -25,7 +24,7 @@ function technic.handle_machine_upgrades(meta)
if upg_item2 == "technic:control_logic_unit" then if upg_item2 == "technic:control_logic_unit" then
tube_upgrade = tube_upgrade + 1 tube_upgrade = tube_upgrade + 1
elseif upg_item2 == "technic:battery" then elseif upg_item2 == "technic:battery" then
EU_upgrade = EU_upgrade + 1 EU_upgrade = EU_upgrade + 1
end end
@ -39,7 +38,7 @@ local function on_machine_upgrade(meta, stack)
meta:set_int("public", 1) meta:set_int("public", 1)
return 1 return 1
elseif stack_name ~= "technic:control_logic_unit" elseif stack_name ~= "technic:control_logic_unit"
and stack_name ~= "technic:battery" then and stack_name ~= "technic:battery" then
return 0 return 0
end end
return 1 return 1
@ -93,7 +92,7 @@ function technic.smelt_item(meta, result, speed)
end end
local result local result
local afterfuel local afterfuel
result, afterfuel = minetest.get_craft_result({method = "cooking", width = 1, items = inv:get_list("src")}) result, afterfuel = minetest.get_craft_result({ method = "cooking", width = 1, items = inv:get_list("src") })
if result and result.item then if result and result.item then
meta:set_int("cook_time", 0) meta:set_int("cook_time", 0)
@ -118,10 +117,10 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function)
local z_velocity = 0 local z_velocity = 0
-- Output is on the left side of the furnace -- Output is on the left side of the furnace
if node.param2 == 3 then pos1.z = pos1.z - 1 z_velocity = -1 end if node.param2 == 3 then pos1.z = pos1.z - 1 z_velocity = -1 end
if node.param2 == 2 then pos1.x = pos1.x - 1 x_velocity = -1 end if node.param2 == 2 then pos1.x = pos1.x - 1 x_velocity = -1 end
if node.param2 == 1 then pos1.z = pos1.z + 1 z_velocity = 1 end if node.param2 == 1 then pos1.z = pos1.z + 1 z_velocity = 1 end
if node.param2 == 0 then pos1.x = pos1.x + 1 x_velocity = 1 end if node.param2 == 0 then pos1.x = pos1.x + 1 x_velocity = 1 end
local output_tube_connected = false local output_tube_connected = false
local node1 = minetest.get_node(pos1) local node1 = minetest.get_node(pos1)
@ -207,7 +206,7 @@ function technic.machine_inventory_take(pos, listname, index, stack, player)
end end
function technic.machine_inventory_move(pos, from_list, from_index, function technic.machine_inventory_move(pos, from_list, from_index,
to_list, to_index, count, player) to_list, to_index, count, player)
local stack = minetest.get_meta(pos):get_inventory():get_stack(from_list, from_index) local stack = minetest.get_meta(pos):get_inventory():get_stack(from_list, from_index)
return inv_change(pos, player, count, from_list, to_list, stack) return inv_change(pos, player, count, from_list, to_list, stack)
end end

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
function technic.register_compressor(data) function technic.register_compressor(data)

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
technic.register_recipe_type("compressing", { description = S("Compressing") }) technic.register_recipe_type("compressing", { description = S("Compressing") })
@ -9,26 +8,26 @@ function technic.register_compressor_recipe(data)
end end
local recipes = { local recipes = {
{"default:snowblock", "default:ice"}, { "default:snowblock", "default:ice" },
{"default:sand 2", "default:sandstone"}, { "default:sand 2", "default:sandstone" },
{"default:desert_sand", "default:desert_stone"}, { "default:desert_sand", "default:desert_stone" },
{"technic:mixed_metal_ingot", "technic:composite_plate"}, { "technic:mixed_metal_ingot", "technic:composite_plate" },
{"default:copper_ingot 5", "technic:copper_plate"}, { "default:copper_ingot 5", "technic:copper_plate" },
{"technic:coal_dust 4", "technic:graphite"}, { "technic:coal_dust 4", "technic:graphite" },
{"technic:carbon_cloth", "technic:carbon_plate"}, { "technic:carbon_cloth", "technic:carbon_plate" },
{"technic:uranium35_ingot 5", "technic:uranium_fuel"}, { "technic:uranium35_ingot 5", "technic:uranium_fuel" },
} }
-- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner -- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner
minetest.register_craft({ minetest.register_craft({
output = "default:sand 0", output = "default:sand 0",
recipe = { recipe = {
{'group:sand', 'group:sand'}, { "group:sand", "group:sand" },
{'group:sand', 'group:sand'} { "group:sand", "group:sand" }
}, },
}) })
for _, data in pairs(recipes) do for _, data in pairs(recipes) do
technic.register_compressor_recipe({input = {data[1]}, output = data[2]}) technic.register_compressor_recipe({ input = { data[1] }, output = data[2] })
end end

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
function technic.register_electric_furnace(data) function technic.register_electric_furnace(data)

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
function technic.register_extractor(data) function technic.register_extractor(data)

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
technic.register_recipe_type("extracting", { description = S("Extracting") }) technic.register_recipe_type("extracting", { description = S("Extracting") })
@ -14,46 +13,45 @@ if minetest.get_modpath("dye") then
-- register recipes with the same crafting ratios as `dye` provides -- register recipes with the same crafting ratios as `dye` provides
local dye_recipes = { local dye_recipes = {
{"technic:coal_dust", "dye:black 2"}, { "technic:coal_dust", "dye:black 2" },
{"default:grass_1", "dye:green 1"}, { "default:grass_1", "dye:green 1" },
{"default:dry_shrub", "dye:brown 1"}, { "default:dry_shrub", "dye:brown 1" },
{"default:junglegrass", "dye:green 2"}, { "default:junglegrass", "dye:green 2" },
{"default:cactus", "dye:green 4"}, { "default:cactus", "dye:green 4" },
{"flowers:geranium", "dye:blue 4"}, { "flowers:geranium", "dye:blue 4" },
{"flowers:dandelion_white", "dye:white 4"}, { "flowers:dandelion_white", "dye:white 4" },
{"flowers:dandelion_yellow", "dye:yellow 4"}, { "flowers:dandelion_yellow", "dye:yellow 4" },
{"flowers:tulip", "dye:orange 4"}, { "flowers:tulip", "dye:orange 4" },
{"flowers:rose", "dye:red 4"}, { "flowers:rose", "dye:red 4" },
{"flowers:viola", "dye:violet 4"}, { "flowers:viola", "dye:violet 4" },
{"bushes:blackberry", unifieddyes and "unifieddyes:magenta_s50 4" or "dye:violet 4"}, { "bushes:blackberry", unifieddyes and "unifieddyes:magenta_s50 4" or "dye:violet 4" },
{"bushes:blueberry", unifieddyes and "unifieddyes:magenta_s50 4" or "dye:magenta 4"}, { "bushes:blueberry", unifieddyes and "unifieddyes:magenta_s50 4" or "dye:magenta 4" },
} }
for _, data in ipairs(dye_recipes) do for _, data in ipairs(dye_recipes) do
technic.register_extractor_recipe({input = {data[1]}, output = data[2]}) technic.register_extractor_recipe({ input = { data[1] }, output = data[2] })
end end
-- overwrite the existing crafting recipes -- overwrite the existing crafting recipes
local dyes = {"white", "red", "yellow", "blue", "violet", "orange"} local dyes = { "white", "red", "yellow", "blue", "violet", "orange" }
for _, color in ipairs(dyes) do for _, color in ipairs(dyes) do
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "dye:"..color.." 1", output = "dye:"..color.." 1",
recipe = {"group:flower,color_"..color}, recipe = { "group:flower,color_"..color },
}) })
end end
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "dye:black 1", output = "dye:black 1",
recipe = {"group:coal"}, recipe = { "group:coal" },
}) })
if unifieddyes then if unifieddyes then
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "dye:green 1", output = "dye:green 1",
recipe = {"default:cactus"}, recipe = { "default:cactus" },
}) })
end end
end end

View File

@ -11,29 +11,34 @@ local tube = {
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:room_for_item("src", stack) return inv:room_for_item("src", stack)
end, end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1}, connect_sides = { left = 1, right = 1, back = 1, top = 1, bottom = 1 },
} }
function technic.register_generator(data) function technic.register_generator(data)
local tier = data.tier local tier = data.tier
local ltier = string.lower(tier) local ltier = string.lower(tier)
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, local groups = {
technic_machine=1, ["technic_"..ltier]=1} snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
["technic_"..ltier] = 1
}
if data.tube then if data.tube then
groups.tubedevice = 1 groups.tubedevice = 1
groups.tubedevice_receiver = 1 groups.tubedevice_receiver = 1
end end
local active_groups = {not_in_creative_inventory = 1} local active_groups = { not_in_creative_inventory = 1 }
for k, v in pairs(groups) do active_groups[k] = v end for k, v in pairs(groups) do active_groups[k] = v end
local generator_formspec = local generator_formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]".. "label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]"..
"list[current_name;src;3,1;1,1;]".. "list[current_name;src;3,1;1,1;]"..
"image[4,1;1,1;default_furnace_fire_bg.png]".. "image[4,1;1,1;default_furnace_fire_bg.png]"..
"list[current_player;main;0,5;8,4;]".. "list[current_player;main;0,5;8,4;]"..
"listring[]" "listring[]"
local desc = S("Fuel-Fired %s Generator"):format(tier) local desc = S("Fuel-Fired %s Generator"):format(tier)
@ -54,9 +59,11 @@ function technic.register_generator(data)
local fuellist = inv:get_list("src") local fuellist = inv:get_list("src")
local fuel local fuel
local afterfuel local afterfuel
fuel, afterfuel = minetest.get_craft_result( fuel, afterfuel = minetest.get_craft_result({
{method = "fuel", width = 1, method = "fuel",
items = fuellist}) width = 1,
items = fuellist
})
if not fuel or fuel.time == 0 then if not fuel or fuel.time == 0 then
meta:set_string("infotext", S("%s Out Of Fuel"):format(desc)) meta:set_string("infotext", S("%s Out Of Fuel"):format(desc))
technic.swap_node(pos, "technic:"..ltier.."_generator") technic.swap_node(pos, "technic:"..ltier.."_generator")
@ -76,24 +83,26 @@ function technic.register_generator(data)
if burn_totaltime == 0 then burn_totaltime = 1 end if burn_totaltime == 0 then burn_totaltime = 1 end
local percent = math.floor((burn_time / burn_totaltime) * 100) local percent = math.floor((burn_time / burn_totaltime) * 100)
meta:set_string("infotext", desc.." ("..percent.."%)") meta:set_string("infotext", desc.." ("..percent.."%)")
meta:set_string("formspec", meta:set_string("formspec",
"size[8, 9]".. "size[8, 9]"..
"label[0, 0;"..minetest.formspec_escape(desc).."]".. "label[0, 0;"..minetest.formspec_escape(desc).."]"..
"list[current_name;src;3, 1;1, 1;]".. "list[current_name;src;3, 1;1, 1;]"..
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. "image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:"..
(percent)..":default_furnace_fire_fg.png]".. (percent)..":default_furnace_fire_fg.png]"..
"list[current_player;main;0, 5;8, 4;]".. "list[current_player;main;0, 5;8, 4;]"..
"listring[]") "listring[]")
end end
minetest.register_node("technic:"..ltier.."_generator", { minetest.register_node("technic:"..ltier.."_generator", {
description = desc, description = desc,
tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", tiles = {
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"}, "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = groups, groups = groups,
connect_sides = {"bottom", "back", "left", "right"}, connect_sides = { "bottom", "back", "left", "right" },
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
tube = data.tube and tube or nil, tube = data.tube and tube or nil,
@ -102,7 +111,7 @@ function technic.register_generator(data)
meta:set_string("infotext", desc) meta:set_string("infotext", desc)
meta:set_int(data.tier.."_EU_supply", 0) meta:set_int(data.tier.."_EU_supply", 0)
meta:set_int("burn_time", 0) meta:set_int("burn_time", 0)
meta:set_int("tube_time", 0) meta:set_int("tube_time", 0)
meta:set_string("formspec", generator_formspec) meta:set_string("formspec", generator_formspec)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("src", 1) inv:set_size("src", 1)
@ -118,12 +127,14 @@ function technic.register_generator(data)
minetest.register_node("technic:"..ltier.."_generator_active", { minetest.register_node("technic:"..ltier.."_generator_active", {
description = desc, description = desc,
tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", tiles = {
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"}, "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = active_groups, groups = active_groups,
connect_sides = {"bottom"}, connect_sides = { "bottom" },
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
tube = data.tube and tube or nil, tube = data.tube and tube or nil,
@ -135,8 +146,8 @@ function technic.register_generator(data)
technic_run = run, technic_run = run,
technic_on_disable = function(pos, node) technic_on_disable = function(pos, node)
local timer = minetest.get_node_timer(pos) local timer = minetest.get_node_timer(pos)
timer:start(1) timer:start(1)
end, end,
on_timer = function(pos, node) on_timer = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -159,17 +170,17 @@ function technic.register_generator(data)
local percent = math.floor(burn_time / burn_totaltime * 100) local percent = math.floor(burn_time / burn_totaltime * 100)
meta:set_string("formspec", meta:set_string("formspec",
"size[8, 9]".. "size[8, 9]"..
"label[0, 0;"..minetest.formspec_escape(desc).."]".. "label[0, 0;"..minetest.formspec_escape(desc).."]"..
"list[current_name;src;3, 1;1, 1;]".. "list[current_name;src;3, 1;1, 1;]"..
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. "image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:"..
(percent)..":default_furnace_fire_fg.png]".. (percent)..":default_furnace_fire_fg.png]"..
"list[current_player;main;0, 5;8, 4;]".. "list[current_player;main;0, 5;8, 4;]"..
"listring[]") "listring[]")
return true return true
end, end,
}) })
technic.register_machine(tier, "technic:"..ltier.."_generator", technic.producer) technic.register_machine(tier, "technic:"..ltier.."_generator", technic.producer)
technic.register_machine(tier, "technic:"..ltier.."_generator_active", technic.producer) technic.register_machine(tier, "technic:"..ltier.."_generator_active", technic.producer)
end end

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
function technic.register_grinder(data) function technic.register_grinder(data)

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
technic.register_recipe_type("grinding", { description = S("Grinding") }) technic.register_recipe_type("grinding", { description = S("Grinding") })
@ -10,69 +9,69 @@ end
local recipes = { local recipes = {
-- Dusts -- Dusts
{"default:coal_lump", "technic:coal_dust 2"}, { "default:coal_lump", "technic:coal_dust 2" },
{"default:copper_lump", "technic:copper_dust 2"}, { "default:copper_lump", "technic:copper_dust 2" },
{"default:desert_stone", "default:desert_sand"}, { "default:desert_stone", "default:desert_sand" },
{"default:gold_lump", "technic:gold_dust 2"}, { "default:gold_lump", "technic:gold_dust 2" },
{"default:iron_lump", "technic:wrought_iron_dust 2"}, { "default:iron_lump", "technic:wrought_iron_dust 2" },
{"technic:chromium_lump", "technic:chromium_dust 2"}, { "technic:chromium_lump", "technic:chromium_dust 2" },
{"technic:uranium_lump", "technic:uranium_dust 2"}, { "technic:uranium_lump", "technic:uranium_dust 2" },
{"technic:zinc_lump", "technic:zinc_dust 2"}, { "technic:zinc_lump", "technic:zinc_dust 2" },
{"technic:lead_lump", "technic:lead_dust 2"}, { "technic:lead_lump", "technic:lead_dust 2" },
{"technic:sulfur_lump", "technic:sulfur_dust 2"}, { "technic:sulfur_lump", "technic:sulfur_dust 2" },
{"default:stone", "technic:stone_dust"}, { "default:stone", "technic:stone_dust" },
{"default:sand", "technic:stone_dust"}, { "default:sand", "technic:stone_dust" },
-- Other -- Other
{"default:cobble", "default:gravel"}, { "default:cobble", "default:gravel" },
{"default:gravel", "default:sand"}, { "default:gravel", "default:sand" },
{"default:sandstone", "default:sand 2"}, -- reverse recipe can be found in the compressor { "default:sandstone", "default:sand 2" }, -- reverse recipe can be found in the compressor
} }
-- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe) -- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe)
minetest.register_craft({ minetest.register_craft({
output = "default:sandstone 0", output = "default:sandstone 0",
recipe = { recipe = {
{'default:sandstone'} { "default:sandstone" }
}, },
}) })
if minetest.get_modpath("farming") then if minetest.get_modpath("farming") then
table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"}) table.insert(recipes, { "farming:seed_wheat", "farming:flour 1" })
end end
if minetest.get_modpath("moreores") then if minetest.get_modpath("moreores") then
table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_dust 2"}) table.insert(recipes, { "moreores:mithril_lump", "technic:mithril_dust 2" })
table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"}) table.insert(recipes, { "moreores:silver_lump", "technic:silver_dust 2" })
table.insert(recipes, {"moreores:tin_lump", "technic:tin_dust 2"}) table.insert(recipes, { "moreores:tin_lump", "technic:tin_dust 2" })
end end
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
table.insert(recipes, {"gloopores:alatro_lump", "technic:alatro_dust 2"}) table.insert(recipes, { "gloopores:alatro_lump", "technic:alatro_dust 2" })
table.insert(recipes, {"gloopores:kalite_lump", "technic:kalite_dust 2"}) table.insert(recipes, { "gloopores:kalite_lump", "technic:kalite_dust 2" })
table.insert(recipes, {"gloopores:arol_lump", "technic:arol_dust 2"}) table.insert(recipes, { "gloopores:arol_lump", "technic:arol_dust 2" })
table.insert(recipes, {"gloopores:talinite_lump", "technic:talinite_dust 2"}) table.insert(recipes, { "gloopores:talinite_lump", "technic:talinite_dust 2" })
table.insert(recipes, {"gloopores:akalin_lump", "technic:akalin_dust 2"}) table.insert(recipes, { "gloopores:akalin_lump", "technic:akalin_dust 2" })
end end
if minetest.get_modpath("homedecor") then if minetest.get_modpath("homedecor") then
table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"}) table.insert(recipes, { "home_decor:brass_ingot", "technic:brass_dust 1" })
end end
for _, data in pairs(recipes) do for _, data in pairs(recipes) do
technic.register_grinder_recipe({input = {data[1]}, output = data[2]}) technic.register_grinder_recipe({ input = { data[1] }, output = data[2] })
end end
-- defuse common grinder unfriendly recipes -- defuse common grinder unfriendly recipes
if minetest.get_modpath("fake_fire") then -- from homedecor_modpack if minetest.get_modpath("fake_fire") then -- from homedecor_modpack
minetest.register_craft({ output='default:cobble 0', recipe={{'default:cobble'}}}) minetest.register_craft({ output = 'default:cobble 0', recipe = { { "default:cobble" } } })
minetest.register_craft({ output='default:gravel 0', recipe={{'default:gravel'}}}) minetest.register_craft({ output = 'default:gravel 0', recipe = { { "default:gravel" } } })
end end
-- dusts -- dusts
local function register_dust(name, ingot) local function register_dust(name, ingot)
local lname = string.lower(name) local lname = string.lower(name)
lname = string.gsub(lname, ' ', '_') lname = string.gsub(lname, ' ', "_")
minetest.register_craftitem("technic:"..lname.."_dust", { minetest.register_craftitem("technic:"..lname.."_dust", {
description = S("%s Dust"):format(S(name)), description = S("%s Dust"):format(S(name)),
inventory_image = "technic_"..lname.."_dust.png", inventory_image = "technic_"..lname.."_dust.png",
@ -83,35 +82,35 @@ local function register_dust(name, ingot)
recipe = "technic:"..lname.."_dust", recipe = "technic:"..lname.."_dust",
output = ingot, output = ingot,
}) })
technic.register_grinder_recipe({ input = {ingot}, output = "technic:"..lname.."_dust 1" }) technic.register_grinder_recipe({ input = { ingot }, output = "technic:"..lname.."_dust 1" })
end end
end end
-- Sorted alphibeticaly -- Sorted alphibeticaly
register_dust("Brass", "technic:brass_ingot") register_dust("Brass", "technic:brass_ingot")
register_dust("Bronze", "default:bronze_ingot") register_dust("Bronze", "default:bronze_ingot")
register_dust("Carbon Steel", "technic:carbon_steel_ingot") register_dust("Carbon Steel", "technic:carbon_steel_ingot")
register_dust("Cast Iron", "technic:cast_iron_ingot") register_dust("Cast Iron", "technic:cast_iron_ingot")
register_dust("Chernobylite", "technic:chernobylite_block") register_dust("Chernobylite", "technic:chernobylite_block")
register_dust("Chromium", "technic:chromium_ingot") register_dust("Chromium", "technic:chromium_ingot")
register_dust("Coal", nil) register_dust("Coal", nil)
register_dust("Copper", "default:copper_ingot") register_dust("Copper", "default:copper_ingot")
register_dust("Lead", "technic:lead_ingot") register_dust("Lead", "technic:lead_ingot")
register_dust("Gold", "default:gold_ingot") register_dust("Gold", "default:gold_ingot")
register_dust("Mithril", "moreores:mithril_ingot") register_dust("Mithril", "moreores:mithril_ingot")
register_dust("Silver", "moreores:silver_ingot") register_dust("Silver", "moreores:silver_ingot")
register_dust("Stainless Steel", "technic:stainless_steel_ingot") register_dust("Stainless Steel", "technic:stainless_steel_ingot")
register_dust("Stone", "default:stone") register_dust("Stone", "default:stone")
register_dust("Sulfur", nil) register_dust("Sulfur", nil)
register_dust("Tin", "moreores:tin_ingot") register_dust("Tin", "moreores:tin_ingot")
register_dust("Wrought Iron", "technic:wrought_iron_ingot") register_dust("Wrought Iron", "technic:wrought_iron_ingot")
register_dust("Zinc", "technic:zinc_ingot") register_dust("Zinc", "technic:zinc_ingot")
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
register_dust("Akalin", "glooptest:akalin_ingot") register_dust("Akalin", "glooptest:akalin_ingot")
register_dust("Alatro", "glooptest:alatro_ingot") register_dust("Alatro", "glooptest:alatro_ingot")
register_dust("Arol", "glooptest:arol_ingot") register_dust("Arol", "glooptest:arol_ingot")
register_dust("Kalite", nil) register_dust("Kalite", nil)
register_dust("Talinite", "glooptest:talinite_ingot") register_dust("Talinite", "glooptest:talinite_ingot")
end end
for p = 0, 35 do for p = 0, 35 do
@ -120,25 +119,26 @@ for p = 0, 35 do
local ingot = "technic:uranium"..psuffix.."_ingot" local ingot = "technic:uranium"..psuffix.."_ingot"
local dust = "technic:uranium"..psuffix.."_dust" local dust = "technic:uranium"..psuffix.."_dust"
minetest.register_craftitem(dust, { minetest.register_craftitem(dust, {
description = S("%s Dust"):format(string.format(S("%.1f%%-Fissile Uranium"), p/10)), description = S("%s Dust"):format(string.format(S("%.1f%%-Fissile Uranium"), p / 10)),
inventory_image = "technic_uranium_dust.png", inventory_image = "technic_uranium_dust.png",
on_place_on_ground = minetest.craftitem_place_item, on_place_on_ground = minetest.craftitem_place_item,
groups = {uranium_dust=1, not_in_creative_inventory=nici}, groups = { uranium_dust = 1, not_in_creative_inventory = nici },
}) })
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
recipe = dust, recipe = dust,
output = ingot, output = ingot,
}) })
technic.register_grinder_recipe({ input = {ingot}, output = dust }) technic.register_grinder_recipe({ input = { ingot }, output = dust })
end end
local function uranium_dust(p) local function uranium_dust(p)
return "technic:uranium"..(p == 7 and "" or p).."_dust" return "technic:uranium"..(p == 7 and "" or p).."_dust"
end end
for pa = 0, 34 do for pa = 0, 34 do
for pb = pa+1, 35 do for pb = pa + 1, 35 do
local pc = (pa+pb)/2 local pc = (pa + pb) / 2
if pc == math.floor(pc) then if pc == math.floor(pc) then
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",

View File

@ -10,16 +10,16 @@ minetest.register_craftitem(sawdust, {
inventory_image = "technic_sawdust.png", inventory_image = "technic_sawdust.png",
}) })
minetest.register_craft({ type = "fuel", recipe = sawdust, burntime = 6 }) minetest.register_craft({ type = "fuel", recipe = sawdust, burntime = 6 })
technic.register_compressor_recipe({ input = {sawdust .. " 4"}, output = "default:wood" }) technic.register_compressor_recipe({ input = { sawdust.." 4" }, output = "default:wood" })
-- tree/wood grindings -- tree/wood grindings
local function register_tree_grinding(name, tree, wood, extract, grinding_color) local function register_tree_grinding(name, tree, wood, extract, grinding_color)
local lname = string.lower(name) local lname = string.lower(name)
lname = string.gsub(lname, ' ', '_') lname = string.gsub(lname, ' ', "_")
local grindings_name = "technic:"..lname.."_grindings" local grindings_name = "technic:"..lname.."_grindings"
local inventory_image = "technic_"..lname.."_grindings.png" local inventory_image = "technic_"..lname.."_grindings.png"
if grinding_color then if grinding_color then
inventory_image = inventory_image .. "^[colorize:" .. grinding_color inventory_image = inventory_image.."^[colorize:"..grinding_color
end end
minetest.register_craftitem(grindings_name, { minetest.register_craftitem(grindings_name, {
description = S("%s Grinding"):format(S(name)), description = S("%s Grinding"):format(S(name)),
@ -30,16 +30,16 @@ local function register_tree_grinding(name, tree, wood, extract, grinding_color)
recipe = grindings_name, recipe = grindings_name,
burntime = 8, burntime = 8,
}) })
technic.register_grinder_recipe({ input = { tree }, output = grindings_name .. " 4" }) technic.register_grinder_recipe({ input = { tree }, output = grindings_name.." 4" })
technic.register_grinder_recipe({ input = { grindings_name }, output = sawdust .. " 4" }) technic.register_grinder_recipe({ input = { grindings_name }, output = sawdust.." 4" })
if wood then if wood then
technic.register_grinder_recipe({ input = { wood }, output = grindings_name }) technic.register_grinder_recipe({ input = { wood }, output = grindings_name })
end end
if extract then if extract then
technic.register_extractor_recipe({ input = { grindings_name .. " 4" }, output = extract}) technic.register_extractor_recipe({ input = { grindings_name.." 4" }, output = extract })
technic.register_separating_recipe({ technic.register_separating_recipe({
input = { grindings_name .. " 4" }, input = { grindings_name.." 4" },
output = { sawdust .. " 4", extract } output = { sawdust.." 4", extract }
}) })
end end
end end
@ -48,8 +48,8 @@ local rubber_tree_planks = moretrees and "moretrees:rubber_tree_planks"
local default_extract = dye and "dye:brown 2" local default_extract = dye and "dye:brown 2"
local grinding_recipes = { local grinding_recipes = {
{"Common Tree", "group:tree", "group:wood", default_extract }, { "Common Tree", "group:tree", "group:wood", default_extract },
{"Rubber Tree", "moretrees:rubber_tree_trunk", rubber_tree_planks, "technic:raw_latex"} { "Rubber Tree", "moretrees:rubber_tree_trunk", rubber_tree_planks, "technic:raw_latex" }
} }
for _, data in pairs(grinding_recipes) do for _, data in pairs(grinding_recipes) do

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
local tube = { local tube = {
@ -12,10 +11,10 @@ local tube = {
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:room_for_item("src", stack) return inv:room_for_item("src", stack)
end, end,
connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1}, connect_sides = { left = 1, right = 1, back = 1, top = 1, bottom = 1 },
} }
local connect_default = {"bottom", "back", "left", "right"} local connect_default = { "bottom", "back", "left", "right" }
local function round(v) local function round(v)
return math.floor(v + 0.5) return math.floor(v + 0.5)
@ -29,43 +28,43 @@ function technic.register_base_machine(data)
local tier = data.tier local tier = data.tier
local ltier = string.lower(tier) local ltier = string.lower(tier)
local groups = {cracky = 2, technic_machine = 1, ["technic_"..ltier] = 1} local groups = { cracky = 2, technic_machine = 1, ["technic_"..ltier] = 1 }
if data.tube then if data.tube then
groups.tubedevice = 1 groups.tubedevice = 1
groups.tubedevice_receiver = 1 groups.tubedevice_receiver = 1
end end
local active_groups = {not_in_creative_inventory = 1} local active_groups = { not_in_creative_inventory = 1 }
for k, v in pairs(groups) do active_groups[k] = v end for k, v in pairs(groups) do active_groups[k] = v end
local formspec = local formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"list[current_name;src;"..(4-input_size)..",1;"..input_size..",1;]".. "list[current_name;src;"..(4 - input_size)..",1;"..input_size..",1;]"..
"list[current_name;dst;5,1;2,2;]".. "list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]".. "list[current_player;main;0,5;8,4;]"..
"label[0,0;"..machine_desc:format(tier).."]".. "label[0,0;"..machine_desc:format(tier).."]"..
"listring[current_name;dst]".. "listring[current_name;dst]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;src]".. "listring[current_name;src]"..
"listring[current_player;main]" "listring[current_player;main]"
if data.upgrade then if data.upgrade then
formspec = formspec.. formspec = formspec..
"list[current_name;upgrade1;1,3;1,1;]".. "list[current_name;upgrade1;1,3;1,1;]"..
"list[current_name;upgrade2;2,3;1,1;]".. "list[current_name;upgrade2;2,3;1,1;]"..
"label[1,4;"..S("Upgrade Slots").."]".. "label[1,4;"..S("Upgrade Slots").."]"..
"listring[current_name;upgrade1]".. "listring[current_name;upgrade1]"..
"listring[current_player;main]".. "listring[current_player;main]"..
"listring[current_name;upgrade2]".. "listring[current_name;upgrade2]"..
"listring[current_player;main]" "listring[current_player;main]"
end end
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local eu_input = meta:get_int(tier.."_EU_input") local eu_input = meta:get_int(tier.."_EU_input")
local machine_desc_tier = machine_desc:format(tier) local machine_desc_tier = machine_desc:format(tier)
local machine_node = "technic:"..ltier.."_"..machine_name local machine_node = "technic:"..ltier.."_"..machine_name
local machine_demand = data.demand local machine_demand = data.demand
-- Setup meta data if it does not exist. -- Setup meta data if it does not exist.
if not eu_input then if not eu_input then
@ -82,9 +81,9 @@ function technic.register_base_machine(data)
technic.handle_machine_pipeworks(pos, tube_upgrade) technic.handle_machine_pipeworks(pos, tube_upgrade)
end end
local powered = eu_input >= machine_demand[EU_upgrade+1] local powered = eu_input >= machine_demand[EU_upgrade + 1]
if powered then if powered then
meta:set_int("src_time", meta:get_int("src_time") + round(data.speed*10)) meta:set_int("src_time", meta:get_int("src_time") + round(data.speed * 10))
end end
while true do while true do
local result = technic.get_recipe(typename, inv:get_list("src")) local result = technic.get_recipe(typename, inv:get_list("src"))
@ -95,10 +94,10 @@ function technic.register_base_machine(data)
meta:set_int("src_time", 0) meta:set_int("src_time", 0)
return return
end end
meta:set_int(tier.."_EU_demand", machine_demand[EU_upgrade+1]) meta:set_int(tier.."_EU_demand", machine_demand[EU_upgrade + 1])
technic.swap_node(pos, machine_node.."_active") technic.swap_node(pos, machine_node.."_active")
meta:set_string("infotext", S("%s Active"):format(machine_desc_tier)) meta:set_string("infotext", S("%s Active"):format(machine_desc_tier))
if meta:get_int("src_time") < round(result.time*10) then if meta:get_int("src_time") < round(result.time * 10) then
if not powered then if not powered then
technic.swap_node(pos, machine_node) technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_desc_tier)) meta:set_string("infotext", S("%s Unpowered"):format(machine_desc_tier))
@ -125,10 +124,10 @@ function technic.register_base_machine(data)
technic.swap_node(pos, machine_node) technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_desc_tier)) meta:set_string("infotext", S("%s Idle"):format(machine_desc_tier))
meta:set_int(tier.."_EU_demand", 0) meta:set_int(tier.."_EU_demand", 0)
meta:set_int("src_time", round(result.time*10)) meta:set_int("src_time", round(result.time * 10))
return return
end end
meta:set_int("src_time", meta:get_int("src_time") - round(result.time*10)) meta:set_int("src_time", meta:get_int("src_time") - round(result.time * 10))
inv:set_list("src", result.new_input) inv:set_list("src", result.new_input)
inv:set_list("dst", inv:get_list("dst_tmp")) inv:set_list("dst", inv:get_list("dst_tmp"))
end end
@ -136,12 +135,14 @@ function technic.register_base_machine(data)
minetest.register_node("technic:"..ltier.."_"..machine_name, { minetest.register_node("technic:"..ltier.."_"..machine_name, {
description = machine_desc:format(tier), description = machine_desc:format(tier),
tiles = {"technic_"..ltier.."_"..machine_name.."_top.png", tiles = {
"technic_"..ltier.."_"..machine_name.."_bottom.png", "technic_"..ltier.."_"..machine_name.."_top.png",
"technic_"..ltier.."_"..machine_name.."_side.png", "technic_"..ltier.."_"..machine_name.."_bottom.png",
"technic_"..ltier.."_"..machine_name.."_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_"..ltier.."_"..machine_name.."_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_"..ltier.."_"..machine_name.."_front.png"}, "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_"..ltier.."_"..machine_name.."_front.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = groups, groups = groups,
tube = data.tube and tube or nil, tube = data.tube and tube or nil,
@ -152,7 +153,7 @@ function technic.register_base_machine(data)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", machine_desc:format(tier)) meta:set_string("infotext", machine_desc:format(tier))
meta:set_int("tube_time", 0) meta:set_int("tube_time", 0)
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("src", input_size) inv:set_size("src", input_size)
@ -169,14 +170,16 @@ function technic.register_base_machine(data)
after_dig_node = technic.machine_after_dig_node after_dig_node = technic.machine_after_dig_node
}) })
minetest.register_node("technic:"..ltier.."_"..machine_name.."_active",{ minetest.register_node("technic:"..ltier.."_"..machine_name.."_active", {
description = machine_desc:format(tier), description = machine_desc:format(tier),
tiles = {"technic_"..ltier.."_"..machine_name.."_top.png", tiles = {
"technic_"..ltier.."_"..machine_name.."_bottom.png", "technic_"..ltier.."_"..machine_name.."_top.png",
"technic_"..ltier.."_"..machine_name.."_side.png", "technic_"..ltier.."_"..machine_name.."_bottom.png",
"technic_"..ltier.."_"..machine_name.."_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_"..ltier.."_"..machine_name.."_side.png", "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_"..ltier.."_"..machine_name.."_front_active.png"}, "technic_"..ltier.."_"..machine_name.."_side.png",
"technic_"..ltier.."_"..machine_name.."_front_active.png"
},
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "technic:"..ltier.."_"..machine_name, drop = "technic:"..ltier.."_"..machine_name,
groups = active_groups, groups = active_groups,
@ -192,8 +195,9 @@ function technic.register_base_machine(data)
technic_disabled_machine_name = "technic:"..ltier.."_"..machine_name, technic_disabled_machine_name = "technic:"..ltier.."_"..machine_name,
}) })
technic.register_machine(tier, "technic:"..ltier.."_"..machine_name, technic.receiver) technic.register_machine(tier, "technic:"..ltier.."_"..machine_name, technic.receiver)
technic.register_machine(tier, "technic:"..ltier.."_"..machine_name.."_active", technic.receiver) technic.register_machine(tier, "technic:"..ltier.."_"..machine_name.."_active", technic.receiver)
end
end -- End registration -- End registration

View File

@ -40,7 +40,7 @@ local function register_recipe(typename, data)
data.output = ItemStack(data.output):to_string() data.output = ItemStack(data.output):to_string()
end end
local recipe = {time = data.time, input = {}, output = data.output} local recipe = { time = data.time, input = {}, output = data.output }
local index = get_recipe_index(data.input) local index = get_recipe_index(data.input)
if not index then if not index then
print("[Technic] ignored registration of garbage recipe!") print("[Technic] ignored registration of garbage recipe!")
@ -70,14 +70,17 @@ function technic.get_recipe(typename, items)
local result, new_input = minetest.get_craft_result({ local result, new_input = minetest.get_craft_result({
method = "cooking", method = "cooking",
width = 1, width = 1,
items = items}) items = items
})
-- Compatibility layer -- Compatibility layer
if not result or result.time == 0 then if not result or result.time == 0 then
return nil return nil
else else
return {time = result.time, return {
new_input = new_input.items, time = result.time,
output = result.item} new_input = new_input.items,
output = result.item
}
end end
end end
local index = get_recipe_index(items) local index = get_recipe_index(items)
@ -96,9 +99,11 @@ function technic.get_recipe(typename, items)
new_input[i]:take_item(recipe.input[stack:get_name()]) new_input[i]:take_item(recipe.input[stack:get_name()])
end end
end end
return {time = recipe.time, return {
new_input = new_input, time = recipe.time,
output = recipe.output} new_input = new_input,
output = recipe.output
}
else else
return nil return nil
end end

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
function technic.register_solar_array(data) function technic.register_solar_array(data)
@ -39,11 +38,13 @@ function technic.register_solar_array(data)
end end
minetest.register_node("technic:solar_array_"..ltier, { minetest.register_node("technic:solar_array_"..ltier, {
tiles = {"technic_"..ltier.."_solar_array_top.png", "technic_"..ltier.."_solar_array_bottom.png", tiles = {
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_top.png", "technic_"..ltier.."_solar_array_bottom.png",
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"}, "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, ["technic_"..ltier]=1}, "technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"
connect_sides = {"bottom"}, },
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, technic_machine = 1, ["technic_"..ltier] = 1 },
connect_sides = { "bottom" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
description = S("Arrayed Solar %s Generator"):format(tier), description = S("Arrayed Solar %s Generator"):format(tier),
active = false, active = false,
@ -51,7 +52,7 @@ function technic.register_solar_array(data)
paramtype = "light", paramtype = "light",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
}, },
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -11,7 +11,7 @@ local S = technic.getter
local function set_supply_converter_formspec(meta) local function set_supply_converter_formspec(meta)
local formspec = "size[5,2.25]".. local formspec = "size[5,2.25]"..
"field[0.3,0.5;2,1;power;"..S("Input Power")..";"..meta:get_int("power").."]" "field[0.3,0.5;2,1;power;"..S("Input Power")..";"..meta:get_int("power").."]"
-- The names for these toggle buttons are explicit about which -- The names for these toggle buttons are explicit about which
-- state they'll switch to, so that multiple presses (arising -- state they'll switch to, so that multiple presses (arising
-- from the ambiguity between lag and a missed press) only make -- from the ambiguity between lag and a missed press) only make
@ -66,9 +66,9 @@ local run = function(pos, node, run_stage)
local remain = 0.9 local remain = 0.9
-- Machine information -- Machine information
local machine_name = S("Supply Converter") local machine_name = S("Supply Converter")
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local enabled = meta:get_string("enabled") local enabled = meta:get_string("enabled")
if enabled == "" then if enabled == "" then
-- Backwards compatibility -- Backwards compatibility
minetest.registered_nodes["technic:supply_converter"].on_construct(pos) minetest.registered_nodes["technic:supply_converter"].on_construct(pos)
@ -79,13 +79,13 @@ local run = function(pos, node, run_stage)
enabled = enabled and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0) enabled = enabled and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0)
local demand = enabled and meta:get_int("power") or 0 local demand = enabled and meta:get_int("power") or 0
local pos_up = {x=pos.x, y=pos.y+1, z=pos.z} local pos_up = { x = pos.x, y = pos.y + 1, z = pos.z }
local pos_down = {x=pos.x, y=pos.y-1, z=pos.z} local pos_down = { x = pos.x, y = pos.y - 1, z = pos.z }
local name_up = minetest.get_node(pos_up).name local name_up = minetest.get_node(pos_up).name
local name_down = minetest.get_node(pos_down).name local name_down = minetest.get_node(pos_down).name
local from = technic.get_cable_tier(name_up) local from = technic.get_cable_tier(name_up)
local to = technic.get_cable_tier(name_down) local to = technic.get_cable_tier(name_down)
if from and to then if from and to then
local input = meta:get_int(from.."_EU_input") local input = meta:get_int(from.."_EU_input")
@ -104,17 +104,23 @@ local run = function(pos, node, run_stage)
end end
return return
end end
end end
minetest.register_node("technic:supply_converter", { minetest.register_node("technic:supply_converter", {
description = S("Supply Converter"), description = S("Supply Converter"),
tiles = {"technic_supply_converter_top.png", "technic_supply_converter_bottom.png", tiles = {
"technic_supply_converter_side.png", "technic_supply_converter_side.png", "technic_supply_converter_top.png", "technic_supply_converter_bottom.png",
"technic_supply_converter_side.png", "technic_supply_converter_side.png"}, "technic_supply_converter_side.png", "technic_supply_converter_side.png",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, "technic_supply_converter_side.png", "technic_supply_converter_side.png"
technic_machine=1, technic_all_tiers=1}, },
connect_sides = {"top", "bottom"}, groups = {
snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
technic_machine = 1,
technic_all_tiers = 1
},
connect_sides = { "top", "bottom" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_receive_fields = supply_converter_receive_fields, on_receive_fields = supply_converter_receive_fields,
on_construct = function(pos) on_construct = function(pos)
@ -134,9 +140,9 @@ minetest.register_node("technic:supply_converter", {
minetest.register_craft({ minetest.register_craft({
output = 'technic:supply_converter 1', output = 'technic:supply_converter 1',
recipe = { recipe = {
{'technic:fine_gold_wire', 'technic:rubber', 'technic:doped_silicon_wafer'}, { "technic:fine_gold_wire", "technic:rubber", "technic:doped_silicon_wafer" },
{'technic:mv_transformer', 'technic:machine_casing', 'technic:lv_transformer'}, { "technic:mv_transformer", "technic:machine_casing", "technic:lv_transformer" },
{'technic:mv_cable', 'technic:rubber', 'technic:lv_cable'}, { "technic:mv_cable", "technic:rubber", "technic:lv_cable" },
} }
}) })

View File

@ -42,19 +42,21 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = "technic:switching_station", output = "technic:switching_station",
recipe = { recipe = {
{"", "technic:lv_transformer", ""}, { "", "technic:lv_transformer", "" },
{"default:copper_ingot", "technic:machine_casing", "default:copper_ingot"}, { "default:copper_ingot", "technic:machine_casing", "default:copper_ingot" },
{"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"} { "technic:lv_cable", "technic:lv_cable", "technic:lv_cable" }
} }
}) })
minetest.register_node("technic:switching_station",{ minetest.register_node("technic:switching_station", {
description = S("Switching Station"), description = S("Switching Station"),
tiles = {"technic_water_mill_top_active.png", "technic_water_mill_top_active.png", tiles = {
"technic_water_mill_top_active.png", "technic_water_mill_top_active.png", "technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
"technic_water_mill_top_active.png", "technic_water_mill_top_active.png"}, "technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1}, "technic_water_mill_top_active.png", "technic_water_mill_top_active.png"
connect_sides = {"bottom"}, },
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, technic_all_tiers = 1 },
connect_sides = { "bottom" },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -80,11 +82,13 @@ minetest.register_node("technic:switching_station",{
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("channel", fields.channel) meta:set_string("channel", fields.channel)
end, end,
mesecons = {effector = { mesecons = {
rules = mesecon.rules.default, effector = {
}}, rules = mesecon.rules.default,
}
},
digiline = { digiline = {
receptor = {action = function() end}, receptor = { action = function() end },
effector = { effector = {
action = function(pos, node, channel, msg) action = function(pos, node, channel, msg)
if msg ~= "GET" and msg ~= "get" then if msg ~= "GET" and msg ~= "get" then
@ -113,12 +117,12 @@ local add_new_cable_node = function(nodes, pos, network_id)
-- Ignore if the node has already been added -- Ignore if the node has already been added
for i = 1, #nodes do for i = 1, #nodes do
if pos.x == nodes[i].x and if pos.x == nodes[i].x and
pos.y == nodes[i].y and pos.y == nodes[i].y and
pos.z == nodes[i].z then pos.z == nodes[i].z then
return false return false
end end
end end
table.insert(nodes, {x=pos.x, y=pos.y, z=pos.z, visited=1}) table.insert(nodes, { x = pos.x, y = pos.y, z = pos.z, visited = 1 })
return true return true
end end
@ -129,11 +133,11 @@ local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nod
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
if technic.is_tier_cable(name, tier) then if technic.is_tier_cable(name, tier) then
add_new_cable_node(all_nodes, pos,network_id) add_new_cable_node(all_nodes, pos, network_id)
elseif machines[name] then elseif machines[name] then
--dprint(name.." is a "..machines[name]) --dprint(name.." is a "..machines[name])
meta:set_string(tier.."_network",minetest.pos_to_string(sw_pos)) meta:set_string(tier.."_network", minetest.pos_to_string(sw_pos))
if machines[name] == technic.producer then if machines[name] == technic.producer then
add_new_cable_node(PR_nodes, pos, network_id) add_new_cable_node(PR_nodes, pos, network_id)
elseif machines[name] == technic.receiver then elseif machines[name] == technic.receiver then
add_new_cable_node(RE_nodes, pos, network_id) add_new_cable_node(RE_nodes, pos, network_id)
@ -158,12 +162,13 @@ end
local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, i, machines, tier, sw_pos, network_id) local traverse_network = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, i, machines, tier, sw_pos, network_id)
local pos = all_nodes[i] local pos = all_nodes[i]
local positions = { local positions = {
{x=pos.x+1, y=pos.y, z=pos.z}, { x = pos.x + 1, y = pos.y, z = pos.z },
{x=pos.x-1, y=pos.y, z=pos.z}, { x = pos.x - 1, y = pos.y, z = pos.z },
{x=pos.x, y=pos.y+1, z=pos.z}, { x = pos.x, y = pos.y + 1, z = pos.z },
{x=pos.x, y=pos.y-1, z=pos.z}, { x = pos.x, y = pos.y - 1, z = pos.z },
{x=pos.x, y=pos.y, z=pos.z+1}, { x = pos.x, y = pos.y, z = pos.z + 1 },
{x=pos.x, y=pos.y, z=pos.z-1}} { x = pos.x, y = pos.y, z = pos.z - 1 }
}
--print("ON") --print("ON")
for i, cur_pos in pairs(positions) do for i, cur_pos in pairs(positions) do
check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos, i == 3, network_id) check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos, i == 3, network_id)
@ -195,14 +200,20 @@ local get_network = function(sw_pos, pos1, tier)
local BA_nodes = {} local BA_nodes = {}
local RE_nodes = {} local RE_nodes = {}
local SP_nodes = {} local SP_nodes = {}
local all_nodes = {pos1} local all_nodes = { pos1 }
repeat repeat
traverse_network(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, traverse_network(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes,
i, technic.machines[tier], tier, sw_pos, minetest.hash_node_position(pos1)) i, technic.machines[tier], tier, sw_pos, minetest.hash_node_position(pos1))
i = i + 1 i = i + 1
until all_nodes[i] == nil until all_nodes[i] == nil
technic.networks[minetest.hash_node_position(pos1)] = {tier = tier, PR_nodes = PR_nodes, technic.networks[minetest.hash_node_position(pos1)] = {
RE_nodes = RE_nodes, BA_nodes = BA_nodes, SP_nodes = SP_nodes, all_nodes = all_nodes} tier = tier,
PR_nodes = PR_nodes,
RE_nodes = RE_nodes,
BA_nodes = BA_nodes,
SP_nodes = SP_nodes,
all_nodes = all_nodes
}
return PR_nodes, BA_nodes, RE_nodes return PR_nodes, BA_nodes, RE_nodes
end end
@ -210,33 +221,33 @@ end
-- The action code for the switching station -- -- The action code for the switching station --
----------------------------------------------- -----------------------------------------------
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:switching_station"}, nodenames = { "technic:switching_station" },
label = "Switching Station", -- allows the mtt profiler to profile this abm individually label = "Switching Station", -- allows the mtt profiler to profile this abm individually
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local meta1 = nil local meta1 = nil
local pos1 = {} local pos1 = {}
local PR_EU = 0 -- EUs from PR nodes local PR_EU = 0 -- EUs from PR nodes
local BA_PR_EU = 0 -- EUs from BA nodes (discharching) local BA_PR_EU = 0 -- EUs from BA nodes (discharching)
local BA_RE_EU = 0 -- EUs to BA nodes (charging) local BA_RE_EU = 0 -- EUs to BA nodes (charging)
local RE_EU = 0 -- EUs to RE nodes local RE_EU = 0 -- EUs to RE nodes
local tier = "" local tier = ""
local PR_nodes local PR_nodes
local BA_nodes local BA_nodes
local RE_nodes local RE_nodes
local machine_name = S("Switching Station") local machine_name = S("Switching Station")
-- Which kind of network are we on: -- Which kind of network are we on:
pos1 = {x=pos.x, y=pos.y-1, z=pos.z} pos1 = { x = pos.x, y = pos.y - 1, z = pos.z }
--Disable if necessary --Disable if necessary
if meta:get_int("active") ~= 1 then if meta:get_int("active") ~= 1 then
minetest.forceload_free_block(pos) minetest.forceload_free_block(pos)
minetest.forceload_free_block(pos1) minetest.forceload_free_block(pos1)
meta:set_string("infotext",S("%s Already Present"):format(machine_name)) meta:set_string("infotext", S("%s Already Present"):format(machine_name))
return return
end end
@ -275,9 +286,9 @@ minetest.register_abm({
run_nodes(BA_nodes, technic.battery) run_nodes(BA_nodes, technic.battery)
-- Strings for the meta data -- Strings for the meta data
local eu_demand_str = tier.."_EU_demand" local eu_demand_str = tier.."_EU_demand"
local eu_input_str = tier.."_EU_input" local eu_input_str = tier.."_EU_input"
local eu_supply_str = tier.."_EU_supply" local eu_supply_str = tier.."_EU_supply"
-- Distribute charge equally across multiple batteries. -- Distribute charge equally across multiple batteries.
local charge_total = 0 local charge_total = 0
@ -336,7 +347,7 @@ minetest.register_abm({
--dprint("Total BA demand:"..BA_eu_demand) --dprint("Total BA demand:"..BA_eu_demand)
meta:set_string("infotext", meta:set_string("infotext",
S("@1. Supply: @2 Demand: @3", S("@1. Supply: @2 Demand: @3",
machine_name, technic.pretty_num(PR_eu_supply), technic.pretty_num(RE_eu_demand))) machine_name, technic.pretty_num(PR_eu_supply), technic.pretty_num(RE_eu_demand)))
-- If mesecon signal and power supply or demand changed then -- If mesecon signal and power supply or demand changed then
@ -353,12 +364,12 @@ minetest.register_abm({
end end
-- Data that will be used by the power monitor -- Data that will be used by the power monitor
meta:set_int("supply",PR_eu_supply) meta:set_int("supply", PR_eu_supply)
meta:set_int("demand",RE_eu_demand) meta:set_int("demand", RE_eu_demand)
-- If the PR supply is enough for the RE demand supply them all -- If the PR supply is enough for the RE demand supply them all
if PR_eu_supply >= RE_eu_demand then if PR_eu_supply >= RE_eu_demand then
--dprint("PR_eu_supply"..PR_eu_supply.." >= RE_eu_demand"..RE_eu_demand) --dprint("PR_eu_supply"..PR_eu_supply.." >= RE_eu_demand"..RE_eu_demand)
for _, pos1 in pairs(RE_nodes) do for _, pos1 in pairs(RE_nodes) do
meta1 = minetest.get_meta(pos1) meta1 = minetest.get_meta(pos1)
local eu_demand = meta1:get_int(eu_demand_str) local eu_demand = meta1:get_int(eu_demand_str)
@ -384,7 +395,7 @@ minetest.register_abm({
if PR_eu_supply + BA_eu_supply >= RE_eu_demand then if PR_eu_supply + BA_eu_supply >= RE_eu_demand then
--dprint("PR_eu_supply "..PR_eu_supply.."+BA_eu_supply "..BA_eu_supply.." >= RE_eu_demand"..RE_eu_demand) --dprint("PR_eu_supply "..PR_eu_supply.."+BA_eu_supply "..BA_eu_supply.." >= RE_eu_demand"..RE_eu_demand)
for _, pos1 in pairs(RE_nodes) do for _, pos1 in pairs(RE_nodes) do
meta1 = minetest.get_meta(pos1) meta1 = minetest.get_meta(pos1)
local eu_demand = meta1:get_int(eu_demand_str) local eu_demand = meta1:get_int(eu_demand_str)
meta1:set_int(eu_input_str, eu_demand) meta1:set_int(eu_input_str, eu_demand)
end end
@ -394,7 +405,7 @@ minetest.register_abm({
if BA_eu_supply > 0 then if BA_eu_supply > 0 then
charge_factor = (PR_eu_supply - RE_eu_demand) / BA_eu_supply charge_factor = (PR_eu_supply - RE_eu_demand) / BA_eu_supply
end end
for n,pos1 in pairs(BA_nodes) do for n, pos1 in pairs(BA_nodes) do
meta1 = minetest.get_meta(pos1) meta1 = minetest.get_meta(pos1)
local eu_supply = meta1:get_int(eu_supply_str) local eu_supply = meta1:get_int(eu_supply_str)
meta1:set_int(eu_input_str, math.floor(eu_supply * charge_factor)) meta1:set_int(eu_input_str, math.floor(eu_supply * charge_factor))
@ -417,7 +428,6 @@ minetest.register_abm({
meta1 = minetest.get_meta(pos1) meta1 = minetest.get_meta(pos1)
meta1:set_int(eu_input_str, 0) meta1:set_int(eu_input_str, 0)
end end
end, end,
}) })
@ -435,10 +445,11 @@ local function switching_station_timeout_count(pos, tier)
return false return false
end end
end end
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:technic_machine"}, nodenames = { "group:technic_machine" },
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
for tier, machines in pairs(technic.machines) do for tier, machines in pairs(technic.machines) do
@ -461,17 +472,17 @@ minetest.register_abm({
--Re-enable disabled switching station if necessary, similar to the timeout above --Re-enable disabled switching station if necessary, similar to the timeout above
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:switching_station"}, nodenames = { "technic:switching_station" },
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local pos1 = {x=pos.x,y=pos.y-1,z=pos.z} local pos1 = { x = pos.x, y = pos.y - 1, z = pos.z }
local tier = technic.get_cable_tier(minetest.get_node(pos1).name) local tier = technic.get_cable_tier(minetest.get_node(pos1).name)
if not tier then return end if not tier then return end
if switching_station_timeout_count(pos, tier) then if switching_station_timeout_count(pos, tier) then
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int("active",1) meta:set_int("active", 1)
end end
end, end,
}) })

View File

@ -272,13 +272,13 @@ local function calculate_base_damage(node_pos, object_pos, strength)
local dist = vector.distance(node_pos, object_pos) local dist = vector.distance(node_pos, object_pos)
for ray_pos in technic.trace_node_ray(node_pos, for ray_pos in technic.trace_node_ray(node_pos,
vector.direction(node_pos, object_pos), dist) do vector.direction(node_pos, object_pos), dist) do
local shield_name = minetest.get_node(ray_pos).name local shield_name = minetest.get_node(ray_pos).name
shielding = shielding + node_radiation_resistance(shield_name) * 0.025 shielding = shielding + node_radiation_resistance(shield_name) * 0.025
end end
local dmg = (strength * strength) / local dmg = (strength * strength) /
(math.max(0.75, dist * dist) * math.exp(shielding)) (math.max(0.75, dist * dist) * math.exp(shielding))
if dmg < rad_dmg_cutoff then return end if dmg < rad_dmg_cutoff then return end
return dmg return dmg
@ -303,9 +303,9 @@ end
local function calculate_object_center(object) local function calculate_object_center(object)
if object:is_player() then if object:is_player() then
return {x=0, y=abdomen_offset, z=0} return { x = 0, y = abdomen_offset, z = 0 }
end end
return {x=0, y=0, z=0} return { x = 0, y = 0, z = 0 }
end end
local function dmg_object(pos, object, strength) local function dmg_object(pos, object, strength)
@ -337,7 +337,7 @@ local function dmg_abm(pos, node)
local strength = minetest.get_item_group(node.name, "radioactive") local strength = minetest.get_item_group(node.name, "radioactive")
local max_dist = strength * rad_dmg_mult_sqrt local max_dist = strength * rad_dmg_mult_sqrt
for _, o in pairs(minetest.get_objects_inside_radius(pos, for _, o in pairs(minetest.get_objects_inside_radius(pos,
max_dist + abdomen_offset)) do max_dist + abdomen_offset)) do
if entity_damage or o:is_player() then if entity_damage or o:is_player() then
dmg_object(pos, o, strength) dmg_object(pos, o, strength)
end end
@ -346,7 +346,7 @@ end
if minetest.setting_getbool("enable_damage") then if minetest.setting_getbool("enable_damage") then
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:radioactive"}, nodenames = { "group:radioactive" },
interval = 1, interval = 1,
chance = 1, chance = 1,
action = dmg_abm, action = dmg_abm,
@ -379,19 +379,21 @@ end
-- Radioactive materials that can result from destroying a reactor -- Radioactive materials that can result from destroying a reactor
local griefing = technic.config:get_bool("enable_corium_griefing") local griefing = technic.config:get_bool("enable_corium_griefing")
for _, state in pairs({"flowing", "source"}) do for _, state in pairs({ "flowing", "source" }) do
minetest.register_node("technic:corium_"..state, { minetest.register_node("technic:corium_"..state, {
description = S(state == "source" and "Corium Source" or "Flowing Corium"), description = S(state == "source" and "Corium Source" or "Flowing Corium"),
drawtype = (state == "source" and "liquid" or "flowingliquid"), drawtype = (state == "source" and "liquid" or "flowingliquid"),
[state == "source" and "tiles" or "special_tiles"] = {{ [state == "source" and "tiles" or "special_tiles"] = {
name = "technic_corium_"..state.."_animated.png", {
animation = { name = "technic_corium_"..state.."_animated.png",
type = "vertical_frames", animation = {
aspect_w = 16, type = "vertical_frames",
aspect_h = 16, aspect_w = 16,
length = 3.0, aspect_h = 16,
}, length = 3.0,
}}, },
}
},
paramtype = "light", paramtype = "light",
paramtype2 = (state == "flowing" and "flowingliquid" or nil), paramtype2 = (state == "flowing" and "flowingliquid" or nil),
light_source = (state == "source" and 8 or 5), light_source = (state == "source" and 8 or 5),
@ -407,7 +409,7 @@ for _, state in pairs({"flowing", "source"}) do
liquid_viscosity = LAVA_VISC, liquid_viscosity = LAVA_VISC,
liquid_renewable = false, liquid_renewable = false,
damage_per_second = 6, damage_per_second = 6,
post_effect_color = {a=192, r=80, g=160, b=80}, post_effect_color = { a = 192, r = 80, g = 160, b = 80 },
groups = { groups = {
liquid = 2, liquid = 2,
hot = 3, hot = 3,
@ -419,27 +421,25 @@ for _, state in pairs({"flowing", "source"}) do
end end
if rawget(_G, "bucket") and bucket.register_liquid then if rawget(_G, "bucket") and bucket.register_liquid then
bucket.register_liquid( bucket.register_liquid("technic:corium_source",
"technic:corium_source",
"technic:corium_flowing", "technic:corium_flowing",
"technic:bucket_corium", "technic:bucket_corium",
"technic_bucket_corium.png", "technic_bucket_corium.png",
"Corium Bucket" "Corium Bucket")
)
end end
minetest.register_node("technic:chernobylite_block", { minetest.register_node("technic:chernobylite_block", {
description = S("Chernobylite Block"), description = S("Chernobylite Block"),
tiles = {"technic_chernobylite_block.png"}, tiles = { "technic_chernobylite_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1, radioactive=4, level=2}, groups = { cracky = 1, radioactive = 4, level = 2 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
light_source = 2, light_source = 2,
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:water"}, nodenames = { "group:water" },
neighbors = {"technic:corium_source"}, neighbors = { "technic:corium_source" },
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node) action = function(pos, node)
@ -448,36 +448,36 @@ minetest.register_abm({
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:corium_flowing"}, nodenames = { "technic:corium_flowing" },
neighbors = {"group:water"}, neighbors = { "group:water" },
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node) action = function(pos, node)
minetest.set_node(pos, {name="technic:chernobylite_block"}) minetest.set_node(pos, { name = "technic:chernobylite_block" })
end, end,
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:corium_flowing"}, nodenames = { "technic:corium_flowing" },
interval = 5, interval = 5,
chance = (griefing and 10 or 1), chance = (griefing and 10 or 1),
action = function(pos, node) action = function(pos, node)
minetest.set_node(pos, {name="technic:chernobylite_block"}) minetest.set_node(pos, { name = "technic:chernobylite_block" })
end, end,
}) })
if griefing then if griefing then
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:corium_source", "technic:corium_flowing"}, nodenames = { "technic:corium_source", "technic:corium_flowing" },
interval = 4, interval = 4,
chance = 4, chance = 4,
action = function(pos, node) action = function(pos, node)
for _, offset in ipairs({ for _, offset in ipairs({
vector.new(1,0,0), vector.new(1, 0, 0),
vector.new(-1,0,0), vector.new(-1, 0, 0),
vector.new(0,0,1), vector.new(0, 0, 1),
vector.new(0,0,-1), vector.new(0, 0, -1),
vector.new(0,-1,0), vector.new(0, -1, 0),
}) do }) do
if math.random(8) == 1 then if math.random(8) == 1 then
minetest.dig_node(vector.add(pos, offset)) minetest.dig_node(vector.add(pos, offset))

View File

@ -4,9 +4,9 @@
technic.receiver = "RE" technic.receiver = "RE"
technic.producer = "PR" technic.producer = "PR"
technic.producer_receiver = "PR_RE" technic.producer_receiver = "PR_RE"
technic.battery = "BA" technic.battery = "BA"
technic.machines = {} technic.machines = {}
technic.power_tools = {} technic.power_tools = {}
technic.networks = {} technic.networks = {}

View File

@ -63,7 +63,7 @@ function technic.register_can(d)
minetest.log("action", user:get_player_name().." tried to place "..data.liquid_source_name.." at protected position "..minetest.pos_to_string(pos).." with a "..data.can_name) minetest.log("action", user:get_player_name().." tried to place "..data.liquid_source_name.." at protected position "..minetest.pos_to_string(pos).." with a "..data.can_name)
return return
end end
minetest.set_node(pos, {name=data.liquid_source_name}) minetest.set_node(pos, { name = data.liquid_source_name })
charge = charge - 1 charge = charge - 1
itemstack:set_metadata(tostring(charge)) itemstack:set_metadata(tostring(charge))
set_can_wear(itemstack, charge, data.can_capacity) set_can_wear(itemstack, charge, data.can_capacity)
@ -89,9 +89,9 @@ technic.register_can({
minetest.register_craft({ minetest.register_craft({
output = 'technic:water_can 1', output = 'technic:water_can 1',
recipe = { recipe = {
{'technic:zinc_ingot', 'technic:rubber','technic:zinc_ingot'}, { "technic:zinc_ingot", "technic:rubber", "technic:zinc_ingot" },
{'technic:carbon_steel_ingot', '', 'technic:carbon_steel_ingot'}, { "technic:carbon_steel_ingot", "", "technic:carbon_steel_ingot" },
{'technic:zinc_ingot', 'technic:carbon_steel_ingot', 'technic:zinc_ingot'}, { "technic:zinc_ingot", "technic:carbon_steel_ingot", "technic:zinc_ingot" },
} }
}) })
@ -107,8 +107,8 @@ technic.register_can({
minetest.register_craft({ minetest.register_craft({
output = 'technic:lava_can 1', output = 'technic:lava_can 1',
recipe = { recipe = {
{'technic:zinc_ingot', 'technic:stainless_steel_ingot','technic:zinc_ingot'}, { "technic:zinc_ingot", "technic:stainless_steel_ingot", "technic:zinc_ingot" },
{'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "", "technic:stainless_steel_ingot" },
{'technic:zinc_ingot', 'technic:stainless_steel_ingot', 'technic:zinc_ingot'}, { "technic:zinc_ingot", "technic:stainless_steel_ingot", "technic:zinc_ingot" },
} }
}) })

View File

@ -1,6 +1,6 @@
-- Configuration -- Configuration
local chainsaw_max_charge = 30000 -- Maximum charge of the saw local chainsaw_max_charge = 30000 -- Maximum charge of the saw
-- Gives 2500 nodes on a single charge (about 50 complete normal trees) -- Gives 2500 nodes on a single charge (about 50 complete normal trees)
local chainsaw_charge_per_node = 12 local chainsaw_charge_per_node = 12
-- Cut down tree leaves. Leaf decay may cause slowness on large trees -- Cut down tree leaves. Leaf decay may cause slowness on large trees
@ -10,13 +10,13 @@ local chainsaw_leaves = true
-- The default trees -- The default trees
local timber_nodenames = { local timber_nodenames = {
["default:acacia_tree"] = true, ["default:acacia_tree"] = true,
["default:aspen_tree"] = true, ["default:aspen_tree"] = true,
["default:jungletree"] = true, ["default:jungletree"] = true,
["default:papyrus"] = true, ["default:papyrus"] = true,
["default:cactus"] = true, ["default:cactus"] = true,
["default:tree"] = true, ["default:tree"] = true,
["default:apple"] = true, ["default:apple"] = true,
["default:pine_tree"] = true, ["default:pine_tree"] = true,
} }
if chainsaw_leaves then if chainsaw_leaves then
@ -31,7 +31,7 @@ end
if minetest.get_modpath("technic_worldgen") or if minetest.get_modpath("technic_worldgen") or
minetest.get_modpath("moretrees") then minetest.get_modpath("moretrees") then
timber_nodenames["moretrees:rubber_tree_trunk_empty"] = true timber_nodenames["moretrees:rubber_tree_trunk_empty"] = true
timber_nodenames["moretrees:rubber_tree_trunk"] = true timber_nodenames["moretrees:rubber_tree_trunk"] = true
if chainsaw_leaves then if chainsaw_leaves then
timber_nodenames["moretrees:rubber_tree_leaves"] = true timber_nodenames["moretrees:rubber_tree_leaves"] = true
end end
@ -39,60 +39,60 @@ end
-- Support moretrees if it is there -- Support moretrees if it is there
if minetest.get_modpath("moretrees") then if minetest.get_modpath("moretrees") then
timber_nodenames["moretrees:acacia_trunk"] = true timber_nodenames["moretrees:acacia_trunk"] = true
timber_nodenames["moretrees:apple_tree_trunk"] = true timber_nodenames["moretrees:apple_tree_trunk"] = true
timber_nodenames["moretrees:beech_trunk"] = true timber_nodenames["moretrees:beech_trunk"] = true
timber_nodenames["moretrees:birch_trunk"] = true timber_nodenames["moretrees:birch_trunk"] = true
timber_nodenames["moretrees:fir_trunk"] = true timber_nodenames["moretrees:fir_trunk"] = true
timber_nodenames["moretrees:oak_trunk"] = true timber_nodenames["moretrees:oak_trunk"] = true
timber_nodenames["moretrees:palm_trunk"] = true timber_nodenames["moretrees:palm_trunk"] = true
timber_nodenames["moretrees:pine_trunk"] = true timber_nodenames["moretrees:pine_trunk"] = true
timber_nodenames["moretrees:sequoia_trunk"] = true timber_nodenames["moretrees:sequoia_trunk"] = true
timber_nodenames["moretrees:spruce_trunk"] = true timber_nodenames["moretrees:spruce_trunk"] = true
timber_nodenames["moretrees:willow_trunk"] = true timber_nodenames["moretrees:willow_trunk"] = true
timber_nodenames["moretrees:jungletree_trunk"] = true timber_nodenames["moretrees:jungletree_trunk"] = true
if chainsaw_leaves then if chainsaw_leaves then
timber_nodenames["moretrees:acacia_leaves"] = true timber_nodenames["moretrees:acacia_leaves"] = true
timber_nodenames["moretrees:apple_tree_leaves"] = true timber_nodenames["moretrees:apple_tree_leaves"] = true
timber_nodenames["moretrees:oak_leaves"] = true timber_nodenames["moretrees:oak_leaves"] = true
timber_nodenames["moretrees:fir_leaves"] = true timber_nodenames["moretrees:fir_leaves"] = true
timber_nodenames["moretrees:fir_leaves_bright"] = true timber_nodenames["moretrees:fir_leaves_bright"] = true
timber_nodenames["moretrees:sequoia_leaves"] = true timber_nodenames["moretrees:sequoia_leaves"] = true
timber_nodenames["moretrees:birch_leaves"] = true timber_nodenames["moretrees:birch_leaves"] = true
timber_nodenames["moretrees:birch_leaves"] = true timber_nodenames["moretrees:birch_leaves"] = true
timber_nodenames["moretrees:palm_leaves"] = true timber_nodenames["moretrees:palm_leaves"] = true
timber_nodenames["moretrees:spruce_leaves"] = true timber_nodenames["moretrees:spruce_leaves"] = true
timber_nodenames["moretrees:spruce_leaves"] = true timber_nodenames["moretrees:spruce_leaves"] = true
timber_nodenames["moretrees:pine_leaves"] = true timber_nodenames["moretrees:pine_leaves"] = true
timber_nodenames["moretrees:willow_leaves"] = true timber_nodenames["moretrees:willow_leaves"] = true
timber_nodenames["moretrees:jungletree_leaves_green"] = true timber_nodenames["moretrees:jungletree_leaves_green"] = true
timber_nodenames["moretrees:jungletree_leaves_yellow"] = true timber_nodenames["moretrees:jungletree_leaves_yellow"] = true
timber_nodenames["moretrees:jungletree_leaves_red"] = true timber_nodenames["moretrees:jungletree_leaves_red"] = true
timber_nodenames["moretrees:acorn"] = true timber_nodenames["moretrees:acorn"] = true
timber_nodenames["moretrees:coconut"] = true timber_nodenames["moretrees:coconut"] = true
timber_nodenames["moretrees:spruce_cone"] = true timber_nodenames["moretrees:spruce_cone"] = true
timber_nodenames["moretrees:pine_cone"] = true timber_nodenames["moretrees:pine_cone"] = true
timber_nodenames["moretrees:fir_cone"] = true timber_nodenames["moretrees:fir_cone"] = true
timber_nodenames["moretrees:apple_blossoms"] = true timber_nodenames["moretrees:apple_blossoms"] = true
end end
end end
-- Support growing_trees -- Support growing_trees
if minetest.get_modpath("growing_trees") then if minetest.get_modpath("growing_trees") then
timber_nodenames["growing_trees:trunk"] = true timber_nodenames["growing_trees:trunk"] = true
timber_nodenames["growing_trees:medium_trunk"] = true timber_nodenames["growing_trees:medium_trunk"] = true
timber_nodenames["growing_trees:big_trunk"] = true timber_nodenames["growing_trees:big_trunk"] = true
timber_nodenames["growing_trees:trunk_top"] = true timber_nodenames["growing_trees:trunk_top"] = true
timber_nodenames["growing_trees:trunk_sprout"] = true timber_nodenames["growing_trees:trunk_sprout"] = true
timber_nodenames["growing_trees:branch_sprout"] = true timber_nodenames["growing_trees:branch_sprout"] = true
timber_nodenames["growing_trees:branch"] = true timber_nodenames["growing_trees:branch"] = true
timber_nodenames["growing_trees:branch_xmzm"] = true timber_nodenames["growing_trees:branch_xmzm"] = true
timber_nodenames["growing_trees:branch_xpzm"] = true timber_nodenames["growing_trees:branch_xpzm"] = true
timber_nodenames["growing_trees:branch_xmzp"] = true timber_nodenames["growing_trees:branch_xmzp"] = true
timber_nodenames["growing_trees:branch_xpzp"] = true timber_nodenames["growing_trees:branch_xpzp"] = true
timber_nodenames["growing_trees:branch_zz"] = true timber_nodenames["growing_trees:branch_zz"] = true
timber_nodenames["growing_trees:branch_xx"] = true timber_nodenames["growing_trees:branch_xx"] = true
if chainsaw_leaves then if chainsaw_leaves then
timber_nodenames["growing_trees:leaves"] = true timber_nodenames["growing_trees:leaves"] = true
@ -101,31 +101,31 @@ end
-- Support growing_cactus -- Support growing_cactus
if minetest.get_modpath("growing_cactus") then if minetest.get_modpath("growing_cactus") then
timber_nodenames["growing_cactus:sprout"] = true timber_nodenames["growing_cactus:sprout"] = true
timber_nodenames["growing_cactus:branch_sprout_vertical"] = true timber_nodenames["growing_cactus:branch_sprout_vertical"] = true
timber_nodenames["growing_cactus:branch_sprout_vertical_fixed"] = true timber_nodenames["growing_cactus:branch_sprout_vertical_fixed"] = true
timber_nodenames["growing_cactus:branch_sprout_xp"] = true timber_nodenames["growing_cactus:branch_sprout_xp"] = true
timber_nodenames["growing_cactus:branch_sprout_xm"] = true timber_nodenames["growing_cactus:branch_sprout_xm"] = true
timber_nodenames["growing_cactus:branch_sprout_zp"] = true timber_nodenames["growing_cactus:branch_sprout_zp"] = true
timber_nodenames["growing_cactus:branch_sprout_zm"] = true timber_nodenames["growing_cactus:branch_sprout_zm"] = true
timber_nodenames["growing_cactus:trunk"] = true timber_nodenames["growing_cactus:trunk"] = true
timber_nodenames["growing_cactus:branch_trunk"] = true timber_nodenames["growing_cactus:branch_trunk"] = true
timber_nodenames["growing_cactus:branch"] = true timber_nodenames["growing_cactus:branch"] = true
timber_nodenames["growing_cactus:branch_xp"] = true timber_nodenames["growing_cactus:branch_xp"] = true
timber_nodenames["growing_cactus:branch_xm"] = true timber_nodenames["growing_cactus:branch_xm"] = true
timber_nodenames["growing_cactus:branch_zp"] = true timber_nodenames["growing_cactus:branch_zp"] = true
timber_nodenames["growing_cactus:branch_zm"] = true timber_nodenames["growing_cactus:branch_zm"] = true
timber_nodenames["growing_cactus:branch_zz"] = true timber_nodenames["growing_cactus:branch_zz"] = true
timber_nodenames["growing_cactus:branch_xx"] = true timber_nodenames["growing_cactus:branch_xx"] = true
end end
-- Support farming_plus -- Support farming_plus
if minetest.get_modpath("farming_plus") then if minetest.get_modpath("farming_plus") then
if chainsaw_leaves then if chainsaw_leaves then
timber_nodenames["farming_plus:banana_leaves"] = true timber_nodenames["farming_plus:banana_leaves"] = true
timber_nodenames["farming_plus:banana"] = true timber_nodenames["farming_plus:banana"] = true
timber_nodenames["farming_plus:cocoa_leaves"] = true timber_nodenames["farming_plus:cocoa_leaves"] = true
timber_nodenames["farming_plus:cocoa"] = true timber_nodenames["farming_plus:cocoa"] = true
end end
end end
@ -299,8 +299,11 @@ end
local function chainsaw_dig(pos, current_charge) local function chainsaw_dig(pos, current_charge)
-- Start sawing things down -- Start sawing things down
local remaining_charge = recursive_dig(pos, current_charge) local remaining_charge = recursive_dig(pos, current_charge)
minetest.sound_play("chainsaw", {pos = pos, gain = 1.0, minetest.sound_play("chainsaw", {
max_hear_distance = 10}) pos = pos,
gain = 1.0,
max_hear_distance = 10
})
-- Now drop items for the player -- Now drop items for the player
for name, stack in pairs(produced) do for name, stack in pairs(produced) do
@ -362,9 +365,9 @@ local trigger = mesecons_button and "mesecons_button:button_off" or "default:mes
minetest.register_craft({ minetest.register_craft({
output = "technic:chainsaw", output = "technic:chainsaw",
recipe = { recipe = {
{"technic:stainless_steel_ingot", trigger, "technic:battery"}, { "technic:stainless_steel_ingot", trigger, "technic:battery" },
{"technic:fine_copper_wire", "technic:motor", "technic:battery"}, { "technic:fine_copper_wire", "technic:motor", "technic:battery" },
{"", "", "technic:stainless_steel_ingot"}, { "", "", "technic:stainless_steel_ingot" },
} }
}) })

View File

@ -20,9 +20,9 @@ minetest.register_tool("technic:flashlight", {
minetest.register_craft({ minetest.register_craft({
output = "technic:flashlight", output = "technic:flashlight",
recipe = { recipe = {
{"technic:rubber", "default:glass", "technic:rubber"}, { "technic:rubber", "default:glass", "technic:rubber" },
{"technic:stainless_steel_ingot", "technic:battery", "technic:stainless_steel_ingot"}, { "technic:stainless_steel_ingot", "technic:battery", "technic:stainless_steel_ingot" },
{"", "technic:battery", ""} { "", "technic:battery", "" }
} }
}) })
@ -97,7 +97,7 @@ minetest.register_globalstep(function(dtime)
elseif (player_moved or not was_wielding[player_name]) and flashlight_weared then elseif (player_moved or not was_wielding[player_name]) and flashlight_weared then
local node = minetest.get_node_or_nil(rounded_pos) local node = minetest.get_node_or_nil(rounded_pos)
if node and node.name == "air" then if node and node.name == "air" then
minetest.set_node(rounded_pos, {name="technic:light"}) minetest.set_node(rounded_pos, { name = "technic:light" })
end end
local node = minetest.get_node_or_nil(old_pos) local node = minetest.get_node_or_nil(old_pos)
if node and node.name == "technic:light" then if node and node.name == "technic:light" then
@ -111,9 +111,9 @@ end)
minetest.register_node("technic:light", { minetest.register_node("technic:light", {
drawtype = "glasslike", drawtype = "glasslike",
tiles = {"technic_light.png"}, tiles = { "technic_light.png" },
paramtype = "light", paramtype = "light",
groups = {not_in_creative_inventory=1}, groups = { not_in_creative_inventory = 1 },
drop = "", drop = "",
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,

View File

@ -1,141 +1,141 @@
local max_charge = {50000, 200000, 650000} local max_charge = { 50000, 200000, 650000 }
local power_usage_per_node = {200, 500, 800} local power_usage_per_node = { 200, 500, 800 }
local S = technic.getter local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:mining_drill', output = "technic:mining_drill",
recipe = { recipe = {
{'moreores:tin_ingot', 'technic:diamond_drill_head', 'moreores:tin_ingot'}, { "moreores:tin_ingot", "technic:diamond_drill_head", "moreores:tin_ingot" },
{'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:motor", "technic:stainless_steel_ingot" },
{'', 'technic:red_energy_crystal', 'default:copper_ingot'}, { "", "technic:red_energy_crystal", "default:copper_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:mining_drill_mk2', output = "technic:mining_drill_mk2",
recipe = { recipe = {
{'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head'}, { "technic:diamond_drill_head", "technic:diamond_drill_head", "technic:diamond_drill_head" },
{'technic:stainless_steel_ingot', 'technic:mining_drill', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mining_drill", "technic:stainless_steel_ingot" },
{'', 'technic:green_energy_crystal', ''}, { "", "technic:green_energy_crystal", "" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:mining_drill_mk3', output = "technic:mining_drill_mk3",
recipe = { recipe = {
{'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head'}, { "technic:diamond_drill_head", "technic:diamond_drill_head", "technic:diamond_drill_head" },
{'technic:stainless_steel_ingot', 'technic:mining_drill_mk2', 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mining_drill_mk2", "technic:stainless_steel_ingot" },
{'', 'technic:blue_energy_crystal', ''}, { "", "technic:blue_energy_crystal", "" },
} }
}) })
for i = 1, 4 do for i = 1, 4 do
minetest.register_craft({ minetest.register_craft({
output = 'technic:mining_drill_mk3', output = "technic:mining_drill_mk3",
recipe = { recipe = {
{'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head'}, { "technic:diamond_drill_head", "technic:diamond_drill_head", "technic:diamond_drill_head" },
{'technic:stainless_steel_ingot', 'technic:mining_drill_mk2_'..i, 'technic:stainless_steel_ingot'}, { "technic:stainless_steel_ingot", "technic:mining_drill_mk2_"..i, "technic:stainless_steel_ingot" },
{'', 'technic:blue_energy_crystal', ''}, { "", "technic:blue_energy_crystal", "" },
} }
}) })
end end
local mining_drill_mode_text = { local mining_drill_mode_text = {
{S("Single node.")}, { S("Single node.") },
{S("3 nodes deep.")}, { S("3 nodes deep.") },
{S("3 nodes wide.")}, { S("3 nodes wide.") },
{S("3 nodes tall.")}, { S("3 nodes tall.") },
{S("3x3 nodes.")}, { S("3x3 nodes.") },
} }
local function drill_dig_it0 (pos,player) local function drill_dig_it0(pos, player)
if minetest.is_protected(pos, player:get_player_name()) then if minetest.is_protected(pos, player:get_player_name()) then
minetest.record_protection_violation(pos, player:get_player_name()) minetest.record_protection_violation(pos, player:get_player_name())
return return
end end
local node=minetest.get_node(pos) local node = minetest.get_node(pos)
if node.name == "air" or node.name == "ignore" then return end if node.name == "air" or node.name == "ignore" then return end
if node.name == "default:lava_source" then return end if node.name == "default:lava_source" then return end
if node.name == "default:lava_flowing" then return end if node.name == "default:lava_flowing" then return end
if node.name == "default:water_source" then minetest.remove_node(pos) return end if node.name == "default:water_source" then minetest.remove_node(pos) return end
if node.name == "default:water_flowing" then minetest.remove_node(pos) return end if node.name == "default:water_flowing" then minetest.remove_node(pos) return end
minetest.node_dig(pos,node,player) minetest.node_dig(pos, node, player)
end end
local function drill_dig_it1 (player) local function drill_dig_it1(player)
local dir=player:get_look_dir() local dir = player:get_look_dir()
if math.abs(dir.x)>math.abs(dir.z) then if math.abs(dir.x) > math.abs(dir.z) then
if dir.x>0 then return 0 end if dir.x > 0 then return 0 end
return 1 return 1
end end
if dir.z>0 then return 2 end if dir.z > 0 then return 2 end
return 3 return 3
end end
local function drill_dig_it2 (pos,player) local function drill_dig_it2(pos, player)
pos.y=pos.y+1 pos.y = pos.y + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z+1 pos.z = pos.z + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z-2 pos.z = pos.z - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z+1 pos.z = pos.z + 1
pos.y=pos.y-1 pos.y = pos.y - 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z+1 pos.z = pos.z + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z-2 pos.z = pos.z - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z+1 pos.z = pos.z + 1
pos.y=pos.y-1 pos.y = pos.y - 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z+1 pos.z = pos.z + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z-2 pos.z = pos.z - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
end end
local function drill_dig_it3 (pos,player) local function drill_dig_it3(pos, player)
pos.y=pos.y+1 pos.y = pos.y + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x-2 pos.x = pos.x - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
pos.y=pos.y-1 pos.y = pos.y - 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x-2 pos.x = pos.x - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
pos.y=pos.y-1 pos.y = pos.y - 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x-2 pos.x = pos.x - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
end end
local function drill_dig_it4 (pos,player) local function drill_dig_it4(pos, player)
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x-2 pos.x = pos.x - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
pos.z=pos.z+1 pos.z = pos.z + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x-2 pos.x = pos.x - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
pos.z=pos.z-2 pos.z = pos.z - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x-2 pos.x = pos.x - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
end end
local function cost_to_use(drill_type, mode) local function cost_to_use(drill_type, mode)
@ -164,71 +164,71 @@ local function drill_dig_it(pos, player, mode)
pos.x = pos.x + 1 pos.x = pos.x + 1
drill_dig_it0(pos, player) drill_dig_it0(pos, player)
end end
if dir == 1 then -- x- if dir == 1 then -- x-
drill_dig_it0(pos, player)
pos.x = pos.x - 1
drill_dig_it0(pos, player)
pos.x = pos.x - 1
drill_dig_it0(pos, player) drill_dig_it0(pos, player)
pos.x=pos.x-1
drill_dig_it0 (pos,player)
pos.x=pos.x-1
drill_dig_it0 (pos,player)
end end
if dir==2 then -- z+ if dir == 2 then -- z+
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z+1 pos.z = pos.z + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z+1 pos.z = pos.z + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
end end
if dir==3 then -- z- if dir == 3 then -- z-
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z-1 pos.z = pos.z - 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z-1 pos.z = pos.z - 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
end end
end end
if mode==3 then -- 3 wide if mode == 3 then -- 3 wide
dir=drill_dig_it1(player) dir = drill_dig_it1(player)
if dir==0 or dir==1 then -- x if dir == 0 or dir == 1 then -- x
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z+1 pos.z = pos.z + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.z=pos.z-2 pos.z = pos.z - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
end end
if dir==2 or dir==3 then -- z if dir == 2 or dir == 3 then -- z
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x+1 pos.x = pos.x + 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.x=pos.x-2 pos.x = pos.x - 2
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
end end
end end
if mode==4 then -- 3 tall, selected in the middle if mode == 4 then -- 3 tall, selected in the middle
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.y=pos.y-1 pos.y = pos.y - 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
pos.y=pos.y-1 pos.y = pos.y - 1
drill_dig_it0 (pos,player) drill_dig_it0(pos, player)
end end
if mode==5 then -- 3 x 3 if mode == 5 then -- 3 x 3
local dir=player:get_look_dir() local dir = player:get_look_dir()
if math.abs(dir.y)<0.5 then if math.abs(dir.y) < 0.5 then
dir=drill_dig_it1(player) dir = drill_dig_it1(player)
if dir==0 or dir==1 then -- x if dir == 0 or dir == 1 then -- x
drill_dig_it2(pos,player) drill_dig_it2(pos, player)
end end
if dir==2 or dir==3 then -- z if dir == 2 or dir == 3 then -- z
drill_dig_it3(pos,player) drill_dig_it3(pos, player)
end end
else else
drill_dig_it4(pos,player) drill_dig_it4(pos, player)
end end
end end
minetest.sound_play("mining_drill", {pos = pos, gain = 1.0, max_hear_distance = 10,}) minetest.sound_play("mining_drill", { pos = pos, gain = 1.0, max_hear_distance = 10, })
end end
local function pos_is_pointable(pos) local function pos_is_pointable(pos)
@ -237,49 +237,49 @@ local function pos_is_pointable(pos)
return nodedef and nodedef.pointable return nodedef and nodedef.pointable
end end
local function mining_drill_mk2_setmode(user,itemstack) local function mining_drill_mk2_setmode(user, itemstack)
local player_name=user:get_player_name() local player_name = user:get_player_name()
local item=itemstack:to_table() local item = itemstack:to_table()
local meta=minetest.deserialize(item["metadata"]) local meta = minetest.deserialize(item["metadata"])
if meta==nil then if meta == nil then
meta={} meta = {}
mode=0 mode = 0
end end
if meta["mode"]==nil then if meta["mode"] == nil then
minetest.chat_send_player(player_name, S("Use while sneaking to change Mining Drill Mk%d modes."):format(2)) minetest.chat_send_player(player_name, S("Use while sneaking to change Mining Drill Mk%d modes."):format(2))
meta["mode"]=0 meta["mode"] = 0
mode=0 mode = 0
end end
mode=(meta["mode"]) mode = (meta["mode"])
mode=mode+1 mode = mode + 1
if mode>=5 then mode=1 end if mode >= 5 then mode = 1 end
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(2, mode)..": "..mining_drill_mode_text[mode][1]) minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(2, mode)..": "..mining_drill_mode_text[mode][1])
itemstack:set_name("technic:mining_drill_mk2_"..mode); itemstack:set_name("technic:mining_drill_mk2_"..mode);
meta["mode"]=mode meta["mode"] = mode
itemstack:set_metadata(minetest.serialize(meta)) itemstack:set_metadata(minetest.serialize(meta))
return itemstack return itemstack
end end
local function mining_drill_mk3_setmode(user,itemstack) local function mining_drill_mk3_setmode(user, itemstack)
local player_name=user:get_player_name() local player_name = user:get_player_name()
local item=itemstack:to_table() local item = itemstack:to_table()
local meta=minetest.deserialize(item["metadata"]) local meta = minetest.deserialize(item["metadata"])
if meta==nil then if meta == nil then
meta={} meta = {}
mode=0 mode = 0
end end
if meta["mode"]==nil then if meta["mode"] == nil then
minetest.chat_send_player(player_name, S("Use while sneaking to change Mining Drill Mk%d modes."):format(3)) minetest.chat_send_player(player_name, S("Use while sneaking to change Mining Drill Mk%d modes."):format(3))
meta["mode"]=0 meta["mode"] = 0
mode=0 mode = 0
end end
mode=(meta["mode"]) mode = (meta["mode"])
mode=mode+1 mode = mode + 1
if mode>=6 then mode=1 end if mode >= 6 then mode = 1 end
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(3, mode)..": "..mining_drill_mode_text[mode][1]) minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(3, mode)..": "..mining_drill_mode_text[mode][1])
itemstack:set_name("technic:mining_drill_mk3_"..mode); itemstack:set_name("technic:mining_drill_mk3_"..mode);
meta["mode"]=mode meta["mode"] = mode
itemstack:set_metadata(minetest.serialize(meta)) itemstack:set_metadata(minetest.serialize(meta))
return itemstack return itemstack
end end
@ -381,7 +381,7 @@ for i = 1, 4 do
wield_image = "technic_mining_drill_mk2.png", wield_image = "technic_mining_drill_mk2.png",
wear_represents = "technic_RE_charge", wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge, on_refill = technic.refill_RE_charge,
groups = {not_in_creative_inventory=1}, groups = { not_in_creative_inventory = 1 },
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
mining_drill_mk2_handler(itemstack, user, pointed_thing) mining_drill_mk2_handler(itemstack, user, pointed_thing)
return itemstack return itemstack
@ -395,14 +395,14 @@ minetest.register_tool("technic:mining_drill_mk3", {
wear_represents = "technic_RE_charge", wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge, on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
mining_drill_mk3_handler(itemstack,user,pointed_thing) mining_drill_mk3_handler(itemstack, user, pointed_thing)
return itemstack return itemstack
end, end,
}) })
technic.register_power_tool("technic:mining_drill_mk3", max_charge[3]) technic.register_power_tool("technic:mining_drill_mk3", max_charge[3])
for i=1,5,1 do for i = 1, 5, 1 do
technic.register_power_tool("technic:mining_drill_mk3_"..i, max_charge[3]) technic.register_power_tool("technic:mining_drill_mk3_"..i, max_charge[3])
minetest.register_tool("technic:mining_drill_mk3_"..i, { minetest.register_tool("technic:mining_drill_mk3_"..i, {
description = S("Mining Drill Mk%d Mode %d"):format(3, i), description = S("Mining Drill Mk%d Mode %d"):format(3, i),
@ -410,10 +410,10 @@ for i=1,5,1 do
wield_image = "technic_mining_drill_mk3.png", wield_image = "technic_mining_drill_mk3.png",
wear_represents = "technic_RE_charge", wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge, on_refill = technic.refill_RE_charge,
groups = {not_in_creative_inventory=1}, groups = { not_in_creative_inventory = 1 },
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
mining_drill_mk3_handler(itemstack,user,pointed_thing) mining_drill_mk3_handler(itemstack, user, pointed_thing)
return itemstack return itemstack
end, end,
}) })
end end

View File

@ -1,34 +1,34 @@
local mining_lasers_list = { local mining_lasers_list = {
-- {<num>, <range of the laser shots>, <max_charge>, <charge_per_shot>}, -- {<num>, <range of the laser shots>, <max_charge>, <charge_per_shot>},
{"1", 7, 50000, 1000}, { "1", 7, 50000, 1000 },
{"2", 14, 200000, 2000}, { "2", 14, 200000, 2000 },
{"3", 21, 650000, 3000}, { "3", 21, 650000, 3000 },
} }
local S = technic.getter local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:laser_mk1', output = "technic:laser_mk1",
recipe = { recipe = {
{'default:diamond', 'technic:brass_ingot', 'default:obsidian_glass'}, { "default:diamond", "technic:brass_ingot", "default:obsidian_glass" },
{'', 'technic:brass_ingot', 'technic:red_energy_crystal'}, { "", "technic:brass_ingot", "technic:red_energy_crystal" },
{'', '', 'default:copper_ingot'}, { "", "", "default:copper_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:laser_mk2', output = "technic:laser_mk2",
recipe = { recipe = {
{'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk1'}, { "default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk1" },
{'', 'technic:carbon_steel_ingot', 'technic:green_energy_crystal'}, { "", "technic:carbon_steel_ingot", "technic:green_energy_crystal" },
{'', '', 'default:copper_ingot'}, { "", "", "default:copper_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:laser_mk3', output = "technic:laser_mk3",
recipe = { recipe = {
{'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk2'}, { "default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk2" },
{'', 'technic:carbon_steel_ingot', 'technic:blue_energy_crystal'}, { "", "technic:carbon_steel_ingot", "technic:blue_energy_crystal" },
{'', '', 'default:copper_ingot'}, { "", "", "default:copper_ingot" },
} }
}) })
@ -38,11 +38,11 @@ local function laser_node(pos, node, player)
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.add_particle({ minetest.add_particle({
pos = pos, pos = pos,
velocity = {x=0, y=2, z=0}, velocity = { x = 0, y = 2, z = 0 },
acceleration = {x=0, y=-1, z=0}, acceleration = { x = 0, y = -1, z = 0 },
expirationtime = 1.5, expirationtime = 1.5,
size = 6 + math.random() * 2, size = 6 + math.random() * 2,
texture = "smoke_puff.png^[transform" .. math.random(0, 7), texture = "smoke_puff.png^[transform"..math.random(0, 7),
}) })
return return
end end
@ -68,9 +68,9 @@ local function laser_shoot(player, range, particle_texture, sound)
acceleration = vector.multiply(dir, 50), acceleration = vector.multiply(dir, 50),
expirationtime = range / 11, expirationtime = range / 11,
size = 1, size = 1,
texture = particle_texture .. "^[transform" .. math.random(0, 7), texture = particle_texture.."^[transform"..math.random(0, 7),
}) })
minetest.sound_play(sound, {pos = player_pos, max_hear_distance = range}) minetest.sound_play(sound, { pos = player_pos, max_hear_distance = range })
for pos in technic.trace_node_ray_fat(start_pos, dir, range) do for pos in technic.trace_node_ray_fat(start_pos, dir, range) do
if minetest.is_protected(pos, player_name) then if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name) minetest.record_protection_violation(pos, player_name)

View File

@ -35,13 +35,13 @@ minetest.register_tool("technic:prospector", {
end end
local start_pos = pointed_thing.under local start_pos = pointed_thing.under
local forward = minetest.facedir_to_dir(minetest.dir_to_facedir(user:get_look_dir(), true)) local forward = minetest.facedir_to_dir(minetest.dir_to_facedir(user:get_look_dir(), true))
local right = forward.x ~= 0 and { x=0, y=1, z=0 } or (forward.y ~= 0 and { x=0, y=0, z=1 } or { x=1, y=0, z=0 }) local right = forward.x ~= 0 and { x = 0, y = 1, z = 0 } or (forward.y ~= 0 and { x = 0, y = 0, z = 1 } or { x = 1, y = 0, z = 0 })
local up = forward.x ~= 0 and { x=0, y=0, z=1 } or (forward.y ~= 0 and { x=1, y=0, z=0 } or { x=0, y=1, z=0 }) local up = forward.x ~= 0 and { x = 0, y = 0, z = 1 } or (forward.y ~= 0 and { x = 1, y = 0, z = 0 } or { x = 0, y = 1, z = 0 })
local base_pos = vector.add(start_pos, vector.multiply(vector.add(right, up), - toolmeta.look_radius)) local base_pos = vector.add(start_pos, vector.multiply(vector.add(right, up), -toolmeta.look_radius))
local found = false local found = false
for f = 0, toolmeta.look_depth-1 do for f = 0, toolmeta.look_depth - 1 do
for r = 0, look_diameter-1 do for r = 0, look_diameter - 1 do
for u = 0, look_diameter-1 do for u = 0, look_diameter - 1 do
if minetest.get_node(vector.add(vector.add(vector.add(base_pos, vector.multiply(forward, f)), vector.multiply(right, r)), vector.multiply(up, u))).name == toolmeta.target then found = true end if minetest.get_node(vector.add(vector.add(vector.add(base_pos, vector.multiply(forward, f)), vector.multiply(right, r)), vector.multiply(up, u))).name == toolmeta.target then found = true end
end end
end end
@ -65,39 +65,39 @@ minetest.register_tool("technic:prospector", {
local look_diameter = toolmeta.look_radius * 2 + 1 local look_diameter = toolmeta.look_radius * 2 + 1
minetest.show_formspec(user:get_player_name(), "technic:prospector_control", minetest.show_formspec(user:get_player_name(), "technic:prospector_control",
"size[7,8.5]".. "size[7,8.5]"..
"item_image[0,0;1,1;"..toolstack:get_name().."]".. "item_image[0,0;1,1;"..toolstack:get_name().."]"..
"label[1,0;"..minetest.formspec_escape(toolstack:get_definition().description).."]".. "label[1,0;"..minetest.formspec_escape(toolstack:get_definition().description).."]"..
(toolmeta.target ~= "" and (toolmeta.target ~= "" and
"label[0,1.5;Current target:]".. "label[0,1.5;Current target:]"..
"label[0,2;"..minetest.formspec_escape(minetest.registered_nodes[toolmeta.target].description).."]".. "label[0,2;"..minetest.formspec_escape(minetest.registered_nodes[toolmeta.target].description).."]"..
"item_image[0,2.5;1,1;"..toolmeta.target.."]" or "item_image[0,2.5;1,1;"..toolmeta.target.."]" or
"label[0,1.5;No target set]").. "label[0,1.5;No target set]")..
(pointed and (pointed and
"label[3.5,1.5;May set new target:]".. "label[3.5,1.5;May set new target:]"..
"label[3.5,2;"..minetest.formspec_escape(minetest.registered_nodes[pointed].description).."]".. "label[3.5,2;"..minetest.formspec_escape(minetest.registered_nodes[pointed].description).."]"..
"item_image[3.5,2.5;1,1;"..pointed.."]".. "item_image[3.5,2.5;1,1;"..pointed.."]"..
"button_exit[3.5,3.65;2,0.5;target_"..pointed..";Set target]" or "button_exit[3.5,3.65;2,0.5;target_"..pointed..";Set target]" or
"label[3.5,1.5;No new target available]").. "label[3.5,1.5;No new target available]")..
"label[0,4.5;Region cross section:]".. "label[0,4.5;Region cross section:]"..
"label[0,5;"..look_diameter.."x"..look_diameter.."]".. "label[0,5;"..look_diameter.."x"..look_diameter.."]"..
"label[3.5,4.5;Set region cross section:]".. "label[3.5,4.5;Set region cross section:]"..
"button_exit[3.5,5.15;1,0.5;look_radius_0;1x1]".. "button_exit[3.5,5.15;1,0.5;look_radius_0;1x1]"..
"button_exit[4.5,5.15;1,0.5;look_radius_1;3x3]".. "button_exit[4.5,5.15;1,0.5;look_radius_1;3x3]"..
"button_exit[5.5,5.15;1,0.5;look_radius_3;7x7]".. "button_exit[5.5,5.15;1,0.5;look_radius_3;7x7]"..
"label[0,6;Region depth:]".. "label[0,6;Region depth:]"..
"label[0,6.5;"..toolmeta.look_depth.."]".. "label[0,6.5;"..toolmeta.look_depth.."]"..
"label[3.5,6;Set region depth:]".. "label[3.5,6;Set region depth:]"..
"button_exit[3.5,6.65;1,0.5;look_depth_7;7]".. "button_exit[3.5,6.65;1,0.5;look_depth_7;7]"..
"button_exit[4.5,6.65;1,0.5;look_depth_14;14]".. "button_exit[4.5,6.65;1,0.5;look_depth_14;14]"..
"button_exit[5.5,6.65;1,0.5;look_depth_21;21]".. "button_exit[5.5,6.65;1,0.5;look_depth_21;21]"..
"label[0,7.5;Accuracy:]".. "label[0,7.5;Accuracy:]"..
"label[0,8;98%]") "label[0,8;98%]")
return return
end, end,
}) })
minetest.register_on_player_receive_fields(function(user, formname, fields) minetest.register_on_player_receive_fields(function(user, formname, fields)
if formname ~= "technic:prospector_control" then return false end if formname ~= "technic:prospector_control" then return false end
if not user or not user:is_player() or user.is_fake_player then return end if not user or not user:is_player() or user.is_fake_player then return end
local toolstack = user:get_wielded_item() local toolstack = user:get_wielded_item()
if toolstack:get_name() ~= "technic:prospector" then return true end if toolstack:get_name() ~= "technic:prospector" then return true end
@ -121,8 +121,8 @@ end)
minetest.register_craft({ minetest.register_craft({
output = "technic:prospector", output = "technic:prospector",
recipe = { recipe = {
{"moreores:pick_silver", "moreores:mithril_block", "pipeworks:teleport_tube_1"}, { "moreores:pick_silver", "moreores:mithril_block", "pipeworks:teleport_tube_1" },
{"technic:brass_ingot", "technic:control_logic_unit", "technic:brass_ingot"}, { "technic:brass_ingot", "technic:control_logic_unit", "technic:brass_ingot" },
{"", "technic:blue_energy_crystal", ""}, { "", "technic:blue_energy_crystal", "" },
} }
}) })

View File

@ -33,7 +33,7 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
local ndef = minetest.registered_nodes[node.name] local ndef = minetest.registered_nodes[node.name]
if not ndef or not ndef.paramtype2 == "facedir" or if not ndef or not ndef.paramtype2 == "facedir" or
(ndef.drawtype == "nodebox" and (ndef.drawtype == "nodebox" and
not ndef.node_box.type == "fixed") or not ndef.node_box.type == "fixed") or
node.param2 == nil then node.param2 == nil then
return return
end end
@ -46,7 +46,7 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
return return
end end
minetest.sound_play("technic_sonic_screwdriver", {pos = pos, gain = 0.3, max_hear_distance = 10}) minetest.sound_play("technic_sonic_screwdriver", { pos = pos, gain = 0.3, max_hear_distance = 10 })
-- Set param2 -- Set param2
local rotationPart = node.param2 % 32 -- get first 4 bits local rotationPart = node.param2 % 32 -- get first 4 bits
@ -90,9 +90,9 @@ minetest.register_tool("technic:sonic_screwdriver", {
minetest.register_craft({ minetest.register_craft({
output = "technic:sonic_screwdriver", output = "technic:sonic_screwdriver",
recipe = { recipe = {
{"", "default:diamond", ""}, { "", "default:diamond", "" },
{"mesecons_materials:fiber", "technic:battery", "mesecons_materials:fiber"}, { "mesecons_materials:fiber", "technic:battery", "mesecons_materials:fiber" },
{"mesecons_materials:fiber", "moreores:mithril_ingot", "mesecons_materials:fiber"} { "mesecons_materials:fiber", "moreores:mithril_ingot", "mesecons_materials:fiber" }
} }
}) })

View File

@ -1,4 +1,3 @@
local S = technic.getter local S = technic.getter
local mesecons_materials = minetest.get_modpath("mesecons_materials") local mesecons_materials = minetest.get_modpath("mesecons_materials")
@ -21,7 +20,7 @@ minetest.register_tool("technic:treetap", {
end end
node.name = "moretrees:rubber_tree_trunk_empty" node.name = "moretrees:rubber_tree_trunk_empty"
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
minetest.handle_node_drops(pointed_thing.above, {"technic:raw_latex"}, user) minetest.handle_node_drops(pointed_thing.above, { "technic:raw_latex" }, user)
if not technic.creative_mode then if not technic.creative_mode then
local item_wear = tonumber(itemstack:get_wear()) local item_wear = tonumber(itemstack:get_wear())
item_wear = item_wear + 819 item_wear = item_wear + 819
@ -38,8 +37,8 @@ minetest.register_tool("technic:treetap", {
minetest.register_craft({ minetest.register_craft({
output = "technic:treetap", output = "technic:treetap",
recipe = { recipe = {
{"pipeworks:tube_1", "group:wood", "default:stick"}, { "pipeworks:tube_1", "group:wood", "default:stick" },
{"", "default:stick", "default:stick"} { "", "default:stick", "default:stick" }
}, },
}) })
@ -62,11 +61,11 @@ minetest.register_craftitem("technic:rubber", {
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"moretrees:rubber_tree_trunk_empty"}, nodenames = { "moretrees:rubber_tree_trunk_empty" },
interval = 60, interval = 60,
chance = 15, chance = 15,
action = function(pos, node) action = function(pos, node)
if minetest.find_node_near(pos, (moretrees and moretrees.leafdecay_radius) or 5, {"moretrees:rubber_tree_leaves"}) then if minetest.find_node_near(pos, (moretrees and moretrees.leafdecay_radius) or 5, { "moretrees:rubber_tree_leaves" }) then
node.name = "moretrees:rubber_tree_trunk" node.name = "moretrees:rubber_tree_trunk"
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
end end

View File

@ -1,7 +1,7 @@
-- Configuration -- Configuration
local vacuum_max_charge = 10000 -- 10000 - Maximum charge of the vacuum cleaner local vacuum_max_charge = 10000 -- 10000 - Maximum charge of the vacuum cleaner
local vacuum_charge_per_object = 100 -- 100 - Capable of picking up 50 objects local vacuum_charge_per_object = 100 -- 100 - Capable of picking up 50 objects
local vacuum_range = 8 -- 8 - Area in which to pick up objects local vacuum_range = 8 -- 8 - Area in which to pick up objects
local S = technic.getter local S = technic.getter
@ -52,10 +52,10 @@ minetest.register_tool("technic:vacuum", {
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:vacuum', output = "technic:vacuum",
recipe = { recipe = {
{'pipeworks:tube_1', 'pipeworks:filter', 'technic:battery'}, { "pipeworks:tube_1", "pipeworks:filter", "technic:battery" },
{'pipeworks:tube_1', 'technic:motor', 'technic:battery'}, { "pipeworks:tube_1", "technic:motor", "technic:battery" },
{'technic:stainless_steel_ingot', '', ''}, { "technic:stainless_steel_ingot", "", "" },
} }
}) })

View File

@ -1,22 +1,32 @@
technic.chests.groups = {
technic.chests.groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, snappy = 2,
tubedevice=1, tubedevice_receiver=1} choppy = 2,
technic.chests.groups_noinv = {snappy=2, choppy=2, oddly_breakable_by_hand=2, oddly_breakable_by_hand = 2,
tubedevice=1, tubedevice_receiver=1, not_in_creative_inventory=1} tubedevice = 1,
tubedevice_receiver = 1
}
technic.chests.groups_noinv = {
snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 2,
tubedevice = 1,
tubedevice_receiver = 1,
not_in_creative_inventory = 1
}
technic.chests.tube = { technic.chests.tube = {
insert_object = function(pos, node, stack, direction) insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:add_item("main",stack) return inv:add_item("main", stack)
end, end,
can_insert = function(pos, node, stack, direction) can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:room_for_item("main",stack) return inv:room_for_item("main", stack)
end, end,
input_inventory = "main", input_inventory = "main",
connect_sides = {left=1, right=1, front=1, back=1, top=1, bottom=1}, connect_sides = { left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1 },
} }
technic.chests.can_dig = function(pos, player) technic.chests.can_dig = function(pos, player)
@ -35,28 +45,30 @@ end
function technic.chests.inv_move(pos, from_list, from_index, to_list, to_index, count, player) function technic.chests.inv_move(pos, from_list, from_index, to_list, to_index, count, player)
return inv_change(pos, count, player) return inv_change(pos, count, player)
end end
function technic.chests.inv_put(pos, listname, index, stack, player) function technic.chests.inv_put(pos, listname, index, stack, player)
return inv_change(pos, stack:get_count(), player) return inv_change(pos, stack:get_count(), player)
end end
function technic.chests.inv_take(pos, listname, index, stack, player) function technic.chests.inv_take(pos, listname, index, stack, player)
return inv_change(pos, stack:get_count(), player) return inv_change(pos, stack:get_count(), player)
end end
function technic.chests.on_inv_move(pos, from_list, from_index, to_list, to_index, count, player) function technic.chests.on_inv_move(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name().. minetest.log("action", player:get_player_name()..
" moves stuff in chest at " " moves stuff in chest at "
..minetest.pos_to_string(pos)) .. minetest.pos_to_string(pos))
end end
function technic.chests.on_inv_put(pos, listname, index, stack, player) function technic.chests.on_inv_put(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name()..
" moves " .. stack:get_name() .. " moves "..stack:get_name()..
" to chest at " .. minetest.pos_to_string(pos)) " to chest at "..minetest.pos_to_string(pos))
end end
function technic.chests.on_inv_take(pos, listname, index, stack, player) function technic.chests.on_inv_take(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name()..
" takes " .. stack:get_name() .. " takes "..stack:get_name()..
" from chest at " .. minetest.pos_to_string(pos)) " from chest at "..minetest.pos_to_string(pos))
end end

View File

@ -1,26 +1,26 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:copper_chest 1', output = 'technic:copper_chest 1',
recipe = { recipe = {
{'default:copper_ingot','default:copper_ingot','default:copper_ingot'}, { "default:copper_ingot", "default:copper_ingot", "default:copper_ingot" },
{'default:copper_ingot','technic:iron_chest','default:copper_ingot'}, { "default:copper_ingot", "technic:iron_chest", "default:copper_ingot" },
{'default:copper_ingot','default:copper_ingot','default:copper_ingot'}, { "default:copper_ingot", "default:copper_ingot", "default:copper_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:copper_locked_chest 1', output = 'technic:copper_locked_chest 1',
recipe = { recipe = {
{'default:copper_ingot','default:copper_ingot','default:copper_ingot'}, { "default:copper_ingot", "default:copper_ingot", "default:copper_ingot" },
{'default:copper_ingot','technic:iron_locked_chest','default:copper_ingot'}, { "default:copper_ingot", "technic:iron_locked_chest", "default:copper_ingot" },
{'default:copper_ingot','default:copper_ingot','default:copper_ingot'}, { "default:copper_ingot", "default:copper_ingot", "default:copper_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:copper_locked_chest 1', output = 'technic:copper_locked_chest 1',
recipe = { recipe = {
{'default:steel_ingot'}, { "default:steel_ingot" },
{'technic:copper_chest'}, { "technic:copper_chest" },
} }
}) })

View File

@ -1,37 +1,36 @@
local material_list local material_list
if minetest.get_modpath("moreores") then if minetest.get_modpath("moreores") then
material_list = { 'silver' } material_list = { "silver" }
else else
-- Make the gold chest obtainable for mere mortals (the silver chest is not obtainable) -- Make the gold chest obtainable for mere mortals (the silver chest is not obtainable)
material_list = { 'copper', 'silver' } material_list = { "copper", "silver" }
end end
for _, material in ipairs(material_list) do for _, material in ipairs(material_list) do
minetest.register_craft({ minetest.register_craft({
output = 'technic:gold_chest', output = "technic:gold_chest",
recipe = { recipe = {
{'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, { "default:gold_ingot", "default:gold_ingot", "default:gold_ingot" },
{'default:gold_ingot',"technic:"..material.."_chest",'default:gold_ingot'}, { "default:gold_ingot", "technic:"..material.."_chest", "default:gold_ingot" },
{'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, { "default:gold_ingot", "default:gold_ingot", "default:gold_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:gold_locked_chest', output = "technic:gold_locked_chest",
recipe = { recipe = {
{'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, { "default:gold_ingot", "default:gold_ingot", "default:gold_ingot" },
{'default:gold_ingot',"technic:"..material.."_locked_chest",'default:gold_ingot'}, { "default:gold_ingot", "technic:"..material.."_locked_chest", "default:gold_ingot" },
{'default:gold_ingot','default:gold_ingot','default:gold_ingot'}, { "default:gold_ingot", "default:gold_ingot", "default:gold_ingot" },
} }
}) })
end end
minetest.register_craft({ minetest.register_craft({
output = 'technic:gold_locked_chest', output = "technic:gold_locked_chest",
recipe = { recipe = {
{'default:steel_ingot'}, { "default:steel_ingot" },
{'technic:gold_chest'}, { "technic:gold_chest" },
} }
}) })

View File

@ -8,26 +8,26 @@ end
minetest.register_craft({ minetest.register_craft({
output = 'technic:iron_chest 1', output = 'technic:iron_chest 1',
recipe = { recipe = {
{cast_iron_ingot,cast_iron_ingot,cast_iron_ingot}, { cast_iron_ingot, cast_iron_ingot, cast_iron_ingot },
{cast_iron_ingot,'default:chest',cast_iron_ingot}, { cast_iron_ingot, "default:chest", cast_iron_ingot },
{cast_iron_ingot,cast_iron_ingot,cast_iron_ingot}, { cast_iron_ingot, cast_iron_ingot, cast_iron_ingot },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:iron_locked_chest 1', output = 'technic:iron_locked_chest 1',
recipe = { recipe = {
{cast_iron_ingot,cast_iron_ingot,cast_iron_ingot}, { cast_iron_ingot, cast_iron_ingot, cast_iron_ingot },
{cast_iron_ingot,'default:chest_locked',cast_iron_ingot}, { cast_iron_ingot, "default:chest_locked", cast_iron_ingot },
{cast_iron_ingot,cast_iron_ingot,cast_iron_ingot}, { cast_iron_ingot, cast_iron_ingot, cast_iron_ingot },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:iron_locked_chest 1', output = 'technic:iron_locked_chest 1',
recipe = { recipe = {
{'default:steel_ingot'}, { "default:steel_ingot" },
{'technic:iron_chest'}, { "technic:iron_chest" },
} }
}) })

View File

@ -2,18 +2,18 @@ if minetest.get_modpath("moreores") then
minetest.register_craft({ minetest.register_craft({
output = 'technic:mithril_chest 1', output = 'technic:mithril_chest 1',
recipe = { recipe = {
{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, { "moreores:mithril_ingot", "moreores:mithril_ingot", "moreores:mithril_ingot" },
{'moreores:mithril_ingot','technic:gold_chest','moreores:mithril_ingot'}, { "moreores:mithril_ingot", "technic:gold_chest", "moreores:mithril_ingot" },
{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, { "moreores:mithril_ingot", "moreores:mithril_ingot", "moreores:mithril_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:mithril_locked_chest 1', output = 'technic:mithril_locked_chest 1',
recipe = { recipe = {
{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, { "moreores:mithril_ingot", "moreores:mithril_ingot", "moreores:mithril_ingot" },
{'moreores:mithril_ingot','technic:gold_locked_chest','moreores:mithril_ingot'}, { "moreores:mithril_ingot", "technic:gold_locked_chest", "moreores:mithril_ingot" },
{'moreores:mithril_ingot','moreores:mithril_ingot','moreores:mithril_ingot'}, { "moreores:mithril_ingot", "moreores:mithril_ingot", "moreores:mithril_ingot" },
} }
}) })
end end
@ -21,8 +21,8 @@ end
minetest.register_craft({ minetest.register_craft({
output = 'technic:mithril_locked_chest 1', output = 'technic:mithril_locked_chest 1',
recipe = { recipe = {
{'default:steel_ingot'}, { "default:steel_ingot" },
{'technic:mithril_chest'}, { "technic:mithril_chest" },
} }
}) })

View File

@ -7,32 +7,32 @@ if not minetest.get_modpath("pipeworks") then
local pipeworks_meta = {} local pipeworks_meta = {}
setmetatable(pipeworks, pipeworks_meta) setmetatable(pipeworks, pipeworks_meta)
local dummy = function() local dummy = function()
end end
pipeworks_meta.__index = function(table, key) pipeworks_meta.__index = function(table, key)
print("[technic_chests] WARNING: variable or method '"..key.."' not present in dummy pipeworks table - assuming it is a method...") print("[technic_chests] WARNING: variable or method '"..key.."' not present in dummy pipeworks table - assuming it is a method...")
pipeworks[key] = dummy pipeworks[key] = dummy
return dummy return dummy
end end
pipeworks.after_place = dummy pipeworks.after_place = dummy
pipeworks.after_dig = dummy pipeworks.after_dig = dummy
end end
local chest_mark_colors = { local chest_mark_colors = {
{"black", S("Black")}, { "black", S("Black") },
{"blue", S("Blue")}, { "blue", S("Blue") },
{"brown", S("Brown")}, { "brown", S("Brown") },
{"cyan", S("Cyan")}, { "cyan", S("Cyan") },
{"dark_green", S("Dark Green")}, { "dark_green", S("Dark Green") },
{"dark_grey", S("Dark Grey")}, { "dark_grey", S("Dark Grey") },
{"green", S("Green")}, { "green", S("Green") },
{"grey", S("Grey")}, { "grey", S("Grey") },
{"magenta", S("Magenta")}, { "magenta", S("Magenta") },
{"orange", S("Orange")}, { "orange", S("Orange") },
{"pink", S("Pink")}, { "pink", S("Pink") },
{"red", S("Red")}, { "red", S("Red") },
{"violet", S("Violet")}, { "violet", S("Violet") },
{"white", S("White")}, { "white", S("White") },
{"yellow", S("Yellow")}, { "yellow", S("Yellow") },
} }
@ -47,9 +47,9 @@ local function get_color_buttons(coleft, lotop)
for x = 0, 3 do for x = 0, 3 do
local file_name = "technic_colorbutton"..(y * 4 + x)..".png" local file_name = "technic_colorbutton"..(y * 4 + x)..".png"
buttons_string = buttons_string.."image_button[" buttons_string = buttons_string.."image_button["
..(coleft + 0.1 + x * 0.7)..","..(lotop + 0.1 + y * 0.7) .. (coleft + 0.1 + x * 0.7)..","..(lotop + 0.1 + y * 0.7)
..";0.8,0.8;"..file_name..";color_button" .. ";0.8,0.8;"..file_name..";color_button"
..(y * 4 + x + 1)..";]" .. (y * 4 + x + 1)..";]"
end end
end end
return buttons_string return buttons_string
@ -74,20 +74,20 @@ local function set_formspec(pos, data, page)
local formspec = data.base_formspec local formspec = data.base_formspec
if data.autosort then if data.autosort then
local status = meta:get_int("autosort") local status = meta:get_int("autosort")
formspec = formspec.."button["..(data.hileft+2)..","..(data.height+1.1)..";3,0.8;autosort_to_"..(1-status)..";"..S("Auto-sort is %s"):format(status == 1 and S("On") or S("Off")).."]" formspec = formspec.."button["..(data.hileft + 2)..","..(data.height + 1.1)..";3,0.8;autosort_to_"..(1 - status)..";"..S("Auto-sort is %s"):format(status == 1 and S("On") or S("Off")).."]"
end end
if data.infotext then if data.infotext then
local formspec_infotext = minetest.formspec_escape(meta:get_string("infotext")) local formspec_infotext = minetest.formspec_escape(meta:get_string("infotext"))
if page == "main" then if page == "main" then
formspec = formspec.."image_button["..(data.hileft+2.1)..",0.1;0.8,0.8;" formspec = formspec.."image_button["..(data.hileft + 2.1)..",0.1;0.8,0.8;"
.."technic_pencil_icon.png;edit_infotext;]" .. "technic_pencil_icon.png;edit_infotext;]"
.."label["..(data.hileft+3)..",0;"..formspec_infotext.."]" .. "label["..(data.hileft + 3)..",0;"..formspec_infotext.."]"
elseif page == "edit_infotext" then elseif page == "edit_infotext" then
formspec = formspec.."image_button["..(data.hileft+2.1)..",0.1;0.8,0.8;" formspec = formspec.."image_button["..(data.hileft + 2.1)..",0.1;0.8,0.8;"
.."technic_checkmark_icon.png;save_infotext;]" .. "technic_checkmark_icon.png;save_infotext;]"
.."field["..(data.hileft+3.3)..",0.2;4.8,1;" .. "field["..(data.hileft + 3.3)..",0.2;4.8,1;"
.."infotext_box;"..S("Edit chest description:")..";" .. "infotext_box;"..S("Edit chest description:")..";"
..formspec_infotext.."]" .. formspec_infotext.."]"
end end
end end
if data.color then if data.color then
@ -98,7 +98,7 @@ local function set_formspec(pos, data, page)
else else
colorName = S("None") colorName = S("None")
end end
formspec = formspec.."label["..(data.coleft+0.2)..","..(data.lotop+3)..";"..S("Color Filter: %s"):format(colorName).."]" formspec = formspec.."label["..(data.coleft + 0.2)..","..(data.lotop + 3)..";"..S("Color Filter: %s"):format(colorName).."]"
end end
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
end end
@ -202,17 +202,17 @@ function technic.chests:definition(name, data)
data.ovheight = data.lotop + 4 data.ovheight = data.lotop + 4
local locked_after_place = nil local locked_after_place = nil
local front = {"technic_"..lname.."_chest_front.png"} local front = { "technic_"..lname.."_chest_front.png" }
data.base_formspec = "size["..data.ovwidth..","..data.ovheight.."]".. data.base_formspec = "size["..data.ovwidth..","..data.ovheight.."]"..
"label[0,0;"..S("%s Chest"):format(name).."]".. "label[0,0;"..S("%s Chest"):format(name).."]"..
"list[context;main;"..data.hileft..",1;"..data.width..","..data.height..";]".. "list[context;main;"..data.hileft..",1;"..data.width..","..data.height..";]"..
"list[current_player;main;"..data.loleft..","..data.lotop..";8,4;]".. "list[current_player;main;"..data.loleft..","..data.lotop..";8,4;]"..
"background[-0.19,-0.25;"..(data.ovwidth+0.4)..","..(data.ovheight+0.75)..";technic_chest_form_bg.png]".. "background[-0.19,-0.25;"..(data.ovwidth + 0.4)..","..(data.ovheight + 0.75)..";technic_chest_form_bg.png]"..
"background["..data.hileft..",1;"..data.width..","..data.height..";technic_"..lname.."_chest_inventory.png]".. "background["..data.hileft..",1;"..data.width..","..data.height..";technic_"..lname.."_chest_inventory.png]"..
"background["..data.loleft..","..data.lotop..";8,4;technic_main_inventory.png]".. "background["..data.loleft..","..data.lotop..";8,4;technic_main_inventory.png]"..
"listring[]" "listring[]"
if data.sort then if data.sort then
data.base_formspec = data.base_formspec.."button["..data.hileft..","..(data.height+1.1)..";1,0.8;sort;"..S("Sort").."]" data.base_formspec = data.base_formspec.."button["..data.hileft..","..(data.height + 1.1)..";1,0.8;sort;"..S("Sort").."]"
end end
if data.color then if data.color then
data.base_formspec = data.base_formspec..get_color_buttons(data.coleft, data.lotop) data.base_formspec = data.base_formspec..get_color_buttons(data.coleft, data.lotop)
@ -223,8 +223,7 @@ function technic.chests:definition(name, data)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "") meta:set_string("owner", placer:get_player_name() or "")
meta:set_string("infotext", meta:set_string("infotext",
S("%s Locked Chest (owned by %s)") S("%s Locked Chest (owned by %s)"):format(name, meta:get_string("owner")))
:format(name, meta:get_string("owner")))
pipeworks.after_place(pos) pipeworks.after_place(pos)
end end
table.insert(front, "technic_"..lname.."_chest_lock_overlay.png") table.insert(front, "technic_"..lname.."_chest_lock_overlay.png")
@ -241,9 +240,11 @@ function technic.chests:definition(name, data)
local def = { local def = {
description = desc, description = desc,
tiles = {"technic_"..lname.."_chest_top.png", "technic_"..lname.."_chest_top.png", tiles = {
"technic_"..lname.."_chest_top.png", "technic_"..lname.."_chest_top.png",
"technic_"..lname.."_chest_side.png", "technic_"..lname.."_chest_side.png", "technic_"..lname.."_chest_side.png", "technic_"..lname.."_chest_side.png",
"technic_"..lname.."_chest_side.png", table.concat(front, "^")}, "technic_"..lname.."_chest_side.png", table.concat(front, "^")
},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = self.groups, groups = self.groups,
tube = self.tube, tube = self.tube,
@ -251,7 +252,6 @@ function technic.chests:definition(name, data)
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
after_place_node = locked_after_place, after_place_node = locked_after_place,
after_dig_node = pipeworks.after_dig, after_dig_node = pipeworks.after_dig,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("%s Chest"):format(name)) meta:set_string("infotext", S("%s Chest"):format(name))
@ -267,7 +267,7 @@ function technic.chests:definition(name, data)
on_blast = function(pos) on_blast = function(pos)
local drops = {} local drops = {}
default.get_inventory_drops(pos, "main", drops) default.get_inventory_drops(pos, "main", drops)
drops[#drops+1] = "technic:"..name:lower()..(data.locked and "_locked" or "").."_chest" drops[#drops + 1] = "technic:"..name:lower()..(data.locked and "_locked" or "").."_chest"
minetest.remove_node(pos) minetest.remove_node(pos)
return drops return drops
end, end,
@ -277,7 +277,7 @@ function technic.chests:definition(name, data)
def.allow_metadata_inventory_put = self.inv_put def.allow_metadata_inventory_put = self.inv_put
def.allow_metadata_inventory_take = self.inv_take def.allow_metadata_inventory_take = self.inv_take
def.on_blast = function() end def.on_blast = function() end
def.can_dig = function(pos,player) def.can_dig = function(pos, player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:is_empty("main") and default.can_interact_with_node(player, pos) return inv:is_empty("main") and default.can_interact_with_node(player, pos)
@ -315,9 +315,9 @@ function technic.chests:register(name, data)
if data.color then if data.color then
local mk_front local mk_front
if string.find(def.tiles[6], "%^") then if string.find(def.tiles[6], "%^") then
mk_front = function (overlay) return def.tiles[6]:gsub("%^", "^"..overlay.."^") end mk_front = function(overlay) return def.tiles[6]:gsub("%^", "^"..overlay.."^") end
else else
mk_front = function (overlay) return def.tiles[6].."^"..overlay end mk_front = function(overlay) return def.tiles[6].."^"..overlay end
end end
for i = 1, 15 do for i = 1, 15 do
local postfix = colorid_to_postfix(i) local postfix = colorid_to_postfix(i)
@ -331,6 +331,5 @@ function technic.chests:register(name, data)
minetest.register_node(":"..nn..postfix, colordef) minetest.register_node(":"..nn..postfix, colordef)
end end
end end
end end

View File

@ -1,28 +1,28 @@
if minetest.get_modpath("moreores") then if minetest.get_modpath("moreores") then
minetest.register_craft({ minetest.register_craft({
output = 'technic:silver_chest', output = "technic:silver_chest",
recipe = { recipe = {
{'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, { "moreores:silver_ingot", "moreores:silver_ingot", "moreores:silver_ingot" },
{'moreores:silver_ingot','technic:copper_chest','moreores:silver_ingot'}, { "moreores:silver_ingot", "technic:copper_chest", "moreores:silver_ingot" },
{'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, { "moreores:silver_ingot", "moreores:silver_ingot", "moreores:silver_ingot" },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:silver_locked_chest', output = "technic:silver_locked_chest",
recipe = { recipe = {
{'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, { "moreores:silver_ingot", "moreores:silver_ingot", "moreores:silver_ingot" },
{'moreores:silver_ingot','technic:copper_locked_chest','moreores:silver_ingot'}, { "moreores:silver_ingot", "technic:copper_locked_chest", "moreores:silver_ingot" },
{'moreores:silver_ingot','moreores:silver_ingot','moreores:silver_ingot'}, { "moreores:silver_ingot", "moreores:silver_ingot", "moreores:silver_ingot" },
} }
}) })
end end
minetest.register_craft({ minetest.register_craft({
output = 'technic:silver_locked_chest', output = "technic:silver_locked_chest",
recipe = { recipe = {
{'default:steel_ingot'}, { "default:steel_ingot" },
{'technic:silver_chest'}, { "technic:silver_chest" },
} }
}) })

View File

@ -1,4 +1,3 @@
local S = technic.worldgen.gettext local S = technic.worldgen.gettext
minetest.register_craftitem(":technic:uranium_lump", { minetest.register_craftitem(":technic:uranium_lump", {
@ -10,7 +9,7 @@ minetest.register_alias("technic:uranium", "technic:uranium_lump")
minetest.register_craftitem(":technic:uranium_ingot", { minetest.register_craftitem(":technic:uranium_ingot", {
description = S("Uranium Ingot"), description = S("Uranium Ingot"),
inventory_image = "technic_uranium_ingot.png", inventory_image = "technic_uranium_ingot.png",
groups = {uranium_ingot=1}, groups = { uranium_ingot = 1 },
}) })
minetest.register_craftitem(":technic:chromium_lump", { minetest.register_craftitem(":technic:chromium_lump", {
@ -79,16 +78,16 @@ local function register_block(block, ingot)
minetest.register_craft({ minetest.register_craft({
output = block, output = block,
recipe = { recipe = {
{ingot, ingot, ingot}, { ingot, ingot, ingot },
{ingot, ingot, ingot}, { ingot, ingot, ingot },
{ingot, ingot, ingot}, { ingot, ingot, ingot },
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = ingot.." 9", output = ingot.." 9",
recipe = { recipe = {
{block} { block }
} }
}) })
end end
@ -103,45 +102,45 @@ register_block("technic:carbon_steel_block", "technic:carbon_steel_ingot")
register_block("technic:stainless_steel_block", "technic:stainless_steel_ingot") register_block("technic:stainless_steel_block", "technic:stainless_steel_ingot")
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = "technic:zinc_lump", recipe = "technic:zinc_lump",
output = "technic:zinc_ingot", output = "technic:zinc_ingot",
}) })
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = "technic:chromium_lump", recipe = "technic:chromium_lump",
output = "technic:chromium_ingot", output = "technic:chromium_ingot",
}) })
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = "technic:uranium_lump", recipe = "technic:uranium_lump",
output = "technic:uranium_ingot", output = "technic:uranium_ingot",
}) })
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = "technic:lead_lump", recipe = "technic:lead_lump",
output = "technic:lead_ingot", output = "technic:lead_ingot",
}) })
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = minetest.registered_aliases["technic:wrought_iron_ingot"], recipe = minetest.registered_aliases["technic:wrought_iron_ingot"],
output = "technic:cast_iron_ingot", output = "technic:cast_iron_ingot",
}) })
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = "technic:cast_iron_ingot", recipe = "technic:cast_iron_ingot",
cooktime = 2, cooktime = 2,
output = "technic:wrought_iron_ingot", output = "technic:wrought_iron_ingot",
}) })
minetest.register_craft({ minetest.register_craft({
type = 'cooking', type = "cooking",
recipe = "technic:carbon_steel_ingot", recipe = "technic:carbon_steel_ingot",
cooktime = 2, cooktime = 2,
output = "technic:wrought_iron_ingot", output = "technic:wrought_iron_ingot",

View File

@ -72,7 +72,7 @@ if technic.config:get_bool("enable_granite_generation") then
tmin = 3, tmin = 3,
tmax = 6, tmax = 6,
threshhold = 0.4, threshhold = 0.4,
noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70} noise_params = { offset = 0, scale = 15, spread = { x = 130, y = 130, z = 130 }, seed = 24, octaves = 3, persist = 0.70 }
}) })
end end
@ -85,6 +85,6 @@ if technic.config:get_bool("enable_marble_generation") then
tmin = 3, tmin = 3,
tmax = 6, tmax = 6,
threshhold = 0.4, threshhold = 0.4,
noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=23, octaves=3, persist=0.70} noise_params = { offset = 0, scale = 15, spread = { x = 130, y = 130, z = 130 }, seed = 23, octaves = 3, persist = 0.70 }
}) })
end end

View File

@ -1,72 +1,71 @@
local S = technic.worldgen.gettext local S = technic.worldgen.gettext
minetest.register_node( ":technic:mineral_uranium", { minetest.register_node(":technic:mineral_uranium", {
description = S("Uranium Ore"), description = S("Uranium Ore"),
tiles = { "default_stone.png^technic_mineral_uranium.png" }, tiles = { "default_stone.png^technic_mineral_uranium.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=3, radioactive=1}, groups = { cracky = 3, radioactive = 1 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drop = "technic:uranium_lump", drop = "technic:uranium_lump",
}) })
minetest.register_node( ":technic:mineral_chromium", { minetest.register_node(":technic:mineral_chromium", {
description = S("Chromium Ore"), description = S("Chromium Ore"),
tiles = { "default_stone.png^technic_mineral_chromium.png" }, tiles = { "default_stone.png^technic_mineral_chromium.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = { cracky = 3 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drop = "technic:chromium_lump", drop = "technic:chromium_lump",
}) })
minetest.register_node( ":technic:mineral_zinc", { minetest.register_node(":technic:mineral_zinc", {
description = S("Zinc Ore"), description = S("Zinc Ore"),
tiles = { "default_stone.png^technic_mineral_zinc.png" }, tiles = { "default_stone.png^technic_mineral_zinc.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = { cracky = 3 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drop = "technic:zinc_lump", drop = "technic:zinc_lump",
}) })
minetest.register_node( ":technic:mineral_lead", { minetest.register_node(":technic:mineral_lead", {
description = S("Lead Ore"), description = S("Lead Ore"),
tiles = { "default_stone.png^technic_mineral_lead.png" }, tiles = { "default_stone.png^technic_mineral_lead.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = { cracky = 3 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drop = "technic:lead_lump", drop = "technic:lead_lump",
}) })
minetest.register_node( ":technic:mineral_sulfur", { minetest.register_node(":technic:mineral_sulfur", {
description = S("Sulfur Ore"), description = S("Sulfur Ore"),
tiles = { "default_stone.png^technic_mineral_sulfur.png" }, tiles = { "default_stone.png^technic_mineral_sulfur.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = { cracky = 3 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
drop = "technic:sulfur_lump", drop = "technic:sulfur_lump",
}) })
minetest.register_node( ":technic:granite", { minetest.register_node(":technic:granite", {
description = S("Granite"), description = S("Granite"),
tiles = { "technic_granite.png" }, tiles = { "technic_granite.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1}, groups = { cracky = 1 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
minetest.register_node( ":technic:marble", { minetest.register_node(":technic:marble", {
description = S("Marble"), description = S("Marble"),
tiles = { "technic_marble.png" }, tiles = { "technic_marble.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=3, marble=1}, groups = { cracky = 3, marble = 1 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
minetest.register_node( ":technic:marble_bricks", { minetest.register_node(":technic:marble_bricks", {
description = S("Marble Bricks"), description = S("Marble Bricks"),
tiles = { "technic_marble_bricks.png" }, tiles = { "technic_marble_bricks.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=3}, groups = { cracky = 3 },
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
@ -74,7 +73,7 @@ minetest.register_node(":technic:uranium_block", {
description = S("Uranium Block"), description = S("Uranium Block"),
tiles = { "technic_uranium_block.png" }, tiles = { "technic_uranium_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {uranium_block=1, cracky=1, level=2, radioactive=2}, groups = { uranium_block = 1, cracky = 1, level = 2, radioactive = 2 },
sounds = default.node_sound_stone_defaults() sounds = default.node_sound_stone_defaults()
}) })
@ -82,7 +81,7 @@ minetest.register_node(":technic:chromium_block", {
description = S("Chromium Block"), description = S("Chromium Block"),
tiles = { "technic_chromium_block.png" }, tiles = { "technic_chromium_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1, level=2}, groups = { cracky = 1, level = 2 },
sounds = default.node_sound_stone_defaults() sounds = default.node_sound_stone_defaults()
}) })
@ -90,7 +89,7 @@ minetest.register_node(":technic:zinc_block", {
description = S("Zinc Block"), description = S("Zinc Block"),
tiles = { "technic_zinc_block.png" }, tiles = { "technic_zinc_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1, level=2}, groups = { cracky = 1, level = 2 },
sounds = default.node_sound_stone_defaults() sounds = default.node_sound_stone_defaults()
}) })
@ -98,7 +97,7 @@ minetest.register_node(":technic:lead_block", {
description = S("Lead Block"), description = S("Lead Block"),
tiles = { "technic_lead_block.png" }, tiles = { "technic_lead_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1, level=2}, groups = { cracky = 1, level = 2 },
sounds = default.node_sound_stone_defaults() sounds = default.node_sound_stone_defaults()
}) })
@ -113,7 +112,7 @@ minetest.register_node(":technic:cast_iron_block", {
description = S("Cast Iron Block"), description = S("Cast Iron Block"),
tiles = { "technic_cast_iron_block.png" }, tiles = { "technic_cast_iron_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1, level=2}, groups = { cracky = 1, level = 2 },
sounds = default.node_sound_stone_defaults() sounds = default.node_sound_stone_defaults()
}) })
@ -121,7 +120,7 @@ minetest.register_node(":technic:carbon_steel_block", {
description = S("Carbon Steel Block"), description = S("Carbon Steel Block"),
tiles = { "technic_carbon_steel_block.png" }, tiles = { "technic_carbon_steel_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1, level=2}, groups = { cracky = 1, level = 2 },
sounds = default.node_sound_stone_defaults() sounds = default.node_sound_stone_defaults()
}) })
@ -129,7 +128,7 @@ minetest.register_node(":technic:stainless_steel_block", {
description = S("Stainless Steel Block"), description = S("Stainless Steel Block"),
tiles = { "technic_stainless_steel_block.png" }, tiles = { "technic_stainless_steel_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1, level=2}, groups = { cracky = 1, level = 2 },
sounds = default.node_sound_stone_defaults() sounds = default.node_sound_stone_defaults()
}) })
@ -137,15 +136,15 @@ minetest.register_node(":technic:brass_block", {
description = S("Brass Block"), description = S("Brass Block"),
tiles = { "technic_brass_block.png" }, tiles = { "technic_brass_block.png" },
is_ground_content = true, is_ground_content = true,
groups = {cracky=1, level=2}, groups = { cracky = 1, level = 2 },
sounds = default.node_sound_stone_defaults() sounds = default.node_sound_stone_defaults()
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:marble_bricks 4', output = 'technic:marble_bricks 4',
recipe = { recipe = {
{'technic:marble','technic:marble'}, { "technic:marble", "technic:marble" },
{'technic:marble','technic:marble'} { "technic:marble", "technic:marble" }
} }
}) })
@ -177,7 +176,7 @@ for_each_registered_node(function(node_name, node_def)
local new_tiles = {} local new_tiles = {}
local do_override = false local do_override = false
if type(tiles) == "string" then if type(tiles) == "string" then
tiles = {tiles} tiles = { tiles }
end end
for i, t in ipairs(tiles) do for i, t in ipairs(tiles) do
if type(t) == "string" and t == "default_steel_block.png" then if type(t) == "string" and t == "default_steel_block.png" then

View File

@ -1,126 +1,126 @@
local uranium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 420, octaves = 3, persist = 0.7} local uranium_params = { offset = 0, scale = 1, spread = { x = 100, y = 100, z = 100 }, seed = 420, octaves = 3, persist = 0.7 }
local uranium_threshhold = 0.55 local uranium_threshhold = 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_params = { offset = 0, scale = 1, spread = { x = 100, y = 100, z = 100 }, seed = 421, octaves = 3, persist = 0.7 }
local chromium_threshhold = 0.55 local chromium_threshhold = 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_params = { offset = 0, scale = 1, spread = { x = 100, y = 100, z = 100 }, seed = 422, octaves = 3, persist = 0.7 }
local zinc_threshhold = 0.5 local zinc_threshhold = 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_params = { offset = 0, scale = 1, spread = { x = 100, y = 100, z = 100 }, seed = 423, octaves = 3, persist = 0.7 }
local lead_threshhold = 0.3 local lead_threshhold = 0.3
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "technic:mineral_uranium", ore = "technic:mineral_uranium",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 8*8*8, clust_scarcity = 8 * 8 * 8,
clust_num_ores = 4, clust_num_ores = 4,
clust_size = 3, clust_size = 3,
y_min = -300, y_min = -300,
y_max = -80, y_max = -80,
noise_params = uranium_params, noise_params = uranium_params,
noise_threshhold = uranium_threshhold, noise_threshhold = uranium_threshhold,
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "technic:mineral_chromium", ore = "technic:mineral_chromium",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 8*8*8, clust_scarcity = 8 * 8 * 8,
clust_num_ores = 2, clust_num_ores = 2,
clust_size = 3, clust_size = 3,
y_min = -200, y_min = -200,
y_max = -100, y_max = -100,
noise_params = chromium_params, noise_params = chromium_params,
noise_threshhold = chromium_threshhold, noise_threshhold = chromium_threshhold,
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "technic:mineral_chromium", ore = "technic:mineral_chromium",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 6*6*6, clust_scarcity = 6 * 6 * 6,
clust_num_ores = 2, clust_num_ores = 2,
clust_size = 3, clust_size = 3,
y_min = -31000, y_min = -31000,
y_max = -200, y_max = -200,
flags = "absheight", flags = "absheight",
noise_params = chromium_params, noise_params = chromium_params,
noise_threshhold = chromium_threshhold, noise_threshhold = chromium_threshhold,
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "technic:mineral_zinc", ore = "technic:mineral_zinc",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 8*8*8, clust_scarcity = 8 * 8 * 8,
clust_num_ores = 5, clust_num_ores = 5,
clust_size = 7, clust_size = 7,
y_min = -32, y_min = -32,
y_max = 2 y_max = 2
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "technic:mineral_zinc", ore = "technic:mineral_zinc",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 6*6*6, clust_scarcity = 6 * 6 * 6,
clust_num_ores = 4, clust_num_ores = 4,
clust_size = 3, clust_size = 3,
y_min = -31000, y_min = -31000,
y_max = -32, y_max = -32,
flags = "absheight", flags = "absheight",
noise_params = zinc_params, noise_params = zinc_params,
noise_threshhold = zinc_threshhold, noise_threshhold = zinc_threshhold,
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "technic:mineral_lead", ore = "technic:mineral_lead",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 9*9*9, clust_scarcity = 9 * 9 * 9,
clust_num_ores = 5, clust_num_ores = 5,
clust_size = 3, clust_size = 3,
y_min = -16, y_min = -16,
y_max = 16, y_max = 16,
noise_params = lead_params, noise_params = lead_params,
noise_threshhold = lead_threshhold, noise_threshhold = lead_threshhold,
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "technic:mineral_lead", ore = "technic:mineral_lead",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 8*8*8, clust_scarcity = 8 * 8 * 8,
clust_num_ores = 5, clust_num_ores = 5,
clust_size = 3, clust_size = 3,
y_min = -128, y_min = -128,
y_max = -16, y_max = -16,
noise_params = lead_params, noise_params = lead_params,
noise_threshhold = lead_threshhold, noise_threshhold = lead_threshhold,
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
ore = "technic:mineral_lead", ore = "technic:mineral_lead",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 6*6*6, clust_scarcity = 6 * 6 * 6,
clust_num_ores = 5, clust_num_ores = 5,
clust_size = 3, clust_size = 3,
y_min = -31000, y_min = -31000,
y_max = -128, y_max = -128,
flags = "absheight", flags = "absheight",
noise_params = lead_params, noise_params = lead_params,
noise_threshhold = lead_threshhold, noise_threshhold = lead_threshhold,
}) })
-- Sulfur -- Sulfur
minetest.register_on_generated(function(minp, maxp, seed) minetest.register_on_generated(function(minp, maxp, seed)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip") local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local a = VoxelArea:new{ local a = VoxelArea:new {
MinEdge = {x = emin.x, y = emin.y, z = emin.z}, MinEdge = { x = emin.x, y = emin.y, z = emin.z },
MaxEdge = {x = emax.x, y = emax.y, z = emax.z}, MaxEdge = { x = emax.x, y = emax.y, z = emax.z },
} }
local data = vm:get_data() local data = vm:get_data()
local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z) local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z)
@ -133,24 +133,24 @@ minetest.register_on_generated(function(minp, maxp, seed)
local grid_size = 5 local grid_size = 5
for x = minp.x + math.floor(grid_size / 2), maxp.x, grid_size do 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 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 for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do
local c = data[a:index(x, y, z)] local c = data[a:index(x, y, z)]
if (c == c_lava or c == c_lava_flowing) and noise:get3d({x = x, y = z, z = z}) >= 0.4 then if (c == c_lava or c == c_lava_flowing) and noise:get3d({ x = x, y = z, z = z }) >= 0.4 then
for xx = math.max(minp.x, x - grid_size), math.min(maxp.x, x + grid_size) do for xx = math.max(minp.x, x - grid_size), math.min(maxp.x, x + grid_size) do
for yy = math.max(minp.y, y - grid_size), math.min(maxp.y, y + grid_size) do for yy = math.max(minp.y, y - grid_size), math.min(maxp.y, y + grid_size) do
for zz = math.max(minp.z, z - grid_size), math.min(maxp.z, z + grid_size) do for zz = math.max(minp.z, z - grid_size), math.min(maxp.z, z + grid_size) do
local i = a:index(xx, yy, zz) local i = a:index(xx, yy, zz)
if data[i] == c_stone and pr:next(1, 10) <= 7 then if data[i] == c_stone and pr:next(1, 10) <= 7 then
data[i] = c_sulfur data[i] = c_sulfur
end
end
end
end
end end
end end
end
end
end end
end end
end
end
vm:set_data(data) vm:set_data(data)
vm:write_to_map(data) vm:write_to_map(data)
@ -158,32 +158,32 @@ end)
if technic.config:get_bool("enable_marble_generation") then if technic.config:get_bool("enable_marble_generation") then
minetest.register_ore({ minetest.register_ore({
ore_type = "sheet", ore_type = "sheet",
ore = "technic:marble", ore = "technic:marble",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 1, clust_scarcity = 1,
clust_num_ores = 1, clust_num_ores = 1,
clust_size = 3, clust_size = 3,
y_min = -31000, y_min = -31000,
y_max = -50, y_max = -50,
noise_threshhold = 0.4, noise_threshhold = 0.4,
noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70} noise_params = { offset = 0, scale = 15, spread = { x = 150, y = 150, z = 150 }, seed = 23, octaves = 3, persist = 0.70 }
}) })
end end
if technic.config:get_bool("enable_granite_generation") then if technic.config:get_bool("enable_granite_generation") then
minetest.register_ore({ minetest.register_ore({
ore_type = "sheet", ore_type = "sheet",
ore = "technic:granite", ore = "technic:granite",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 1, clust_scarcity = 1,
clust_num_ores = 1, clust_num_ores = 1,
clust_size = 4, clust_size = 4,
y_min = -31000, y_min = -31000,
y_max = -150, y_max = -150,
noise_threshhold = 0.4, noise_threshhold = 0.4,
noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70} noise_params = { offset = 0, scale = 15, spread = { x = 130, y = 130, z = 130 }, seed = 24, octaves = 3, persist = 0.70 }
}) })
end end

View File

@ -5,12 +5,12 @@ local S = technic.worldgen.gettext
minetest.register_node(":moretrees:rubber_tree_sapling", { minetest.register_node(":moretrees:rubber_tree_sapling", {
description = S("Rubber Tree Sapling"), description = S("Rubber Tree Sapling"),
drawtype = "plantlike", drawtype = "plantlike",
tiles = {"technic_rubber_sapling.png"}, tiles = { "technic_rubber_sapling.png" },
inventory_image = "technic_rubber_sapling.png", inventory_image = "technic_rubber_sapling.png",
wield_image = "technic_rubber_sapling.png", wield_image = "technic_rubber_sapling.png",
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
groups = {dig_immediate=3, flammable=2}, groups = { dig_immediate = 3, flammable = 2 },
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}) })
@ -22,43 +22,59 @@ minetest.register_craft({
minetest.register_node(":moretrees:rubber_tree_trunk", { minetest.register_node(":moretrees:rubber_tree_trunk", {
description = S("Rubber Tree"), description = S("Rubber Tree"),
tiles = {"default_tree_top.png", "default_tree_top.png", tiles = {
"technic_rubber_tree_full.png"}, "default_tree_top.png", "default_tree_top.png",
groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1, "technic_rubber_tree_full.png"
flammable=2}, },
groups = {
tree = 1,
snappy = 1,
choppy = 2,
oddly_breakable_by_hand = 1,
flammable = 2
},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
minetest.register_node(":moretrees:rubber_tree_trunk_empty", { minetest.register_node(":moretrees:rubber_tree_trunk_empty", {
description = S("Rubber Tree"), description = S("Rubber Tree"),
tiles = {"default_tree_top.png", "default_tree_top.png", tiles = {
"technic_rubber_tree_empty.png"}, "default_tree_top.png", "default_tree_top.png",
groups = {tree=1, snappy=1, choppy=2, oddly_breakable_by_hand=1, "technic_rubber_tree_empty.png"
flammable=2, not_in_creative_inventory=1}, },
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(), sounds = default.node_sound_wood_defaults(),
}) })
minetest.register_node(":moretrees:rubber_tree_leaves", { minetest.register_node(":moretrees:rubber_tree_leaves", {
drawtype = "allfaces_optional", drawtype = "allfaces_optional",
description = S("Rubber Tree Leaves"), description = S("Rubber Tree Leaves"),
tiles = {"technic_rubber_leaves.png"}, tiles = { "technic_rubber_leaves.png" },
paramtype = "light", paramtype = "light",
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1}, groups = { snappy = 3, leafdecay = 3, flammable = 2, leaves = 1 },
drop = { drop = {
max_items = 1, max_items = 1,
items = {{ items = {
items = {"moretrees:rubber_tree_sapling"}, {
rarity = 20, items = { "moretrees:rubber_tree_sapling" },
}, rarity = 20,
{ },
items = {"moretrees:rubber_tree_leaves"}, {
} items = { "moretrees:rubber_tree_leaves" },
}
} }
}, },
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
technic.rubber_tree_model={ technic.rubber_tree_model = {
axiom = "FFFFA", axiom = "FFFFA",
rules_a = "[&FFBFA]////[&BFFFA]////[&FBFFA]", rules_a = "[&FFBFA]////[&BFFFA]////[&FBFFA]",
rules_b = "[&FFA]////[&FFA]////[&FFA]", rules_b = "[&FFA]////[&FFA]////[&FFA]",
@ -72,7 +88,7 @@ technic.rubber_tree_model={
} }
minetest.register_abm({ minetest.register_abm({
nodenames = {"moretrees:rubber_tree_sapling"}, nodenames = { "moretrees:rubber_tree_sapling" },
interval = 60, interval = 60,
chance = 20, chance = 20,
action = function(pos, node) action = function(pos, node)
@ -87,13 +103,14 @@ if technic.config:get_bool("enable_rubber_tree_generation") then
return return
end end
local tmp = { local tmp = {
x = (maxp.x - minp.x) / 2 + minp.x, x = (maxp.x - minp.x) / 2 + minp.x,
y = (maxp.y - minp.y) / 2 + minp.y, y = (maxp.y - minp.y) / 2 + minp.y,
z = (maxp.z - minp.z) / 2 + minp.z} z = (maxp.z - minp.z) / 2 + minp.z
}
local pos = minetest.find_node_near(tmp, maxp.x - minp.x, local pos = minetest.find_node_near(tmp, maxp.x - minp.x,
{"default:dirt_with_grass"}) { "default:dirt_with_grass" })
if pos ~= nil then if pos ~= nil then
minetest.spawn_tree({x=pos.x, y=pos.y+1, z=pos.z}, technic.rubber_tree_model) minetest.spawn_tree({ x = pos.x, y = pos.y + 1, z = pos.z }, technic.rubber_tree_model)
end end
end) end)
end end

View File

@ -40,7 +40,7 @@ local function restore(pos, placer, itemstack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local data = minetest.deserialize(itemstack:get_metadata()) local data = minetest.deserialize(itemstack:get_metadata())
minetest.set_node(pos, {name = data.name, param2 = node.param2}) minetest.set_node(pos, { name = data.name, param2 = node.param2 })
local lists = data.lists local lists = data.lists
for name, value in pairs(data.metas) do for name, value in pairs(data.metas) do
local meta_type = get_meta_type(data.name, name) local meta_type = get_meta_type(data.name, name)
@ -84,12 +84,15 @@ minetest.register_tool("wrench:wrench", {
full_punch_interval = 0.9, full_punch_interval = 0.9,
max_drop_level = 0, max_drop_level = 0,
groupcaps = { groupcaps = {
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1}, crumbly = { times = { [2] = 3.00, [3] = 0.70 }, uses = 0, maxlevel = 1 },
snappy = {times={[3]=0.40}, 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}, oddly_breakable_by_hand = {
uses=0, maxlevel=3} times = { [1] = 7.00, [2] = 4.00, [3] = 1.40 },
uses = 0,
maxlevel = 3
}
}, },
damage_groups = {fleshy=1}, damage_groups = { fleshy = 1 },
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under local pos = pointed_thing.under
@ -116,9 +119,9 @@ minetest.register_tool("wrench:wrench", {
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
if owner and owner ~= placer:get_player_name() then if owner and owner ~= placer:get_player_name() then
minetest.log("action", placer:get_player_name().. minetest.log("action", placer:get_player_name()..
" tried to pick up a owned node belonging to ".. " tried to pick up a owned node belonging to "..
owner.." at ".. owner.." at "..
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
return return
end end
end end

View File

@ -19,41 +19,49 @@ wrench.META_TYPE_INT = 0
wrench.META_TYPE_FLOAT = 1 wrench.META_TYPE_FLOAT = 1
wrench.META_TYPE_STRING = 2 wrench.META_TYPE_STRING = 2
local INT, STRING, FLOAT = local INT, STRING, FLOAT =
wrench.META_TYPE_INT, wrench.META_TYPE_INT,
wrench.META_TYPE_STRING, wrench.META_TYPE_STRING,
wrench.META_TYPE_FLOAT wrench.META_TYPE_FLOAT
wrench.registered_nodes = { wrench.registered_nodes = {
["default:chest"] = { ["default:chest"] = {
lists = {"main"}, lists = { "main" },
}, },
["default:chest_locked"] = { ["default:chest_locked"] = {
lists = {"main"}, lists = { "main" },
metas = {owner = STRING, metas = {
infotext = STRING}, owner = STRING,
infotext = STRING
},
owned = true, owned = true,
}, },
["default:furnace"] = { ["default:furnace"] = {
lists = {"fuel", "src", "dst"}, lists = { "fuel", "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
fuel_totaltime = FLOAT, fuel_totaltime = FLOAT,
fuel_time = FLOAT, fuel_time = FLOAT,
src_totaltime = FLOAT, src_totaltime = FLOAT,
src_time = FLOAT}, src_time = FLOAT
},
}, },
["default:furnace_active"] = { ["default:furnace_active"] = {
lists = {"fuel", "src", "dst"}, lists = { "fuel", "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
fuel_totaltime = FLOAT, fuel_totaltime = FLOAT,
fuel_time = FLOAT, fuel_time = FLOAT,
src_totaltime = FLOAT, src_totaltime = FLOAT,
src_time = FLOAT}, src_time = FLOAT
},
store_meta_always = true, store_meta_always = true,
}, },
["default:sign_wall"] = { ["default:sign_wall"] = {
metas = {infotext = STRING, metas = {
text = STRING}, infotext = STRING,
text = STRING
},
}, },
} }
@ -67,7 +75,7 @@ end
function wrench:register_node(name, def) function wrench:register_node(name, def)
if minetest.registered_nodes[name] then if minetest.registered_nodes[name] then
self.registered_nodes[name] = def self.registered_nodes[name] = def
end end
end end

View File

@ -1,341 +1,412 @@
local INT, STRING, FLOAT =
local INT, STRING, FLOAT = wrench.META_TYPE_INT,
wrench.META_TYPE_INT, wrench.META_TYPE_STRING,
wrench.META_TYPE_STRING, wrench.META_TYPE_FLOAT
wrench.META_TYPE_FLOAT
wrench:register_node("technic:iron_chest", { wrench:register_node("technic:iron_chest", {
lists = {"main"}, lists = { "main" },
}) })
wrench:register_node("technic:iron_locked_chest", { wrench:register_node("technic:iron_locked_chest", {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING, metas = {
owner = STRING}, infotext = STRING,
owner = STRING
},
owned = true, owned = true,
}) })
wrench:register_node("technic:copper_chest", { wrench:register_node("technic:copper_chest", {
lists = {"main"}, lists = { "main" },
}) })
wrench:register_node("technic:copper_locked_chest", { wrench:register_node("technic:copper_locked_chest", {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING, metas = {
owner = STRING}, infotext = STRING,
owner = STRING
},
owned = true, owned = true,
}) })
wrench:register_node("technic:silver_chest", { wrench:register_node("technic:silver_chest", {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING, metas = {
formspec = STRING}, infotext = STRING,
formspec = STRING
},
}) })
wrench:register_node("technic:silver_locked_chest", { wrench:register_node("technic:silver_locked_chest", {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING, metas = {
infotext = STRING,
owner = STRING, owner = STRING,
formspec = STRING}, formspec = STRING
},
owned = true, owned = true,
}) })
wrench:register_node("technic:gold_chest", { wrench:register_node("technic:gold_chest", {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING, metas = {
formspec = STRING}, infotext = STRING,
formspec = STRING
},
}) })
wrench:register_node("technic:gold_locked_chest", { wrench:register_node("technic:gold_locked_chest", {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING, metas = {
infotext = STRING,
owner = STRING, owner = STRING,
formspec = STRING}, formspec = STRING
},
owned = true, owned = true,
}) })
wrench:register_node("technic:mithril_chest", { wrench:register_node("technic:mithril_chest", {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING, metas = {
formspec = STRING}, infotext = STRING,
formspec = STRING
},
}) })
wrench:register_node("technic:mithril_locked_chest", { wrench:register_node("technic:mithril_locked_chest", {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING, metas = {
infotext = STRING,
owner = STRING, owner = STRING,
formspec = STRING}, formspec = STRING
},
owned = true, owned = true,
}) })
wrench:register_node("technic:lv_electric_furnace", { wrench:register_node("technic:lv_electric_furnace", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:lv_electric_furnace_active", { wrench:register_node("technic:lv_electric_furnace_active", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_electric_furnace", { wrench:register_node("technic:mv_electric_furnace", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_electric_furnace_active", { wrench:register_node("technic:mv_electric_furnace_active", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:coal_alloy_furnace", { wrench:register_node("technic:coal_alloy_furnace", {
lists = {"fuel", "src", "dst"}, lists = { "fuel", "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
fuel_totaltime = FLOAT, fuel_totaltime = FLOAT,
fuel_time = FLOAT, fuel_time = FLOAT,
src_totaltime = FLOAT, src_totaltime = FLOAT,
src_time = FLOAT}, src_time = FLOAT
},
}) })
wrench:register_node("technic:coal_alloy_furnace_active", { wrench:register_node("technic:coal_alloy_furnace_active", {
lists = {"fuel", "src", "dst"}, lists = { "fuel", "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
fuel_totaltime = FLOAT, fuel_totaltime = FLOAT,
fuel_time = FLOAT, fuel_time = FLOAT,
src_totaltime = FLOAT, src_totaltime = FLOAT,
src_time = FLOAT}, src_time = FLOAT
},
}) })
wrench:register_node("technic:alloy_furnace", { wrench:register_node("technic:alloy_furnace", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:alloy_furnace_active", { wrench:register_node("technic:alloy_furnace_active", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_alloy_furnace", { wrench:register_node("technic:mv_alloy_furnace", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_alloy_furnace_active", { wrench:register_node("technic:mv_alloy_furnace_active", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:tool_workshop", { wrench:register_node("technic:tool_workshop", {
lists = {"src", "upgrade1", "upgrade2"}, lists = { "src", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT}, tube_time = INT
},
}) })
wrench:register_node("technic:grinder", { wrench:register_node("technic:grinder", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:grinder_active", { wrench:register_node("technic:grinder_active", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_grinder", { wrench:register_node("technic:mv_grinder", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_grinder_active", { wrench:register_node("technic:mv_grinder_active", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:extractor", { wrench:register_node("technic:extractor", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:extractor_active", { wrench:register_node("technic:extractor_active", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_extractor", { wrench:register_node("technic:mv_extractor", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_extractor_active", { wrench:register_node("technic:mv_extractor_active", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:compressor", { wrench:register_node("technic:compressor", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:compressor_active", { wrench:register_node("technic:compressor_active", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_compressor", { wrench:register_node("technic:mv_compressor", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_compressor_active", { wrench:register_node("technic:mv_compressor_active", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:cnc", { wrench:register_node("technic:cnc", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT, src_time = INT,
cnc_product = STRING}, cnc_product = STRING
},
}) })
wrench:register_node("technic:cnc_active", { wrench:register_node("technic:cnc_active", {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
LV_EU_demand = INT, LV_EU_demand = INT,
LV_EU_input = INT, LV_EU_input = INT,
src_time = INT, src_time = INT,
cnc_product = STRING}, cnc_product = STRING
},
}) })
wrench:register_node("technic:mv_centrifuge", { wrench:register_node("technic:mv_centrifuge", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
wrench:register_node("technic:mv_centrifuge_active", { wrench:register_node("technic:mv_centrifuge_active", {
lists = {"src", "dst", "upgrade1", "upgrade2"}, lists = { "src", "dst", "upgrade1", "upgrade2" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
MV_EU_demand = INT, MV_EU_demand = INT,
MV_EU_input = INT, MV_EU_input = INT,
tube_time = INT, tube_time = INT,
src_time = INT}, src_time = INT
},
}) })
local chest_mark_colors = { local chest_mark_colors = {
'_black', "_black",
'_blue', "_blue",
'_brown', "_brown",
'_cyan', "_cyan",
'_dark_green', "_dark_green",
'_dark_grey', "_dark_grey",
'_green', "_green",
'_grey', "_grey",
'_magenta', "_magenta",
'_orange', "_orange",
'_pink', "_pink",
'_red', "_red",
'_violet', "_violet",
'_white', "_white",
'_yellow', "_yellow",
'', "",
} }
for i = 1, 15 do for i = 1, 15 do
wrench:register_node("technic:gold_chest"..chest_mark_colors[i], { wrench:register_node("technic:gold_chest"..chest_mark_colors[i], {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING,formspec = STRING}, metas = { infotext = STRING, formspec = STRING },
}) })
wrench:register_node("technic:gold_locked_chest"..chest_mark_colors[i], { wrench:register_node("technic:gold_locked_chest"..chest_mark_colors[i], {
lists = {"main"}, lists = { "main" },
metas = {infotext = STRING,owner = STRING,formspec = STRING}, metas = { infotext = STRING, owner = STRING, formspec = STRING },
owned = true, owned = true,
}) })
end end
if minetest.get_modpath("technic") then if minetest.get_modpath("technic") then
for tier, _ in pairs(technic.machines) do for tier, _ in pairs(technic.machines) do
local ltier = tier:lower() local ltier = tier:lower()
for i = 0, 8 do for i = 0, 8 do
wrench:register_node("technic:"..ltier.."_battery_box"..i, { wrench:register_node("technic:"..ltier.."_battery_box"..i, {
lists = {"src", "dst"}, lists = { "src", "dst" },
metas = {infotext = STRING, metas = {
infotext = STRING,
formspec = STRING, formspec = STRING,
[tier.."_EU_demand"] = INT, [tier.."_EU_demand"] = INT,
[tier.."_EU_supply"] = INT, [tier.."_EU_supply"] = INT,
[tier.."_EU_input"] = INT, [tier.."_EU_input"] = INT,
internal_EU_charge = INT, internal_EU_charge = INT,
last_side_shown = INT}, last_side_shown = INT
},
}) })
end end
end end