mirror of
https://github.com/minetest-mods/technic.git
synced 2024-11-10 20:40:27 +01:00
Reformat code with IntelliJ auto-reformat function.
This commit is contained in:
parent
b7cecd7f3d
commit
73d8bdff4b
|
@ -8,12 +8,12 @@ technic.concrete_posts = {}
|
|||
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
|
||||
|
||||
for i = 0, 31 do
|
||||
minetest.register_alias("technic:concrete_post"..i,
|
||||
"technic:concrete_post")
|
||||
minetest.register_alias("technic:concrete_post" .. i,
|
||||
"technic:concrete_post")
|
||||
end
|
||||
for i = 32, 63 do
|
||||
minetest.register_alias("technic:concrete_post"..i,
|
||||
"technic:concrete_post_with_platform")
|
||||
minetest.register_alias("technic:concrete_post" .. i,
|
||||
"technic:concrete_post_with_platform")
|
||||
end
|
||||
|
||||
local steel_ingot
|
||||
|
@ -26,43 +26,43 @@ end
|
|||
minetest.register_craft({
|
||||
output = 'technic:rebar 6',
|
||||
recipe = {
|
||||
{'','', steel_ingot},
|
||||
{'',steel_ingot,''},
|
||||
{steel_ingot, '', ''},
|
||||
{ '', '', steel_ingot },
|
||||
{ '', steel_ingot, '' },
|
||||
{ steel_ingot, '', '' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:concrete 5',
|
||||
recipe = {
|
||||
{'default:stone','technic:rebar','default:stone'},
|
||||
{'technic:rebar','default:stone','technic:rebar'},
|
||||
{'default:stone','technic:rebar','default:stone'},
|
||||
{ 'default:stone', 'technic:rebar', 'default:stone' },
|
||||
{ 'technic:rebar', 'default:stone', 'technic:rebar' },
|
||||
{ 'default:stone', 'technic:rebar', 'default:stone' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:concrete_post_platform 6',
|
||||
recipe = {
|
||||
{'technic:concrete','technic:concrete_post','technic:concrete'},
|
||||
{ 'technic:concrete', 'technic:concrete_post', 'technic:concrete' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:concrete_post 12',
|
||||
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({
|
||||
output = 'technic:blast_resistant_concrete 5',
|
||||
recipe = {
|
||||
{'technic:concrete','technic:composite_plate','technic:concrete'},
|
||||
{'technic:composite_plate','technic:concrete','technic:composite_plate'},
|
||||
{'technic:concrete','technic:composite_plate','technic:concrete'},
|
||||
{ 'technic:concrete', 'technic:composite_plate', 'technic:concrete' },
|
||||
{ 'technic:composite_plate', 'technic:concrete', 'technic:composite_plate' },
|
||||
{ 'technic:concrete', 'technic:composite_plate', 'technic:concrete' },
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -73,49 +73,49 @@ minetest.register_craftitem(":technic:rebar", {
|
|||
|
||||
minetest.register_node(":technic:concrete", {
|
||||
description = S("Concrete Block"),
|
||||
tiles = {"technic_concrete_block.png",},
|
||||
groups = {cracky=1, level=2, concrete=1},
|
||||
tiles = { "technic_concrete_block.png", },
|
||||
groups = { cracky = 1, level = 2, concrete = 1 },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node(":technic:blast_resistant_concrete", {
|
||||
description = S("Blast-resistant Concrete Block"),
|
||||
tiles = {"technic_blast_resistant_concrete_block.png",},
|
||||
groups = {cracky=1, level=3, concrete=1},
|
||||
tiles = { "technic_blast_resistant_concrete_block.png", },
|
||||
groups = { cracky = 1, level = 3, concrete = 1 },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_blast = function(pos, intensity)
|
||||
if intensity > 9 then
|
||||
minetest.remove_node(pos)
|
||||
return {"technic:blast_resistant_concrete"}
|
||||
return { "technic:blast_resistant_concrete" }
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
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_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_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_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_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_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 }
|
||||
|
||||
minetest.register_node(":technic:concrete_post_platform", {
|
||||
description = S("Concrete Post Platform"),
|
||||
tiles = {"technic_concrete_block.png",},
|
||||
groups={cracky=1, level=2},
|
||||
tiles = { "technic_concrete_block.png", },
|
||||
groups = { cracky = 1, level = 2 },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
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)
|
||||
if node.name ~= "technic:concrete_post" then
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
if node.name ~= "technic:concrete_post" then
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
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()
|
||||
placer:set_wielded_item(itemstack)
|
||||
return itemstack
|
||||
|
@ -131,23 +131,23 @@ for platform = 0, 1 do
|
|||
end
|
||||
end
|
||||
|
||||
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"),
|
||||
tiles = {"technic_concrete_block.png"},
|
||||
groups = {cracky=1, level=2, concrete_post=1, not_in_creative_inventory=platform},
|
||||
tiles = { "technic_concrete_block.png" },
|
||||
groups = { cracky = 1, level = 2, concrete_post = 1, not_in_creative_inventory = platform },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = (platform == 1 and "technic:concrete_post_platform" or
|
||||
"technic:concrete_post"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
connects_to = {"group:concrete", "group:concrete_post"},
|
||||
connects_to = { "group:concrete", "group:concrete_post" },
|
||||
node_box = {
|
||||
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_back = box_back,
|
||||
connect_left = box_left,
|
||||
connect_back = box_back,
|
||||
connect_left = box_left,
|
||||
connect_right = box_right,
|
||||
},
|
||||
after_dig_node = after_dig_node,
|
||||
|
|
|
@ -10,139 +10,146 @@ if minetest.get_modpath("moreblocks") then
|
|||
-- chrome seems to be too hard of a metal to be actually sawable
|
||||
|
||||
stairsplus:register_all("technic", "marble", "technic:marble", {
|
||||
description=S("Marble"),
|
||||
groups={cracky=3, not_in_creative_inventory=1},
|
||||
tiles={"technic_marble.png"},
|
||||
description = S("Marble"),
|
||||
groups = { cracky = 3, not_in_creative_inventory = 1 },
|
||||
tiles = { "technic_marble.png" },
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "marble_bricks", "technic:marble_bricks", {
|
||||
description=S("Marble Bricks"),
|
||||
groups={cracky=3, not_in_creative_inventory=1},
|
||||
tiles={"technic_marble_bricks.png"},
|
||||
description = S("Marble Bricks"),
|
||||
groups = { cracky = 3, not_in_creative_inventory = 1 },
|
||||
tiles = { "technic_marble_bricks.png" },
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "granite", "technic:granite", {
|
||||
description=S("Granite"),
|
||||
groups={cracky=1, not_in_creative_inventory=1},
|
||||
tiles={"technic_granite.png"},
|
||||
description = S("Granite"),
|
||||
groups = { cracky = 1, not_in_creative_inventory = 1 },
|
||||
tiles = { "technic_granite.png" },
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "concrete", "technic:concrete", {
|
||||
description=S("Concrete"),
|
||||
groups={cracky=3, not_in_creative_inventory=1},
|
||||
tiles={"technic_concrete_block.png"},
|
||||
description = S("Concrete"),
|
||||
groups = { cracky = 3, not_in_creative_inventory = 1 },
|
||||
tiles = { "technic_concrete_block.png" },
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "zinc_block", "technic:zinc_block", {
|
||||
description=S("Zinc Block"),
|
||||
groups={cracky=1, not_in_creative_inventory=1},
|
||||
tiles={"technic_zinc_block.png"},
|
||||
description = S("Zinc Block"),
|
||||
groups = { cracky = 1, not_in_creative_inventory = 1 },
|
||||
tiles = { "technic_zinc_block.png" },
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "cast_iron_block", "technic:cast_iron_block", {
|
||||
description=S("Cast Iron Block"),
|
||||
groups={cracky=1, not_in_creative_inventory=1},
|
||||
tiles={"technic_cast_iron_block.png"},
|
||||
description = S("Cast Iron Block"),
|
||||
groups = { cracky = 1, not_in_creative_inventory = 1 },
|
||||
tiles = { "technic_cast_iron_block.png" },
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "carbon_steel_block", "technic:carbon_steel_block", {
|
||||
description=S("Carbon Steel Block"),
|
||||
groups={cracky=1, not_in_creative_inventory=1},
|
||||
tiles={"technic_carbon_steel_block.png"},
|
||||
description = S("Carbon Steel Block"),
|
||||
groups = { cracky = 1, not_in_creative_inventory = 1 },
|
||||
tiles = { "technic_carbon_steel_block.png" },
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "stainless_steel_block", "technic:stainless_steel_block", {
|
||||
description=S("Stainless Steel Block"),
|
||||
groups={cracky=1, not_in_creative_inventory=1},
|
||||
tiles={"technic_stainless_steel_block.png"},
|
||||
description = S("Stainless Steel Block"),
|
||||
groups = { cracky = 1, not_in_creative_inventory = 1 },
|
||||
tiles = { "technic_stainless_steel_block.png" },
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "brass_block", "technic:brass_block", {
|
||||
description=S("Brass Block"),
|
||||
groups={cracky=1, not_in_creative_inventory=1},
|
||||
tiles={"technic_brass_block.png"},
|
||||
description = S("Brass Block"),
|
||||
groups = { cracky = 1, not_in_creative_inventory = 1 },
|
||||
tiles = { "technic_brass_block.png" },
|
||||
})
|
||||
|
||||
function register_technic_stairs_alias(modname, origname, newmod, 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 .. "_wall", newmod..":slab_" .. newname .. "_wall")
|
||||
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_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_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 .. ":stair_" .. origname, newmod..":stair_" .. newname)
|
||||
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_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 .. "_half", newmod..":stair_" .. newname .. "_half")
|
||||
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_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_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_inverted", newmod..":stair_" .. newname .. "_inner_inverted")
|
||||
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 .. ":panel_" .. origname .. "_bottom", newmod..":panel_" .. newname .. "_bottom")
|
||||
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 .. ":micro_" .. origname .. "_bottom", newmod..":micro_" .. newname .. "_bottom")
|
||||
minetest.register_alias(modname .. ":micro_" .. origname .. "_top", newmod..":micro_" .. newname .. "_top")
|
||||
end
|
||||
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 .. "_wall", newmod .. ":slab_" .. newname .. "_wall")
|
||||
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_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_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 .. ":stair_" .. origname, newmod .. ":stair_" .. newname)
|
||||
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_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 .. "_half", newmod .. ":stair_" .. newname .. "_half")
|
||||
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_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_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_inverted", newmod .. ":stair_" .. newname .. "_inner_inverted")
|
||||
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 .. ":panel_" .. origname .. "_bottom", newmod .. ":panel_" .. newname .. "_bottom")
|
||||
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 .. ":micro_" .. origname .. "_bottom", newmod .. ":micro_" .. newname .. "_bottom")
|
||||
minetest.register_alias(modname .. ":micro_" .. origname .. "_top", newmod .. ":micro_" .. newname .. "_top")
|
||||
end
|
||||
|
||||
register_technic_stairs_alias("stairsplus", "concrete", "technic", "concrete")
|
||||
register_technic_stairs_alias("stairsplus", "marble", "technic", "marble")
|
||||
register_technic_stairs_alias("stairsplus", "granite", "technic", "granite")
|
||||
register_technic_stairs_alias("stairsplus", "marble_bricks", "technic", "marble_bricks")
|
||||
|
||||
end
|
||||
|
||||
local iclip_def = {
|
||||
description = "Insulator/cable clip",
|
||||
drawtype = "mesh",
|
||||
mesh = "technic_insulator_clip.obj",
|
||||
tiles = {"technic_insulator_clip.png"},
|
||||
tiles = { "technic_insulator_clip.png" },
|
||||
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(),
|
||||
}
|
||||
|
||||
local iclipfence_def = {
|
||||
description = "Insulator/cable clip",
|
||||
tiles = {"technic_insulator_clip.png"},
|
||||
tiles = { "technic_insulator_clip.png" },
|
||||
is_ground_content = false,
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "connected",
|
||||
fixed = {
|
||||
{ -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.1875, 0.625, -0.1875, 0.1875, 0.6875, 0.1875 },
|
||||
{ -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.125, 0.4375, -0.125, 0.125, 0.5, 0.125 },
|
||||
{ -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.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.1875, 0.625, -0.1875, 0.1875, 0.6875, 0.1875 },
|
||||
{ -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.125, 0.4375, -0.125, 0.125, 0.5, 0.125 },
|
||||
{ -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
|
||||
},
|
||||
-- connect_top =
|
||||
-- connect_bottom =
|
||||
connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8},
|
||||
{-1/16,-5/16,-1/2,1/16,-3/16,-1/8}},
|
||||
connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16},
|
||||
{-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},
|
||||
{-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}},
|
||||
connect_front = {
|
||||
{ -1 / 16, 3 / 16, -1 / 2, 1 / 16, 5 / 16, -1 / 8 },
|
||||
{ -1 / 16, -5 / 16, -1 / 2, 1 / 16, -3 / 16, -1 / 8 }
|
||||
},
|
||||
connect_left = {
|
||||
{ -1 / 2, 3 / 16, -1 / 16, -1 / 8, 5 / 16, 1 / 16 },
|
||||
{ -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 },
|
||||
{ -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"},
|
||||
groups = {fence=1, choppy=1, snappy=1, oddly_breakable_by_hand=1 },
|
||||
connects_to = { "group:fence", "group:wood", "group:tree" },
|
||||
groups = { fence = 1, choppy = 1, snappy = 1, oddly_breakable_by_hand = 1 },
|
||||
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)
|
||||
end
|
||||
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.palette = "unifieddyes_palette_extended.png"
|
||||
iclipfence_def.on_construct = unifieddyes.on_construct
|
||||
iclipfence_def.after_place_node = unifieddyes.recolor_on_place
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -171,17 +178,17 @@ minetest.register_node(":technic:insulator_clip_fencepost", iclipfence_def)
|
|||
minetest.register_craft({
|
||||
output = "technic:insulator_clip",
|
||||
recipe = {
|
||||
{ "", "dye:white", ""},
|
||||
{ "", "technic:raw_latex", ""},
|
||||
{ "technic:raw_latex", "default:stone", "technic:raw_latex"},
|
||||
{ "", "dye:white", "" },
|
||||
{ "", "technic:raw_latex", "" },
|
||||
{ "technic:raw_latex", "default:stone", "technic:raw_latex" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "technic:insulator_clip_fencepost 2",
|
||||
recipe = {
|
||||
{ "", "dye:white", ""},
|
||||
{ "", "technic:raw_latex", ""},
|
||||
{ "technic:raw_latex", "default:fence_wood", "technic:raw_latex"},
|
||||
{ "", "dye:white", "" },
|
||||
{ "", "technic:raw_latex", "" },
|
||||
{ "technic:raw_latex", "default:fence_wood", "technic:raw_latex" },
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
technic.config = technic.config or Settings(minetest.get_worldpath().."/technic.conf")
|
||||
technic.config = technic.config or Settings(minetest.get_worldpath() .. "/technic.conf")
|
||||
|
||||
local conf_table = technic.config:to_table()
|
||||
|
||||
|
|
|
@ -4,99 +4,99 @@ local mesecons_materials = minetest.get_modpath("mesecons_materials")
|
|||
-- tubes crafting recipes
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'pipeworks:accelerator_tube_1',
|
||||
recipe = {
|
||||
{'technic:copper_coil', 'pipeworks:tube_1', 'technic:copper_coil'},
|
||||
}
|
||||
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'},
|
||||
}
|
||||
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 = {
|
||||
{'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot'},
|
||||
{'default:diamond', '', 'default:diamond'},
|
||||
{'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot'},
|
||||
{ 'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot' },
|
||||
{ 'default:diamond', '', 'default:diamond' },
|
||||
{ 'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:green_energy_crystal',
|
||||
recipe = {
|
||||
{'default:gold_ingot', 'technic:battery', 'dye:green'},
|
||||
{'technic:battery', 'technic:red_energy_crystal', 'technic:battery'},
|
||||
{'dye:green', 'technic:battery', 'default:gold_ingot'},
|
||||
{ 'default:gold_ingot', 'technic:battery', 'dye:green' },
|
||||
{ 'technic:battery', 'technic:red_energy_crystal', 'technic:battery' },
|
||||
{ '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'},
|
||||
{ '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'},
|
||||
{ 'moreores:silver_ingot', 'technic:battery', 'dye:red' },
|
||||
{ 'technic:battery', 'default:diamondblock', 'technic:battery' },
|
||||
{ 'dye:red', 'technic:battery', 'moreores:silver_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:fine_copper_wire 2',
|
||||
recipe = {
|
||||
{'', 'default:copper_ingot', ''},
|
||||
{'', 'default:copper_ingot', ''},
|
||||
{'', 'default:copper_ingot', ''},
|
||||
{ '', 'default:copper_ingot', '' },
|
||||
{ '', 'default:copper_ingot', '' },
|
||||
{ '', 'default:copper_ingot', '' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:fine_gold_wire 2',
|
||||
recipe = {
|
||||
{'', 'default:gold_ingot', ''},
|
||||
{'', 'default:gold_ingot', ''},
|
||||
{'', 'default:gold_ingot', ''},
|
||||
{ '', 'default:gold_ingot', '' },
|
||||
{ '', 'default:gold_ingot', '' },
|
||||
{ '', 'default:gold_ingot', '' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:fine_silver_wire 2',
|
||||
recipe = {
|
||||
{'', 'moreores:silver_ingot', ''},
|
||||
{'', 'moreores:silver_ingot', ''},
|
||||
{'', 'moreores:silver_ingot', ''},
|
||||
{ '', 'moreores:silver_ingot', '' },
|
||||
{ '', 'moreores:silver_ingot', '' },
|
||||
{ '', 'moreores:silver_ingot', '' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:copper_coil 1',
|
||||
recipe = {
|
||||
{'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire'},
|
||||
{'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' },
|
||||
{ 'technic:wrought_iron_ingot', '', 'technic:wrought_iron_ingot' },
|
||||
{ 'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:motor',
|
||||
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', 'default:copper_ingot', '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' },
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -105,52 +105,52 @@ local isolation = mesecons_materials and "mesecons_materials:fiber" or "technic:
|
|||
minetest.register_craft({
|
||||
output = 'technic:lv_transformer',
|
||||
recipe = {
|
||||
{isolation, 'technic:wrought_iron_ingot', isolation},
|
||||
{'technic:copper_coil', 'technic:wrought_iron_ingot', 'technic:copper_coil'},
|
||||
{'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'},
|
||||
{ isolation, 'technic:wrought_iron_ingot', isolation },
|
||||
{ 'technic:copper_coil', 'technic:wrought_iron_ingot', 'technic:copper_coil' },
|
||||
{ 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:mv_transformer',
|
||||
recipe = {
|
||||
{isolation, 'technic:carbon_steel_ingot', isolation},
|
||||
{'technic:copper_coil', 'technic:carbon_steel_ingot', 'technic:copper_coil'},
|
||||
{'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot'},
|
||||
{ isolation, 'technic:carbon_steel_ingot', isolation },
|
||||
{ 'technic:copper_coil', 'technic:carbon_steel_ingot', 'technic:copper_coil' },
|
||||
{ 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:hv_transformer',
|
||||
recipe = {
|
||||
{isolation, 'technic:stainless_steel_ingot', isolation},
|
||||
{'technic:copper_coil', 'technic:stainless_steel_ingot', 'technic:copper_coil'},
|
||||
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
|
||||
{ isolation, 'technic:stainless_steel_ingot', isolation },
|
||||
{ 'technic:copper_coil', 'technic:stainless_steel_ingot', 'technic:copper_coil' },
|
||||
{ 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:control_logic_unit',
|
||||
recipe = {
|
||||
{'', 'technic:fine_gold_wire', ''},
|
||||
{'default:copper_ingot', 'technic:silicon_wafer', 'default:copper_ingot'},
|
||||
{'', 'technic:chromium_ingot', ''},
|
||||
{ '', 'technic:fine_gold_wire', '' },
|
||||
{ 'default:copper_ingot', 'technic:silicon_wafer', 'default:copper_ingot' },
|
||||
{ '', 'technic:chromium_ingot', '' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:mixed_metal_ingot 9',
|
||||
recipe = {
|
||||
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
|
||||
{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'},
|
||||
{'moreores:tin_ingot', 'moreores:tin_ingot', 'moreores:tin_ingot'},
|
||||
{ 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot' },
|
||||
{ 'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot' },
|
||||
{ 'moreores:tin_ingot', 'moreores:tin_ingot', 'moreores:tin_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:carbon_cloth',
|
||||
recipe = {
|
||||
{'technic:graphite', 'technic:graphite', 'technic:graphite'}
|
||||
{ 'technic:graphite', 'technic:graphite', 'technic:graphite' }
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -168,16 +168,16 @@ minetest.register_craft({
|
|||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "default:bronze_ingot 0",
|
||||
recipe = {"default:copper_ingot", "default:steel_ingot"}
|
||||
recipe = { "default:copper_ingot", "default:steel_ingot" }
|
||||
})
|
||||
|
||||
-- Accelerator tube
|
||||
minetest.register_craft({
|
||||
output = "pipeworks:accelerator_tube_1 0",
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||
{ "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" },
|
||||
{ "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" },
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -185,16 +185,16 @@ minetest.register_craft({
|
|||
minetest.register_craft({
|
||||
output = "pipeworks:teleport_tube_1 0",
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
|
||||
{ "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" },
|
||||
{ "default:desert_stone", "default:mese", "default:desert_stone" },
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:dirt 2",
|
||||
type = "shapeless",
|
||||
replacements = {{"bucket:bucket_water","bucket:bucket_empty"}},
|
||||
replacements = { { "bucket:bucket_water", "bucket:bucket_empty" } },
|
||||
recipe = {
|
||||
"technic:stone_dust",
|
||||
"group:leaves",
|
||||
|
|
|
@ -5,7 +5,7 @@ do
|
|||
-- Escape for gsub
|
||||
for magic in ("().%+-*?[^$"):gmatch(".") do
|
||||
if sep == magic then
|
||||
sep = "%"..sep
|
||||
sep = "%" .. sep
|
||||
end
|
||||
end
|
||||
digit_sep_esc = sep
|
||||
|
@ -15,7 +15,7 @@ end
|
|||
function technic.pretty_num(num)
|
||||
local str, k = tostring(num), nil
|
||||
repeat
|
||||
str, k = str:gsub("^(-?%d+)(%d%d%d)", "%1"..digit_sep_esc.."%2")
|
||||
str, k = str:gsub("^(-?%d+)(%d%d%d)", "%1" .. digit_sep_esc .. "%2")
|
||||
until k == 0
|
||||
return str
|
||||
end
|
||||
|
@ -147,7 +147,7 @@ function technic.trace_node_ray_fat(pos, dir, range)
|
|||
end
|
||||
|
||||
-- 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 > dz then
|
||||
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
|
||||
-- table will be completely cleared before we reach this
|
||||
-- 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
|
||||
local dxn, dyn, dzn = dx / dlen, dy / dlen, dz / dlen
|
||||
if not sx and dxn > 0.5 then
|
||||
|
|
|
@ -16,36 +16,36 @@ technic.modpath = modpath
|
|||
if rawget(_G, "intllib") then
|
||||
technic.getter = intllib.Getter()
|
||||
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
|
||||
local S = technic.getter
|
||||
|
||||
-- Read configuration file
|
||||
dofile(modpath.."/config.lua")
|
||||
dofile(modpath .. "/config.lua")
|
||||
|
||||
-- Helper functions
|
||||
dofile(modpath.."/helpers.lua")
|
||||
dofile(modpath .. "/helpers.lua")
|
||||
|
||||
-- Items
|
||||
dofile(modpath.."/items.lua")
|
||||
dofile(modpath .. "/items.lua")
|
||||
|
||||
-- Craft recipes for items
|
||||
dofile(modpath.."/crafts.lua")
|
||||
dofile(modpath .. "/crafts.lua")
|
||||
|
||||
-- Register functions
|
||||
dofile(modpath.."/register.lua")
|
||||
dofile(modpath .. "/register.lua")
|
||||
|
||||
-- Radiation
|
||||
dofile(modpath.."/radiation.lua")
|
||||
dofile(modpath .. "/radiation.lua")
|
||||
|
||||
-- Machines
|
||||
dofile(modpath.."/machines/init.lua")
|
||||
dofile(modpath .. "/machines/init.lua")
|
||||
|
||||
-- Tools
|
||||
dofile(modpath.."/tools/init.lua")
|
||||
dofile(modpath .. "/tools/init.lua")
|
||||
|
||||
-- Aliases for legacy node/item names
|
||||
dofile(modpath.."/legacy.lua")
|
||||
dofile(modpath .. "/legacy.lua")
|
||||
|
||||
if minetest.setting_getbool("log_mods") then
|
||||
print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start))
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craftitem("technic:silicon_wafer", {
|
||||
|
@ -6,7 +5,7 @@ minetest.register_craftitem("technic:silicon_wafer", {
|
|||
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"),
|
||||
inventory_image = "technic_doped_silicon_wafer.png",
|
||||
})
|
||||
|
@ -16,15 +15,14 @@ minetest.register_craftitem("technic:uranium_fuel", {
|
|||
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"),
|
||||
inventory_image = "technic_diamond_drill_head.png",
|
||||
})
|
||||
|
||||
minetest.register_tool("technic:blue_energy_crystal", {
|
||||
description = S("Blue Energy Crystal"),
|
||||
inventory_image = minetest.inventorycube(
|
||||
"technic_diamond_block_blue.png",
|
||||
inventory_image = minetest.inventorycube("technic_diamond_block_blue.png",
|
||||
"technic_diamond_block_blue.png",
|
||||
"technic_diamond_block_blue.png"),
|
||||
wear_represents = "technic_RE_charge",
|
||||
|
@ -32,15 +30,14 @@ minetest.register_tool("technic:blue_energy_crystal", {
|
|||
tool_capabilities = {
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
fleshy = {times={}, uses=10000, maxlevel=0}
|
||||
fleshy = { times = {}, uses = 10000, maxlevel = 0 }
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_tool("technic:green_energy_crystal", {
|
||||
description = S("Green Energy Crystal"),
|
||||
inventory_image = minetest.inventorycube(
|
||||
"technic_diamond_block_green.png",
|
||||
inventory_image = minetest.inventorycube("technic_diamond_block_green.png",
|
||||
"technic_diamond_block_green.png",
|
||||
"technic_diamond_block_green.png"),
|
||||
wear_represents = "technic_RE_charge",
|
||||
|
@ -48,15 +45,14 @@ minetest.register_tool("technic:green_energy_crystal", {
|
|||
tool_capabilities = {
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
fleshy = {times={}, uses=10000, maxlevel=0}
|
||||
fleshy = { times = {}, uses = 10000, maxlevel = 0 }
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_tool("technic:red_energy_crystal", {
|
||||
description = S("Red Energy Crystal"),
|
||||
inventory_image = minetest.inventorycube(
|
||||
"technic_diamond_block_red.png",
|
||||
inventory_image = minetest.inventorycube("technic_diamond_block_red.png",
|
||||
"technic_diamond_block_red.png",
|
||||
"technic_diamond_block_red.png"),
|
||||
wear_represents = "technic_RE_charge",
|
||||
|
@ -64,10 +60,10 @@ minetest.register_tool("technic:red_energy_crystal", {
|
|||
tool_capabilities = {
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
fleshy = {times={}, uses=10000, maxlevel=0}
|
||||
fleshy = { times = {}, uses = 10000, maxlevel = 0 }
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem("technic:fine_copper_wire", {
|
||||
|
@ -105,12 +101,12 @@ minetest.register_craftitem("technic:mv_transformer", {
|
|||
inventory_image = "technic_mv_transformer.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:hv_transformer", {
|
||||
minetest.register_craftitem("technic:hv_transformer", {
|
||||
description = S("High Voltage Transformer"),
|
||||
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"),
|
||||
inventory_image = "technic_control_logic_unit.png",
|
||||
})
|
||||
|
@ -147,24 +143,24 @@ minetest.register_craftitem("technic:carbon_cloth", {
|
|||
|
||||
minetest.register_node("technic:machine_casing", {
|
||||
description = S("Machine Casing"),
|
||||
groups = {cracky=2},
|
||||
groups = { cracky = 2 },
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
drawtype = "allfaces",
|
||||
tiles = {"technic_machine_casing.png"},
|
||||
tiles = { "technic_machine_casing.png" },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
for p = 0, 35 do
|
||||
local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil
|
||||
local psuffix = p == 7 and "" or p
|
||||
local ingot = "technic:uranium"..psuffix.."_ingot"
|
||||
local block = "technic:uranium"..psuffix.."_block"
|
||||
local ingot = "technic:uranium" .. psuffix .. "_ingot"
|
||||
local block = "technic:uranium" .. psuffix .. "_block"
|
||||
local ov = p == 7 and minetest.override_item or nil;
|
||||
(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",
|
||||
groups = {uranium_ingot=1, not_in_creative_inventory=nici},
|
||||
groups = { uranium_ingot = 1, not_in_creative_inventory = nici },
|
||||
});
|
||||
-- Note on radioactivity of blocks:
|
||||
-- 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
|
||||
-- for a fully-depleted uranium block and radioactive=2.6 for
|
||||
-- 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, {
|
||||
description = string.format(S("%.1f%%-Fissile Uranium Block"), p/10),
|
||||
tiles = {"technic_uranium_block.png"},
|
||||
description = string.format(S("%.1f%%-Fissile Uranium Block"), p / 10),
|
||||
tiles = { "technic_uranium_block.png" },
|
||||
is_ground_content = true,
|
||||
groups = {uranium_block=1, not_in_creative_inventory=nici,
|
||||
cracky=1, level=2, radioactive=radioactivity},
|
||||
groups = {
|
||||
uranium_block = 1,
|
||||
not_in_creative_inventory = nici,
|
||||
cracky = 1,
|
||||
level = 2,
|
||||
radioactive = radioactivity
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
});
|
||||
if not ov then
|
||||
minetest.register_craft({
|
||||
output = block,
|
||||
recipe = {
|
||||
{ingot, ingot, ingot},
|
||||
{ingot, ingot, ingot},
|
||||
{ingot, ingot, ingot},
|
||||
{ ingot, ingot, ingot },
|
||||
{ ingot, ingot, ingot },
|
||||
{ ingot, ingot, ingot },
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = ingot.." 9",
|
||||
recipe = {{block}},
|
||||
output = ingot .. " 9",
|
||||
recipe = { { block } },
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
|
||||
-- Aliases to convert from legacy node/item names
|
||||
|
||||
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:battery_box"] = "technic:lv_battery_box0",
|
||||
["technic:battery_box"] = "technic:lv_battery_box0",
|
||||
["technic:battery_box1"] = "technic:lv_battery_box1",
|
||||
["technic:battery_box2"] = "technic:lv_battery_box2",
|
||||
["technic:battery_box3"] = "technic:lv_battery_box3",
|
||||
|
@ -13,17 +12,17 @@ technic.legacy_nodenames = {
|
|||
["technic:battery_box6"] = "technic:lv_battery_box6",
|
||||
["technic:battery_box7"] = "technic:lv_battery_box7",
|
||||
["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:grinder"] = "technic:lv_grinder",
|
||||
["technic:grinder"] = "technic:lv_grinder",
|
||||
["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:compressor"] = "technic:lv_compressor",
|
||||
["technic:compressor"] = "technic:lv_compressor",
|
||||
["technic:compressor_active"] = "technic:lv_compressor_active",
|
||||
["technic:hv_battery_box"] = "technic:hv_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:iron_dust"] = "technic:wrought_iron_dust",
|
||||
["technic:enriched_uranium"] = "technic:uranium35_ingot",
|
||||
|
@ -34,8 +33,8 @@ for old, new in pairs(technic.legacy_nodenames) do
|
|||
end
|
||||
|
||||
for i = 0, 64 do
|
||||
minetest.register_alias("technic:hv_cable"..i, "technic:hv_cable")
|
||||
minetest.register_alias("technic:mv_cable"..i, "technic:mv_cable")
|
||||
minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable")
|
||||
minetest.register_alias("technic:hv_cable" .. i, "technic:hv_cable")
|
||||
minetest.register_alias("technic:mv_cable" .. i, "technic:mv_cable")
|
||||
minetest.register_alias("technic:lv_cable" .. i, "technic:lv_cable")
|
||||
end
|
||||
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:hv_battery_box0',
|
||||
recipe = {
|
||||
{'technic:mv_battery_box0', 'technic:mv_battery_box0', 'technic:mv_battery_box0'},
|
||||
{'technic:mv_battery_box0', 'technic:hv_transformer', 'technic:mv_battery_box0'},
|
||||
{'', 'technic:hv_cable', ''},
|
||||
{ 'technic:mv_battery_box0', 'technic:mv_battery_box0', 'technic:mv_battery_box0' },
|
||||
{ 'technic:mv_battery_box0', 'technic:hv_transformer', 'technic:mv_battery_box0' },
|
||||
{ '', 'technic:hv_cable', '' },
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_battery_box({
|
||||
tier = "HV",
|
||||
max_charge = 1000000,
|
||||
charge_rate = 100000,
|
||||
tier = "HV",
|
||||
max_charge = 1000000,
|
||||
charge_rate = 100000,
|
||||
discharge_rate = 400000,
|
||||
charge_step = 10000,
|
||||
charge_step = 10000,
|
||||
discharge_step = 40000,
|
||||
upgrade = 1,
|
||||
tube = 1,
|
||||
upgrade = 1,
|
||||
tube = 1,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
|
||||
minetest.register_craft({
|
||||
output = 'technic:hv_cable 3',
|
||||
recipe = {
|
||||
{'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'},
|
||||
{'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' },
|
||||
{ 'technic:mv_cable', 'technic:mv_cable', 'technic:mv_cable' },
|
||||
{ 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting' },
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
technic.register_cable("HV", 3/16)
|
||||
technic.register_cable("HV", 3 / 16)
|
||||
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
|
||||
-- How expensive is the generator?
|
||||
-- Leaves room for upgrades lowering the power drain?
|
||||
local forcefield_power_drain = 10
|
||||
local forcefield_power_drain = 10
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = "technic:forcefield_emitter_off",
|
||||
recipe = {
|
||||
{"default:mese", "technic:motor", "default:mese" },
|
||||
{"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"},
|
||||
{"default:mese", "technic:hv_cable", "default:mese" },
|
||||
{ "default:mese", "technic:motor", "default:mese" },
|
||||
{ "technic:deployer_off", "technic:machine_casing", "technic:deployer_off" },
|
||||
{ "default:mese", "technic:hv_cable", "default:mese" },
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -43,40 +43,40 @@ local function update_forcefield(pos, meta, active, first)
|
|||
local range = meta:get_int("range")
|
||||
local vm = VoxelManip()
|
||||
local MinEdge, MaxEdge = vm:read_from_map(vector.subtract(pos, range),
|
||||
vector.add(pos, range))
|
||||
local area = VoxelArea:new({MinEdge = MinEdge, MaxEdge = MaxEdge})
|
||||
vector.add(pos, range))
|
||||
local area = VoxelArea:new({ MinEdge = MinEdge, MaxEdge = MaxEdge })
|
||||
local data = vm:get_data()
|
||||
|
||||
local c_air = minetest.get_content_id("air")
|
||||
local c_field = minetest.get_content_id("technic:forcefield")
|
||||
|
||||
for z = -range, range do
|
||||
for y = -range, range do
|
||||
local vi = area:index(pos.x + (-range), pos.y + y, pos.z + z)
|
||||
for x = -range, range do
|
||||
local relevant
|
||||
if shape == 0 then
|
||||
local squared = x * x + y * y + z * z
|
||||
relevant =
|
||||
squared <= range * range + range and
|
||||
squared >= (range - 1) * (range - 1) + (range - 1)
|
||||
else
|
||||
relevant =
|
||||
x == -range or x == range or
|
||||
y == -range or y == range or
|
||||
z == -range or z == range
|
||||
end
|
||||
if relevant then
|
||||
local cid = data[vi]
|
||||
if active and replaceable_cids[cid] then
|
||||
data[vi] = c_field
|
||||
elseif not active and cid == c_field then
|
||||
data[vi] = c_air
|
||||
for y = -range, range do
|
||||
local vi = area:index(pos.x + (-range), pos.y + y, pos.z + z)
|
||||
for x = -range, range do
|
||||
local relevant
|
||||
if shape == 0 then
|
||||
local squared = x * x + y * y + z * z
|
||||
relevant =
|
||||
squared <= range * range + range and
|
||||
squared >= (range - 1) * (range - 1) + (range - 1)
|
||||
else
|
||||
relevant =
|
||||
x == -range or x == range or
|
||||
y == -range or y == range or
|
||||
z == -range or z == range
|
||||
end
|
||||
if relevant then
|
||||
local cid = data[vi]
|
||||
if active and replaceable_cids[cid] then
|
||||
data[vi] = c_field
|
||||
elseif not active and cid == c_field then
|
||||
data[vi] = c_air
|
||||
end
|
||||
end
|
||||
vi = vi + 1
|
||||
end
|
||||
end
|
||||
vi = vi + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vm:set_data(data)
|
||||
|
@ -90,26 +90,26 @@ local function update_forcefield(pos, meta, active, first)
|
|||
end
|
||||
|
||||
local function set_forcefield_formspec(meta)
|
||||
local formspec = "size[5,2.25]"..
|
||||
"field[0.3,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]"
|
||||
local formspec = "size[5,2.25]" ..
|
||||
"field[0.3,0.5;2,1;range;" .. S("Range") .. ";" .. meta:get_int("range") .. "]"
|
||||
-- The names for these toggle buttons are explicit about which
|
||||
-- state they'll switch to, so that multiple presses (arising
|
||||
-- from the ambiguity between lag and a missed press) only make
|
||||
-- the single change that the user expects.
|
||||
if meta:get_int("shape") == 0 then
|
||||
formspec = formspec.."button[3,0.2;2,1;shape1;"..S("Sphere").."]"
|
||||
formspec = formspec .. "button[3,0.2;2,1;shape1;" .. S("Sphere") .. "]"
|
||||
else
|
||||
formspec = formspec.."button[3,0.2;2,1;shape0;"..S("Cube").."]"
|
||||
formspec = formspec .. "button[3,0.2;2,1;shape0;" .. S("Cube") .. "]"
|
||||
end
|
||||
if meta:get_int("mesecon_mode") == 0 then
|
||||
formspec = formspec.."button[0,1;5,1;mesecon_mode_1;"..S("Ignoring Mesecon Signal").."]"
|
||||
formspec = formspec .. "button[0,1;5,1;mesecon_mode_1;" .. S("Ignoring Mesecon Signal") .. "]"
|
||||
else
|
||||
formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]"
|
||||
formspec = formspec .. "button[0,1;5,1;mesecon_mode_0;" .. S("Controlled by Mesecon Signal") .. "]"
|
||||
end
|
||||
if meta:get_int("enabled") == 0 then
|
||||
formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
|
||||
formspec = formspec .. "button[0,1.75;5,1;enable;" .. S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")) .. "]"
|
||||
else
|
||||
formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
|
||||
formspec = formspec .. "button[0,1.75;5,1;disable;" .. S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")) .. "]"
|
||||
end
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
|
@ -152,7 +152,7 @@ local mesecons = {
|
|||
|
||||
local function run(pos, node)
|
||||
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 machine_name = S("%s Forcefield Emitter"):format("HV")
|
||||
|
||||
|
@ -194,8 +194,8 @@ end
|
|||
|
||||
minetest.register_node("technic:forcefield_emitter_off", {
|
||||
description = S("%s Forcefield Emitter"):format("HV"),
|
||||
tiles = {"technic_forcefield_emitter_off.png"},
|
||||
groups = {cracky = 1, technic_machine = 1, technic_hv = 1},
|
||||
tiles = { "technic_forcefield_emitter_off.png" },
|
||||
groups = { cracky = 1, technic_machine = 1, technic_hv = 1 },
|
||||
on_receive_fields = forcefield_receive_fields,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -214,9 +214,13 @@ minetest.register_node("technic:forcefield_emitter_off", {
|
|||
|
||||
minetest.register_node("technic:forcefield_emitter_on", {
|
||||
description = S("%s Forcefield Emitter"):format("HV"),
|
||||
tiles = {"technic_forcefield_emitter_on.png"},
|
||||
groups = {cracky = 1, technic_machine = 1, technic_hv = 1,
|
||||
not_in_creative_inventory=1},
|
||||
tiles = { "technic_forcefield_emitter_on.png" },
|
||||
groups = {
|
||||
cracky = 1,
|
||||
technic_machine = 1,
|
||||
technic_hv = 1,
|
||||
not_in_creative_inventory = 1
|
||||
},
|
||||
drop = "technic:forcefield_emitter_off",
|
||||
on_receive_fields = forcefield_receive_fields,
|
||||
on_destruct = function(pos)
|
||||
|
@ -225,7 +229,7 @@ minetest.register_node("technic:forcefield_emitter_on", {
|
|||
end,
|
||||
mesecons = mesecons,
|
||||
technic_run = run,
|
||||
technic_on_disable = function (pos, node)
|
||||
technic_on_disable = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
update_forcefield(pos, meta, false)
|
||||
technic.swap_node(pos, "technic:forcefield_emitter_off")
|
||||
|
@ -236,20 +240,22 @@ minetest.register_node("technic:forcefield", {
|
|||
description = S("%s Forcefield"):format("HV"),
|
||||
sunlight_propagates = true,
|
||||
drawtype = "glasslike",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
groups = { not_in_creative_inventory = 1 },
|
||||
paramtype = "light",
|
||||
light_source = 15,
|
||||
light_source = 15,
|
||||
diggable = false,
|
||||
drop = '',
|
||||
tiles = {{
|
||||
name = "technic_forcefield_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 1.0,
|
||||
},
|
||||
}},
|
||||
tiles = {
|
||||
{
|
||||
name = "technic_forcefield_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 1.0,
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
@ -257,6 +263,6 @@ if minetest.get_modpath("mesecons_mvps") then
|
|||
mesecon.register_mvps_stopper("technic:forcefield")
|
||||
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)
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ minetest.register_alias("hv_generator", "technic:hv_generator")
|
|||
minetest.register_craft({
|
||||
output = 'technic:hv_generator',
|
||||
recipe = {
|
||||
{'technic:carbon_plate', 'technic:mv_generator', 'technic:composite_plate'},
|
||||
{'pipeworks:tube_1', 'technic:hv_transformer', 'pipeworks:tube_1'},
|
||||
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
|
||||
{ 'technic:carbon_plate', 'technic:mv_generator', 'technic:composite_plate' },
|
||||
{ 'pipeworks:tube_1', 'technic:hv_transformer', 'pipeworks:tube_1' },
|
||||
{ '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 })
|
||||
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
|
||||
technic.register_tier("HV", "High Voltage")
|
||||
|
||||
local path = technic.modpath.."/machines/HV"
|
||||
local path = technic.modpath .. "/machines/HV"
|
||||
|
||||
-- Wiring stuff
|
||||
dofile(path.."/cables.lua")
|
||||
dofile(path.."/battery_box.lua")
|
||||
dofile(path .. "/cables.lua")
|
||||
dofile(path .. "/battery_box.lua")
|
||||
|
||||
-- Generators
|
||||
dofile(path.."/solar_array.lua")
|
||||
dofile(path.."/nuclear_reactor.lua")
|
||||
dofile(path.."/generator.lua")
|
||||
dofile(path .. "/solar_array.lua")
|
||||
dofile(path .. "/nuclear_reactor.lua")
|
||||
dofile(path .. "/generator.lua")
|
||||
|
||||
-- Machines
|
||||
dofile(path.."/quarry.lua")
|
||||
dofile(path.."/forcefield.lua")
|
||||
dofile(path .. "/quarry.lua")
|
||||
dofile(path .. "/forcefield.lua")
|
||||
|
||||
|
|
|
@ -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!
|
||||
--]]
|
||||
|
||||
local burn_ticks = 7 * 24 * 60 * 60 -- Seconds
|
||||
local power_supply = 100000 -- EUs
|
||||
local fuel_type = "technic:uranium_fuel" -- The reactor burns this
|
||||
local burn_ticks = 7 * 24 * 60 * 60 -- Seconds
|
||||
local power_supply = 100000 -- EUs
|
||||
local fuel_type = "technic:uranium_fuel" -- The reactor burns this
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
|
@ -22,37 +22,37 @@ local reactor_desc = S("@1 Nuclear Reactor Core", S("HV")),
|
|||
minetest.register_craft({
|
||||
output = 'technic:hv_nuclear_reactor_core',
|
||||
recipe = {
|
||||
{'technic:carbon_plate', 'default:obsidian_glass', 'technic:carbon_plate'},
|
||||
{'technic:composite_plate', 'technic:machine_casing', 'technic:composite_plate'},
|
||||
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
|
||||
{ 'technic:carbon_plate', 'default:obsidian_glass', 'technic:carbon_plate' },
|
||||
{ 'technic:composite_plate', 'technic:machine_casing', 'technic:composite_plate' },
|
||||
{ 'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
local reactor_formspec =
|
||||
"invsize[8,9;]"..
|
||||
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
|
||||
"list[current_name;src;2,1;3,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"listring[]"
|
||||
"invsize[8,9;]" ..
|
||||
"label[0,0;" .. S("Nuclear Reactor Rod Compartment") .. "]" ..
|
||||
"list[current_name;src;2,1;3,2;]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[]"
|
||||
|
||||
-- "Boxy sphere"
|
||||
local node_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.483, -0.128, -0.128, 0.483, 0.128, 0.128},
|
||||
{-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.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.250, -0.432, -0.250, 0.250, 0.432, 0.250},
|
||||
{-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.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.128, -0.128, -0.483, 0.128, 0.128, 0.483},
|
||||
{-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.303, -0.303, -0.397, 0.303, 0.303, 0.397},
|
||||
{ -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.483, -0.128, -0.128, 0.483, 0.128, 0.128 },
|
||||
{ -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.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.250, -0.432, -0.250, 0.250, 0.432, 0.250 },
|
||||
{ -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.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.128, -0.128, -0.483, 0.128, 0.128, 0.483 },
|
||||
{ -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.303, -0.303, -0.397, 0.303, 0.303, 0.397 },
|
||||
}
|
||||
|
||||
local SS_OFF = 0
|
||||
|
@ -65,18 +65,18 @@ local function siren_set_state(pos, state)
|
|||
local siren = reactor_siren[hpos]
|
||||
if not siren then
|
||||
if state == SS_OFF then return end
|
||||
siren = {state=SS_OFF}
|
||||
siren = { state = SS_OFF }
|
||||
reactor_siren[hpos] = siren
|
||||
end
|
||||
if state == SS_DANGER and siren.state ~= SS_DANGER then
|
||||
if siren.handle then minetest.sound_stop(siren.handle) end
|
||||
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
|
||||
elseif state == SS_CLEAR then
|
||||
if siren.handle then minetest.sound_stop(siren.handle) end
|
||||
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.state = SS_CLEAR
|
||||
minetest.after(10, function()
|
||||
|
@ -148,7 +148,7 @@ local function reactor_structure_badness(pos)
|
|||
local pos2 = vector.add(pos, 3)
|
||||
local MinEdge, MaxEdge = vm:read_from_map(pos1, pos2)
|
||||
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_lead = minetest.get_content_id("technic:lead_block")
|
||||
|
@ -159,48 +159,48 @@ local function reactor_structure_badness(pos)
|
|||
local blast_layer, steel_layer, lead_layer, water_layer = 0, 0, 0, 0
|
||||
|
||||
for z = pos1.z, pos2.z do
|
||||
for y = pos1.y, pos2.y do
|
||||
for x = pos1.x, pos2.x do
|
||||
local cid = data[area:index(x, y, z)]
|
||||
if x == pos1.x or x == pos2.x or
|
||||
y == pos1.y or y == pos2.y or
|
||||
z == pos1.z or z == pos2.z then
|
||||
if cid == c_blast_concrete then
|
||||
blast_layer = blast_layer + 1
|
||||
end
|
||||
elseif 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 cid == c_lead then
|
||||
lead_layer = lead_layer + 1
|
||||
elseif cid == c_steel then
|
||||
steel_layer = steel_layer + 1
|
||||
end
|
||||
elseif x == pos1.x+2 or x == pos2.x-2 or
|
||||
y == pos1.y+2 or y == pos2.y-2 or
|
||||
z == pos1.z+2 or z == pos2.z-2 then
|
||||
if cid == c_water_source or cid == c_water_flowing then
|
||||
water_layer = water_layer + 1
|
||||
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
|
||||
for y = pos1.y, pos2.y do
|
||||
for x = pos1.x, pos2.x do
|
||||
local cid = data[area:index(x, y, z)]
|
||||
if x == pos1.x or x == pos2.x or
|
||||
y == pos1.y or y == pos2.y or
|
||||
z == pos1.z or z == pos2.z then
|
||||
if cid == c_blast_concrete then
|
||||
blast_layer = blast_layer + 1
|
||||
end
|
||||
elseif 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 cid == c_lead then
|
||||
lead_layer = lead_layer + 1
|
||||
elseif cid == c_steel then
|
||||
steel_layer = steel_layer + 1
|
||||
end
|
||||
elseif x == pos1.x + 2 or x == pos2.x - 2 or
|
||||
y == pos1.y + 2 or y == pos2.y - 2 or
|
||||
z == pos1.z + 2 or z == pos2.z - 2 then
|
||||
if cid == c_water_source or cid == c_water_flowing then
|
||||
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
|
||||
vm:set_data(data)
|
||||
vm:write_to_map()
|
||||
|
@ -215,16 +215,16 @@ end
|
|||
|
||||
|
||||
local function melt_down_reactor(pos)
|
||||
minetest.log("action", "A reactor melted down at "..minetest.pos_to_string(pos))
|
||||
minetest.set_node(pos, {name="technic:corium_source"})
|
||||
minetest.log("action", "A reactor melted down at " .. minetest.pos_to_string(pos))
|
||||
minetest.set_node(pos, { name = "technic:corium_source" })
|
||||
end
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:hv_nuclear_reactor_core_active"},
|
||||
nodenames = { "technic:hv_nuclear_reactor_core_active" },
|
||||
interval = 4,
|
||||
chance = 1,
|
||||
action = function (pos, node)
|
||||
action = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local badness = reactor_structure_badness(pos)
|
||||
local accum_badness = meta:get_int("structure_accumulated_badness")
|
||||
|
@ -251,7 +251,7 @@ local function run(pos, node)
|
|||
|
||||
if burn_time >= burn_ticks or burn_time == 0 then
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") then
|
||||
if not inv:is_empty("src") then
|
||||
local src_list = inv:get_list("src")
|
||||
local correct_fuel_count = 0
|
||||
for _, src_stack in pairs(src_list) do
|
||||
|
@ -263,7 +263,7 @@ local function run(pos, node)
|
|||
if correct_fuel_count == 6 and
|
||||
reactor_structure_badness(pos) == 0 then
|
||||
meta:set_int("burn_time", 1)
|
||||
technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active")
|
||||
technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active")
|
||||
meta:set_int("HV_EU_supply", power_supply)
|
||||
for idx, src_stack in pairs(src_list) do
|
||||
src_stack:take_item()
|
||||
|
@ -282,15 +282,15 @@ local function run(pos, node)
|
|||
burn_time = burn_time + 1
|
||||
meta:set_int("burn_time", burn_time)
|
||||
local percent = math.floor(burn_time / burn_ticks * 100)
|
||||
meta:set_string("infotext", reactor_desc.." ("..percent.."%)")
|
||||
meta:set_string("infotext", reactor_desc .. " (" .. percent .. "%)")
|
||||
meta:set_int("HV_EU_supply", power_supply)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("technic:hv_nuclear_reactor_core", {
|
||||
description = reactor_desc,
|
||||
tiles = {"technic_hv_nuclear_reactor_core.png"},
|
||||
groups = {cracky=1, technic_machine=1, technic_hv=1},
|
||||
tiles = { "technic_hv_nuclear_reactor_core.png" },
|
||||
groups = { cracky = 1, technic_machine = 1, technic_hv = 1 },
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drawtype = "nodebox",
|
||||
|
@ -316,9 +316,14 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
|
|||
})
|
||||
|
||||
minetest.register_node("technic:hv_nuclear_reactor_core_active", {
|
||||
tiles = {"technic_hv_nuclear_reactor_core.png"},
|
||||
groups = {cracky=1, technic_machine=1, technic_hv=1,
|
||||
radioactive=4, not_in_creative_inventory=1},
|
||||
tiles = { "technic_hv_nuclear_reactor_core.png" },
|
||||
groups = {
|
||||
cracky = 1,
|
||||
technic_machine = 1,
|
||||
technic_hv = 1,
|
||||
radioactive = 4,
|
||||
not_in_creative_inventory = 1
|
||||
},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "technic:hv_nuclear_reactor_core",
|
||||
|
@ -338,8 +343,8 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
|
|||
technic_run = run,
|
||||
technic_on_disable = function(pos, node)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1)
|
||||
end,
|
||||
timer:start(1)
|
||||
end,
|
||||
on_timer = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
|
@ -362,6 +367,6 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
|
|||
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)
|
||||
|
||||
|
|
|
@ -1,53 +1,50 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
recipe = {
|
||||
{"technic:carbon_plate", "pipeworks:filter", "technic:composite_plate"},
|
||||
{"technic:motor", "technic:machine_casing", "technic:diamond_drill_head"},
|
||||
{"technic:carbon_steel_block", "technic:hv_cable", "technic:carbon_steel_block"}},
|
||||
{ "technic:carbon_plate", "pipeworks:filter", "technic:composite_plate" },
|
||||
{ "technic:motor", "technic:machine_casing", "technic:diamond_drill_head" },
|
||||
{ "technic:carbon_steel_block", "technic:hv_cable", "technic:carbon_steel_block" }
|
||||
},
|
||||
output = "technic:quarry",
|
||||
})
|
||||
|
||||
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_eject_dir = vector.new(0, 1, 0)
|
||||
|
||||
local function set_quarry_formspec(meta)
|
||||
local radius = meta:get_int("size")
|
||||
local formspec = "size[6,4.3]"..
|
||||
"list[context;cache;0,1;4,3;]"..
|
||||
"item_image[4.8,0;1,1;technic:quarry]"..
|
||||
"label[0,0.2;"..S("%s Quarry"):format("HV").."]"..
|
||||
"field[4.3,3.5;2,1;size;"..S("Radius:")..";"..radius.."]"
|
||||
local formspec = "size[6,4.3]" ..
|
||||
"list[context;cache;0,1;4,3;]" ..
|
||||
"item_image[4.8,0;1,1;technic:quarry]" ..
|
||||
"label[0,0.2;" .. S("%s Quarry"):format("HV") .. "]" ..
|
||||
"field[4.3,3.5;2,1;size;" .. S("Radius:") .. ";" .. radius .. "]"
|
||||
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
|
||||
formspec = formspec.."button[4,1;2,1;disable;"..S("Enabled").."]"
|
||||
formspec = formspec .. "button[4,1;2,1;disable;" .. S("Enabled") .. "]"
|
||||
end
|
||||
local diameter = radius*2 + 1
|
||||
local diameter = radius * 2 + 1
|
||||
local nd = meta:get_int("dug")
|
||||
local rel_y = quarry_dig_above_nodes - math.floor(nd / (diameter*diameter))
|
||||
formspec = formspec.."label[0,4;"..minetest.formspec_escape(
|
||||
nd == 0 and S("Digging not started") or
|
||||
local rel_y = quarry_dig_above_nodes - math.floor(nd / (diameter * diameter))
|
||||
formspec = formspec .. "label[0,4;" .. minetest.formspec_escape(nd == 0 and S("Digging not started") or
|
||||
(rel_y < -quarry_max_depth and S("Digging finished") or
|
||||
(meta:get_int("purge_on") == 1 and S("Purging cache") or
|
||||
S("Digging %d m "..(rel_y > 0 and "above" or "below").." machine")
|
||||
:format(math.abs(rel_y))))
|
||||
).."]"
|
||||
formspec = formspec.."button[4,2;2,1;restart;"..S("Restart").."]"
|
||||
(meta:get_int("purge_on") == 1 and S("Purging cache") or
|
||||
S("Digging %d m " .. (rel_y > 0 and "above" or "below") .. " machine"):format(math.abs(rel_y))))) .. "]"
|
||||
formspec = formspec .. "button[4,2;2,1;restart;" .. S("Restart") .. "]"
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
|
||||
local function set_quarry_demand(meta)
|
||||
local radius = meta:get_int("size")
|
||||
local diameter = radius*2 + 1
|
||||
local diameter = radius * 2 + 1
|
||||
local machine_name = S("%s Quarry"):format("HV")
|
||||
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_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_int("HV_EU_demand", 0)
|
||||
else
|
||||
|
@ -79,7 +76,7 @@ local function quarry_handle_purge(pos)
|
|||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local i = 0
|
||||
for _,stack in ipairs(inv:get_list("cache")) do
|
||||
for _, stack in ipairs(inv:get_list("cache")) do
|
||||
i = i + 1
|
||||
if stack then
|
||||
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
|
||||
local pdir = minetest.facedir_to_dir(node.param2)
|
||||
local qdir = pdir.x == 1 and vector.new(0,0,-1) or
|
||||
(pdir.z == -1 and vector.new(-1,0,0) or
|
||||
(pdir.x == -1 and vector.new(0,0,1) or
|
||||
vector.new(1,0,0)))
|
||||
local qdir = pdir.x == 1 and vector.new(0, 0, -1) or
|
||||
(pdir.z == -1 and vector.new(-1, 0, 0) or
|
||||
(pdir.x == -1 and vector.new(0, 0, 1) or
|
||||
vector.new(1, 0, 0)))
|
||||
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,
|
||||
vector.new(0, quarry_dig_above_nodes, 0)),
|
||||
pdir),
|
||||
vector.multiply(qdir, -radius))
|
||||
local endpos = vector.add(vector.add(vector.add(startpos,
|
||||
vector.new(0, -quarry_dig_above_nodes-quarry_max_depth, 0)),
|
||||
vector.multiply(pdir, diameter-1)),
|
||||
vector.multiply(qdir, diameter-1))
|
||||
vector.new(0, -quarry_dig_above_nodes - quarry_max_depth, 0)),
|
||||
vector.multiply(pdir, diameter - 1)),
|
||||
vector.multiply(qdir, diameter - 1))
|
||||
local vm = VoxelManip()
|
||||
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 c_air = minetest.get_content_id("air")
|
||||
local owner = meta:get_string("owner")
|
||||
local nd = meta:get_int("dug")
|
||||
while nd ~= diameter*diameter * (quarry_dig_above_nodes+1+quarry_max_depth) do
|
||||
local ry = math.floor(nd / (diameter*diameter))
|
||||
local ndl = nd % (diameter*diameter)
|
||||
while nd ~= diameter * diameter * (quarry_dig_above_nodes + 1 + quarry_max_depth) do
|
||||
local ry = math.floor(nd / (diameter * diameter))
|
||||
local ndl = nd % (diameter * diameter)
|
||||
if ry % 2 == 1 then
|
||||
ndl = diameter*diameter - 1 - ndl
|
||||
ndl = diameter * diameter - 1 - ndl
|
||||
end
|
||||
local rq = math.floor(ndl / diameter)
|
||||
local rp = ndl % diameter
|
||||
|
@ -150,15 +147,15 @@ local function quarry_run(pos, node)
|
|||
local dignode
|
||||
if can_dig then
|
||||
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
|
||||
can_dig = false
|
||||
end
|
||||
end
|
||||
|
||||
if can_dig then
|
||||
for ay = startpos.y, digpos.y+1, -1 do
|
||||
local checkpos = {x=digpos.x, y=ay, z=digpos.z}
|
||||
for ay = startpos.y, digpos.y + 1, -1 do
|
||||
local checkpos = { x = digpos.x, y = ay, z = digpos.z }
|
||||
local checknode = technic.get_or_load_node(checkpos) or minetest.get_node(checkpos)
|
||||
if checknode.name ~= "air" then
|
||||
can_dig = false
|
||||
|
@ -181,7 +178,7 @@ local function quarry_run(pos, node)
|
|||
break
|
||||
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
|
||||
meta:set_int("purge_on", 1)
|
||||
end
|
||||
|
@ -200,24 +197,26 @@ end
|
|||
|
||||
local function send_move_error(player)
|
||||
minetest.chat_send_player(player:get_player_name(),
|
||||
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."))
|
||||
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."))
|
||||
return 0
|
||||
end
|
||||
|
||||
minetest.register_node("technic:quarry", {
|
||||
description = S("%s Quarry"):format("HV"),
|
||||
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"},
|
||||
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"
|
||||
},
|
||||
inventory_image = minetest.inventorycube("technic_carbon_steel_block.png",
|
||||
"technic_carbon_steel_block.png^default_tool_mesepick.png",
|
||||
"technic_carbon_steel_block.png"),
|
||||
"technic_carbon_steel_block.png^default_tool_mesepick.png",
|
||||
"technic_carbon_steel_block.png"),
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, tubedevice=1, technic_machine=1, technic_hv=1},
|
||||
connect_sides = {"bottom", "front", "left", "right"},
|
||||
groups = { cracky = 2, tubedevice = 1, technic_machine = 1, technic_hv = 1 },
|
||||
connect_sides = { "bottom", "front", "left", "right" },
|
||||
tube = {
|
||||
connect_sides = {top = 1},
|
||||
connect_sides = { top = 1 },
|
||||
-- lower priority than other tubes, so that quarries will prefer any
|
||||
-- other tube to another quarry, which could lead to server freezes
|
||||
-- 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())
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("cache")
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:solar_array_hv 1',
|
||||
recipe = {
|
||||
{'technic:solar_array_mv', 'technic:solar_array_mv', 'technic:solar_array_mv'},
|
||||
{'technic:carbon_plate', 'technic:hv_transformer', 'technic:composite_plate'},
|
||||
{'', 'technic:hv_cable', ''},
|
||||
{ 'technic:solar_array_mv', 'technic:solar_array_mv', 'technic:solar_array_mv' },
|
||||
{ 'technic:carbon_plate', 'technic:hv_transformer', 'technic:composite_plate' },
|
||||
{ '', 'technic:hv_cable', '' },
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_solar_array({tier="HV", power=100})
|
||||
technic.register_solar_array({ tier = "HV", power = 100 })
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:lv_alloy_furnace',
|
||||
recipe = {
|
||||
{'default:brick', 'default:brick', 'default:brick'},
|
||||
{'default:brick', 'technic:machine_casing', 'default:brick'},
|
||||
{'default:brick', 'technic:lv_cable', 'default:brick'},
|
||||
{ 'default:brick', 'default:brick', 'default:brick' },
|
||||
{ 'default:brick', 'technic:machine_casing', '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 } })
|
||||
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_battery_box0',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'technic:battery', 'technic:machine_casing', 'technic:battery'},
|
||||
{'technic:battery', 'technic:lv_cable', 'technic:battery'},
|
||||
{ 'group:wood', 'group:wood', 'group:wood' },
|
||||
{ 'technic:battery', 'technic:machine_casing', 'technic:battery' },
|
||||
{ 'technic:battery', 'technic:lv_cable', 'technic:battery' },
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_battery_box({
|
||||
tier = "LV",
|
||||
max_charge = 40000,
|
||||
charge_rate = 1000,
|
||||
tier = "LV",
|
||||
max_charge = 40000,
|
||||
charge_rate = 1000,
|
||||
discharge_rate = 4000,
|
||||
charge_step = 500,
|
||||
charge_step = 500,
|
||||
discharge_step = 800,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
minetest.register_alias("lv_cable", "technic:lv_cable")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_cable 6',
|
||||
recipe = {
|
||||
{'default:paper', 'default:paper', 'default:paper'},
|
||||
{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'},
|
||||
{'default:paper', 'default:paper', 'default:paper'},
|
||||
{ 'default:paper', 'default:paper', 'default:paper' },
|
||||
{ 'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot' },
|
||||
{ 'default:paper', 'default:paper', 'default:paper' },
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
technic.register_cable("LV", 2/16)
|
||||
technic.register_cable("LV", 2 / 16)
|
||||
|
||||
|
|
|
@ -13,82 +13,82 @@ local S = technic.getter
|
|||
minetest.register_craft({
|
||||
output = 'technic:cnc',
|
||||
recipe = {
|
||||
{'default:glass', 'technic:diamond_drill_head', 'default:glass'},
|
||||
{'technic:control_logic_unit', 'technic:machine_casing', 'technic:motor'},
|
||||
{'technic:carbon_steel_ingot', 'technic:lv_cable', 'technic:carbon_steel_ingot'},
|
||||
{ 'default:glass', 'technic:diamond_drill_head', 'default:glass' },
|
||||
{ 'technic:control_logic_unit', 'technic:machine_casing', 'technic:motor' },
|
||||
{ 'technic:carbon_steel_ingot', 'technic:lv_cable', 'technic:carbon_steel_ingot' },
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
local shape = {}
|
||||
local onesize_products = {
|
||||
slope = 2,
|
||||
slope_edge = 1,
|
||||
slope_inner_edge = 1,
|
||||
pyramid = 2,
|
||||
spike = 1,
|
||||
cylinder = 2,
|
||||
oblate_spheroid = 1,
|
||||
sphere = 1,
|
||||
stick = 8,
|
||||
slope_upsdown = 2,
|
||||
slope_edge_upsdown = 1,
|
||||
slope = 2,
|
||||
slope_edge = 1,
|
||||
slope_inner_edge = 1,
|
||||
pyramid = 2,
|
||||
spike = 1,
|
||||
cylinder = 2,
|
||||
oblate_spheroid = 1,
|
||||
sphere = 1,
|
||||
stick = 8,
|
||||
slope_upsdown = 2,
|
||||
slope_edge_upsdown = 1,
|
||||
slope_inner_edge_upsdown = 1,
|
||||
cylinder_horizontal = 2,
|
||||
slope_lying = 2,
|
||||
onecurvededge = 1,
|
||||
twocurvededge = 1,
|
||||
cylinder_horizontal = 2,
|
||||
slope_lying = 2,
|
||||
onecurvededge = 1,
|
||||
twocurvededge = 1,
|
||||
}
|
||||
local twosize_products = {
|
||||
element_straight = 4,
|
||||
element_end = 2,
|
||||
element_cross = 1,
|
||||
element_t = 1,
|
||||
element_edge = 2,
|
||||
element_straight = 4,
|
||||
element_end = 2,
|
||||
element_cross = 1,
|
||||
element_t = 1,
|
||||
element_edge = 2,
|
||||
}
|
||||
|
||||
local cnc_formspec =
|
||||
"invsize[9,11;]"..
|
||||
"label[1,0;"..S("Choose Milling Program:").."]"..
|
||||
"image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]"..
|
||||
"image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]"..
|
||||
"image_button[3,0.5;1,1;technic_cnc_slope_inner_edge.png;slope_inner_edge; ]"..
|
||||
"image_button[4,0.5;1,1;technic_cnc_pyramid.png;pyramid; ]"..
|
||||
"image_button[5,0.5;1,1;technic_cnc_spike.png;spike; ]"..
|
||||
"image_button[6,0.5;1,1;technic_cnc_cylinder.png;cylinder; ]"..
|
||||
"image_button[7,0.5;1,1;technic_cnc_oblate_spheroid.png;oblate_spheroid; ]"..
|
||||
"image_button[8,0.5;1,1;technic_cnc_stick.png;stick; ]"..
|
||||
"invsize[9,11;]" ..
|
||||
"label[1,0;" .. S("Choose Milling Program:") .. "]" ..
|
||||
"image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]" ..
|
||||
"image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]" ..
|
||||
"image_button[3,0.5;1,1;technic_cnc_slope_inner_edge.png;slope_inner_edge; ]" ..
|
||||
"image_button[4,0.5;1,1;technic_cnc_pyramid.png;pyramid; ]" ..
|
||||
"image_button[5,0.5;1,1;technic_cnc_spike.png;spike; ]" ..
|
||||
"image_button[6,0.5;1,1;technic_cnc_cylinder.png;cylinder; ]" ..
|
||||
"image_button[7,0.5;1,1;technic_cnc_oblate_spheroid.png;oblate_spheroid; ]" ..
|
||||
"image_button[8,0.5;1,1;technic_cnc_stick.png;stick; ]" ..
|
||||
|
||||
"image_button[1,1.5;1,1;technic_cnc_slope_upsdwn.png;slope_upsdown; ]"..
|
||||
"image_button[2,1.5;1,1;technic_cnc_slope_edge_upsdwn.png;slope_edge_upsdown; ]"..
|
||||
"image_button[3,1.5;1,1;technic_cnc_slope_inner_edge_upsdwn.png;slope_inner_edge_upsdown; ]"..
|
||||
"image_button[4,1.5;1,1;technic_cnc_cylinder_horizontal.png;cylinder_horizontal; ]"..
|
||||
"image_button[5,1.5;1,1;technic_cnc_sphere.png;sphere; ]"..
|
||||
"image_button[1,1.5;1,1;technic_cnc_slope_upsdwn.png;slope_upsdown; ]" ..
|
||||
"image_button[2,1.5;1,1;technic_cnc_slope_edge_upsdwn.png;slope_edge_upsdown; ]" ..
|
||||
"image_button[3,1.5;1,1;technic_cnc_slope_inner_edge_upsdwn.png;slope_inner_edge_upsdown; ]" ..
|
||||
"image_button[4,1.5;1,1;technic_cnc_cylinder_horizontal.png;cylinder_horizontal; ]" ..
|
||||
"image_button[5,1.5;1,1;technic_cnc_sphere.png;sphere; ]" ..
|
||||
|
||||
"image_button[1,2.5;1,1;technic_cnc_slope_lying.png;slope_lying; ]"..
|
||||
"image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]"..
|
||||
"image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]"..
|
||||
"image_button[1,2.5;1,1;technic_cnc_slope_lying.png;slope_lying; ]" ..
|
||||
"image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]" ..
|
||||
"image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]" ..
|
||||
|
||||
"label[1,3.5;"..S("Slim Elements half / normal height:").."]"..
|
||||
"label[1,3.5;" .. S("Slim Elements half / normal height:") .. "]" ..
|
||||
|
||||
"image_button[1,4;1,0.5;technic_cnc_full.png;full; ]"..
|
||||
"image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]"..
|
||||
"image_button[2,4;1,1;technic_cnc_element_straight.png;element_straight; ]"..
|
||||
"image_button[3,4;1,1;technic_cnc_element_end.png;element_end; ]"..
|
||||
"image_button[4,4;1,1;technic_cnc_element_cross.png;element_cross; ]"..
|
||||
"image_button[5,4;1,1;technic_cnc_element_t.png;element_t; ]"..
|
||||
"image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]"..
|
||||
"image_button[1,4;1,0.5;technic_cnc_full.png;full; ]" ..
|
||||
"image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]" ..
|
||||
"image_button[2,4;1,1;technic_cnc_element_straight.png;element_straight; ]" ..
|
||||
"image_button[3,4;1,1;technic_cnc_element_end.png;element_end; ]" ..
|
||||
"image_button[4,4;1,1;technic_cnc_element_cross.png;element_cross; ]" ..
|
||||
"image_button[5,4;1,1;technic_cnc_element_t.png;element_t; ]" ..
|
||||
"image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]" ..
|
||||
|
||||
"label[0, 5.5;"..S("In:").."]"..
|
||||
"list[current_name;src;0.5,5.5;1,1;]"..
|
||||
"label[4, 5.5;"..S("Out:").."]"..
|
||||
"list[current_name;dst;5,5.5;4,1;]"..
|
||||
"label[0, 5.5;" .. S("In:") .. "]" ..
|
||||
"list[current_name;src;0.5,5.5;1,1;]" ..
|
||||
"label[4, 5.5;" .. S("Out:") .. "]" ..
|
||||
"list[current_name;dst;5,5.5;4,1;]" ..
|
||||
|
||||
"list[current_player;main;0,7;8,4;]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"
|
||||
"list[current_player;main;0,7;8,4;]" ..
|
||||
"listring[current_name;dst]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;src]" ..
|
||||
"listring[current_player;main]"
|
||||
|
||||
local size = 1;
|
||||
|
||||
|
@ -109,10 +109,10 @@ local function form_handler(pos, formname, fields, sender)
|
|||
end
|
||||
|
||||
-- Resolve the node name and the number of items to make
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local inputstack = inv:get_stack("src", 1)
|
||||
local inputname = inputstack:get_name()
|
||||
local inputname = inputstack:get_name()
|
||||
local multiplier = 0
|
||||
for k, _ in pairs(fields) do
|
||||
-- Set a multipier for the half/full size capable blocks
|
||||
|
@ -123,18 +123,18 @@ local function form_handler(pos, formname, fields, sender)
|
|||
end
|
||||
|
||||
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())
|
||||
end
|
||||
|
||||
if onesize_products[k] ~= nil or (twosize_products[k] ~= nil and size==2) then
|
||||
meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k)
|
||||
if onesize_products[k] ~= nil or (twosize_products[k] ~= nil and size == 2) then
|
||||
meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k)
|
||||
--print(inputname .. "_technic_cnc_" .. k)
|
||||
break
|
||||
end
|
||||
|
||||
if twosize_products[k] ~= nil and size==1 then
|
||||
meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k .. "_double")
|
||||
if twosize_products[k] ~= nil and size == 1 then
|
||||
meta:set_string("cnc_product", inputname .. "_technic_cnc_" .. k .. "_double")
|
||||
--print(inputname .. "_technic_cnc_" .. k .. "_double")
|
||||
break
|
||||
end
|
||||
|
@ -144,17 +144,17 @@ end
|
|||
|
||||
-- Action code performing the transformation
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local machine_name = S("%s CNC Machine"):format("LV")
|
||||
local machine_node = "technic:cnc"
|
||||
local demand = 450
|
||||
local demand = 450
|
||||
|
||||
local result = meta:get_string("cnc_product")
|
||||
if inv:is_empty("src") or
|
||||
(not minetest.registered_nodes[result]) or
|
||||
(not inv:room_for_item("dst", result)) then
|
||||
(not minetest.registered_nodes[result]) or
|
||||
(not inv:room_for_item("dst", result)) then
|
||||
technic.swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_string("cnc_product", "")
|
||||
|
@ -166,7 +166,7 @@ local run = function(pos, node)
|
|||
technic.swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
elseif eu_input >= demand then
|
||||
technic.swap_node(pos, machine_node.."_active")
|
||||
technic.swap_node(pos, machine_node .. "_active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
meta:set_int("src_time", meta:get_int("src_time") + 1)
|
||||
if meta:get_int("src_time") >= 3 then -- 3 ticks per output
|
||||
|
@ -174,7 +174,7 @@ local run = function(pos, node)
|
|||
srcstack = inv:get_stack("src", 1)
|
||||
srcstack:take_item()
|
||||
inv:set_stack("src", 1, srcstack)
|
||||
inv:add_item("dst", result.." "..meta:get_int("cnc_multiplier"))
|
||||
inv:add_item("dst", result .. " " .. meta:get_int("cnc_multiplier"))
|
||||
end
|
||||
end
|
||||
meta:set_int("LV_EU_demand", demand)
|
||||
|
@ -183,11 +183,13 @@ end
|
|||
-- The actual block inactive state
|
||||
minetest.register_node("technic:cnc", {
|
||||
description = S("%s CNC Machine"):format("LV"),
|
||||
tiles = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
||||
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"},
|
||||
groups = {cracky=2, technic_machine=1, technic_lv=1},
|
||||
connect_sides = {"bottom", "back", "left", "right"},
|
||||
paramtype2 = "facedir",
|
||||
tiles = {
|
||||
"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
||||
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"
|
||||
},
|
||||
groups = { cracky = 2, technic_machine = 1, technic_lv = 1 },
|
||||
connect_sides = { "bottom", "back", "left", "right" },
|
||||
paramtype2 = "facedir",
|
||||
legacy_facedir_simple = true,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -209,10 +211,12 @@ minetest.register_node("technic:cnc", {
|
|||
-- Active state block
|
||||
minetest.register_node("technic:cnc_active", {
|
||||
description = S("%s CNC Machine"):format("LV"),
|
||||
tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
||||
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"},
|
||||
groups = {cracky=2, technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||
connect_sides = {"bottom", "back", "left", "right"},
|
||||
tiles = {
|
||||
"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
||||
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"
|
||||
},
|
||||
groups = { cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1 },
|
||||
connect_sides = { "bottom", "back", "left", "right" },
|
||||
paramtype2 = "facedir",
|
||||
drop = "technic:cnc",
|
||||
legacy_facedir_simple = true,
|
||||
|
@ -225,6 +229,6 @@ minetest.register_node("technic:cnc_active", {
|
|||
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)
|
||||
|
||||
|
|
|
@ -11,265 +11,298 @@ technic.cnc = {}
|
|||
-- Define slope boxes for the various nodes
|
||||
-------------------------------------------
|
||||
technic.cnc.programs = {
|
||||
{ suffix = "technic_cnc_stick",
|
||||
model = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15},
|
||||
desc = S("Stick")
|
||||
{
|
||||
suffix = "technic_cnc_stick",
|
||||
model = { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 },
|
||||
desc = S("Stick")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_element_end_double",
|
||||
model = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.5},
|
||||
desc = S("Element End Double")
|
||||
{
|
||||
suffix = "technic_cnc_element_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 = {
|
||||
{0.3, -0.5, -0.3, 0.5, 0.5, 0.3},
|
||||
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.5},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}},
|
||||
desc = S("Element Cross Double")
|
||||
{ 0.3, -0.5, -0.3, 0.5, 0.5, 0.3 },
|
||||
{ -0.3, -0.5, -0.5, 0.3, 0.5, 0.5 },
|
||||
{ -0.5, -0.5, -0.3, -0.3, 0.5, 0.3 }
|
||||
},
|
||||
desc = S("Element Cross Double")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_element_t_double",
|
||||
{
|
||||
suffix = "technic_cnc_element_t_double",
|
||||
model = {
|
||||
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.3},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3},
|
||||
{0.3, -0.5, -0.3, 0.5, 0.5, 0.3}},
|
||||
desc = S("Element T Double")
|
||||
{ -0.3, -0.5, -0.5, 0.3, 0.5, 0.3 },
|
||||
{ -0.5, -0.5, -0.3, -0.3, 0.5, 0.3 },
|
||||
{ 0.3, -0.5, -0.3, 0.5, 0.5, 0.3 }
|
||||
},
|
||||
desc = S("Element T Double")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_element_edge_double",
|
||||
{
|
||||
suffix = "technic_cnc_element_edge_double",
|
||||
model = {
|
||||
{-0.3, -0.5, -0.5, 0.3, 0.5, 0.3},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0.5, 0.3}},
|
||||
desc = S("Element Edge Double")
|
||||
{ -0.3, -0.5, -0.5, 0.3, 0.5, 0.3 },
|
||||
{ -0.5, -0.5, -0.3, -0.3, 0.5, 0.3 }
|
||||
},
|
||||
desc = S("Element Edge Double")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_element_straight_double",
|
||||
model = {-0.3, -0.5, -0.5, 0.3, 0.5, 0.5},
|
||||
desc = S("Element Straight Double")
|
||||
{
|
||||
suffix = "technic_cnc_element_straight_double",
|
||||
model = { -0.3, -0.5, -0.5, 0.3, 0.5, 0.5 },
|
||||
desc = S("Element Straight Double")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_element_end",
|
||||
model = {-0.3, -0.5, -0.3, 0.3, 0, 0.5},
|
||||
desc = S("Element End")
|
||||
{
|
||||
suffix = "technic_cnc_element_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 = {
|
||||
{0.3, -0.5, -0.3, 0.5, 0, 0.3},
|
||||
{-0.3, -0.5, -0.5, 0.3, 0, 0.5},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0, 0.3}},
|
||||
desc = S("Element Cross")
|
||||
{ 0.3, -0.5, -0.3, 0.5, 0, 0.3 },
|
||||
{ -0.3, -0.5, -0.5, 0.3, 0, 0.5 },
|
||||
{ -0.5, -0.5, -0.3, -0.3, 0, 0.3 }
|
||||
},
|
||||
desc = S("Element Cross")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_element_t",
|
||||
{
|
||||
suffix = "technic_cnc_element_t",
|
||||
model = {
|
||||
{-0.3, -0.5, -0.5, 0.3, 0, 0.3},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0, 0.3},
|
||||
{0.3, -0.5, -0.3, 0.5, 0, 0.3}},
|
||||
desc = S("Element T")
|
||||
{ -0.3, -0.5, -0.5, 0.3, 0, 0.3 },
|
||||
{ -0.5, -0.5, -0.3, -0.3, 0, 0.3 },
|
||||
{ 0.3, -0.5, -0.3, 0.5, 0, 0.3 }
|
||||
},
|
||||
desc = S("Element T")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_element_edge",
|
||||
{
|
||||
suffix = "technic_cnc_element_edge",
|
||||
model = {
|
||||
{-0.3, -0.5, -0.5, 0.3, 0, 0.3},
|
||||
{-0.5, -0.5, -0.3, -0.3, 0, 0.3}},
|
||||
desc = S("Element Edge")
|
||||
{ -0.3, -0.5, -0.5, 0.3, 0, 0.3 },
|
||||
{ -0.5, -0.5, -0.3, -0.3, 0, 0.3 }
|
||||
},
|
||||
desc = S("Element Edge")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_element_straight",
|
||||
model = {-0.3, -0.5, -0.5, 0.3, 0, 0.5},
|
||||
desc = S("Element Straight")
|
||||
{
|
||||
suffix = "technic_cnc_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",
|
||||
desc = S("Oblate spheroid"),
|
||||
cbox = {
|
||||
desc = S("Oblate spheroid"),
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -6/16, 4/16, -6/16, 6/16, 8/16, 6/16 },
|
||||
{ -8/16, -4/16, -8/16, 8/16, 4/16, 8/16 },
|
||||
{ -6/16, -8/16, -6/16, 6/16, -4/16, 6/16 }
|
||||
{ -6 / 16, 4 / 16, -6 / 16, 6 / 16, 8 / 16, 6 / 16 },
|
||||
{ -8 / 16, -4 / 16, -8 / 16, 8 / 16, 4 / 16, 8 / 16 },
|
||||
{ -6 / 16, -8 / 16, -6 / 16, 6 / 16, -4 / 16, 6 / 16 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_sphere",
|
||||
{
|
||||
suffix = "technic_cnc_sphere",
|
||||
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",
|
||||
desc = S("Horizontal Cylinder")
|
||||
desc = S("Horizontal Cylinder")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_cylinder",
|
||||
{
|
||||
suffix = "technic_cnc_cylinder",
|
||||
model = "technic_cylinder.obj",
|
||||
desc = S("Cylinder")
|
||||
desc = S("Cylinder")
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_twocurvededge",
|
||||
{
|
||||
suffix = "technic_cnc_twocurvededge",
|
||||
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",
|
||||
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",
|
||||
desc = S("Spike"),
|
||||
cbox = {
|
||||
desc = S("Spike"),
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -2/16, 4/16, -2/16, 2/16, 8/16, 2/16 },
|
||||
{ -4/16, 0, -4/16, 4/16, 4/16, 4/16 },
|
||||
{ -6/16, -4/16, -6/16, 6/16, 0, 6/16 },
|
||||
{ -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 }
|
||||
{ -2 / 16, 4 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16 },
|
||||
{ -4 / 16, 0, -4 / 16, 4 / 16, 4 / 16, 4 / 16 },
|
||||
{ -6 / 16, -4 / 16, -6 / 16, 6 / 16, 0, 6 / 16 },
|
||||
{ -8 / 16, -8 / 16, -8 / 16, 8 / 16, -4 / 16, 8 / 16 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_pyramid",
|
||||
{
|
||||
suffix = "technic_cnc_pyramid",
|
||||
model = "technic_pyramid.obj",
|
||||
desc = S("Pyramid"),
|
||||
cbox = {
|
||||
desc = S("Pyramid"),
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -2/16, -2/16, -2/16, 2/16, 0, 2/16 },
|
||||
{ -4/16, -4/16, -4/16, 4/16, -2/16, 4/16 },
|
||||
{ -6/16, -6/16, -6/16, 6/16, -4/16, 6/16 },
|
||||
{ -8/16, -8/16, -8/16, 8/16, -6/16, 8/16 }
|
||||
{ -2 / 16, -2 / 16, -2 / 16, 2 / 16, 0, 2 / 16 },
|
||||
{ -4 / 16, -4 / 16, -4 / 16, 4 / 16, -2 / 16, 4 / 16 },
|
||||
{ -6 / 16, -6 / 16, -6 / 16, 6 / 16, -4 / 16, 6 / 16 },
|
||||
{ -8 / 16, -8 / 16, -8 / 16, 8 / 16, -6 / 16, 8 / 16 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_slope_inner_edge_upsdown",
|
||||
{
|
||||
suffix = "technic_cnc_slope_inner_edge_upsdown",
|
||||
model = "technic_innercorner_upsdown.obj",
|
||||
desc = S("Slope Upside Down Inner Edge/Corner"),
|
||||
sbox = {
|
||||
desc = S("Slope Upside Down Inner Edge/Corner"),
|
||||
sbox = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||
},
|
||||
cbox = {
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ 0.25, -0.25, -0.5, 0.5, -0.5, 0.5 },
|
||||
{ -0.5, -0.25, 0.25, 0.5, -0.5, 0.5 },
|
||||
{ 0, 0, -0.5, 0.5, -0.25, 0.5 },
|
||||
{ -0.5, 0, 0, 0.5, -0.25, 0.5 },
|
||||
{ -0.25, 0.25, -0.5, 0.5, 0, -0.25 },
|
||||
{ -0.5, 0.25, -0.25, 0.5, 0, 0.5 },
|
||||
{ -0.5, 0.5, -0.5, 0.5, 0.25, 0.5 }
|
||||
{ 0.25, -0.25, -0.5, 0.5, -0.5, 0.5 },
|
||||
{ -0.5, -0.25, 0.25, 0.5, -0.5, 0.5 },
|
||||
{ 0, 0, -0.5, 0.5, -0.25, 0.5 },
|
||||
{ -0.5, 0, 0, 0.5, -0.25, 0.5 },
|
||||
{ -0.25, 0.25, -0.5, 0.5, 0, -0.25 },
|
||||
{ -0.5, 0.25, -0.25, 0.5, 0, 0.5 },
|
||||
{ -0.5, 0.5, -0.5, 0.5, 0.25, 0.5 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_slope_edge_upsdown",
|
||||
{
|
||||
suffix = "technic_cnc_slope_edge_upsdown",
|
||||
model = "technic_outercorner_upsdown.obj",
|
||||
desc = S("Slope Upside Down Outer Edge/Corner"),
|
||||
cbox = {
|
||||
desc = S("Slope Upside Down Outer Edge/Corner"),
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -8/16, 8/16, -8/16, 8/16, 4/16, 8/16 },
|
||||
{ -4/16, 4/16, -4/16, 8/16, 0, 8/16 },
|
||||
{ 0, 0, 0, 8/16, -4/16, 8/16 },
|
||||
{ 4/16, -4/16, 4/16, 8/16, -8/16, 8/16 }
|
||||
{ -8 / 16, 8 / 16, -8 / 16, 8 / 16, 4 / 16, 8 / 16 },
|
||||
{ -4 / 16, 4 / 16, -4 / 16, 8 / 16, 0, 8 / 16 },
|
||||
{ 0, 0, 0, 8 / 16, -4 / 16, 8 / 16 },
|
||||
{ 4 / 16, -4 / 16, 4 / 16, 8 / 16, -8 / 16, 8 / 16 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_slope_inner_edge",
|
||||
{
|
||||
suffix = "technic_cnc_slope_inner_edge",
|
||||
model = "technic_innercorner.obj",
|
||||
desc = S("Slope Inner Edge/Corner"),
|
||||
sbox = {
|
||||
desc = S("Slope Inner Edge/Corner"),
|
||||
sbox = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||
},
|
||||
cbox = {
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 },
|
||||
{ -0.5, -0.25, -0.25, 0.5, 0, 0.5 },
|
||||
{ -0.25, -0.25, -0.5, 0.5, 0, -0.25 },
|
||||
{ -0.5, 0, 0, 0.5, 0.25, 0.5 },
|
||||
{ 0, 0, -0.5, 0.5, 0.25, 0.5 },
|
||||
{ -0.5, 0.25, 0.25, 0.5, 0.5, 0.5 },
|
||||
{ 0.25, 0.25, -0.5, 0.5, 0.5, 0.5 }
|
||||
{ -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 },
|
||||
{ -0.5, -0.25, -0.25, 0.5, 0, 0.5 },
|
||||
{ -0.25, -0.25, -0.5, 0.5, 0, -0.25 },
|
||||
{ -0.5, 0, 0, 0.5, 0.25, 0.5 },
|
||||
{ 0, 0, -0.5, 0.5, 0.25, 0.5 },
|
||||
{ -0.5, 0.25, 0.25, 0.5, 0.5, 0.5 },
|
||||
{ 0.25, 0.25, -0.5, 0.5, 0.5, 0.5 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_slope_edge",
|
||||
{
|
||||
suffix = "technic_cnc_slope_edge",
|
||||
model = "technic_outercorner.obj",
|
||||
desc = S("Slope Outer Edge/Corner"),
|
||||
cbox = {
|
||||
desc = S("Slope Outer Edge/Corner"),
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ 4/16, 4/16, 4/16, 8/16, 8/16, 8/16 },
|
||||
{ 0, 0, 0, 8/16, 4/16, 8/16 },
|
||||
{ -4/16, -4/16, -4/16, 8/16, 0, 8/16 },
|
||||
{ -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 }
|
||||
{ 4 / 16, 4 / 16, 4 / 16, 8 / 16, 8 / 16, 8 / 16 },
|
||||
{ 0, 0, 0, 8 / 16, 4 / 16, 8 / 16 },
|
||||
{ -4 / 16, -4 / 16, -4 / 16, 8 / 16, 0, 8 / 16 },
|
||||
{ -8 / 16, -8 / 16, -8 / 16, 8 / 16, -4 / 16, 8 / 16 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_slope_upsdown",
|
||||
{
|
||||
suffix = "technic_cnc_slope_upsdown",
|
||||
model = "technic_slope_upsdown.obj",
|
||||
desc = S("Slope Upside Down"),
|
||||
cbox = {
|
||||
desc = S("Slope Upside Down"),
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -8/16, 8/16, -8/16, 8/16, 4/16, 8/16 },
|
||||
{ -8/16, 4/16, -4/16, 8/16, 0, 8/16 },
|
||||
{ -8/16, 0, 0, 8/16, -4/16, 8/16 },
|
||||
{ -8/16, -4/16, 4/16, 8/16, -8/16, 8/16 }
|
||||
{ -8 / 16, 8 / 16, -8 / 16, 8 / 16, 4 / 16, 8 / 16 },
|
||||
{ -8 / 16, 4 / 16, -4 / 16, 8 / 16, 0, 8 / 16 },
|
||||
{ -8 / 16, 0, 0, 8 / 16, -4 / 16, 8 / 16 },
|
||||
{ -8 / 16, -4 / 16, 4 / 16, 8 / 16, -8 / 16, 8 / 16 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_slope_lying",
|
||||
{
|
||||
suffix = "technic_cnc_slope_lying",
|
||||
model = "technic_slope_horizontal.obj",
|
||||
desc = S("Slope Lying"),
|
||||
cbox = {
|
||||
desc = S("Slope Lying"),
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ 4/16, -8/16, 4/16, 8/16, 8/16, 8/16 },
|
||||
{ 0, -8/16, 0, 4/16, 8/16, 8/16 },
|
||||
{ -4/16, -8/16, -4/16, 0, 8/16, 8/16 },
|
||||
{ -8/16, -8/16, -8/16, -4/16, 8/16, 8/16 }
|
||||
{ 4 / 16, -8 / 16, 4 / 16, 8 / 16, 8 / 16, 8 / 16 },
|
||||
{ 0, -8 / 16, 0, 4 / 16, 8 / 16, 8 / 16 },
|
||||
{ -4 / 16, -8 / 16, -4 / 16, 0, 8 / 16, 8 / 16 },
|
||||
{ -8 / 16, -8 / 16, -8 / 16, -4 / 16, 8 / 16, 8 / 16 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{ suffix = "technic_cnc_slope",
|
||||
{
|
||||
suffix = "technic_cnc_slope",
|
||||
model = "technic_slope.obj",
|
||||
desc = S("Slope"),
|
||||
cbox = {
|
||||
desc = S("Slope"),
|
||||
cbox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -8/16, 4/16, 4/16, 8/16, 8/16, 8/16 },
|
||||
{ -8/16, 0, 0, 8/16, 4/16, 8/16 },
|
||||
{ -8/16, -4/16, -4/16, 8/16, 0, 8/16 },
|
||||
{ -8/16, -8/16, -8/16, 8/16, -4/16, 8/16 }
|
||||
{ -8 / 16, 4 / 16, 4 / 16, 8 / 16, 8 / 16, 8 / 16 },
|
||||
{ -8 / 16, 0, 0, 8 / 16, 4 / 16, 8 / 16 },
|
||||
{ -8 / 16, -4 / 16, -4 / 16, 8 / 16, 0, 8 / 16 },
|
||||
{ -8 / 16, -8 / 16, -8 / 16, 8 / 16, -4 / 16, 8 / 16 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
-- Allow disabling certain programs for some node. Default is allowing all types for all nodes
|
||||
technic.cnc.programs_disable = {
|
||||
-- ["default:brick"] = {"technic_cnc_stick"}, -- Example: Disallow the stick for brick
|
||||
-- ...
|
||||
["default:dirt"] = {"technic_cnc_oblate_spheroid", "technic_cnc_slope_upsdown", "technic_cnc_edge",
|
||||
"technic_cnc_inner_edge", "technic_cnc_slope_edge_upsdown",
|
||||
"technic_cnc_slope_inner_edge_upsdown", "technic_cnc_stick",
|
||||
"technic_cnc_cylinder_horizontal"}
|
||||
["default:dirt"] = {
|
||||
"technic_cnc_oblate_spheroid", "technic_cnc_slope_upsdown", "technic_cnc_edge",
|
||||
"technic_cnc_inner_edge", "technic_cnc_slope_edge_upsdown",
|
||||
"technic_cnc_slope_inner_edge_upsdown", "technic_cnc_stick",
|
||||
"technic_cnc_cylinder_horizontal"
|
||||
}
|
||||
}
|
||||
|
||||
-- Generic function for registering all the different node types
|
||||
|
@ -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
|
||||
dtype = "nodebox"
|
||||
nodeboxdef = {
|
||||
type = "fixed",
|
||||
type = "fixed",
|
||||
fixed = model
|
||||
}
|
||||
else
|
||||
|
@ -292,16 +325,16 @@ function technic.cnc.register_program(recipeitem, suffix, model, groups, images,
|
|||
|
||||
if cbox and not sbox then sbox = cbox end
|
||||
|
||||
minetest.register_node(":"..recipeitem.."_"..suffix, {
|
||||
description = description,
|
||||
drawtype = dtype,
|
||||
node_box = nodeboxdef,
|
||||
mesh = meshdef,
|
||||
tiles = images,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
groups = groups,
|
||||
minetest.register_node(":" .. recipeitem .. "_" .. suffix, {
|
||||
description = description,
|
||||
drawtype = dtype,
|
||||
node_box = nodeboxdef,
|
||||
mesh = meshdef,
|
||||
tiles = images,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
groups = groups,
|
||||
selection_box = sbox,
|
||||
collision_box = cbox
|
||||
})
|
||||
|
@ -322,7 +355,7 @@ function technic.cnc.register_all(recipeitem, groups, images, description)
|
|||
-- Create the node if it passes the test
|
||||
if do_register then
|
||||
technic.cnc.register_program(recipeitem, data.suffix, data.model,
|
||||
groups, images, description.." "..data.desc, data.cbox, data.sbox)
|
||||
groups, images, description .. " " .. data.desc, data.cbox, data.sbox)
|
||||
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)
|
||||
|
||||
technic.cnc.register_slope(recipeitem, groups, images, desc_slope)
|
||||
technic.cnc.register_slope_lying(recipeitem, groups, images, desc_slope_lying)
|
||||
technic.cnc.register_slope_upsdown(recipeitem, groups, images, desc_slope_upsdown)
|
||||
technic.cnc.register_slope_edge(recipeitem, groups, images, desc_slope_edge)
|
||||
technic.cnc.register_slope_inner_edge(recipeitem, groups, images, desc_slope_inner_edge)
|
||||
technic.cnc.register_slope_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_edge)
|
||||
technic.cnc.register_slope_inner_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_inner_edge)
|
||||
technic.cnc.register_pyramid(recipeitem, groups, images, desc_pyramid)
|
||||
technic.cnc.register_spike(recipeitem, groups, images, desc_spike)
|
||||
technic.cnc.register_onecurvededge(recipeitem, groups, images, desc_onecurvededge)
|
||||
technic.cnc.register_twocurvededge(recipeitem, groups, images, desc_twocurvededge)
|
||||
technic.cnc.register_cylinder(recipeitem, groups, images, desc_cylinder)
|
||||
technic.cnc.register_cylinder_horizontal(recipeitem, groups, images, desc_cylinder_horizontal)
|
||||
technic.cnc.register_spheroid(recipeitem, groups, images, desc_spheroid)
|
||||
technic.cnc.register_element_straight(recipeitem, groups, images, desc_element_straight)
|
||||
technic.cnc.register_element_edge(recipeitem, groups, images, desc_element_edge)
|
||||
technic.cnc.register_element_t(recipeitem, groups, images, desc_element_t)
|
||||
technic.cnc.register_element_cross(recipeitem, groups, images, desc_element_cross)
|
||||
technic.cnc.register_element_end(recipeitem, groups, images, desc_element_end)
|
||||
technic.cnc.register_slope(recipeitem, groups, images, desc_slope)
|
||||
technic.cnc.register_slope_lying(recipeitem, groups, images, desc_slope_lying)
|
||||
technic.cnc.register_slope_upsdown(recipeitem, groups, images, desc_slope_upsdown)
|
||||
technic.cnc.register_slope_edge(recipeitem, groups, images, desc_slope_edge)
|
||||
technic.cnc.register_slope_inner_edge(recipeitem, groups, images, desc_slope_inner_edge)
|
||||
technic.cnc.register_slope_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_edge)
|
||||
technic.cnc.register_slope_inner_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_inner_edge)
|
||||
technic.cnc.register_pyramid(recipeitem, groups, images, desc_pyramid)
|
||||
technic.cnc.register_spike(recipeitem, groups, images, desc_spike)
|
||||
technic.cnc.register_onecurvededge(recipeitem, groups, images, desc_onecurvededge)
|
||||
technic.cnc.register_twocurvededge(recipeitem, groups, images, desc_twocurvededge)
|
||||
technic.cnc.register_cylinder(recipeitem, groups, images, desc_cylinder)
|
||||
technic.cnc.register_cylinder_horizontal(recipeitem, groups, images, desc_cylinder_horizontal)
|
||||
technic.cnc.register_spheroid(recipeitem, groups, images, desc_spheroid)
|
||||
technic.cnc.register_element_straight(recipeitem, groups, images, desc_element_straight)
|
||||
technic.cnc.register_element_edge(recipeitem, groups, images, desc_element_edge)
|
||||
technic.cnc.register_element_t(recipeitem, groups, images, desc_element_t)
|
||||
technic.cnc.register_element_cross(recipeitem, groups, images, desc_element_cross)
|
||||
technic.cnc.register_element_end(recipeitem, groups, images, desc_element_end)
|
||||
end
|
||||
|
||||
-- REGISTER STICKS: noncubic.register_xyz(recipeitem, groups, images, desc_element_xyz)
|
||||
------------------------------------------------------------------------------------------------------------
|
||||
function technic.cnc.register_stick_etc(recipeitem, groups, images, desc_stick)
|
||||
technic.cnc.register_stick(recipeitem, groups, images, desc_stick)
|
||||
technic.cnc.register_stick(recipeitem, groups, images, desc_stick)
|
||||
end
|
||||
|
||||
function technic.cnc.register_elements(recipeitem, groups, images, desc_element_straight_double, desc_element_edge_double, desc_element_t_double, desc_element_cross_double, desc_element_end_double)
|
||||
technic.cnc.register_element_straight_double(recipeitem, groups, images, desc_element_straight_double)
|
||||
technic.cnc.register_element_edge_double(recipeitem, groups, images, desc_element_edge_double)
|
||||
technic.cnc.register_element_t_double(recipeitem, groups, images, desc_element_t_double)
|
||||
technic.cnc.register_element_cross_double(recipeitem, groups, images, desc_element_cross_double)
|
||||
technic.cnc.register_element_end_double(recipeitem, groups, images, desc_element_end_double)
|
||||
technic.cnc.register_element_straight_double(recipeitem, groups, images, desc_element_straight_double)
|
||||
technic.cnc.register_element_edge_double(recipeitem, groups, images, desc_element_edge_double)
|
||||
technic.cnc.register_element_t_double(recipeitem, groups, images, desc_element_t_double)
|
||||
technic.cnc.register_element_cross_double(recipeitem, groups, images, desc_element_cross_double)
|
||||
technic.cnc.register_element_end_double(recipeitem, groups, images, desc_element_end_double)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,86 +6,86 @@ local S = technic.getter
|
|||
-- DIRT
|
||||
-------
|
||||
technic.cnc.register_all("default:dirt",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1},
|
||||
{"default_grass.png", "default_dirt.png", "default_grass.png"},
|
||||
S("Dirt"))
|
||||
{ snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1 },
|
||||
{ "default_grass.png", "default_dirt.png", "default_grass.png" },
|
||||
S("Dirt"))
|
||||
-- WOOD
|
||||
-------
|
||||
technic.cnc.register_all("default:wood",
|
||||
{snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
|
||||
{"default_wood.png"},
|
||||
S("Wooden"))
|
||||
{ snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1 },
|
||||
{ "default_wood.png" },
|
||||
S("Wooden"))
|
||||
-- STONE
|
||||
--------
|
||||
technic.cnc.register_all("default:stone",
|
||||
{cracky=3, not_in_creative_inventory=1},
|
||||
{"default_stone.png"},
|
||||
S("Stone"))
|
||||
{ cracky = 3, not_in_creative_inventory = 1 },
|
||||
{ "default_stone.png" },
|
||||
S("Stone"))
|
||||
-- COBBLE
|
||||
---------
|
||||
technic.cnc.register_all("default:cobble",
|
||||
{cracky=3, not_in_creative_inventory=1},
|
||||
{"default_cobble.png"},
|
||||
S("Cobble"))
|
||||
{ cracky = 3, not_in_creative_inventory = 1 },
|
||||
{ "default_cobble.png" },
|
||||
S("Cobble"))
|
||||
-- BRICK
|
||||
--------
|
||||
technic.cnc.register_all("default:brick",
|
||||
{cracky=3, not_in_creative_inventory=1},
|
||||
{"default_brick.png"},
|
||||
S("Brick"))
|
||||
{ cracky = 3, not_in_creative_inventory = 1 },
|
||||
{ "default_brick.png" },
|
||||
S("Brick"))
|
||||
|
||||
-- SANDSTONE
|
||||
------------
|
||||
technic.cnc.register_all("default:sandstone",
|
||||
{crumbly=2, cracky=3, not_in_creative_inventory=1},
|
||||
{"default_sandstone.png"},
|
||||
S("Sandstone"))
|
||||
{ crumbly = 2, cracky = 3, not_in_creative_inventory = 1 },
|
||||
{ "default_sandstone.png" },
|
||||
S("Sandstone"))
|
||||
|
||||
-- LEAVES
|
||||
---------
|
||||
technic.cnc.register_all("default:leaves",
|
||||
{snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1},
|
||||
{"default_leaves.png"},
|
||||
S("Leaves"))
|
||||
{ snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1 },
|
||||
{ "default_leaves.png" },
|
||||
S("Leaves"))
|
||||
-- TREE
|
||||
-------
|
||||
technic.cnc.register_all("default:tree",
|
||||
{snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1},
|
||||
{"default_tree.png"},
|
||||
S("Tree"))
|
||||
{ snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1, not_in_creative_inventory = 1 },
|
||||
{ "default_tree.png" },
|
||||
S("Tree"))
|
||||
|
||||
-- WROUGHT IRON
|
||||
---------------
|
||||
technic.cnc.register_all("default:steelblock",
|
||||
{cracky=1, level=2, not_in_creative_inventory=1},
|
||||
{"technic_wrought_iron_block.png"},
|
||||
S("Wrought Iron"))
|
||||
{ cracky = 1, level = 2, not_in_creative_inventory = 1 },
|
||||
{ "technic_wrought_iron_block.png" },
|
||||
S("Wrought Iron"))
|
||||
|
||||
-- Bronze
|
||||
--------
|
||||
technic.cnc.register_all("default:bronzeblock",
|
||||
{cracky=1, level=2, not_in_creative_inventory=1},
|
||||
{"default_bronze_block.png"},
|
||||
S("Bronze"))
|
||||
{ cracky = 1, level = 2, not_in_creative_inventory = 1 },
|
||||
{ "default_bronze_block.png" },
|
||||
S("Bronze"))
|
||||
|
||||
-- Stainless Steel
|
||||
--------
|
||||
technic.cnc.register_all("technic:stainless_steel_block",
|
||||
{cracky=1, level=2, not_in_creative_inventory=1},
|
||||
{"technic_stainless_steel_block.png"},
|
||||
S("Stainless Steel"))
|
||||
{ cracky = 1, level = 2, not_in_creative_inventory = 1 },
|
||||
{ "technic_stainless_steel_block.png" },
|
||||
S("Stainless Steel"))
|
||||
|
||||
-- Marble
|
||||
------------
|
||||
technic.cnc.register_all("technic:marble",
|
||||
{cracky=3, not_in_creative_inventory=1},
|
||||
{"technic_marble.png"},
|
||||
S("Marble"))
|
||||
{ cracky = 3, not_in_creative_inventory = 1 },
|
||||
{ "technic_marble.png" },
|
||||
S("Marble"))
|
||||
|
||||
-- Granite
|
||||
------------
|
||||
technic.cnc.register_all("technic:granite",
|
||||
{cracky=1, not_in_creative_inventory=1},
|
||||
{"technic_granite.png"},
|
||||
S("Granite"))
|
||||
{ cracky = 1, not_in_creative_inventory = 1 },
|
||||
{ "technic_granite.png" },
|
||||
S("Granite"))
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
|
||||
minetest.register_alias("compressor", "technic:lv_compressor")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_compressor',
|
||||
recipe = {
|
||||
{'default:stone', 'technic:motor', 'default:stone'},
|
||||
{'mesecons:piston', 'technic:machine_casing', 'mesecons:piston'},
|
||||
{'technic:fine_silver_wire', 'technic:lv_cable', 'technic:fine_silver_wire'},
|
||||
{ 'default:stone', 'technic:motor', 'default:stone' },
|
||||
{ 'mesecons:piston', 'technic:machine_casing', 'mesecons:piston' },
|
||||
{ '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 })
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:electric_furnace',
|
||||
recipe = {
|
||||
{'default:cobble', 'default:cobble', 'default:cobble'},
|
||||
{'default:cobble', 'technic:machine_casing', 'default:cobble'},
|
||||
{'default:cobble', 'technic:lv_cable', 'default:cobble'},
|
||||
{ 'default:cobble', 'default:cobble', 'default:cobble' },
|
||||
{ 'default:cobble', 'technic:machine_casing', '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 })
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
|
||||
minetest.register_alias("extractor", "technic:lv_extractor")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_extractor',
|
||||
recipe = {
|
||||
{'technic:treetap', 'technic:motor', 'technic:treetap'},
|
||||
{'technic:treetap', 'technic:machine_casing', 'technic:treetap'},
|
||||
{'', 'technic:lv_cable', ''},
|
||||
{ 'technic:treetap', 'technic:motor', 'technic:treetap' },
|
||||
{ 'technic:treetap', 'technic:machine_casing', 'technic:treetap' },
|
||||
{ '', 'technic:lv_cable', '' },
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_extractor({tier = "LV", demand = {300}, speed = 1})
|
||||
technic.register_extractor({ tier = "LV", demand = { 300 }, speed = 1 })
|
||||
|
|
|
@ -8,11 +8,11 @@ minetest.register_alias("lv_generator", "technic:lv_generator")
|
|||
minetest.register_craft({
|
||||
output = 'technic:lv_generator',
|
||||
recipe = {
|
||||
{'default:stone', 'default:furnace', 'default:stone'},
|
||||
{'default:stone', 'technic:machine_casing', 'default:stone'},
|
||||
{'default:stone', 'technic:lv_cable', 'default:stone'},
|
||||
{ 'default:stone', 'default:furnace', 'default:stone' },
|
||||
{ 'default:stone', 'technic:machine_casing', 'default:stone' },
|
||||
{ 'default:stone', 'technic:lv_cable', 'default:stone' },
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_generator({tier="LV", supply=200})
|
||||
technic.register_generator({ tier = "LV", supply = 200 })
|
||||
|
||||
|
|
|
@ -10,29 +10,29 @@ local S = technic.getter
|
|||
minetest.register_craft({
|
||||
output = 'technic:geothermal',
|
||||
recipe = {
|
||||
{'technic:granite', 'default:diamond', 'technic:granite'},
|
||||
{'technic:fine_copper_wire', 'technic:machine_casing', 'technic:fine_copper_wire'},
|
||||
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
|
||||
{ 'technic:granite', 'default:diamond', 'technic:granite' },
|
||||
{ 'technic:fine_copper_wire', 'technic:machine_casing', 'technic:fine_copper_wire' },
|
||||
{ 'technic:granite', 'technic:lv_cable', 'technic:granite' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:geothermal", {
|
||||
description = S("Geothermal %s Generator"):format("LV"),
|
||||
})
|
||||
})
|
||||
|
||||
local check_node_around = function(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: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
|
||||
end
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local water_nodes = 0
|
||||
local lava_nodes = 0
|
||||
local meta = minetest.get_meta(pos)
|
||||
local water_nodes = 0
|
||||
local lava_nodes = 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.
|
||||
-- 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
|
||||
|
||||
local positions = {
|
||||
{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, 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-1, 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 + 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, 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 - 1, 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 },
|
||||
}
|
||||
for _, p in pairs(positions) do
|
||||
local check = check_node_around(p)
|
||||
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
|
||||
|
||||
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 == 1 and lava_nodes == 2 then production_level = 75; eu_supply = 200 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 == 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 production_level > 0 then
|
||||
|
@ -66,10 +66,10 @@ local run = function(pos, node)
|
|||
end
|
||||
|
||||
meta:set_string("infotext",
|
||||
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
|
||||
technic.swap_node (pos, "technic:geothermal_active")
|
||||
technic.swap_node(pos, "technic:geothermal_active")
|
||||
return
|
||||
end
|
||||
if production_level == 0 then
|
||||
|
@ -80,10 +80,17 @@ end
|
|||
|
||||
minetest.register_node("technic:geothermal", {
|
||||
description = S("Geothermal %s Generator"):format("LV"),
|
||||
tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
||||
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1},
|
||||
tiles = {
|
||||
"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
||||
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"
|
||||
},
|
||||
groups = {
|
||||
snappy = 2,
|
||||
choppy = 2,
|
||||
oddly_breakable_by_hand = 2,
|
||||
technic_machine = 1,
|
||||
technic_lv = 1
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
@ -97,17 +104,25 @@ minetest.register_node("technic:geothermal", {
|
|||
|
||||
minetest.register_node("technic:geothermal_active", {
|
||||
description = S("Geothermal %s Generator"):format("LV"),
|
||||
tiles = {"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"},
|
||||
tiles = {
|
||||
"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",
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||
groups = {
|
||||
snappy = 2,
|
||||
choppy = 2,
|
||||
oddly_breakable_by_hand = 2,
|
||||
technic_machine = 1,
|
||||
technic_lv = 1,
|
||||
not_in_creative_inventory = 1
|
||||
},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "technic:geothermal",
|
||||
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)
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
|
||||
minetest.register_alias("grinder", "technic:lv_grinder")
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_grinder',
|
||||
recipe = {
|
||||
{'default:desert_stone', 'default:diamond', 'default:desert_stone'},
|
||||
{'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'},
|
||||
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
|
||||
{ 'default:desert_stone', 'default:diamond', 'default:desert_stone' },
|
||||
{ 'default:desert_stone', 'technic:machine_casing', 'default:desert_stone' },
|
||||
{ '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 })
|
||||
|
||||
|
|
|
@ -1,29 +1,28 @@
|
|||
|
||||
technic.register_tier("LV", "Low Voltage")
|
||||
|
||||
local path = technic.modpath.."/machines/LV"
|
||||
local path = technic.modpath .. "/machines/LV"
|
||||
|
||||
-- Wiring stuff
|
||||
dofile(path.."/cables.lua")
|
||||
dofile(path.."/battery_box.lua")
|
||||
dofile(path .. "/cables.lua")
|
||||
dofile(path .. "/battery_box.lua")
|
||||
|
||||
-- Generators
|
||||
dofile(path.."/solar_panel.lua")
|
||||
dofile(path.."/solar_array.lua")
|
||||
dofile(path.."/geothermal.lua")
|
||||
dofile(path.."/water_mill.lua")
|
||||
dofile(path.."/generator.lua")
|
||||
dofile(path .. "/solar_panel.lua")
|
||||
dofile(path .. "/solar_array.lua")
|
||||
dofile(path .. "/geothermal.lua")
|
||||
dofile(path .. "/water_mill.lua")
|
||||
dofile(path .. "/generator.lua")
|
||||
|
||||
-- Machines
|
||||
dofile(path.."/alloy_furnace.lua")
|
||||
dofile(path.."/electric_furnace.lua")
|
||||
dofile(path.."/grinder.lua")
|
||||
dofile(path.."/extractor.lua")
|
||||
dofile(path.."/compressor.lua")
|
||||
dofile(path .. "/alloy_furnace.lua")
|
||||
dofile(path .. "/electric_furnace.lua")
|
||||
dofile(path .. "/grinder.lua")
|
||||
dofile(path .. "/extractor.lua")
|
||||
dofile(path .. "/compressor.lua")
|
||||
|
||||
dofile(path.."/music_player.lua")
|
||||
dofile(path .. "/music_player.lua")
|
||||
|
||||
dofile(path.."/cnc.lua")
|
||||
dofile(path.."/cnc_api.lua")
|
||||
dofile(path.."/cnc_nodes.lua")
|
||||
dofile(path .. "/cnc.lua")
|
||||
dofile(path .. "/cnc_api.lua")
|
||||
dofile(path .. "/cnc_nodes.lua")
|
||||
|
||||
|
|
|
@ -7,29 +7,29 @@ minetest.register_alias("music_player", "technic:music_player")
|
|||
minetest.register_craft({
|
||||
output = 'technic:music_player',
|
||||
recipe = {
|
||||
{'technic:chromium_ingot', 'default:diamond', 'technic:chromium_ingot'},
|
||||
{'default:diamond', 'technic:machine_casing', 'default:diamond'},
|
||||
{'default:mossycobble', 'technic:lv_cable', 'default:mossycobble'},
|
||||
{ 'technic:chromium_ingot', 'default:diamond', 'technic:chromium_ingot' },
|
||||
{ 'default:diamond', 'technic:machine_casing', 'default:diamond' },
|
||||
{ 'default:mossycobble', 'technic:lv_cable', 'default:mossycobble' },
|
||||
}
|
||||
})
|
||||
|
||||
local music_handles = {}
|
||||
|
||||
local function play_track(pos, track)
|
||||
return minetest.sound_play("technic_track"..tostring(track),
|
||||
{pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,})
|
||||
return minetest.sound_play("technic_track" .. tostring(track),
|
||||
{ pos = pos, gain = 1.0, loop = true, max_hear_distance = 72, })
|
||||
end
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local machine_name = S("%s Music Player"):format("LV")
|
||||
local machine_node = "technic:music_player"
|
||||
local demand = 150
|
||||
local demand = 150
|
||||
|
||||
local current_track = meta:get_int("current_track")
|
||||
local pos_hash = minetest.hash_node_position(pos)
|
||||
local music_handle = music_handles[pos_hash]
|
||||
local pos_hash = minetest.hash_node_position(pos)
|
||||
local music_handle = music_handles[pos_hash]
|
||||
|
||||
-- Setup meta data if it does not exist.
|
||||
if not eu_input then
|
||||
|
@ -71,32 +71,38 @@ end
|
|||
|
||||
local function set_display(meta)
|
||||
meta:set_string("formspec",
|
||||
"size[4,4.5]"..
|
||||
"item_image[0,0;1,1;technic:music_player]"..
|
||||
"label[1,0;"..S("%s Music Player"):format("LV").."]"..
|
||||
"button[0,1;1,1;track1;1]"..
|
||||
"button[1,1;1,1;track2;2]"..
|
||||
"button[2,1;1,1;track3;3]"..
|
||||
"button[0,2;1,1;track4;4]"..
|
||||
"button[1,2;1,1;track5;5]"..
|
||||
"button[2,2;1,1;track6;6]"..
|
||||
"button[0,3;1,1;track7;7]"..
|
||||
"button[1,3;1,1;track8;8]"..
|
||||
"button[2,3;1,1;track9;9]"..
|
||||
"button[3,1;1,1;stop;Stop]"..
|
||||
"label[0,4;"..minetest.formspec_escape(
|
||||
meta:get_int("active") == 0 and
|
||||
S("Stopped") or
|
||||
S("Current track %s"):format(meta:get_int("current_track"))).."]")
|
||||
"size[4,4.5]" ..
|
||||
"item_image[0,0;1,1;technic:music_player]" ..
|
||||
"label[1,0;" .. S("%s Music Player"):format("LV") .. "]" ..
|
||||
"button[0,1;1,1;track1;1]" ..
|
||||
"button[1,1;1,1;track2;2]" ..
|
||||
"button[2,1;1,1;track3;3]" ..
|
||||
"button[0,2;1,1;track4;4]" ..
|
||||
"button[1,2;1,1;track5;5]" ..
|
||||
"button[2,2;1,1;track6;6]" ..
|
||||
"button[0,3;1,1;track7;7]" ..
|
||||
"button[1,3;1,1;track8;8]" ..
|
||||
"button[2,3;1,1;track9;9]" ..
|
||||
"button[3,1;1,1;stop;Stop]" ..
|
||||
"label[0,4;" .. minetest.formspec_escape(meta:get_int("active") == 0 and
|
||||
S("Stopped") or
|
||||
S("Current track %s"):format(meta:get_int("current_track"))) .. "]")
|
||||
end
|
||||
|
||||
minetest.register_node("technic:music_player", {
|
||||
description = S("%s Music Player"):format("LV"),
|
||||
tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png",
|
||||
"technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1},
|
||||
connect_sides = {"bottom"},
|
||||
tiles = {
|
||||
"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png",
|
||||
"technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"
|
||||
},
|
||||
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(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:solar_array_lv 1',
|
||||
recipe = {
|
||||
{'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel'},
|
||||
{'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot'},
|
||||
{'', 'technic:lv_cable', ''},
|
||||
{ 'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel' },
|
||||
{ 'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot' },
|
||||
{ '', 'technic:lv_cable', '' },
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_solar_array({tier="LV", power=10})
|
||||
technic.register_solar_array({ tier = "LV", power = 10 })
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@ local S = technic.getter
|
|||
minetest.register_craft({
|
||||
output = 'technic:solar_panel',
|
||||
recipe = {
|
||||
{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'},
|
||||
{'technic:fine_silver_wire', 'technic:lv_cable', 'mesecons_materials:glue'},
|
||||
|
||||
{ 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer' },
|
||||
{ '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.
|
||||
-- To take care of some of it solar panels do not work outside daylight hours or if
|
||||
-- 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 light = minetest.get_node_light(pos1, nil)
|
||||
|
@ -30,7 +29,7 @@ local run = function(pos, node)
|
|||
local meta = minetest.get_meta(pos)
|
||||
if light == nil then light = 0 end
|
||||
-- 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
|
||||
local charge_to_give = math.floor((light + pos1.y) * 3)
|
||||
charge_to_give = math.max(charge_to_give, 0)
|
||||
|
@ -44,20 +43,27 @@ local run = function(pos, node)
|
|||
end
|
||||
|
||||
minetest.register_node("technic:solar_panel", {
|
||||
tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
|
||||
"technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1},
|
||||
connect_sides = {"bottom"},
|
||||
tiles = {
|
||||
"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
|
||||
"technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"
|
||||
},
|
||||
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(),
|
||||
description = S("Small Solar %s Generator"):format("LV"),
|
||||
description = S("Small Solar %s Generator"):format("LV"),
|
||||
active = false,
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
is_ground_content = true,
|
||||
node_box = {
|
||||
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)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
|
|
@ -9,35 +9,35 @@ minetest.register_alias("water_mill", "technic:water_mill")
|
|||
minetest.register_craft({
|
||||
output = 'technic:water_mill',
|
||||
recipe = {
|
||||
{'technic:marble', 'default:diamond', 'technic:marble'},
|
||||
{'group:wood', 'technic:machine_casing', 'group:wood'},
|
||||
{'technic:marble', 'technic:lv_cable', 'technic:marble'},
|
||||
{ 'technic:marble', 'default:diamond', 'technic:marble' },
|
||||
{ 'group:wood', 'technic:machine_casing', 'group:wood' },
|
||||
{ 'technic:marble', 'technic:lv_cable', 'technic:marble' },
|
||||
}
|
||||
})
|
||||
|
||||
local function check_node_around_mill(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
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
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local water_flow = 0
|
||||
local lava_nodes = 0
|
||||
local meta = minetest.get_meta(pos)
|
||||
local water_flow = 0
|
||||
local lava_nodes = 0
|
||||
local production_level = 0
|
||||
local eu_supply = 0
|
||||
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)
|
||||
local eu_supply = 0
|
||||
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)
|
||||
|
||||
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, y=pos.y, z=pos.z+1},
|
||||
{x=pos.x, y=pos.y, z=pos.z-1},
|
||||
{ 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 },
|
||||
}
|
||||
|
||||
for _, p in pairs(positions) do
|
||||
|
@ -55,11 +55,11 @@ local run = function(pos, node)
|
|||
end
|
||||
|
||||
meta:set_string("infotext",
|
||||
S("Hydro %s Generator"):format("LV").." ("..production_level.."%)")
|
||||
S("Hydro %s Generator"):format("LV") .. " (" .. production_level .. "%)")
|
||||
|
||||
if production_level > 0 and
|
||||
minetest.get_node(pos).name == "technic:water_mill" then
|
||||
technic.swap_node (pos, "technic:water_mill_active")
|
||||
minetest.get_node(pos).name == "technic:water_mill" then
|
||||
technic.swap_node(pos, "technic:water_mill_active")
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
return
|
||||
end
|
||||
|
@ -70,12 +70,19 @@ end
|
|||
|
||||
minetest.register_node("technic:water_mill", {
|
||||
description = S("Hydro %s Generator"):format("LV"),
|
||||
tiles = {"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"},
|
||||
tiles = {
|
||||
"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"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1},
|
||||
groups = {
|
||||
snappy = 2,
|
||||
choppy = 2,
|
||||
oddly_breakable_by_hand = 2,
|
||||
technic_machine = 1,
|
||||
technic_lv = 1
|
||||
},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
|
@ -88,12 +95,20 @@ minetest.register_node("technic:water_mill", {
|
|||
|
||||
minetest.register_node("technic:water_mill_active", {
|
||||
description = S("Hydro %s Generator"):format("LV"),
|
||||
tiles = {"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"},
|
||||
tiles = {
|
||||
"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"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||
groups = {
|
||||
snappy = 2,
|
||||
choppy = 2,
|
||||
oddly_breakable_by_hand = 2,
|
||||
technic_machine = 1,
|
||||
technic_lv = 1,
|
||||
not_in_creative_inventory = 1
|
||||
},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "technic:water_mill",
|
||||
|
@ -101,6 +116,6 @@ minetest.register_node("technic:water_mill_active", {
|
|||
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)
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:mv_alloy_furnace',
|
||||
recipe = {
|
||||
{'technic:stainless_steel_ingot', 'technic:lv_alloy_furnace', 'technic:stainless_steel_ingot'},
|
||||
{'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:lv_alloy_furnace', 'technic:stainless_steel_ingot' },
|
||||
{ 'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1' },
|
||||
{ '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 } })
|
||||
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:mv_battery_box0',
|
||||
recipe = {
|
||||
{'technic:lv_battery_box0', 'technic:lv_battery_box0', 'technic:lv_battery_box0'},
|
||||
{'technic:lv_battery_box0', 'technic:mv_transformer', 'technic:lv_battery_box0'},
|
||||
{'', 'technic:mv_cable', ''},
|
||||
{ 'technic:lv_battery_box0', 'technic:lv_battery_box0', 'technic:lv_battery_box0' },
|
||||
{ 'technic:lv_battery_box0', 'technic:mv_transformer', 'technic:lv_battery_box0' },
|
||||
{ '', 'technic:mv_cable', '' },
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_battery_box({
|
||||
tier = "MV",
|
||||
max_charge = 200000,
|
||||
charge_rate = 20000,
|
||||
tier = "MV",
|
||||
max_charge = 200000,
|
||||
charge_rate = 20000,
|
||||
discharge_rate = 80000,
|
||||
charge_step = 2000,
|
||||
charge_step = 2000,
|
||||
discharge_step = 8000,
|
||||
upgrade = 1,
|
||||
tube = 1,
|
||||
upgrade = 1,
|
||||
tube = 1,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
minetest.register_alias("mv_cable", "technic:mv_cable")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:mv_cable 3',
|
||||
recipe ={
|
||||
{'technic:rubber', 'technic:rubber', 'technic:rubber'},
|
||||
{'technic:lv_cable', 'technic:lv_cable', 'technic:lv_cable'},
|
||||
{'technic:rubber', 'technic:rubber', 'technic:rubber'},
|
||||
recipe = {
|
||||
{ 'technic:rubber', 'technic:rubber', 'technic:rubber' },
|
||||
{ 'technic:lv_cable', 'technic:lv_cable', 'technic:lv_cable' },
|
||||
{ 'technic:rubber', 'technic:rubber', 'technic:rubber' },
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
technic.register_cable("MV", 2.5/16)
|
||||
technic.register_cable("MV", 2.5 / 16)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
minetest.register_craft({
|
||||
output = "technic:mv_centrifuge",
|
||||
recipe = {
|
||||
{"technic:motor", "technic:copper_plate", "technic:diamond_drill_head"},
|
||||
{"technic:copper_plate", "technic:machine_casing", "technic:copper_plate" },
|
||||
{"pipeworks:one_way_tube", "technic:mv_cable", "pipeworks:mese_filter" },
|
||||
{ "technic:motor", "technic:copper_plate", "technic:diamond_drill_head" },
|
||||
{ "technic:copper_plate", "technic:machine_casing", "technic:copper_plate" },
|
||||
{ "pipeworks:one_way_tube", "technic:mv_cable", "pipeworks:mese_filter" },
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:mv_compressor',
|
||||
recipe = {
|
||||
{'technic:stainless_steel_ingot', 'technic:lv_compressor', 'technic:stainless_steel_ingot'},
|
||||
{'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:lv_compressor', 'technic:stainless_steel_ingot' },
|
||||
{ 'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1' },
|
||||
{ '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 })
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:mv_electric_furnace',
|
||||
recipe = {
|
||||
{'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'},
|
||||
{'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:lv_electric_furnace', 'technic:stainless_steel_ingot' },
|
||||
{ 'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1' },
|
||||
{ '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 })
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:mv_extractor',
|
||||
recipe = {
|
||||
{'technic:stainless_steel_ingot', 'technic:lv_extractor', 'technic:stainless_steel_ingot'},
|
||||
{'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:lv_extractor', 'technic:stainless_steel_ingot' },
|
||||
{ 'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1' },
|
||||
{ '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 })
|
||||
|
|
|
@ -3,11 +3,11 @@ minetest.register_alias("generator_mv", "technic:generator_mv")
|
|||
minetest.register_craft({
|
||||
output = 'technic:mv_generator',
|
||||
recipe = {
|
||||
{'technic:stainless_steel_ingot', 'technic:lv_generator', 'technic:stainless_steel_ingot'},
|
||||
{'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:lv_generator', 'technic:stainless_steel_ingot' },
|
||||
{ 'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1' },
|
||||
{ '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 })
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:mv_grinder',
|
||||
recipe = {
|
||||
{'technic:stainless_steel_ingot', 'technic:lv_grinder', 'technic:stainless_steel_ingot'},
|
||||
{'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:lv_grinder', 'technic:stainless_steel_ingot' },
|
||||
{ 'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1' },
|
||||
{ '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 })
|
||||
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
|
||||
technic.register_tier("MV", "Medium Voltage")
|
||||
|
||||
local path = technic.modpath.."/machines/MV"
|
||||
local path = technic.modpath .. "/machines/MV"
|
||||
|
||||
-- Wiring stuff
|
||||
dofile(path.."/cables.lua")
|
||||
dofile(path.."/battery_box.lua")
|
||||
dofile(path .. "/cables.lua")
|
||||
dofile(path .. "/battery_box.lua")
|
||||
|
||||
-- Generators
|
||||
if technic.config:get_bool("enable_wind_mill") then
|
||||
dofile(path.."/wind_mill.lua")
|
||||
dofile(path .. "/wind_mill.lua")
|
||||
end
|
||||
dofile(path.."/generator.lua")
|
||||
dofile(path.."/solar_array.lua")
|
||||
dofile(path .. "/generator.lua")
|
||||
dofile(path .. "/solar_array.lua")
|
||||
|
||||
-- Machines
|
||||
dofile(path.."/alloy_furnace.lua")
|
||||
dofile(path.."/electric_furnace.lua")
|
||||
dofile(path.."/grinder.lua")
|
||||
dofile(path.."/extractor.lua")
|
||||
dofile(path.."/compressor.lua")
|
||||
dofile(path.."/centrifuge.lua")
|
||||
dofile(path .. "/alloy_furnace.lua")
|
||||
dofile(path .. "/electric_furnace.lua")
|
||||
dofile(path .. "/grinder.lua")
|
||||
dofile(path .. "/extractor.lua")
|
||||
dofile(path .. "/compressor.lua")
|
||||
dofile(path .. "/centrifuge.lua")
|
||||
|
||||
dofile(path.."/tool_workshop.lua")
|
||||
dofile(path .. "/tool_workshop.lua")
|
||||
|
||||
-- The power radiator supplies appliances with inductive coupled power:
|
||||
-- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric.
|
||||
|
|
|
@ -6,51 +6,51 @@
|
|||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
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())
|
||||
else
|
||||
S = function (s) return s end
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
function technic_homedecor_node_is_owned(pos, placer)
|
||||
local ownername = false
|
||||
if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod
|
||||
if HasOwner(pos, placer) then
|
||||
if not IsPlayerNodeOwner(pos, placer:get_player_name()) then
|
||||
if type(getLastOwner) == "function" then -- ...is an old version
|
||||
ownername = getLastOwner(pos)
|
||||
elseif type(GetNodeOwnerName) == "function" then -- ...is a recent version
|
||||
ownername = GetNodeOwnerName(pos)
|
||||
else
|
||||
ownername = S("someone")
|
||||
end
|
||||
end
|
||||
end
|
||||
local ownername = false
|
||||
if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod
|
||||
if HasOwner(pos, placer) then
|
||||
if not IsPlayerNodeOwner(pos, placer:get_player_name()) then
|
||||
if type(getLastOwner) == "function" then -- ...is an old version
|
||||
ownername = getLastOwner(pos)
|
||||
elseif type(GetNodeOwnerName) == "function" then -- ...is a recent version
|
||||
ownername = GetNodeOwnerName(pos)
|
||||
else
|
||||
ownername = S("someone")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elseif type(isprotect) == "function" then -- glomie's protection mod
|
||||
if not isprotect(5, pos, placer) then
|
||||
ownername = S("someone")
|
||||
end
|
||||
elseif type(protector) == "table" and type(protector.can_dig) == "function" then -- Zeg9's protection mod
|
||||
if not protector.can_dig(5, pos, placer) then
|
||||
ownername = S("someone")
|
||||
end
|
||||
end
|
||||
elseif type(isprotect) == "function" then -- glomie's protection mod
|
||||
if not isprotect(5, pos, placer) then
|
||||
ownername = S("someone")
|
||||
end
|
||||
elseif type(protector) == "table" and type(protector.can_dig) == "function" then -- Zeg9's protection mod
|
||||
if not protector.can_dig(5, pos, placer) then
|
||||
ownername = S("someone")
|
||||
end
|
||||
end
|
||||
|
||||
if ownername ~= false then
|
||||
minetest.chat_send_player(placer:get_player_name(), S("Sorry, %s owns that spot."):format(ownername) )
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
if ownername ~= false then
|
||||
minetest.chat_send_player(placer:get_player_name(), S("Sorry, %s owns that spot."):format(ownername))
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local dirs1 = {20, 23, 22, 21}
|
||||
local dirs2 = {9, 18, 7, 12}
|
||||
local dirs1 = { 20, 23, 22, 21 }
|
||||
local dirs2 = { 9, 18, 7, 12 }
|
||||
|
||||
local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_thing)
|
||||
if not technic_homedecor_node_is_owned(pointed_thing.under, placer)
|
||||
and not technic_homedecor_node_is_owned(pointed_thing.above, placer) then
|
||||
if not technic_homedecor_node_is_owned(pointed_thing.under, placer)
|
||||
and not technic_homedecor_node_is_owned(pointed_thing.above, placer) then
|
||||
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
|
||||
|
||||
|
@ -63,7 +63,7 @@ local technic_homedecor_rotate_and_place = function(itemstack, placer, pointed_t
|
|||
local wield_name = itemstack:get_name()
|
||||
|
||||
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 isceiling = (above.x == under.x) and (above.z == under.z) and (pitch > 0)
|
||||
|
@ -76,12 +76,12 @@ 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 iswall then
|
||||
minetest.add_node(pos1, {name = wield_name, param2 = dirs2[fdir+1] }) -- place wall variant
|
||||
if iswall then
|
||||
minetest.add_node(pos1, { name = wield_name, param2 = dirs2[fdir + 1] }) -- place wall variant
|
||||
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
|
||||
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
|
||||
|
||||
if not homedecor_expect_infinite_stacks then
|
||||
|
@ -107,32 +107,30 @@ minetest.register_node('technic:homedecor_glowlight_half_yellow', {
|
|||
'technic_homedecor_glowlight_thick_yellow_sides.png',
|
||||
'technic_homedecor_glowlight_thick_yellow_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thick)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thick)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_half_yellow_active")
|
||||
end
|
||||
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_half_yellow_active")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node('technic:homedecor_glowlight_half_yellow_active', {
|
||||
|
@ -146,34 +144,32 @@ minetest.register_node('technic:homedecor_glowlight_half_yellow_active', {
|
|||
'technic_homedecor_glowlight_thick_yellow_sides.png',
|
||||
'technic_homedecor_glowlight_thick_yellow_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
light_source = LIGHT_MAX,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3, not_in_creative_inventory=1},
|
||||
drop="technic:homedecor_glowlight_half_yellow",
|
||||
groups = { snappy = 3, not_in_creative_inventory = 1 },
|
||||
drop = "technic:homedecor_glowlight_half_yellow",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thick)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thick)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_half_yellow")
|
||||
end
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_half_yellow")
|
||||
end
|
||||
})
|
||||
|
||||
-- Yellow -- Quarter node
|
||||
|
@ -188,32 +184,30 @@ minetest.register_node('technic:homedecor_glowlight_quarter_yellow', {
|
|||
'technic_homedecor_glowlight_thin_yellow_sides.png',
|
||||
'technic_homedecor_glowlight_thin_yellow_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thin)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thin)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_quarter_yellow_active")
|
||||
end
|
||||
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_quarter_yellow_active")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node('technic:homedecor_glowlight_quarter_yellow_active', {
|
||||
|
@ -227,34 +221,32 @@ minetest.register_node('technic:homedecor_glowlight_quarter_yellow_active', {
|
|||
'technic_homedecor_glowlight_thin_yellow_sides.png',
|
||||
'technic_homedecor_glowlight_thin_yellow_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
light_source = LIGHT_MAX-1,
|
||||
light_source = LIGHT_MAX - 1,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3, not_in_creative_inventory=1},
|
||||
drop="technic:homedecor_glowlight_quarter_yellow",
|
||||
groups = { snappy = 3, not_in_creative_inventory = 1 },
|
||||
drop = "technic:homedecor_glowlight_quarter_yellow",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thin)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 100, "Yellow Glowlight (thin)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_quarter_yellow")
|
||||
end
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_quarter_yellow")
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
@ -270,32 +262,30 @@ minetest.register_node('technic:homedecor_glowlight_half_white', {
|
|||
'technic_homedecor_glowlight_thick_white_sides.png',
|
||||
'technic_homedecor_glowlight_thick_white_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 100, "White Glowlight (thick)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 100, "White Glowlight (thick)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_half_white_active")
|
||||
end
|
||||
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_half_white_active")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node('technic:homedecor_glowlight_half_white_active', {
|
||||
|
@ -309,34 +299,32 @@ minetest.register_node('technic:homedecor_glowlight_half_white_active', {
|
|||
'technic_homedecor_glowlight_thick_white_sides.png',
|
||||
'technic_homedecor_glowlight_thick_white_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
light_source = LIGHT_MAX,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3, not_in_creative_inventory=1},
|
||||
drop="technic:homedecor_glowlight_half_white",
|
||||
groups = { snappy = 3, not_in_creative_inventory = 1 },
|
||||
drop = "technic:homedecor_glowlight_half_white",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 100, "White Glowlight (thick)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 100, "White Glowlight (thick)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_half_white")
|
||||
end
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_half_white")
|
||||
end
|
||||
})
|
||||
|
||||
-- White -- Quarter node
|
||||
|
@ -351,32 +339,30 @@ minetest.register_node('technic:homedecor_glowlight_quarter_white', {
|
|||
'technic_homedecor_glowlight_thin_white_sides.png',
|
||||
'technic_homedecor_glowlight_thin_white_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 100, "White Glowlight (thin)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 100, "White Glowlight (thin)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_quarter_white_active")
|
||||
end
|
||||
technic.inductive_on_punch_off(pos, 100, "technic:homedecor_glowlight_quarter_white_active")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node('technic:homedecor_glowlight_quarter_white_active', {
|
||||
|
@ -390,34 +376,32 @@ minetest.register_node('technic:homedecor_glowlight_quarter_white_active', {
|
|||
'technic_homedecor_glowlight_thin_white_sides.png',
|
||||
'technic_homedecor_glowlight_thin_white_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
light_source = LIGHT_MAX-1,
|
||||
light_source = LIGHT_MAX - 1,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3, not_in_creative_inventory=1},
|
||||
drop="technic:homedecor_glowlight_quarter_white",
|
||||
groups = { snappy = 3, not_in_creative_inventory = 1 },
|
||||
drop = "technic:homedecor_glowlight_quarter_white",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 100, "White Glowlight (thin)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 100, "White Glowlight (thin)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_quarter_white")
|
||||
end
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_quarter_white")
|
||||
end
|
||||
})
|
||||
|
||||
-- Glowlight "cubes" - yellow
|
||||
|
@ -432,32 +416,30 @@ minetest.register_node('technic:homedecor_glowlight_small_cube_yellow', {
|
|||
'technic_homedecor_glowlight_cube_yellow_sides.png',
|
||||
'technic_homedecor_glowlight_cube_yellow_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 50, "Yellow Glowlight (small cube)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 50, "Yellow Glowlight (small cube)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_off(pos, 50, "technic:homedecor_glowlight_small_cube_yellow_active")
|
||||
end
|
||||
technic.inductive_on_punch_off(pos, 50, "technic:homedecor_glowlight_small_cube_yellow_active")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node('technic:homedecor_glowlight_small_cube_yellow_active', {
|
||||
|
@ -471,34 +453,32 @@ minetest.register_node('technic:homedecor_glowlight_small_cube_yellow_active', {
|
|||
'technic_homedecor_glowlight_cube_yellow_sides.png',
|
||||
'technic_homedecor_glowlight_cube_yellow_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
light_source = LIGHT_MAX-1,
|
||||
light_source = LIGHT_MAX - 1,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3, not_in_creative_inventory=1},
|
||||
drop="technic:homedecor_glowlight_small_cube_yellow",
|
||||
groups = { snappy = 3, not_in_creative_inventory = 1 },
|
||||
drop = "technic:homedecor_glowlight_small_cube_yellow",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 50, "Yellow Glowlight (small cube)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 50, "Yellow Glowlight (small cube)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_small_cube_yellow")
|
||||
end
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_small_cube_yellow")
|
||||
end
|
||||
})
|
||||
|
||||
-- Glowlight "cubes" - white
|
||||
|
@ -513,32 +493,30 @@ minetest.register_node('technic:homedecor_glowlight_small_cube_white', {
|
|||
'technic_homedecor_glowlight_cube_white_sides.png',
|
||||
'technic_homedecor_glowlight_cube_white_sides.png'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3 },
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 50, "White Glowlight (small cube)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 50, "White Glowlight (small cube)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_off(pos, 50, "technic:homedecor_glowlight_small_cube_white_active")
|
||||
end
|
||||
technic.inductive_on_punch_off(pos, 50, "technic:homedecor_glowlight_small_cube_white_active")
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node('technic:homedecor_glowlight_small_cube_white_active', {
|
||||
|
@ -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'
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 }
|
||||
},
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
light_source = LIGHT_MAX-1,
|
||||
light_source = LIGHT_MAX - 1,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
groups = { snappy = 3, not_in_creative_inventory=1},
|
||||
drop="technic:homedecor_glowlight_small_cube_white",
|
||||
groups = { snappy = 3, not_in_creative_inventory = 1 },
|
||||
drop = "technic:homedecor_glowlight_small_cube_white",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
technic_homedecor_rotate_and_place(itemstack, placer, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
technic.inductive_on_construct(pos, 50, "White Glowlight (small cube)")
|
||||
end,
|
||||
technic.inductive_on_construct(pos, 50, "White Glowlight (small cube)")
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_small_cube_white")
|
||||
end
|
||||
technic.inductive_on_punch_on(pos, 0, "technic:homedecor_glowlight_small_cube_white")
|
||||
end
|
||||
})
|
||||
|
||||
technic.register_inductive_machine("technic:homedecor_glowlight_half_yellow")
|
||||
|
|
|
@ -16,9 +16,9 @@ local power_radius = 12
|
|||
minetest.register_craft({
|
||||
output = 'technic:power_radiator 1',
|
||||
recipe = {
|
||||
{'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'},
|
||||
{'technic:copper_coil', 'technic:machine_casing', 'technic:copper_coil'},
|
||||
{'technic:rubber', 'technic:mv_cable', 'technic:rubber'},
|
||||
{ 'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot' },
|
||||
{ 'technic:copper_coil', 'technic:machine_casing', 'technic:copper_coil' },
|
||||
{ 'technic:rubber', 'technic:mv_cable', 'technic:rubber' },
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -32,7 +32,7 @@ minetest.register_craft({
|
|||
technic.inductive_nodes = {}
|
||||
technic.register_inductive_machine = function(name)
|
||||
table.insert(technic.inductive_nodes, name)
|
||||
table.insert(technic.inductive_nodes, name.."_active")
|
||||
table.insert(technic.inductive_nodes, name .. "_active")
|
||||
end
|
||||
|
||||
-- Appliances:
|
||||
|
@ -44,10 +44,10 @@ technic.inductive_on_construct = function(pos, eu_demand, infotext)
|
|||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", infotext)
|
||||
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_charge", 0) -- The actual power draw 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_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
|
||||
|
||||
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
|
||||
technic.swap_node(pos, swapnode)
|
||||
meta:set_int("active", 1)
|
||||
meta:set_int("EU_charge",eu_charge)
|
||||
meta:set_int("EU_charge", eu_charge)
|
||||
--print("-----------")
|
||||
--print("Turn on:")
|
||||
--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)
|
||||
technic.swap_node(pos, swapnode)
|
||||
meta:set_int("active", 0)
|
||||
meta:set_int("EU_charge",eu_charge)
|
||||
meta:set_int("EU_charge", eu_charge)
|
||||
--print("-----------")
|
||||
--print("Turn off:")
|
||||
--print("EU_charge: "..meta:get_int("EU_charge"))
|
||||
|
@ -81,14 +81,13 @@ local shutdown_inductive_appliances = function(pos)
|
|||
local rad = power_radius
|
||||
-- If the radiator is removed. turn off all appliances in region
|
||||
-- If another radiator is near it will turn on the appliances again
|
||||
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},
|
||||
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 },
|
||||
technic.inductive_nodes)
|
||||
for _, pos1 in pairs(positions) do
|
||||
local meta1 = minetest.get_meta(pos1)
|
||||
-- If the appliance is belonging to this node
|
||||
if meta1:get_string("has_supply") == pos.x..pos.y..pos.z then
|
||||
if meta1:get_string("has_supply") == pos.x .. pos.y .. pos.z then
|
||||
local nodename = minetest.get_node(pos1).name
|
||||
-- Swap the node and make sure it is off and unpowered
|
||||
if string.sub(nodename, -7) == "_active" then
|
||||
|
@ -105,13 +104,12 @@ local toggle_on_off_inductive_appliances = function(pos, node, puncher)
|
|||
if pos == nil then return end
|
||||
-- The supply radius
|
||||
local rad = power_radius
|
||||
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},
|
||||
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 },
|
||||
technic.inductive_nodes)
|
||||
for _, pos1 in pairs(positions) do
|
||||
local meta1 = minetest.get_meta(pos1)
|
||||
if meta1:get_string("has_supply") == pos.x..pos.y..pos.z then
|
||||
if meta1:get_string("has_supply") == pos.x .. pos.y .. pos.z then
|
||||
minetest.punch_node(pos1)
|
||||
end
|
||||
end
|
||||
|
@ -119,21 +117,23 @@ end
|
|||
|
||||
minetest.register_node("technic:power_radiator", {
|
||||
description = "MV Power Radiator",
|
||||
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},
|
||||
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 },
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
node_box = {
|
||||
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)
|
||||
local meta = minetest.get_meta(pos)
|
||||
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("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_string("infotext", "MV Power Radiator")
|
||||
end,
|
||||
on_dig = function(pos, node, digger)
|
||||
|
@ -146,12 +146,12 @@ minetest.register_node("technic:power_radiator", {
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:power_radiator"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
nodenames = { "technic:power_radiator" },
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int("MV_EU_input")
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int("MV_EU_input")
|
||||
local eu_demand = meta:get_int("MV_EU_demand")
|
||||
|
||||
-- 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
|
||||
shutdown_inductive_appliances(pos)
|
||||
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
|
||||
-- Powered and ready
|
||||
|
||||
-- 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")
|
||||
|
||||
-- Efficiency factor
|
||||
|
@ -176,14 +176,13 @@ minetest.register_abm({
|
|||
-- The supply radius
|
||||
local rad = power_radius
|
||||
|
||||
local meta1 = nil
|
||||
local pos1 = {}
|
||||
local used_charge = 0
|
||||
local meta1 = nil
|
||||
local pos1 = {}
|
||||
local used_charge = 0
|
||||
|
||||
-- Index all nodes within supply range
|
||||
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},
|
||||
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 },
|
||||
technic.inductive_nodes)
|
||||
for _, pos1 in pairs(positions) do
|
||||
local meta1 = minetest.get_meta(pos1)
|
||||
|
@ -195,16 +194,16 @@ minetest.register_abm({
|
|||
-- We can power the appliance. Register, and spend power if it is on.
|
||||
connected_EU_demand = connected_EU_demand + app_eu_demand
|
||||
|
||||
meta1:set_string("has_supply", pos.x..pos.y..pos.z)
|
||||
meta1:set_string("has_supply", pos.x .. pos.y .. pos.z)
|
||||
--Always 0: used_charge = math.floor(used_charge + meta1:get_int("EU_charge") / eff_factor)
|
||||
end
|
||||
elseif meta1:get_string("has_supply") == pos.x..pos.y..pos.z then
|
||||
elseif meta1:get_string("has_supply") == pos.x .. pos.y .. pos.z then
|
||||
-- The appliance has power from this node. Spend power if it is on.
|
||||
used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor)
|
||||
end
|
||||
meta:set_string("infotext", "MV Power Radiator is powered ("
|
||||
..math.floor(used_charge / max_charge * 100)
|
||||
.."% of maximum power)");
|
||||
.. math.floor(used_charge / max_charge * 100)
|
||||
.. "% of maximum power)");
|
||||
if used_charge == 0 then
|
||||
meta:set_int("MV_EU_demand", 1) -- Still idle
|
||||
else
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
minetest.register_craft({
|
||||
output = 'technic:solar_array_mv 1',
|
||||
recipe = {
|
||||
{'technic:solar_array_lv', 'technic:solar_array_lv', 'technic:solar_array_lv'},
|
||||
{'technic:carbon_steel_ingot', 'technic:mv_transformer', 'technic:carbon_steel_ingot'},
|
||||
{'', 'technic:mv_cable', ''},
|
||||
{ 'technic:solar_array_lv', 'technic:solar_array_lv', 'technic:solar_array_lv' },
|
||||
{ 'technic:carbon_steel_ingot', 'technic:mv_transformer', 'technic:carbon_steel_ingot' },
|
||||
{ '', '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
|
||||
minetest.register_alias("technic:solar_panel_mv", "technic:solar_array_mv")
|
||||
|
|
|
@ -8,34 +8,34 @@ local S = technic.getter
|
|||
minetest.register_craft({
|
||||
output = 'technic:tool_workshop',
|
||||
recipe = {
|
||||
{'group:wood', 'default:diamond', 'group:wood'},
|
||||
{'mesecons_pistons:piston_sticky_off', 'technic:machine_casing', 'technic:carbon_cloth'},
|
||||
{'default:obsidian', 'technic:mv_cable', 'default:obsidian'},
|
||||
{ 'group:wood', 'default:diamond', 'group:wood' },
|
||||
{ 'mesecons_pistons:piston_sticky_off', 'technic:machine_casing', 'technic:carbon_cloth' },
|
||||
{ 'default:obsidian', 'technic:mv_cable', 'default:obsidian' },
|
||||
}
|
||||
})
|
||||
|
||||
local workshop_demand = {5000, 3500, 2000}
|
||||
local workshop_demand = { 5000, 3500, 2000 }
|
||||
|
||||
local workshop_formspec =
|
||||
"invsize[8,9;]"..
|
||||
"list[current_name;src;3,1;1,1;]"..
|
||||
"label[0,0;"..S("%s Tool Workshop"):format("MV").."]"..
|
||||
"list[current_name;upgrade1;1,3;1,1;]"..
|
||||
"list[current_name;upgrade2;2,3;1,1;]"..
|
||||
"label[1,4;"..S("Upgrade Slots").."]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;upgrade1]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;upgrade2]"..
|
||||
"listring[current_player;main]"
|
||||
"invsize[8,9;]" ..
|
||||
"list[current_name;src;3,1;1,1;]" ..
|
||||
"label[0,0;" .. S("%s Tool Workshop"):format("MV") .. "]" ..
|
||||
"list[current_name;upgrade1;1,3;1,1;]" ..
|
||||
"list[current_name;upgrade2;2,3;1,1;]" ..
|
||||
"label[1,4;" .. S("Upgrade Slots") .. "]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;src]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;upgrade1]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;upgrade2]" ..
|
||||
"listring[current_player;main]"
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local eu_input = meta:get_int("MV_EU_input")
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local eu_input = meta:get_int("MV_EU_input")
|
||||
local machine_name = S("%s Tool Workshop"):format("MV")
|
||||
local machine_node = "technic:tool_workshop"
|
||||
|
||||
|
@ -54,12 +54,12 @@ local run = function(pos, node)
|
|||
local itemdef = minetest.registered_items[srcstack:get_name()]
|
||||
if itemdef and
|
||||
(not itemdef.wear_represents or
|
||||
itemdef.wear_represents == "mechanical_wear") and
|
||||
itemdef.wear_represents == "mechanical_wear") and
|
||||
srcstack:get_wear() ~= 0 then
|
||||
repairable = true
|
||||
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
|
||||
technic.send_items(pos, x_velocity, z_velocity, "src")
|
||||
end
|
||||
|
@ -69,25 +69,34 @@ local run = function(pos, node)
|
|||
meta:set_int("MV_EU_demand", 0)
|
||||
return
|
||||
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))
|
||||
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))
|
||||
srcstack:add_wear(-1000)
|
||||
inv:set_stack("src", 1, srcstack)
|
||||
end
|
||||
meta:set_int("MV_EU_demand", workshop_demand[EU_upgrade+1])
|
||||
meta:set_int("MV_EU_demand", workshop_demand[EU_upgrade + 1])
|
||||
end
|
||||
|
||||
minetest.register_node("technic:tool_workshop", {
|
||||
description = S("%s Tool Workshop"):format("MV"),
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png",
|
||||
"technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"},
|
||||
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"},
|
||||
tiles = {
|
||||
"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png",
|
||||
"technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"
|
||||
},
|
||||
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(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -97,18 +106,18 @@ minetest.register_node("technic:tool_workshop", {
|
|||
inv:set_size("src", 1)
|
||||
inv:set_size("upgrade1", 1)
|
||||
inv:set_size("upgrade2", 1)
|
||||
end,
|
||||
end,
|
||||
can_dig = technic.machine_can_dig,
|
||||
allow_metadata_inventory_put = technic.machine_inventory_put,
|
||||
allow_metadata_inventory_take = technic.machine_inventory_take,
|
||||
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)
|
||||
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)
|
||||
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,
|
||||
after_place_node = pipeworks.after_place,
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:wind_mill_frame 5',
|
||||
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({
|
||||
output = 'technic:wind_mill',
|
||||
recipe = {
|
||||
{'', 'technic:motor', ''},
|
||||
{'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot'},
|
||||
{'', 'technic:mv_cable', ''},
|
||||
{ '', 'technic:motor', '' },
|
||||
{ 'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot' },
|
||||
{ '', 'technic:mv_cable', '' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("technic:wind_mill_frame", {
|
||||
description = S("Wind Mill Frame"),
|
||||
drawtype = "glasslike_framed",
|
||||
tiles = {"technic_carbon_steel_block.png", "default_glass.png"},
|
||||
tiles = { "technic_carbon_steel_block.png", "default_glass.png" },
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky=3},
|
||||
groups = { cracky = 3 },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
paramtype = "light",
|
||||
})
|
||||
|
@ -33,7 +32,7 @@ local function check_wind_mill(pos)
|
|||
if pos.y < 30 then
|
||||
return false
|
||||
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
|
||||
pos.y = pos.y - 1
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
|
@ -67,20 +66,20 @@ end
|
|||
|
||||
minetest.register_node("technic:wind_mill", {
|
||||
description = S("Wind %s Generator"):format("MV"),
|
||||
tiles = {"technic_carbon_steel_block.png"},
|
||||
tiles = { "technic_carbon_steel_block.png" },
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1, technic_machine=1, technic_mv=1},
|
||||
connect_sides = {"top", "bottom", "back", "left", "right"},
|
||||
groups = { cracky = 1, technic_machine = 1, technic_mv = 1 },
|
||||
connect_sides = { "top", "bottom", "back", "left", "right" },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-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, -1, -0.6, 0.1, 1, -0.7}, -- Vertical blades
|
||||
{-1, -0.1, -0.6, 1, 0.1, -0.7}, -- Horizontal blades
|
||||
{ -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, -1, -0.6, 0.1, 1, -0.7 }, -- Vertical blades
|
||||
{ -1, -0.1, -0.6, 1, 0.1, -0.7 }, -- Horizontal blades
|
||||
}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
local path = technic.modpath.."/machines"
|
||||
local path = technic.modpath .. "/machines"
|
||||
|
||||
dofile(path.."/register/init.lua")
|
||||
dofile(path .. "/register/init.lua")
|
||||
|
||||
-- Tiers
|
||||
dofile(path.."/LV/init.lua")
|
||||
dofile(path.."/MV/init.lua")
|
||||
dofile(path.."/HV/init.lua")
|
||||
dofile(path .. "/LV/init.lua")
|
||||
dofile(path .. "/MV/init.lua")
|
||||
dofile(path .. "/HV/init.lua")
|
||||
|
||||
dofile(path.."/switching_station.lua")
|
||||
dofile(path.."/power_monitor.lua")
|
||||
dofile(path.."/supply_converter.lua")
|
||||
dofile(path .. "/switching_station.lua")
|
||||
dofile(path .. "/power_monitor.lua")
|
||||
dofile(path .. "/supply_converter.lua")
|
||||
|
||||
dofile(path.."/other/init.lua")
|
||||
dofile(path .. "/other/init.lua")
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ local function compute_forceload_positions(pos, meta)
|
|||
local maxpos = vector.add(pos, vector.new(radius, radius, radius))
|
||||
local minbpos = {}
|
||||
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
|
||||
maxbpos[coord] = math.floor(maxpos[coord] / 16) * 16
|
||||
end
|
||||
|
@ -50,47 +50,47 @@ end
|
|||
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("formspec",
|
||||
"size[5,3.5]"..
|
||||
"item_image[0,0;1,1;technic:admin_anchor]"..
|
||||
"label[1,0;"..minetest.formspec_escape(desc).."]"..
|
||||
"label[0,1;"..minetest.formspec_escape(S("Owner:").." "..meta:get_string("owner")).."]"..
|
||||
(meta:get_int("locked") == 0 and
|
||||
"button[3,1;2,1;lock;"..minetest.formspec_escape(S("Unlocked")).."]" or
|
||||
"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").."]"..
|
||||
(meta:get_int("enabled") == 0 and
|
||||
"button[3,2;2,1;enable;"..minetest.formspec_escape(S("Disabled")).."]" or
|
||||
"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))).."]")
|
||||
"size[5,3.5]" ..
|
||||
"item_image[0,0;1,1;technic:admin_anchor]" ..
|
||||
"label[1,0;" .. minetest.formspec_escape(desc) .. "]" ..
|
||||
"label[0,1;" .. minetest.formspec_escape(S("Owner:") .. " " .. meta:get_string("owner")) .. "]" ..
|
||||
(meta:get_int("locked") == 0 and
|
||||
"button[3,1;2,1;lock;" .. minetest.formspec_escape(S("Unlocked")) .. "]" or
|
||||
"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") .. "]" ..
|
||||
(meta:get_int("enabled") == 0 and
|
||||
"button[3,2;2,1;enable;" .. minetest.formspec_escape(S("Disabled")) .. "]" or
|
||||
"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))) .. "]")
|
||||
end
|
||||
|
||||
minetest.register_node("technic:admin_anchor", {
|
||||
description = desc,
|
||||
drawtype = "normal",
|
||||
tiles = {"technic_admin_anchor.png"},
|
||||
tiles = { "technic_admin_anchor.png" },
|
||||
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(),
|
||||
after_place_node = function (pos, placer)
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if placer and placer:is_player() then
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
end
|
||||
set_display(pos, meta)
|
||||
end,
|
||||
can_dig = function (pos, player)
|
||||
can_dig = function(pos, player)
|
||||
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"))
|
||||
end,
|
||||
on_destruct = function (pos)
|
||||
on_destruct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
forceload_off(meta)
|
||||
end,
|
||||
on_receive_fields = function (pos, formname, fields, sender)
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if (meta:get_int("locked") ~= 0 or fields.lock) 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
|
||||
end
|
||||
if fields.unlock then meta:set_int("locked", 0) end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
-- Fuel driven alloy furnace. This uses no EUs:
|
||||
|
||||
local S = technic.getter
|
||||
|
@ -6,35 +5,37 @@ local S = technic.getter
|
|||
minetest.register_craft({
|
||||
output = 'technic:coal_alloy_furnace',
|
||||
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 formspec =
|
||||
"size[8,9]"..
|
||||
"label[0,0;"..machine_name.."]"..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png]"..
|
||||
"list[current_name;fuel;2,3;1,1;]"..
|
||||
"list[current_name;src;2,1;2,1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;fuel]"..
|
||||
"listring[current_player;main]"
|
||||
"size[8,9]" ..
|
||||
"label[0,0;" .. machine_name .. "]" ..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png]" ..
|
||||
"list[current_name;fuel;2,3;1,1;]" ..
|
||||
"list[current_name;src;2,1;2,1;]" ..
|
||||
"list[current_name;dst;5,1;2,2;]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[current_name;dst]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;src]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;fuel]" ..
|
||||
"listring[current_player;main]"
|
||||
|
||||
minetest.register_node("technic:coal_alloy_furnace", {
|
||||
description = machine_name,
|
||||
tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.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"},
|
||||
tiles = {
|
||||
"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.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",
|
||||
groups = {cracky=2},
|
||||
groups = { cracky = 2 },
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
|
@ -54,13 +55,15 @@ minetest.register_node("technic:coal_alloy_furnace", {
|
|||
|
||||
minetest.register_node("technic:coal_alloy_furnace_active", {
|
||||
description = machine_name,
|
||||
tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.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"},
|
||||
tiles = {
|
||||
"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.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",
|
||||
light_source = 8,
|
||||
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,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
can_dig = technic.machine_can_dig,
|
||||
|
@ -70,26 +73,27 @@ minetest.register_node("technic:coal_alloy_furnace_active", {
|
|||
})
|
||||
|
||||
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,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
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
|
||||
inv:set_size("src", 2)
|
||||
inv:set_stack("src", 2, inv:get_stack("src2", 1))
|
||||
inv:set_size("src2", 0)
|
||||
end
|
||||
|
||||
|
||||
local recipe = nil
|
||||
|
||||
for i, name in pairs({
|
||||
"fuel_totaltime",
|
||||
"fuel_time",
|
||||
"src_totaltime",
|
||||
"src_time"}) do
|
||||
"fuel_totaltime",
|
||||
"fuel_time",
|
||||
"src_totaltime",
|
||||
"src_time"
|
||||
}) do
|
||||
if not meta:get_float(name) then
|
||||
meta:set_float(name, 0.0)
|
||||
end
|
||||
|
@ -121,23 +125,23 @@ minetest.register_abm({
|
|||
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
|
||||
local percent = math.floor(meta:get_float("fuel_time") /
|
||||
meta:get_float("fuel_totaltime") * 100)
|
||||
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")
|
||||
meta:set_string("formspec",
|
||||
"size[8,9]"..
|
||||
"label[0,0;"..machine_name.."]"..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
(100 - percent)..":default_furnace_fire_fg.png]"..
|
||||
"list[current_name;fuel;2,3;1,1;]"..
|
||||
"list[current_name;src;2,1;2,1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;fuel]"..
|
||||
"listring[current_player;main]")
|
||||
"size[8,9]" ..
|
||||
"label[0,0;" .. machine_name .. "]" ..
|
||||
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:" ..
|
||||
(100 - percent) .. ":default_furnace_fire_fg.png]" ..
|
||||
"list[current_name;fuel;2,3;1,1;]" ..
|
||||
"list[current_name;src;2,1;2,1;]" ..
|
||||
"list[current_name;dst;5,1;2,2;]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[current_name;dst]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;src]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;fuel]" ..
|
||||
"listring[current_player;main]")
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -158,7 +162,7 @@ minetest.register_abm({
|
|||
local fuellist = inv:get_list("fuel")
|
||||
|
||||
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
|
||||
|
||||
if fuel.time <= 0 then
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
local function deploy_node(inv, slot_name, pos, node, machine_node)
|
||||
if node.name ~= "air" then
|
||||
if node.name == "ignore" or
|
||||
node.name == "default:lava_source" or
|
||||
node.name == "default:lava_flowing" or
|
||||
node.name == "default:water_source" or
|
||||
node.name == "default:water_flowing" then
|
||||
node.name == "default:lava_source" or
|
||||
node.name == "default:lava_flowing" or
|
||||
node.name == "default:water_source" or
|
||||
node.name == "default:water_flowing" then
|
||||
return
|
||||
end
|
||||
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
|
||||
type = "node",
|
||||
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
|
||||
inv:set_stack(slot_name, 1, stk or stack)
|
||||
|
@ -67,21 +66,18 @@ end
|
|||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'technic:constructor_mk1_off 1',
|
||||
recipe = {'technic:nodebreaker_off', 'technic:deployer_off'},
|
||||
|
||||
recipe = { 'technic:nodebreaker_off', 'technic:deployer_off' },
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
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({
|
||||
type = "shapeless",
|
||||
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)
|
||||
|
@ -96,13 +92,13 @@ local function make_on(mark, length)
|
|||
|
||||
local place_pos = vector.new(pos)
|
||||
|
||||
if node.name == "technic:constructor_mk"..mark.."_off" then
|
||||
technic.swap_node(pos, "technic:constructor_mk"..mark.."_on")
|
||||
if node.name == "technic:constructor_mk" .. mark .. "_off" then
|
||||
technic.swap_node(pos, "technic:constructor_mk" .. mark .. "_on")
|
||||
nodeupdate(pos)
|
||||
for i = 1, length do
|
||||
place_pos = vector.add(place_pos, dir)
|
||||
local place_node = minetest.get_node(place_pos)
|
||||
deploy_node(inv, "slot"..i, place_pos, place_node, node)
|
||||
deploy_node(inv, "slot" .. i, place_pos, place_node, node)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -110,8 +106,8 @@ end
|
|||
|
||||
local function make_off(mark)
|
||||
return function(pos, node)
|
||||
if node.name == "technic:constructor_mk"..mark.."_on" then
|
||||
technic.swap_node(pos,"technic:constructor_mk"..mark.."_off")
|
||||
if node.name == "technic:constructor_mk" .. mark .. "_on" then
|
||||
technic.swap_node(pos, "technic:constructor_mk" .. mark .. "_off")
|
||||
nodeupdate(pos)
|
||||
end
|
||||
end
|
||||
|
@ -119,41 +115,43 @@ end
|
|||
|
||||
|
||||
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),
|
||||
tiles = {"technic_constructor_mk"..mark.."_top_off.png",
|
||||
"technic_constructor_mk"..mark.."_bottom_off.png",
|
||||
"technic_constructor_mk"..mark.."_side2_off.png",
|
||||
"technic_constructor_mk"..mark.."_side1_off.png",
|
||||
tiles = {
|
||||
"technic_constructor_mk" .. mark .. "_top_off.png",
|
||||
"technic_constructor_mk" .. mark .. "_bottom_off.png",
|
||||
"technic_constructor_mk" .. mark .. "_side2_off.png",
|
||||
"technic_constructor_mk" .. mark .. "_side1_off.png",
|
||||
"technic_constructor_back.png",
|
||||
"technic_constructor_front_off.png"},
|
||||
"technic_constructor_front_off.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, mesecon = 2},
|
||||
mesecons = {effector = {action_on = make_on(mark, length)}},
|
||||
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, mesecon = 2 },
|
||||
mesecons = { effector = { action_on = make_on(mark, length) } },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local formspec = "size[8,9;]"..
|
||||
"label[0,0;"..S("Constructor Mk%d"):format(mark).."]"..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
local formspec = "size[8,9;]" ..
|
||||
"label[0,0;" .. S("Constructor Mk%d"):format(mark) .. "]" ..
|
||||
"list[current_player;main;0,5;8,4;]"
|
||||
for i = 1, length do
|
||||
formspec = formspec
|
||||
.."label[5,"..(i - 1)..";"..S("Slot %d"):format(i).."]"
|
||||
.."list[current_name;slot"..i
|
||||
..";6,"..(i - 1)..";1,1;]"
|
||||
.. "label[5," .. (i - 1) .. ";" .. S("Slot %d"):format(i) .. "]"
|
||||
.. "list[current_name;slot" .. i
|
||||
.. ";6," .. (i - 1) .. ";1,1;]"
|
||||
end
|
||||
meta:set_string("formspec", formspec)
|
||||
meta:set_string("infotext", S("Constructor Mk%d"):format(mark))
|
||||
local inv = meta:get_inventory()
|
||||
for i = 1, length do
|
||||
inv:set_size("slot"..i, 1)
|
||||
inv:set_size("slot" .. i, 1)
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
for i = 1, length do
|
||||
if not inv:is_empty("slot"..i) then
|
||||
if not inv:is_empty("slot" .. i) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -164,18 +162,25 @@ local function make_constructor(mark, length)
|
|||
allow_metadata_inventory_move = technic.machine_inventory_move,
|
||||
})
|
||||
|
||||
minetest.register_node("technic:constructor_mk"..mark.."_on", {
|
||||
tiles = {"technic_constructor_mk"..mark.."_top_on.png",
|
||||
"technic_constructor_mk"..mark.."_bottom_on.png",
|
||||
"technic_constructor_mk"..mark.."_side2_on.png",
|
||||
"technic_constructor_mk"..mark.."_side1_on.png",
|
||||
minetest.register_node("technic:constructor_mk" .. mark .. "_on", {
|
||||
tiles = {
|
||||
"technic_constructor_mk" .. mark .. "_top_on.png",
|
||||
"technic_constructor_mk" .. mark .. "_bottom_on.png",
|
||||
"technic_constructor_mk" .. mark .. "_side2_on.png",
|
||||
"technic_constructor_mk" .. mark .. "_side1_on.png",
|
||||
"technic_constructor_back.png",
|
||||
"technic_constructor_front_on.png"},
|
||||
"technic_constructor_front_on.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
drop = "technic:constructor_mk"..mark.."_off",
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
mesecon=2, not_in_creative_inventory=1},
|
||||
mesecons= {effector = {action_off = make_off(mark)}},
|
||||
drop = "technic:constructor_mk" .. mark .. "_off",
|
||||
groups = {
|
||||
snappy = 2,
|
||||
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(),
|
||||
allow_metadata_inventory_put = technic.machine_inventory_put,
|
||||
allow_metadata_inventory_take = technic.machine_inventory_take,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,15 +1,15 @@
|
|||
local path = technic.modpath.."/machines/other"
|
||||
local path = technic.modpath .. "/machines/other"
|
||||
|
||||
-- mesecons and tubes related
|
||||
dofile(path.."/injector.lua")
|
||||
dofile(path.."/constructor.lua")
|
||||
dofile(path .. "/injector.lua")
|
||||
dofile(path .. "/constructor.lua")
|
||||
|
||||
if technic.config:get_bool("enable_frames") and minetest.get_modpath("mesecons_mvps") ~= nil then
|
||||
dofile(path.."/frames.lua")
|
||||
dofile(path .. "/frames.lua")
|
||||
end
|
||||
|
||||
-- Coal-powered machines
|
||||
dofile(path.."/coal_alloy_furnace.lua")
|
||||
dofile(path.."/coal_furnace.lua")
|
||||
dofile(path .. "/coal_alloy_furnace.lua")
|
||||
dofile(path .. "/coal_furnace.lua")
|
||||
|
||||
dofile(path.."/anchor.lua")
|
||||
dofile(path .. "/anchor.lua")
|
||||
|
|
|
@ -1,91 +1,91 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
local function inject_items (pos)
|
||||
local meta=minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mode=meta:get_string("mode")
|
||||
if mode=="single items" then
|
||||
local i=0
|
||||
for _,stack in ipairs(inv:get_list("main")) do
|
||||
i=i+1
|
||||
if stack then
|
||||
local item0=stack:to_table()
|
||||
if item0 then
|
||||
local function inject_items(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mode = meta:get_string("mode")
|
||||
if mode == "single items" then
|
||||
local i = 0
|
||||
for _, stack in ipairs(inv:get_list("main")) do
|
||||
i = i + 1
|
||||
if stack then
|
||||
local item0 = stack:to_table()
|
||||
if item0 then
|
||||
item0["count"] = "1"
|
||||
technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0)
|
||||
stack:take_item(1)
|
||||
inv:set_stack("main", i, stack)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if mode=="whole stacks" then
|
||||
local i=0
|
||||
for _,stack in ipairs(inv:get_list("main")) do
|
||||
i=i+1
|
||||
if stack then
|
||||
local item0=stack:to_table()
|
||||
if item0 then
|
||||
end
|
||||
if mode == "whole stacks" then
|
||||
local i = 0
|
||||
for _, stack in ipairs(inv:get_list("main")) do
|
||||
i = i + 1
|
||||
if stack then
|
||||
local item0 = stack:to_table()
|
||||
if item0 then
|
||||
technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0)
|
||||
stack:clear()
|
||||
inv:set_stack("main", i, stack)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:injector 1',
|
||||
recipe = {
|
||||
{'', 'technic:control_logic_unit',''},
|
||||
{'', 'default:chest',''},
|
||||
{'', 'pipeworks:tube_1',''},
|
||||
{ '', 'technic:control_logic_unit', '' },
|
||||
{ '', 'default:chest', '' },
|
||||
{ '', 'pipeworks:tube_1', '' },
|
||||
}
|
||||
})
|
||||
|
||||
local function set_injector_formspec(meta)
|
||||
local is_stack = meta:get_string("mode") == "whole stacks"
|
||||
meta:set_string("formspec",
|
||||
"invsize[8,9;]"..
|
||||
"item_image[0,0;1,1;technic:injector]"..
|
||||
"label[1,0;"..S("Self-Contained Injector").."]"..
|
||||
(is_stack and
|
||||
"button[0,1;2,1;mode_item;"..S("Stackwise").."]" or
|
||||
"button[0,1;2,1;mode_stack;"..S("Itemwise").."]")..
|
||||
"list[current_name;main;0,2;8,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"listring[]")
|
||||
"invsize[8,9;]" ..
|
||||
"item_image[0,0;1,1;technic:injector]" ..
|
||||
"label[1,0;" .. S("Self-Contained Injector") .. "]" ..
|
||||
(is_stack and
|
||||
"button[0,1;2,1;mode_item;" .. S("Stackwise") .. "]" or
|
||||
"button[0,1;2,1;mode_stack;" .. S("Itemwise") .. "]") ..
|
||||
"list[current_name;main;0,2;8,2;]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[]")
|
||||
end
|
||||
|
||||
minetest.register_node("technic:injector", {
|
||||
description = S("Self-Contained Injector"),
|
||||
tiles = {"technic_injector_top.png", "technic_injector_bottom.png", "technic_injector_side.png",
|
||||
"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},
|
||||
tiles = {
|
||||
"technic_injector_top.png", "technic_injector_bottom.png", "technic_injector_side.png",
|
||||
"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 = {
|
||||
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,
|
||||
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,
|
||||
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(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", S("Self-Contained Injector"))
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
meta:set_string("mode","single items")
|
||||
inv:set_size("main", 8 * 4)
|
||||
meta:set_string("mode", "single items")
|
||||
set_injector_formspec(meta)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
|
@ -104,12 +104,12 @@ minetest.register_node("technic:injector", {
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:injector"},
|
||||
nodenames = { "technic:injector" },
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local pos1 = vector.add(pos, vector.new(0, -1, 0))
|
||||
local node1 = minetest.get_node(pos1)
|
||||
local node1 = minetest.get_node(pos1)
|
||||
if minetest.get_item_group(node1.name, "tubedevice") > 0 then
|
||||
inject_items(pos)
|
||||
end
|
||||
|
|
|
@ -7,15 +7,15 @@ local S = technic.getter
|
|||
minetest.register_craft({
|
||||
output = "technic:power_monitor",
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{"", "technic:machine_casing", "default:copper_ingot"},
|
||||
{"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"}
|
||||
{ "", "", "" },
|
||||
{ "", "technic:machine_casing", "default:copper_ingot" },
|
||||
{ "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"),
|
||||
tiles = {
|
||||
tiles = {
|
||||
"technic_power_monitor_sides.png",
|
||||
"technic_power_monitor_bottom_back.png",
|
||||
"technic_power_monitor_sides.png",
|
||||
|
@ -24,8 +24,8 @@ minetest.register_node("technic:power_monitor",{
|
|||
"technic_power_monitor_front.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1, technic_machine=1},
|
||||
connect_sides = {"bottom", "back"},
|
||||
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, technic_all_tiers = 1, technic_machine = 1 },
|
||||
connect_sides = { "bottom", "back" },
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -34,28 +34,28 @@ minetest.register_node("technic:power_monitor",{
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:power_monitor"},
|
||||
nodenames = { "technic:power_monitor" },
|
||||
label = "Power Monitor",
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local network_hash = technic.cables[minetest.hash_node_position(pos)]
|
||||
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
|
||||
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
|
||||
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 supply = sw_meta:get_int("supply")
|
||||
local demand = sw_meta:get_int("demand")
|
||||
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)))
|
||||
else
|
||||
meta:set_string("infotext",S("Power Monitor Has No Network"))
|
||||
meta:set_string("infotext", S("Power Monitor Has No Network"))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_alloy_furnace(data)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
technic.register_recipe_type("alloy", {
|
||||
|
@ -12,24 +11,24 @@ function technic.register_alloy_recipe(data)
|
|||
end
|
||||
|
||||
local recipes = {
|
||||
{"technic:copper_dust 3", "technic:tin_dust", "technic:bronze_dust 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_ingot", "technic:coal_dust", "technic:carbon_steel_ingot", 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_dust 3", "technic:chromium_dust", "technic:stainless_steel_dust 4"},
|
||||
{"technic:carbon_steel_ingot 3", "technic:chromium_ingot", "technic:stainless_steel_ingot 4"},
|
||||
{"technic:copper_dust 2", "technic:zinc_dust", "technic:brass_dust 3"},
|
||||
{"default:copper_ingot 2", "technic:zinc_ingot", "technic:brass_ingot 3"},
|
||||
{"default:sand 2", "technic:coal_dust 2", "technic:silicon_wafer"},
|
||||
{"technic:silicon_wafer", "technic:gold_dust", "technic:doped_silicon_wafer"},
|
||||
{ "technic:copper_dust 3", "technic:tin_dust", "technic:bronze_dust 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_ingot", "technic:coal_dust", "technic:carbon_steel_ingot", 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_dust 3", "technic:chromium_dust", "technic:stainless_steel_dust 4" },
|
||||
{ "technic:carbon_steel_ingot 3", "technic:chromium_ingot", "technic:stainless_steel_ingot 4" },
|
||||
{ "technic:copper_dust 2", "technic:zinc_dust", "technic:brass_dust 3" },
|
||||
{ "default:copper_ingot 2", "technic:zinc_ingot", "technic:brass_ingot 3" },
|
||||
{ "default:sand 2", "technic:coal_dust 2", "technic:silicon_wafer" },
|
||||
{ "technic:silicon_wafer", "technic:gold_dust", "technic:doped_silicon_wafer" },
|
||||
-- from https://en.wikipedia.org/wiki/Carbon_black
|
||||
-- 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 …"
|
||||
{"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
|
||||
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
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
technic.register_power_tool("technic:battery", 10000)
|
||||
|
@ -9,9 +8,9 @@ technic.register_power_tool("technic:blue_energy_crystal", 450000)
|
|||
minetest.register_craft({
|
||||
output = 'technic:battery',
|
||||
recipe = {
|
||||
{'group:wood', 'default:copper_ingot', 'group:wood'},
|
||||
{'group:wood', 'moreores:tin_ingot', 'group:wood'},
|
||||
{'group:wood', 'default:copper_ingot', 'group:wood'},
|
||||
{ 'group:wood', 'default:copper_ingot', 'group:wood' },
|
||||
{ 'group:wood', 'moreores:tin_ingot', 'group:wood' },
|
||||
{ 'group:wood', 'default:copper_ingot', 'group:wood' },
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -24,7 +23,7 @@ minetest.register_tool("technic:battery", {
|
|||
charge = 0,
|
||||
max_drop_level = 0,
|
||||
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)
|
||||
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)
|
||||
|
@ -62,35 +61,35 @@ function technic.register_battery_box(data)
|
|||
local ltier = string.lower(tier)
|
||||
|
||||
local formspec =
|
||||
"invsize[8,9;]"..
|
||||
"image[1,1;1,2;technic_power_meter_bg.png]"..
|
||||
"list[current_name;src;3,1;1,1;]"..
|
||||
"image[4,1;1,1;technic_battery_reload.png]"..
|
||||
"list[current_name;dst;5,1;1,1;]"..
|
||||
"label[0,0;"..S("%s Battery Box"):format(tier).."]"..
|
||||
"label[3,0;"..S("Charge").."]"..
|
||||
"label[5,0;"..S("Discharge").."]"..
|
||||
"label[1,3;"..S("Power level").."]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"
|
||||
"invsize[8,9;]" ..
|
||||
"image[1,1;1,2;technic_power_meter_bg.png]" ..
|
||||
"list[current_name;src;3,1;1,1;]" ..
|
||||
"image[4,1;1,1;technic_battery_reload.png]" ..
|
||||
"list[current_name;dst;5,1;1,1;]" ..
|
||||
"label[0,0;" .. S("%s Battery Box"):format(tier) .. "]" ..
|
||||
"label[3,0;" .. S("Charge") .. "]" ..
|
||||
"label[5,0;" .. S("Discharge") .. "]" ..
|
||||
"label[1,3;" .. S("Power level") .. "]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[current_name;dst]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;src]" ..
|
||||
"listring[current_player;main]"
|
||||
|
||||
if data.upgrade then
|
||||
formspec = formspec..
|
||||
"list[current_name;upgrade1;3.5,3;1,1;]"..
|
||||
"list[current_name;upgrade2;4.5,3;1,1;]"..
|
||||
"label[3.5,4;"..S("Upgrade Slots").."]"..
|
||||
"listring[current_name;upgrade1]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;upgrade2]"..
|
||||
"listring[current_player;main]"
|
||||
formspec = formspec ..
|
||||
"list[current_name;upgrade1;3.5,3;1,1;]" ..
|
||||
"list[current_name;upgrade2;4.5,3;1,1;]" ..
|
||||
"label[3.5,4;" .. S("Upgrade Slots") .. "]" ..
|
||||
"listring[current_name;upgrade1]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;upgrade2]" ..
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int(tier.."_EU_input")
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int(tier .. "_EU_input")
|
||||
local current_charge = meta:get_int("internal_EU_charge")
|
||||
|
||||
local EU_upgrade, tube_upgrade = 0, 0
|
||||
|
@ -98,7 +97,7 @@ function technic.register_battery_box(data)
|
|||
EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta)
|
||||
end
|
||||
local max_charge = data.max_charge * (1 + EU_upgrade / 10)
|
||||
|
||||
|
||||
-- Charge/discharge the battery with the input EUs
|
||||
if eu_input >= 0 then
|
||||
current_charge = math.min(current_charge + eu_input, max_charge)
|
||||
|
@ -109,29 +108,29 @@ function technic.register_battery_box(data)
|
|||
-- Charging/discharging tools here
|
||||
local tool_full, tool_empty
|
||||
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, data.discharge_step,
|
||||
max_charge)
|
||||
|
||||
current_charge, data.discharge_step,
|
||||
max_charge)
|
||||
|
||||
if data.tube then
|
||||
local inv = meta:get_inventory()
|
||||
technic.handle_machine_pipeworks(pos, tube_upgrade,
|
||||
function(pos, x_velocity, z_velocity)
|
||||
if tool_full and not inv:is_empty("src") then
|
||||
technic.send_items(pos, x_velocity, z_velocity, "src")
|
||||
elseif tool_empty and not inv:is_empty("dst") then
|
||||
technic.send_items(pos, x_velocity, z_velocity, "dst")
|
||||
end
|
||||
end)
|
||||
function(pos, x_velocity, z_velocity)
|
||||
if tool_full and not inv:is_empty("src") then
|
||||
technic.send_items(pos, x_velocity, z_velocity, "src")
|
||||
elseif tool_empty and not inv:is_empty("dst") then
|
||||
technic.send_items(pos, x_velocity, z_velocity, "dst")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- We allow batteries to charge on less than the demand
|
||||
meta:set_int(tier.."_EU_demand",
|
||||
math.min(data.charge_rate, max_charge - current_charge))
|
||||
meta:set_int(tier.."_EU_supply",
|
||||
math.min(data.discharge_rate, current_charge))
|
||||
meta:set_int("internal_EU_charge", current_charge)
|
||||
meta:set_int(tier .. "_EU_demand",
|
||||
math.min(data.charge_rate, max_charge - current_charge))
|
||||
meta:set_int(tier .. "_EU_supply",
|
||||
math.min(data.discharge_rate, current_charge))
|
||||
meta:set_int("internal_EU_charge", current_charge)
|
||||
|
||||
-- Select node textures
|
||||
local charge_count = math.ceil((current_charge / max_charge) * 8)
|
||||
|
@ -139,51 +138,58 @@ function technic.register_battery_box(data)
|
|||
charge_count = math.max(charge_count, 0)
|
||||
local last_count = meta:get_float("last_side_shown")
|
||||
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)
|
||||
end
|
||||
|
||||
local charge_percent = math.floor(current_charge / max_charge * 100)
|
||||
meta:set_string("formspec",
|
||||
formspec..
|
||||
"image[1,1;1,2;technic_power_meter_bg.png"
|
||||
.."^[lowpart:"..charge_percent
|
||||
..":technic_power_meter_fg.png]")
|
||||
formspec ..
|
||||
"image[1,1;1,2;technic_power_meter_bg.png"
|
||||
.. "^[lowpart:" .. charge_percent
|
||||
.. ":technic_power_meter_fg.png]")
|
||||
|
||||
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
|
||||
infotext = S("%s Idle"):format(infotext)
|
||||
end
|
||||
meta:set_string("infotext", infotext)
|
||||
end
|
||||
|
||||
|
||||
for i = 0, 8 do
|
||||
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, ["technic_"..ltier]=1}
|
||||
local groups = {
|
||||
snappy = 2,
|
||||
choppy = 2,
|
||||
oddly_breakable_by_hand = 2,
|
||||
technic_machine = 1,
|
||||
["technic_" .. ltier] = 1
|
||||
}
|
||||
if i ~= 0 then
|
||||
groups.not_in_creative_inventory = 1
|
||||
end
|
||||
|
||||
|
||||
if data.tube then
|
||||
groups.tubedevice = 1
|
||||
groups.tubedevice_receiver = 1
|
||||
end
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_battery_box"..i, {
|
||||
|
||||
minetest.register_node("technic:" .. ltier .. "_battery_box" .. i, {
|
||||
description = S("%s Battery Box"):format(tier),
|
||||
tiles = {"technic_"..ltier.."_battery_box_top.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"},
|
||||
tiles = {
|
||||
"technic_" .. ltier .. "_battery_box_top.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"
|
||||
},
|
||||
groups = groups,
|
||||
connect_sides = {"bottom"},
|
||||
connect_sides = { "bottom" },
|
||||
tube = data.tube and tube or nil,
|
||||
paramtype2 = "facedir",
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "technic:"..ltier.."_battery_box0",
|
||||
drop = "technic:" .. ltier .. "_battery_box0",
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
@ -191,9 +197,9 @@ function technic.register_battery_box(data)
|
|||
|
||||
meta:set_string("infotext", S("%s Battery Box"):format(tier))
|
||||
meta:set_string("formspec", formspec)
|
||||
meta:set_int(tier.."_EU_demand", 0)
|
||||
meta:set_int(tier.."_EU_supply", 0)
|
||||
meta:set_int(tier.."_EU_input", 0)
|
||||
meta:set_int(tier .. "_EU_demand", 0)
|
||||
meta:set_int(tier .. "_EU_supply", 0)
|
||||
meta:set_int(tier .. "_EU_input", 0)
|
||||
meta:set_float("internal_EU_charge", 0)
|
||||
inv:set_size("src", 1)
|
||||
inv:set_size("dst", 1)
|
||||
|
@ -213,10 +219,11 @@ function technic.register_battery_box(data)
|
|||
-- Register as a battery type
|
||||
-- Battery type machines function as power reservoirs and can both receive and give back power
|
||||
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 registration
|
||||
-- End registration
|
||||
|
||||
|
||||
function technic.charge_tools(meta, batt_charge, charge_step)
|
||||
|
@ -237,7 +244,7 @@ function technic.charge_tools(meta, batt_charge, charge_step)
|
|||
end
|
||||
-- Do the charging
|
||||
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
|
||||
return batt_charge, true
|
||||
elseif batt_charge <= 0 then
|
||||
|
@ -274,7 +281,7 @@ function technic.discharge_tools(meta, batt_charge, charge_step, max_charge)
|
|||
|
||||
-- Do the discharging
|
||||
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
|
||||
return batt_charge, true
|
||||
elseif batt_charge >= max_charge then
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
local cable_tier = {}
|
||||
|
@ -14,23 +13,24 @@ end
|
|||
local function check_connections(pos)
|
||||
-- Build a table of all machines
|
||||
local machines = {}
|
||||
for tier,list in pairs(technic.machines) do
|
||||
for k,v in pairs(list) do
|
||||
for tier, list in pairs(technic.machines) do
|
||||
for k, v in pairs(list) do
|
||||
machines[k] = v
|
||||
end
|
||||
end
|
||||
local connections = {}
|
||||
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, 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}}
|
||||
for _,connected_pos in pairs(positions) do
|
||||
{ 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, z = pos.z + 1 },
|
||||
{ x = pos.x, y = pos.y, z = pos.z - 1 }
|
||||
}
|
||||
for _, connected_pos in pairs(positions) do
|
||||
local name = minetest.get_node(connected_pos).name
|
||||
if machines[name] or technic.get_cable_tier(name) then
|
||||
table.insert(connections,connected_pos)
|
||||
table.insert(connections, connected_pos)
|
||||
end
|
||||
end
|
||||
return connections
|
||||
|
@ -43,7 +43,7 @@ local function clear_networks(pos)
|
|||
local positions = check_connections(pos)
|
||||
if #positions < 1 then return end
|
||||
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)]
|
||||
if net and technic.networks[net] 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
|
||||
pos.visited = 1
|
||||
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
|
||||
meta:set_string(tier.."_network",minetest.pos_to_string(sw_pos))
|
||||
if technic.machines[tier][node.name] == technic.producer then
|
||||
table.insert(network.PR_nodes,pos)
|
||||
meta:set_string(tier .. "_network", minetest.pos_to_string(sw_pos))
|
||||
if technic.machines[tier][node.name] == technic.producer then
|
||||
table.insert(network.PR_nodes, pos)
|
||||
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
|
||||
table.insert(network.PR_nodes,pos)
|
||||
table.insert(network.RE_nodes,pos)
|
||||
table.insert(network.PR_nodes, pos)
|
||||
table.insert(network.RE_nodes, pos)
|
||||
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
|
||||
from_below then
|
||||
table.insert(network.SP_nodes,pos)
|
||||
table.insert(network.SP_nodes, pos)
|
||||
elseif technic.machines[tier][node.name] == technic.battery then
|
||||
table.insert(network.BA_nodes,pos)
|
||||
table.insert(network.BA_nodes, pos)
|
||||
end
|
||||
end
|
||||
elseif dead_end and not placed then
|
||||
|
@ -94,12 +94,12 @@ local function clear_networks(pos)
|
|||
|
||||
-- Search for and remove machine
|
||||
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
|
||||
for machinenum,machine in pairs(table) do
|
||||
for machinenum, machine in pairs(table) do
|
||||
if machine.x == pos.x
|
||||
and machine.y == pos.y
|
||||
and machine.z == pos.z then
|
||||
and machine.y == pos.y
|
||||
and machine.z == pos.z then
|
||||
table[machinenum] = nil
|
||||
end
|
||||
end
|
||||
|
@ -107,7 +107,7 @@ local function clear_networks(pos)
|
|||
end
|
||||
else
|
||||
-- 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)
|
||||
technic.cables[pos1] = nil
|
||||
end
|
||||
|
@ -119,35 +119,37 @@ end
|
|||
|
||||
function technic.register_cable(tier, size)
|
||||
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 = {
|
||||
type = "connected",
|
||||
fixed = {-size, -size, -size, size, size, size},
|
||||
connect_top = {-size, -size, -size, size, 0.5, size}, -- y+
|
||||
connect_bottom = {-size, -0.5, -size, size, size, size}, -- y-
|
||||
connect_front = {-size, -size, -0.5, size, size, size}, -- z-
|
||||
connect_back = {-size, -size, size, size, size, 0.5 }, -- z+
|
||||
connect_left = {-0.5, -size, -size, size, size, size}, -- x-
|
||||
connect_right = {-size, -size, -size, 0.5, size, size}, -- x+
|
||||
fixed = { -size, -size, -size, size, size, size },
|
||||
connect_top = { -size, -size, -size, size, 0.5, size }, -- y+
|
||||
connect_bottom = { -size, -0.5, -size, size, size, size }, -- y-
|
||||
connect_front = { -size, -size, -0.5, size, size, size }, -- z-
|
||||
connect_back = { -size, -size, size, size, size, 0.5 }, -- z+
|
||||
connect_left = { -0.5, -size, -size, size, 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),
|
||||
tiles = {"technic_"..ltier.."_cable.png"},
|
||||
inventory_image = "technic_"..ltier.."_cable_wield.png",
|
||||
wield_image = "technic_"..ltier.."_cable_wield.png",
|
||||
tiles = { "technic_" .. ltier .. "_cable.png" },
|
||||
inventory_image = "technic_" .. ltier .. "_cable_wield.png",
|
||||
wield_image = "technic_" .. ltier .. "_cable_wield.png",
|
||||
groups = groups,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "technic:"..ltier.."_cable",
|
||||
drop = "technic:" .. ltier .. "_cable",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = node_box,
|
||||
connects_to = {"technic:"..ltier.."_cable",
|
||||
"group:technic_"..ltier, "group:technic_all_tiers"},
|
||||
connects_to = {
|
||||
"technic:" .. ltier .. "_cable",
|
||||
"group:technic_" .. ltier, "group:technic_all_tiers"
|
||||
},
|
||||
on_construct = clear_networks,
|
||||
on_destruct = clear_networks,
|
||||
})
|
||||
|
|
|
@ -11,23 +11,24 @@ function technic.register_separating_recipe(data)
|
|||
end
|
||||
|
||||
local recipes = {
|
||||
{ "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:brass_dust 3", "technic:copper_dust 2", "technic:zinc_dust" },
|
||||
{ "technic:chernobylite_dust", "default:sand", "technic:uranium3_dust" },
|
||||
{ "default:dirt 4", "default:sand", "default:gravel", "default:clay_lump 2" },
|
||||
{ "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:brass_dust 3", "technic:copper_dust 2", "technic:zinc_dust" },
|
||||
{ "technic:chernobylite_dust", "default:sand", "technic:uranium3_dust" },
|
||||
{ "default:dirt 4", "default:sand", "default:gravel", "default:clay_lump 2" },
|
||||
}
|
||||
|
||||
local function uranium_dust(p)
|
||||
return "technic:uranium"..(p == 7 and "" or p).."_dust"
|
||||
return "technic:uranium" .. (p == 7 and "" or p) .. "_dust"
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
if minetest.get_modpath("bushes_classic") then
|
||||
for _, berry in ipairs({ "blackberry", "blueberry", "gooseberry", "raspberry", "strawberry" }) do
|
||||
table.insert(recipes, { "bushes:"..berry.."_bush", "default:stick 20", "bushes:"..berry.." 4" })
|
||||
table.insert(recipes, { "bushes:" .. berry .. "_bush", "default:stick 20", "bushes:" .. berry .. " 4" })
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
-- handles the machine upgrades every tick
|
||||
|
@ -25,7 +24,7 @@ function technic.handle_machine_upgrades(meta)
|
|||
|
||||
if upg_item2 == "technic:control_logic_unit" then
|
||||
tube_upgrade = tube_upgrade + 1
|
||||
elseif upg_item2 == "technic:battery" then
|
||||
elseif upg_item2 == "technic:battery" then
|
||||
EU_upgrade = EU_upgrade + 1
|
||||
end
|
||||
|
||||
|
@ -39,7 +38,7 @@ local function on_machine_upgrade(meta, stack)
|
|||
meta:set_int("public", 1)
|
||||
return 1
|
||||
elseif stack_name ~= "technic:control_logic_unit"
|
||||
and stack_name ~= "technic:battery" then
|
||||
and stack_name ~= "technic:battery" then
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
|
@ -65,15 +64,15 @@ function technic.send_items(pos, x_velocity, z_velocity, output_name)
|
|||
if output_name == nil then
|
||||
output_name = "dst"
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local i = 0
|
||||
for _, stack in ipairs(inv:get_list(output_name)) do
|
||||
i = i + 1
|
||||
if stack then
|
||||
local item0 = stack:to_table()
|
||||
if item0 then
|
||||
if item0 then
|
||||
item0["count"] = "1"
|
||||
technic.tube_inject_item(pos, pos, vector.new(x_velocity, 0, z_velocity), item0)
|
||||
stack:take_item(1)
|
||||
|
@ -93,7 +92,7 @@ function technic.smelt_item(meta, result, speed)
|
|||
end
|
||||
local result
|
||||
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
|
||||
meta:set_int("cook_time", 0)
|
||||
|
@ -109,7 +108,7 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function)
|
|||
if send_function == nil then
|
||||
send_function = technic.send_items
|
||||
end
|
||||
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
@ -118,13 +117,13 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function)
|
|||
local z_velocity = 0
|
||||
|
||||
-- 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 == 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 == 0 then pos1.x = pos1.x + 1 x_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 == 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
|
||||
|
||||
local output_tube_connected = false
|
||||
local node1 = minetest.get_node(pos1)
|
||||
local node1 = minetest.get_node(pos1)
|
||||
if minetest.get_item_group(node1.name, "tubedevice") > 0 then
|
||||
output_tube_connected = true
|
||||
end
|
||||
|
@ -207,7 +206,7 @@ function technic.machine_inventory_take(pos, listname, index, stack, player)
|
|||
end
|
||||
|
||||
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)
|
||||
return inv_change(pos, player, count, from_list, to_list, stack)
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_compressor(data)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
technic.register_recipe_type("compressing", { description = S("Compressing") })
|
||||
|
@ -9,26 +8,26 @@ function technic.register_compressor_recipe(data)
|
|||
end
|
||||
|
||||
local recipes = {
|
||||
{"default:snowblock", "default:ice"},
|
||||
{"default:sand 2", "default:sandstone"},
|
||||
{"default:desert_sand", "default:desert_stone"},
|
||||
{"technic:mixed_metal_ingot", "technic:composite_plate"},
|
||||
{"default:copper_ingot 5", "technic:copper_plate"},
|
||||
{"technic:coal_dust 4", "technic:graphite"},
|
||||
{"technic:carbon_cloth", "technic:carbon_plate"},
|
||||
{"technic:uranium35_ingot 5", "technic:uranium_fuel"},
|
||||
{ "default:snowblock", "default:ice" },
|
||||
{ "default:sand 2", "default:sandstone" },
|
||||
{ "default:desert_sand", "default:desert_stone" },
|
||||
{ "technic:mixed_metal_ingot", "technic:composite_plate" },
|
||||
{ "default:copper_ingot 5", "technic:copper_plate" },
|
||||
{ "technic:coal_dust 4", "technic:graphite" },
|
||||
{ "technic:carbon_cloth", "technic:carbon_plate" },
|
||||
{ "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
|
||||
minetest.register_craft({
|
||||
output = "default:sand 0",
|
||||
recipe = {
|
||||
{'group:sand', 'group:sand'},
|
||||
{'group:sand', 'group:sand'}
|
||||
{ 'group:sand', 'group:sand' },
|
||||
{ 'group:sand', 'group:sand' }
|
||||
},
|
||||
})
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_electric_furnace(data)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_extractor(data)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
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
|
||||
local dye_recipes = {
|
||||
{"technic:coal_dust", "dye:black 2"},
|
||||
{"default:grass_1", "dye:green 1"},
|
||||
{"default:dry_shrub", "dye:brown 1"},
|
||||
{"default:junglegrass", "dye:green 2"},
|
||||
{"default:cactus", "dye:green 4"},
|
||||
{"flowers:geranium", "dye:blue 4"},
|
||||
{"flowers:dandelion_white", "dye:white 4"},
|
||||
{"flowers:dandelion_yellow", "dye:yellow 4"},
|
||||
{"flowers:tulip", "dye:orange 4"},
|
||||
{"flowers:rose", "dye:red 4"},
|
||||
{"flowers:viola", "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"},
|
||||
{ "technic:coal_dust", "dye:black 2" },
|
||||
{ "default:grass_1", "dye:green 1" },
|
||||
{ "default:dry_shrub", "dye:brown 1" },
|
||||
{ "default:junglegrass", "dye:green 2" },
|
||||
{ "default:cactus", "dye:green 4" },
|
||||
{ "flowers:geranium", "dye:blue 4" },
|
||||
{ "flowers:dandelion_white", "dye:white 4" },
|
||||
{ "flowers:dandelion_yellow", "dye:yellow 4" },
|
||||
{ "flowers:tulip", "dye:orange 4" },
|
||||
{ "flowers:rose", "dye:red 4" },
|
||||
{ "flowers:viola", "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" },
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
-- 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
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "dye:"..color.." 1",
|
||||
recipe = {"group:flower,color_"..color},
|
||||
type = "shapeless",
|
||||
output = "dye:" .. color .. " 1",
|
||||
recipe = { "group:flower,color_" .. color },
|
||||
})
|
||||
|
||||
end
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "dye:black 1",
|
||||
recipe = {"group:coal"},
|
||||
recipe = { "group:coal" },
|
||||
})
|
||||
|
||||
if unifieddyes then
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "dye:green 1",
|
||||
recipe = {"default:cactus"},
|
||||
recipe = { "default:cactus" },
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,98 +11,107 @@ local tube = {
|
|||
local inv = meta:get_inventory()
|
||||
return inv:room_for_item("src", stack)
|
||||
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 ltier = string.lower(tier)
|
||||
|
||||
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, ["technic_"..ltier]=1}
|
||||
local groups = {
|
||||
snappy = 2,
|
||||
choppy = 2,
|
||||
oddly_breakable_by_hand = 2,
|
||||
technic_machine = 1,
|
||||
["technic_" .. ltier] = 1
|
||||
}
|
||||
if data.tube then
|
||||
groups.tubedevice = 1
|
||||
groups.tubedevice_receiver = 1
|
||||
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
|
||||
|
||||
local generator_formspec =
|
||||
"invsize[8,9;]"..
|
||||
"label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]"..
|
||||
"list[current_name;src;3,1;1,1;]"..
|
||||
"image[4,1;1,1;default_furnace_fire_bg.png]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"listring[]"
|
||||
|
||||
"invsize[8,9;]" ..
|
||||
"label[0,0;" .. S("Fuel-Fired %s Generator"):format(tier) .. "]" ..
|
||||
"list[current_name;src;3,1;1,1;]" ..
|
||||
"image[4,1;1,1;default_furnace_fire_bg.png]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"listring[]"
|
||||
|
||||
local desc = S("Fuel-Fired %s Generator"):format(tier)
|
||||
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local burn_time = meta:get_int("burn_time")
|
||||
local burn_totaltime = meta:get_int("burn_totaltime")
|
||||
-- If more to burn and the energy produced was used: produce some more
|
||||
if burn_time > 0 then
|
||||
meta:set_int(tier.."_EU_supply", data.supply)
|
||||
meta:set_int(tier .. "_EU_supply", data.supply)
|
||||
burn_time = burn_time - 1
|
||||
meta:set_int("burn_time", burn_time)
|
||||
end
|
||||
-- Burn another piece of fuel
|
||||
if burn_time == 0 then
|
||||
local inv = meta:get_inventory()
|
||||
if not inv:is_empty("src") then
|
||||
if not inv:is_empty("src") then
|
||||
local fuellist = inv:get_list("src")
|
||||
local fuel
|
||||
local afterfuel
|
||||
fuel, afterfuel = minetest.get_craft_result(
|
||||
{method = "fuel", width = 1,
|
||||
items = fuellist})
|
||||
fuel, afterfuel = minetest.get_craft_result({
|
||||
method = "fuel",
|
||||
width = 1,
|
||||
items = fuellist
|
||||
})
|
||||
if not fuel or fuel.time == 0 then
|
||||
meta:set_string("infotext", S("%s Out Of Fuel"):format(desc))
|
||||
technic.swap_node(pos, "technic:"..ltier.."_generator")
|
||||
meta:set_int(tier.."_EU_supply", 0)
|
||||
technic.swap_node(pos, "technic:" .. ltier .. "_generator")
|
||||
meta:set_int(tier .. "_EU_supply", 0)
|
||||
return
|
||||
end
|
||||
meta:set_int("burn_time", fuel.time)
|
||||
meta:set_int("burn_totaltime", fuel.time)
|
||||
inv:set_stack("src", 1, afterfuel.items[1])
|
||||
technic.swap_node(pos, "technic:"..ltier.."_generator_active")
|
||||
meta:set_int(tier.."_EU_supply", data.supply)
|
||||
technic.swap_node(pos, "technic:" .. ltier .. "_generator_active")
|
||||
meta:set_int(tier .. "_EU_supply", data.supply)
|
||||
else
|
||||
technic.swap_node(pos, "technic:"..ltier.."_generator")
|
||||
meta:set_int(tier.."_EU_supply", 0)
|
||||
technic.swap_node(pos, "technic:" .. ltier .. "_generator")
|
||||
meta:set_int(tier .. "_EU_supply", 0)
|
||||
end
|
||||
end
|
||||
if burn_totaltime == 0 then burn_totaltime = 1 end
|
||||
local percent = math.floor((burn_time / burn_totaltime) * 100)
|
||||
meta:set_string("infotext", desc.." ("..percent.."%)")
|
||||
meta:set_string("formspec",
|
||||
"size[8, 9]"..
|
||||
"label[0, 0;"..minetest.formspec_escape(desc).."]"..
|
||||
"list[current_name;src;3, 1;1, 1;]"..
|
||||
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
(percent)..":default_furnace_fire_fg.png]"..
|
||||
"list[current_player;main;0, 5;8, 4;]"..
|
||||
"listring[]")
|
||||
meta:set_string("infotext", desc .. " (" .. percent .. "%)")
|
||||
meta:set_string("formspec",
|
||||
"size[8, 9]" ..
|
||||
"label[0, 0;" .. minetest.formspec_escape(desc) .. "]" ..
|
||||
"list[current_name;src;3, 1;1, 1;]" ..
|
||||
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:" ..
|
||||
(percent) .. ":default_furnace_fire_fg.png]" ..
|
||||
"list[current_player;main;0, 5;8, 4;]" ..
|
||||
"listring[]")
|
||||
end
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_generator", {
|
||||
|
||||
minetest.register_node("technic:" .. ltier .. "_generator", {
|
||||
description = desc,
|
||||
tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
|
||||
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
|
||||
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"},
|
||||
tiles = {
|
||||
"technic_" .. ltier .. "_generator_top.png", "technic_machine_bottom.png",
|
||||
"technic_" .. ltier .. "_generator_side.png", "technic_" .. ltier .. "_generator_side.png",
|
||||
"technic_" .. ltier .. "_generator_side.png", "technic_" .. ltier .. "_generator_front.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = groups,
|
||||
connect_sides = {"bottom", "back", "left", "right"},
|
||||
connect_sides = { "bottom", "back", "left", "right" },
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
tube = data.tube and tube or nil,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
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("tube_time", 0)
|
||||
meta:set_int("tube_time", 0)
|
||||
meta:set_string("formspec", generator_formspec)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("src", 1)
|
||||
|
@ -116,18 +125,20 @@ function technic.register_generator(data)
|
|||
after_dig_node = technic.machine_after_dig_node
|
||||
})
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_generator_active", {
|
||||
minetest.register_node("technic:" .. ltier .. "_generator_active", {
|
||||
description = desc,
|
||||
tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
|
||||
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
|
||||
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"},
|
||||
tiles = {
|
||||
"technic_" .. ltier .. "_generator_top.png", "technic_machine_bottom.png",
|
||||
"technic_" .. ltier .. "_generator_side.png", "technic_" .. ltier .. "_generator_side.png",
|
||||
"technic_" .. ltier .. "_generator_side.png", "technic_" .. ltier .. "_generator_front_active.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = active_groups,
|
||||
connect_sides = {"bottom"},
|
||||
connect_sides = { "bottom" },
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
tube = data.tube and tube or nil,
|
||||
drop = "technic:"..ltier.."_generator",
|
||||
drop = "technic:" .. ltier .. "_generator",
|
||||
can_dig = technic.machine_can_dig,
|
||||
allow_metadata_inventory_put = technic.machine_inventory_put,
|
||||
allow_metadata_inventory_take = technic.machine_inventory_take,
|
||||
|
@ -135,20 +146,20 @@ function technic.register_generator(data)
|
|||
technic_run = run,
|
||||
technic_on_disable = function(pos, node)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1)
|
||||
end,
|
||||
timer:start(1)
|
||||
end,
|
||||
on_timer = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
|
||||
-- Connected back?
|
||||
if meta:get_int(tier.."_EU_timeout") > 0 then return false end
|
||||
|
||||
if meta:get_int(tier .. "_EU_timeout") > 0 then return false end
|
||||
|
||||
local burn_time = meta:get_int("burn_time") or 0
|
||||
|
||||
if burn_time <= 0 then
|
||||
meta:set_int(tier.."_EU_supply", 0)
|
||||
meta:set_int(tier .. "_EU_supply", 0)
|
||||
meta:set_int("burn_time", 0)
|
||||
technic.swap_node(pos, "technic:"..ltier.."_generator")
|
||||
technic.swap_node(pos, "technic:" .. ltier .. "_generator")
|
||||
return false
|
||||
end
|
||||
|
||||
|
@ -157,19 +168,19 @@ function technic.register_generator(data)
|
|||
burn_time = burn_time - 1
|
||||
meta:set_int("burn_time", burn_time)
|
||||
local percent = math.floor(burn_time / burn_totaltime * 100)
|
||||
meta:set_string("formspec",
|
||||
"size[8, 9]"..
|
||||
"label[0, 0;"..minetest.formspec_escape(desc).."]"..
|
||||
"list[current_name;src;3, 1;1, 1;]"..
|
||||
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
(percent)..":default_furnace_fire_fg.png]"..
|
||||
"list[current_player;main;0, 5;8, 4;]"..
|
||||
"listring[]")
|
||||
meta:set_string("formspec",
|
||||
"size[8, 9]" ..
|
||||
"label[0, 0;" .. minetest.formspec_escape(desc) .. "]" ..
|
||||
"list[current_name;src;3, 1;1, 1;]" ..
|
||||
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:" ..
|
||||
(percent) .. ":default_furnace_fire_fg.png]" ..
|
||||
"list[current_player;main;0, 5;8, 4;]" ..
|
||||
"listring[]")
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
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", technic.producer)
|
||||
technic.register_machine(tier, "technic:" .. ltier .. "_generator_active", technic.producer)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_grinder(data)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
technic.register_recipe_type("grinding", { description = S("Grinding") })
|
||||
|
@ -10,140 +9,141 @@ end
|
|||
|
||||
local recipes = {
|
||||
-- Dusts
|
||||
{"default:coal_lump", "technic:coal_dust 2"},
|
||||
{"default:copper_lump", "technic:copper_dust 2"},
|
||||
{"default:desert_stone", "default:desert_sand"},
|
||||
{"default:gold_lump", "technic:gold_dust 2"},
|
||||
{"default:iron_lump", "technic:wrought_iron_dust 2"},
|
||||
{"technic:chromium_lump", "technic:chromium_dust 2"},
|
||||
{"technic:uranium_lump", "technic:uranium_dust 2"},
|
||||
{"technic:zinc_lump", "technic:zinc_dust 2"},
|
||||
{"technic:lead_lump", "technic:lead_dust 2"},
|
||||
{"technic:sulfur_lump", "technic:sulfur_dust 2"},
|
||||
{"default:stone", "technic:stone_dust"},
|
||||
{"default:sand", "technic:stone_dust"},
|
||||
|
||||
{ "default:coal_lump", "technic:coal_dust 2" },
|
||||
{ "default:copper_lump", "technic:copper_dust 2" },
|
||||
{ "default:desert_stone", "default:desert_sand" },
|
||||
{ "default:gold_lump", "technic:gold_dust 2" },
|
||||
{ "default:iron_lump", "technic:wrought_iron_dust 2" },
|
||||
{ "technic:chromium_lump", "technic:chromium_dust 2" },
|
||||
{ "technic:uranium_lump", "technic:uranium_dust 2" },
|
||||
{ "technic:zinc_lump", "technic:zinc_dust 2" },
|
||||
{ "technic:lead_lump", "technic:lead_dust 2" },
|
||||
{ "technic:sulfur_lump", "technic:sulfur_dust 2" },
|
||||
{ "default:stone", "technic:stone_dust" },
|
||||
{ "default:sand", "technic:stone_dust" },
|
||||
|
||||
-- Other
|
||||
{"default:cobble", "default:gravel"},
|
||||
{"default:gravel", "default:sand"},
|
||||
{"default:sandstone", "default:sand 2"}, -- reverse recipe can be found in the compressor
|
||||
{ "default:cobble", "default:gravel" },
|
||||
{ "default:gravel", "default:sand" },
|
||||
{ "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)
|
||||
minetest.register_craft({
|
||||
output = "default:sandstone 0",
|
||||
recipe = {
|
||||
{'default:sandstone'}
|
||||
{ 'default:sandstone' }
|
||||
},
|
||||
})
|
||||
|
||||
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
|
||||
|
||||
if minetest.get_modpath("moreores") then
|
||||
table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_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:mithril_lump", "technic:mithril_dust 2" })
|
||||
table.insert(recipes, { "moreores:silver_lump", "technic:silver_dust 2" })
|
||||
table.insert(recipes, { "moreores:tin_lump", "technic:tin_dust 2" })
|
||||
end
|
||||
|
||||
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:kalite_lump", "technic:kalite_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:akalin_lump", "technic:akalin_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:arol_lump", "technic:arol_dust 2" })
|
||||
table.insert(recipes, { "gloopores:talinite_lump", "technic:talinite_dust 2" })
|
||||
table.insert(recipes, { "gloopores:akalin_lump", "technic:akalin_dust 2" })
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
-- defuse common grinder unfriendly recipes
|
||||
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:gravel 0', recipe={{'default:gravel'}}})
|
||||
minetest.register_craft({ output = 'default:cobble 0', recipe = { { 'default:cobble' } } })
|
||||
minetest.register_craft({ output = 'default:gravel 0', recipe = { { 'default:gravel' } } })
|
||||
end
|
||||
|
||||
-- dusts
|
||||
local function register_dust(name, ingot)
|
||||
local lname = string.lower(name)
|
||||
lname = string.gsub(lname, ' ', '_')
|
||||
minetest.register_craftitem("technic:"..lname.."_dust", {
|
||||
minetest.register_craftitem("technic:" .. lname .. "_dust", {
|
||||
description = S("%s Dust"):format(S(name)),
|
||||
inventory_image = "technic_"..lname.."_dust.png",
|
||||
inventory_image = "technic_" .. lname .. "_dust.png",
|
||||
})
|
||||
if ingot then
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
recipe = "technic:"..lname.."_dust",
|
||||
recipe = "technic:" .. lname .. "_dust",
|
||||
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
|
||||
|
||||
-- Sorted alphibeticaly
|
||||
register_dust("Brass", "technic:brass_ingot")
|
||||
register_dust("Bronze", "default:bronze_ingot")
|
||||
register_dust("Carbon Steel", "technic:carbon_steel_ingot")
|
||||
register_dust("Cast Iron", "technic:cast_iron_ingot")
|
||||
register_dust("Chernobylite", "technic:chernobylite_block")
|
||||
register_dust("Chromium", "technic:chromium_ingot")
|
||||
register_dust("Coal", nil)
|
||||
register_dust("Copper", "default:copper_ingot")
|
||||
register_dust("Lead", "technic:lead_ingot")
|
||||
register_dust("Gold", "default:gold_ingot")
|
||||
register_dust("Mithril", "moreores:mithril_ingot")
|
||||
register_dust("Silver", "moreores:silver_ingot")
|
||||
register_dust("Brass", "technic:brass_ingot")
|
||||
register_dust("Bronze", "default:bronze_ingot")
|
||||
register_dust("Carbon Steel", "technic:carbon_steel_ingot")
|
||||
register_dust("Cast Iron", "technic:cast_iron_ingot")
|
||||
register_dust("Chernobylite", "technic:chernobylite_block")
|
||||
register_dust("Chromium", "technic:chromium_ingot")
|
||||
register_dust("Coal", nil)
|
||||
register_dust("Copper", "default:copper_ingot")
|
||||
register_dust("Lead", "technic:lead_ingot")
|
||||
register_dust("Gold", "default:gold_ingot")
|
||||
register_dust("Mithril", "moreores:mithril_ingot")
|
||||
register_dust("Silver", "moreores:silver_ingot")
|
||||
register_dust("Stainless Steel", "technic:stainless_steel_ingot")
|
||||
register_dust("Stone", "default:stone")
|
||||
register_dust("Sulfur", nil)
|
||||
register_dust("Tin", "moreores:tin_ingot")
|
||||
register_dust("Wrought Iron", "technic:wrought_iron_ingot")
|
||||
register_dust("Zinc", "technic:zinc_ingot")
|
||||
register_dust("Stone", "default:stone")
|
||||
register_dust("Sulfur", nil)
|
||||
register_dust("Tin", "moreores:tin_ingot")
|
||||
register_dust("Wrought Iron", "technic:wrought_iron_ingot")
|
||||
register_dust("Zinc", "technic:zinc_ingot")
|
||||
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
|
||||
register_dust("Akalin", "glooptest:akalin_ingot")
|
||||
register_dust("Alatro", "glooptest:alatro_ingot")
|
||||
register_dust("Arol", "glooptest:arol_ingot")
|
||||
register_dust("Kalite", nil)
|
||||
register_dust("Talinite", "glooptest:talinite_ingot")
|
||||
register_dust("Akalin", "glooptest:akalin_ingot")
|
||||
register_dust("Alatro", "glooptest:alatro_ingot")
|
||||
register_dust("Arol", "glooptest:arol_ingot")
|
||||
register_dust("Kalite", nil)
|
||||
register_dust("Talinite", "glooptest:talinite_ingot")
|
||||
end
|
||||
|
||||
for p = 0, 35 do
|
||||
local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil
|
||||
local psuffix = p == 7 and "" or p
|
||||
local ingot = "technic:uranium"..psuffix.."_ingot"
|
||||
local dust = "technic:uranium"..psuffix.."_dust"
|
||||
local ingot = "technic:uranium" .. psuffix .. "_ingot"
|
||||
local dust = "technic:uranium" .. psuffix .. "_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",
|
||||
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({
|
||||
type = "cooking",
|
||||
recipe = dust,
|
||||
output = ingot,
|
||||
})
|
||||
technic.register_grinder_recipe({ input = {ingot}, output = dust })
|
||||
technic.register_grinder_recipe({ input = { ingot }, output = dust })
|
||||
end
|
||||
|
||||
local function uranium_dust(p)
|
||||
return "technic:uranium"..(p == 7 and "" or p).."_dust"
|
||||
return "technic:uranium" .. (p == 7 and "" or p) .. "_dust"
|
||||
end
|
||||
|
||||
for pa = 0, 34 do
|
||||
for pb = pa+1, 35 do
|
||||
local pc = (pa+pb)/2
|
||||
for pb = pa + 1, 35 do
|
||||
local pc = (pa + pb) / 2
|
||||
if pc == math.floor(pc) then
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
recipe = { uranium_dust(pa), uranium_dust(pb) },
|
||||
output = uranium_dust(pc).." 2",
|
||||
output = uranium_dust(pc) .. " 2",
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,14 +10,14 @@ minetest.register_craftitem(sawdust, {
|
|||
inventory_image = "technic_sawdust.png",
|
||||
})
|
||||
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
|
||||
local function register_tree_grinding(name, tree, wood, extract, grinding_color)
|
||||
local lname = string.lower(name)
|
||||
lname = string.gsub(lname, ' ', '_')
|
||||
local grindings_name = "technic:"..lname.."_grindings"
|
||||
local inventory_image = "technic_"..lname.."_grindings.png"
|
||||
local grindings_name = "technic:" .. lname .. "_grindings"
|
||||
local inventory_image = "technic_" .. lname .. "_grindings.png"
|
||||
if grinding_color then
|
||||
inventory_image = inventory_image .. "^[colorize:" .. grinding_color
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ local function register_tree_grinding(name, tree, wood, extract, grinding_color)
|
|||
technic.register_grinder_recipe({ input = { wood }, output = grindings_name })
|
||||
end
|
||||
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({
|
||||
input = { grindings_name .. " 4" },
|
||||
output = { sawdust .. " 4", extract }
|
||||
|
@ -48,8 +48,8 @@ local rubber_tree_planks = moretrees and "moretrees:rubber_tree_planks"
|
|||
local default_extract = dye and "dye:brown 2"
|
||||
|
||||
local grinding_recipes = {
|
||||
{"Common Tree", "group:tree", "group:wood", default_extract },
|
||||
{"Rubber Tree", "moretrees:rubber_tree_trunk", rubber_tree_planks, "technic:raw_latex"}
|
||||
{ "Common Tree", "group:tree", "group:wood", default_extract },
|
||||
{ "Rubber Tree", "moretrees:rubber_tree_trunk", rubber_tree_planks, "technic:raw_latex" }
|
||||
}
|
||||
|
||||
for _, data in pairs(grinding_recipes) do
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
local path = technic.modpath.."/machines/register"
|
||||
local path = technic.modpath .. "/machines/register"
|
||||
|
||||
dofile(path.."/common.lua")
|
||||
dofile(path .. "/common.lua")
|
||||
|
||||
-- Wiring stuff
|
||||
dofile(path.."/cables.lua")
|
||||
dofile(path.."/battery_box.lua")
|
||||
dofile(path .. "/cables.lua")
|
||||
dofile(path .. "/battery_box.lua")
|
||||
|
||||
-- Generators
|
||||
dofile(path.."/solar_array.lua")
|
||||
dofile(path.."/generator.lua")
|
||||
dofile(path .. "/solar_array.lua")
|
||||
dofile(path .. "/generator.lua")
|
||||
|
||||
-- API for machines
|
||||
dofile(path.."/recipes.lua")
|
||||
dofile(path.."/machine_base.lua")
|
||||
dofile(path .. "/recipes.lua")
|
||||
dofile(path .. "/machine_base.lua")
|
||||
|
||||
-- Recipes
|
||||
dofile(path.."/alloy_recipes.lua")
|
||||
dofile(path.."/grinder_recipes.lua")
|
||||
dofile(path.."/extractor_recipes.lua")
|
||||
dofile(path.."/compressor_recipes.lua")
|
||||
dofile(path.."/centrifuge_recipes.lua")
|
||||
dofile(path .. "/alloy_recipes.lua")
|
||||
dofile(path .. "/grinder_recipes.lua")
|
||||
dofile(path .. "/extractor_recipes.lua")
|
||||
dofile(path .. "/compressor_recipes.lua")
|
||||
dofile(path .. "/centrifuge_recipes.lua")
|
||||
|
||||
-- Multi-Machine Recipes
|
||||
dofile(path.."/grindings.lua")
|
||||
dofile(path .. "/grindings.lua")
|
||||
|
||||
-- Machines
|
||||
dofile(path.."/alloy_furnace.lua")
|
||||
dofile(path.."/electric_furnace.lua")
|
||||
dofile(path.."/grinder.lua")
|
||||
dofile(path.."/extractor.lua")
|
||||
dofile(path.."/compressor.lua")
|
||||
dofile(path.."/centrifuge.lua")
|
||||
dofile(path .. "/alloy_furnace.lua")
|
||||
dofile(path .. "/electric_furnace.lua")
|
||||
dofile(path .. "/grinder.lua")
|
||||
dofile(path .. "/extractor.lua")
|
||||
dofile(path .. "/compressor.lua")
|
||||
dofile(path .. "/centrifuge.lua")
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
local tube = {
|
||||
|
@ -12,10 +11,10 @@ local tube = {
|
|||
local inv = meta:get_inventory()
|
||||
return inv:room_for_item("src", stack)
|
||||
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)
|
||||
return math.floor(v + 0.5)
|
||||
|
@ -29,48 +28,48 @@ function technic.register_base_machine(data)
|
|||
local tier = data.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
|
||||
groups.tubedevice = 1
|
||||
groups.tubedevice_receiver = 1
|
||||
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
|
||||
|
||||
local formspec =
|
||||
"invsize[8,9;]"..
|
||||
"list[current_name;src;"..(4-input_size)..",1;"..input_size..",1;]"..
|
||||
"list[current_name;dst;5,1;2,2;]"..
|
||||
"list[current_player;main;0,5;8,4;]"..
|
||||
"label[0,0;"..machine_desc:format(tier).."]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"
|
||||
if data.upgrade then
|
||||
formspec = formspec..
|
||||
"list[current_name;upgrade1;1,3;1,1;]"..
|
||||
"list[current_name;upgrade2;2,3;1,1;]"..
|
||||
"label[1,4;"..S("Upgrade Slots").."]"..
|
||||
"listring[current_name;upgrade1]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;upgrade2]"..
|
||||
"invsize[8,9;]" ..
|
||||
"list[current_name;src;" .. (4 - input_size) .. ",1;" .. input_size .. ",1;]" ..
|
||||
"list[current_name;dst;5,1;2,2;]" ..
|
||||
"list[current_player;main;0,5;8,4;]" ..
|
||||
"label[0,0;" .. machine_desc:format(tier) .. "]" ..
|
||||
"listring[current_name;dst]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;src]" ..
|
||||
"listring[current_player;main]"
|
||||
if data.upgrade then
|
||||
formspec = formspec ..
|
||||
"list[current_name;upgrade1;1,3;1,1;]" ..
|
||||
"list[current_name;upgrade2;2,3;1,1;]" ..
|
||||
"label[1,4;" .. S("Upgrade Slots") .. "]" ..
|
||||
"listring[current_name;upgrade1]" ..
|
||||
"listring[current_player;main]" ..
|
||||
"listring[current_name;upgrade2]" ..
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local eu_input = meta:get_int(tier.."_EU_input")
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local eu_input = meta:get_int(tier .. "_EU_input")
|
||||
|
||||
local machine_desc_tier = machine_desc:format(tier)
|
||||
local machine_node = "technic:"..ltier.."_"..machine_name
|
||||
local machine_demand = data.demand
|
||||
local machine_node = "technic:" .. ltier .. "_" .. machine_name
|
||||
local machine_demand = data.demand
|
||||
|
||||
-- Setup meta data if it does not exist.
|
||||
if not eu_input then
|
||||
meta:set_int(tier.."_EU_demand", machine_demand[1])
|
||||
meta:set_int(tier.."_EU_input", 0)
|
||||
meta:set_int(tier .. "_EU_demand", machine_demand[1])
|
||||
meta:set_int(tier .. "_EU_input", 0)
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -82,23 +81,23 @@ function technic.register_base_machine(data)
|
|||
technic.handle_machine_pipeworks(pos, tube_upgrade)
|
||||
end
|
||||
|
||||
local powered = eu_input >= machine_demand[EU_upgrade+1]
|
||||
local powered = eu_input >= machine_demand[EU_upgrade + 1]
|
||||
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
|
||||
while true do
|
||||
local result = technic.get_recipe(typename, inv:get_list("src"))
|
||||
if not result then
|
||||
technic.swap_node(pos, machine_node)
|
||||
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", 0)
|
||||
return
|
||||
end
|
||||
meta:set_int(tier.."_EU_demand", machine_demand[EU_upgrade+1])
|
||||
technic.swap_node(pos, machine_node.."_active")
|
||||
meta:set_int(tier .. "_EU_demand", machine_demand[EU_upgrade + 1])
|
||||
technic.swap_node(pos, machine_node .. "_active")
|
||||
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
|
||||
technic.swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_desc_tier))
|
||||
|
@ -124,24 +123,26 @@ function technic.register_base_machine(data)
|
|||
if not room_for_output then
|
||||
technic.swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_desc_tier))
|
||||
meta:set_int(tier.."_EU_demand", 0)
|
||||
meta:set_int("src_time", round(result.time*10))
|
||||
meta:set_int(tier .. "_EU_demand", 0)
|
||||
meta:set_int("src_time", round(result.time * 10))
|
||||
return
|
||||
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("dst", inv:get_list("dst_tmp"))
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("technic:"..ltier.."_"..machine_name, {
|
||||
|
||||
minetest.register_node("technic:" .. ltier .. "_" .. machine_name, {
|
||||
description = machine_desc:format(tier),
|
||||
tiles = {"technic_"..ltier.."_"..machine_name.."_top.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.."_front.png"},
|
||||
tiles = {
|
||||
"technic_" .. ltier .. "_" .. machine_name .. "_top.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 .. "_front.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = groups,
|
||||
tube = data.tube and tube or nil,
|
||||
|
@ -152,7 +153,7 @@ function technic.register_base_machine(data)
|
|||
local node = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
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)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("src", input_size)
|
||||
|
@ -169,16 +170,18 @@ function technic.register_base_machine(data)
|
|||
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),
|
||||
tiles = {"technic_"..ltier.."_"..machine_name.."_top.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.."_front_active.png"},
|
||||
tiles = {
|
||||
"technic_" .. ltier .. "_" .. machine_name .. "_top.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 .. "_front_active.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
drop = "technic:"..ltier.."_"..machine_name,
|
||||
drop = "technic:" .. ltier .. "_" .. machine_name,
|
||||
groups = active_groups,
|
||||
connect_sides = data.connect_sides or connect_default,
|
||||
legacy_facedir_simple = true,
|
||||
|
@ -189,11 +192,12 @@ function technic.register_base_machine(data)
|
|||
allow_metadata_inventory_take = technic.machine_inventory_take,
|
||||
allow_metadata_inventory_move = technic.machine_inventory_move,
|
||||
technic_run = run,
|
||||
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.."_active", technic.receiver)
|
||||
technic.register_machine(tier, "technic:" .. ltier .. "_" .. machine_name, technic.receiver)
|
||||
technic.register_machine(tier, "technic:" .. ltier .. "_" .. machine_name .. "_active", technic.receiver)
|
||||
end
|
||||
|
||||
end -- End registration
|
||||
-- End registration
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ local function register_recipe(typename, data)
|
|||
else
|
||||
data.output = ItemStack(data.output):to_string()
|
||||
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)
|
||||
if not index then
|
||||
print("[Technic] ignored registration of garbage recipe!")
|
||||
|
@ -49,7 +49,7 @@ local function register_recipe(typename, data)
|
|||
for _, stack in ipairs(data.input) do
|
||||
recipe.input[ItemStack(stack):get_name()] = ItemStack(stack):get_count()
|
||||
end
|
||||
|
||||
|
||||
technic.recipes[typename].recipes[index] = recipe
|
||||
if unified_inventory and technic.recipes[typename].output_size == 1 then
|
||||
unified_inventory.register_craft({
|
||||
|
@ -70,14 +70,17 @@ function technic.get_recipe(typename, items)
|
|||
local result, new_input = minetest.get_craft_result({
|
||||
method = "cooking",
|
||||
width = 1,
|
||||
items = items})
|
||||
items = items
|
||||
})
|
||||
-- Compatibility layer
|
||||
if not result or result.time == 0 then
|
||||
return nil
|
||||
else
|
||||
return {time = result.time,
|
||||
new_input = new_input.items,
|
||||
output = result.item}
|
||||
return {
|
||||
time = result.time,
|
||||
new_input = new_input.items,
|
||||
output = result.item
|
||||
}
|
||||
end
|
||||
end
|
||||
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()])
|
||||
end
|
||||
end
|
||||
return {time = recipe.time,
|
||||
new_input = new_input,
|
||||
output = recipe.output}
|
||||
return {
|
||||
time = recipe.time,
|
||||
new_input = new_input,
|
||||
output = recipe.output
|
||||
}
|
||||
else
|
||||
return nil
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
|
||||
function technic.register_solar_array(data)
|
||||
|
@ -31,19 +30,21 @@ function technic.register_solar_array(data)
|
|||
charge_to_give = math.max(charge_to_give, 0)
|
||||
charge_to_give = math.min(charge_to_give, data.power * 50)
|
||||
meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give)))
|
||||
meta:set_int(tier.."_EU_supply", charge_to_give)
|
||||
meta:set_int(tier .. "_EU_supply", charge_to_give)
|
||||
else
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_int(tier.."_EU_supply", 0)
|
||||
meta:set_int(tier .. "_EU_supply", 0)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("technic:solar_array_"..ltier, {
|
||||
tiles = {"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},
|
||||
connect_sides = {"bottom"},
|
||||
|
||||
minetest.register_node("technic:solar_array_" .. ltier, {
|
||||
tiles = {
|
||||
"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 },
|
||||
connect_sides = { "bottom" },
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
description = S("Arrayed Solar %s Generator"):format(tier),
|
||||
active = false,
|
||||
|
@ -51,16 +52,16 @@ function technic.register_solar_array(data)
|
|||
paramtype = "light",
|
||||
node_box = {
|
||||
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)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local name = minetest.get_node(pos).name
|
||||
meta:set_int(tier.."_EU_supply", 0)
|
||||
meta:set_int(tier .. "_EU_supply", 0)
|
||||
end,
|
||||
technic_run = run,
|
||||
})
|
||||
|
||||
technic.register_machine(tier, "technic:solar_array_"..ltier, technic.producer)
|
||||
technic.register_machine(tier, "technic:solar_array_" .. ltier, technic.producer)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,21 +10,21 @@
|
|||
local S = technic.getter
|
||||
|
||||
local function set_supply_converter_formspec(meta)
|
||||
local formspec = "size[5,2.25]"..
|
||||
"field[0.3,0.5;2,1;power;"..S("Input Power")..";"..meta:get_int("power").."]"
|
||||
local formspec = "size[5,2.25]" ..
|
||||
"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
|
||||
-- state they'll switch to, so that multiple presses (arising
|
||||
-- from the ambiguity between lag and a missed press) only make
|
||||
-- the single change that the user expects.
|
||||
if meta:get_int("mesecon_mode") == 0 then
|
||||
formspec = formspec.."button[0,1;5,1;mesecon_mode_1;"..S("Ignoring Mesecon Signal").."]"
|
||||
formspec = formspec .. "button[0,1;5,1;mesecon_mode_1;" .. S("Ignoring Mesecon Signal") .. "]"
|
||||
else
|
||||
formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]"
|
||||
formspec = formspec .. "button[0,1;5,1;mesecon_mode_0;" .. S("Controlled by Mesecon Signal") .. "]"
|
||||
end
|
||||
if meta:get_int("enabled") == 0 then
|
||||
formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("Supply Converter")).."]"
|
||||
formspec = formspec .. "button[0,1.75;5,1;enable;" .. S("%s Disabled"):format(S("Supply Converter")) .. "]"
|
||||
else
|
||||
formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("Supply Converter")).."]"
|
||||
formspec = formspec .. "button[0,1.75;5,1;disable;" .. S("%s Enabled"):format(S("Supply Converter")) .. "]"
|
||||
end
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
|
@ -66,9 +66,9 @@ local run = function(pos, node, run_stage)
|
|||
|
||||
local remain = 0.9
|
||||
-- Machine information
|
||||
local machine_name = S("Supply Converter")
|
||||
local meta = minetest.get_meta(pos)
|
||||
local enabled = meta:get_string("enabled")
|
||||
local machine_name = S("Supply Converter")
|
||||
local meta = minetest.get_meta(pos)
|
||||
local enabled = meta:get_string("enabled")
|
||||
if enabled == "" then
|
||||
-- Backwards compatibility
|
||||
minetest.registered_nodes["technic:supply_converter"].on_construct(pos)
|
||||
|
@ -79,42 +79,48 @@ local run = function(pos, node, run_stage)
|
|||
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 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 name_up = minetest.get_node(pos_up).name
|
||||
local name_down = minetest.get_node(pos_down).name
|
||||
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 name_up = minetest.get_node(pos_up).name
|
||||
local name_down = minetest.get_node(pos_down).name
|
||||
|
||||
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
|
||||
local input = meta:get_int(from.."_EU_input")
|
||||
meta:set_int(from.."_EU_demand", demand)
|
||||
meta:set_int(from.."_EU_supply", 0)
|
||||
meta:set_int(to.."_EU_demand", 0)
|
||||
meta:set_int(to.."_EU_supply", input * remain)
|
||||
local input = meta:get_int(from .. "_EU_input")
|
||||
meta:set_int(from .. "_EU_demand", demand)
|
||||
meta:set_int(from .. "_EU_supply", 0)
|
||||
meta:set_int(to .. "_EU_demand", 0)
|
||||
meta:set_int(to .. "_EU_supply", input * remain)
|
||||
meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name, technic.pretty_num(input), from, technic.pretty_num(input * remain), to))
|
||||
else
|
||||
meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name))
|
||||
if to then
|
||||
meta:set_int(to.."_EU_supply", 0)
|
||||
meta:set_int(to .. "_EU_supply", 0)
|
||||
end
|
||||
if from then
|
||||
meta:set_int(from.."_EU_demand", 0)
|
||||
meta:set_int(from .. "_EU_demand", 0)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
minetest.register_node("technic:supply_converter", {
|
||||
description = S("Supply Converter"),
|
||||
tiles = {"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_machine=1, technic_all_tiers=1},
|
||||
connect_sides = {"top", "bottom"},
|
||||
tiles = {
|
||||
"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_machine = 1,
|
||||
technic_all_tiers = 1
|
||||
},
|
||||
connect_sides = { "top", "bottom" },
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_receive_fields = supply_converter_receive_fields,
|
||||
on_construct = function(pos)
|
||||
|
@ -134,9 +140,9 @@ minetest.register_node("technic:supply_converter", {
|
|||
minetest.register_craft({
|
||||
output = 'technic:supply_converter 1',
|
||||
recipe = {
|
||||
{'technic:fine_gold_wire', 'technic:rubber', 'technic:doped_silicon_wafer'},
|
||||
{'technic:mv_transformer', 'technic:machine_casing', 'technic:lv_transformer'},
|
||||
{'technic:mv_cable', 'technic:rubber', 'technic:lv_cable'},
|
||||
{ 'technic:fine_gold_wire', 'technic:rubber', 'technic:doped_silicon_wafer' },
|
||||
{ 'technic:mv_transformer', 'technic:machine_casing', 'technic:lv_transformer' },
|
||||
{ 'technic:mv_cable', 'technic:rubber', 'technic:lv_cable' },
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -42,25 +42,27 @@ local S = technic.getter
|
|||
minetest.register_craft({
|
||||
output = "technic:switching_station",
|
||||
recipe = {
|
||||
{"", "technic:lv_transformer", ""},
|
||||
{"default:copper_ingot", "technic:machine_casing", "default:copper_ingot"},
|
||||
{"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"}
|
||||
{ "", "technic:lv_transformer", "" },
|
||||
{ "default:copper_ingot", "technic:machine_casing", "default:copper_ingot" },
|
||||
{ "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"),
|
||||
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"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1},
|
||||
connect_sides = {"bottom"},
|
||||
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"
|
||||
},
|
||||
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, technic_all_tiers = 1 },
|
||||
connect_sides = { "bottom" },
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", S("Switching Station"))
|
||||
meta:set_string("active", 1)
|
||||
meta:set_string("channel", "switching_station"..minetest.pos_to_string(pos))
|
||||
meta:set_string("channel", "switching_station" .. minetest.pos_to_string(pos))
|
||||
meta:set_string("formspec", "field[channel;Channel;${channel}]")
|
||||
end,
|
||||
after_dig_node = function(pos)
|
||||
|
@ -80,11 +82,13 @@ minetest.register_node("technic:switching_station",{
|
|||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("channel", fields.channel)
|
||||
end,
|
||||
mesecons = {effector = {
|
||||
rules = mesecon.rules.default,
|
||||
}},
|
||||
mesecons = {
|
||||
effector = {
|
||||
rules = mesecon.rules.default,
|
||||
}
|
||||
},
|
||||
digiline = {
|
||||
receptor = {action = function() end},
|
||||
receptor = { action = function() end },
|
||||
effector = {
|
||||
action = function(pos, node, channel, msg)
|
||||
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
|
||||
for i = 1, #nodes do
|
||||
if pos.x == nodes[i].x and
|
||||
pos.y == nodes[i].y and
|
||||
pos.z == nodes[i].z then
|
||||
pos.y == nodes[i].y and
|
||||
pos.z == nodes[i].z then
|
||||
return false
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
--dprint(name.." is a "..machines[name])
|
||||
meta:set_string(tier.."_network",minetest.pos_to_string(sw_pos))
|
||||
if machines[name] == technic.producer then
|
||||
meta:set_string(tier .. "_network", minetest.pos_to_string(sw_pos))
|
||||
if machines[name] == technic.producer then
|
||||
add_new_cable_node(PR_nodes, pos, network_id)
|
||||
elseif machines[name] == technic.receiver then
|
||||
add_new_cable_node(RE_nodes, pos, network_id)
|
||||
|
@ -150,7 +154,7 @@ local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nod
|
|||
add_new_cable_node(BA_nodes, pos, network_id)
|
||||
end
|
||||
|
||||
meta:set_int(tier.."_EU_timeout", 2) -- Touch node
|
||||
meta:set_int(tier .. "_EU_timeout", 2) -- Touch node
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -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 pos = all_nodes[i]
|
||||
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, 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 + 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, z = pos.z + 1 },
|
||||
{ x = pos.x, y = pos.y, z = pos.z - 1 }
|
||||
}
|
||||
--print("ON")
|
||||
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)
|
||||
|
@ -173,7 +178,7 @@ end
|
|||
local touch_nodes = function(list, tier)
|
||||
for _, pos in ipairs(list) do
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int(tier.."_EU_timeout", 2) -- Touch node
|
||||
meta:set_int(tier .. "_EU_timeout", 2) -- Touch node
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -195,14 +200,20 @@ local get_network = function(sw_pos, pos1, tier)
|
|||
local BA_nodes = {}
|
||||
local RE_nodes = {}
|
||||
local SP_nodes = {}
|
||||
local all_nodes = {pos1}
|
||||
local all_nodes = { pos1 }
|
||||
repeat
|
||||
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
|
||||
until all_nodes[i] == nil
|
||||
technic.networks[minetest.hash_node_position(pos1)] = {tier = tier, PR_nodes = PR_nodes,
|
||||
RE_nodes = RE_nodes, BA_nodes = BA_nodes, SP_nodes = SP_nodes, all_nodes = all_nodes}
|
||||
technic.networks[minetest.hash_node_position(pos1)] = {
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -210,33 +221,33 @@ end
|
|||
-- The action code for the switching station --
|
||||
-----------------------------------------------
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:switching_station"},
|
||||
nodenames = { "technic:switching_station" },
|
||||
label = "Switching Station", -- allows the mtt profiler to profile this abm individually
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta1 = nil
|
||||
local pos1 = {}
|
||||
local PR_EU = 0 -- EUs from PR nodes
|
||||
local BA_PR_EU = 0 -- EUs from BA nodes (discharching)
|
||||
local BA_RE_EU = 0 -- EUs to BA nodes (charging)
|
||||
local RE_EU = 0 -- EUs to RE nodes
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta1 = nil
|
||||
local pos1 = {}
|
||||
local PR_EU = 0 -- EUs from PR nodes
|
||||
local BA_PR_EU = 0 -- EUs from BA nodes (discharching)
|
||||
local BA_RE_EU = 0 -- EUs to BA nodes (charging)
|
||||
local RE_EU = 0 -- EUs to RE nodes
|
||||
|
||||
local tier = ""
|
||||
local tier = ""
|
||||
local PR_nodes
|
||||
local BA_nodes
|
||||
local RE_nodes
|
||||
local machine_name = S("Switching Station")
|
||||
|
||||
-- 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
|
||||
if meta:get_int("active") ~= 1 then
|
||||
minetest.forceload_free_block(pos)
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -275,9 +286,9 @@ minetest.register_abm({
|
|||
run_nodes(BA_nodes, technic.battery)
|
||||
|
||||
-- Strings for the meta data
|
||||
local eu_demand_str = tier.."_EU_demand"
|
||||
local eu_input_str = tier.."_EU_input"
|
||||
local eu_supply_str = tier.."_EU_supply"
|
||||
local eu_demand_str = tier .. "_EU_demand"
|
||||
local eu_input_str = tier .. "_EU_input"
|
||||
local eu_supply_str = tier .. "_EU_supply"
|
||||
|
||||
-- Distribute charge equally across multiple batteries.
|
||||
local charge_total = 0
|
||||
|
@ -336,7 +347,7 @@ minetest.register_abm({
|
|||
--dprint("Total BA demand:"..BA_eu_demand)
|
||||
|
||||
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)))
|
||||
|
||||
-- If mesecon signal and power supply or demand changed then
|
||||
|
@ -353,12 +364,12 @@ minetest.register_abm({
|
|||
end
|
||||
|
||||
-- Data that will be used by the power monitor
|
||||
meta:set_int("supply",PR_eu_supply)
|
||||
meta:set_int("demand",RE_eu_demand)
|
||||
meta:set_int("supply", PR_eu_supply)
|
||||
meta:set_int("demand", RE_eu_demand)
|
||||
|
||||
-- If the PR supply is enough for the RE demand supply them all
|
||||
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
|
||||
meta1 = minetest.get_meta(pos1)
|
||||
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
|
||||
--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
|
||||
meta1 = minetest.get_meta(pos1)
|
||||
meta1 = minetest.get_meta(pos1)
|
||||
local eu_demand = meta1:get_int(eu_demand_str)
|
||||
meta1:set_int(eu_input_str, eu_demand)
|
||||
end
|
||||
|
@ -394,7 +405,7 @@ minetest.register_abm({
|
|||
if BA_eu_supply > 0 then
|
||||
charge_factor = (PR_eu_supply - RE_eu_demand) / BA_eu_supply
|
||||
end
|
||||
for n,pos1 in pairs(BA_nodes) do
|
||||
for n, pos1 in pairs(BA_nodes) do
|
||||
meta1 = minetest.get_meta(pos1)
|
||||
local eu_supply = meta1:get_int(eu_supply_str)
|
||||
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:set_int(eu_input_str, 0)
|
||||
end
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -426,19 +436,20 @@ minetest.register_abm({
|
|||
-- A node must be touched by the station continuously in order to function
|
||||
local function switching_station_timeout_count(pos, tier)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local timeout = meta:get_int(tier.."_EU_timeout")
|
||||
local timeout = meta:get_int(tier .. "_EU_timeout")
|
||||
if timeout <= 0 then
|
||||
meta:set_int(tier.."_EU_input", 0) -- Not needed anymore <-- actually, it is for supply converter
|
||||
meta:set_int(tier .. "_EU_input", 0) -- Not needed anymore <-- actually, it is for supply converter
|
||||
return true
|
||||
else
|
||||
meta:set_int(tier.."_EU_timeout", timeout - 1)
|
||||
meta:set_int(tier .. "_EU_timeout", timeout - 1)
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:technic_machine"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
nodenames = { "group:technic_machine" },
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
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
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:switching_station"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
nodenames = { "technic:switching_station" },
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
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)
|
||||
if not tier then return end
|
||||
if switching_station_timeout_count(pos, tier) then
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("active",1)
|
||||
meta:set_int("active", 1)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -272,13 +272,13 @@ local function calculate_base_damage(node_pos, object_pos, strength)
|
|||
local dist = vector.distance(node_pos, object_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
|
||||
shielding = shielding + node_radiation_resistance(shield_name) * 0.025
|
||||
end
|
||||
|
||||
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
|
||||
return dmg
|
||||
|
@ -303,9 +303,9 @@ end
|
|||
|
||||
local function calculate_object_center(object)
|
||||
if object:is_player() then
|
||||
return {x=0, y=abdomen_offset, z=0}
|
||||
return { x = 0, y = abdomen_offset, z = 0 }
|
||||
end
|
||||
return {x=0, y=0, z=0}
|
||||
return { x = 0, y = 0, z = 0 }
|
||||
end
|
||||
|
||||
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 max_dist = strength * rad_dmg_mult_sqrt
|
||||
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
|
||||
dmg_object(pos, o, strength)
|
||||
end
|
||||
|
@ -346,7 +346,7 @@ end
|
|||
|
||||
if minetest.setting_getbool("enable_damage") then
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:radioactive"},
|
||||
nodenames = { "group:radioactive" },
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = dmg_abm,
|
||||
|
@ -379,19 +379,21 @@ end
|
|||
-- Radioactive materials that can result from destroying a reactor
|
||||
local griefing = technic.config:get_bool("enable_corium_griefing")
|
||||
|
||||
for _, state in pairs({"flowing", "source"}) do
|
||||
minetest.register_node("technic:corium_"..state, {
|
||||
for _, state in pairs({ "flowing", "source" }) do
|
||||
minetest.register_node("technic:corium_" .. state, {
|
||||
description = S(state == "source" and "Corium Source" or "Flowing Corium"),
|
||||
drawtype = (state == "source" and "liquid" or "flowingliquid"),
|
||||
[state == "source" and "tiles" or "special_tiles"] = {{
|
||||
name = "technic_corium_"..state.."_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 3.0,
|
||||
},
|
||||
}},
|
||||
[state == "source" and "tiles" or "special_tiles"] = {
|
||||
{
|
||||
name = "technic_corium_" .. state .. "_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 3.0,
|
||||
},
|
||||
}
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = (state == "flowing" and "flowingliquid" or nil),
|
||||
light_source = (state == "source" and 8 or 5),
|
||||
|
@ -407,7 +409,7 @@ for _, state in pairs({"flowing", "source"}) do
|
|||
liquid_viscosity = LAVA_VISC,
|
||||
liquid_renewable = false,
|
||||
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 = {
|
||||
liquid = 2,
|
||||
hot = 3,
|
||||
|
@ -419,27 +421,25 @@ for _, state in pairs({"flowing", "source"}) do
|
|||
end
|
||||
|
||||
if rawget(_G, "bucket") and bucket.register_liquid then
|
||||
bucket.register_liquid(
|
||||
"technic:corium_source",
|
||||
bucket.register_liquid("technic:corium_source",
|
||||
"technic:corium_flowing",
|
||||
"technic:bucket_corium",
|
||||
"technic_bucket_corium.png",
|
||||
"Corium Bucket"
|
||||
)
|
||||
"Corium Bucket")
|
||||
end
|
||||
|
||||
minetest.register_node("technic:chernobylite_block", {
|
||||
description = S("Chernobylite Block"),
|
||||
tiles = {"technic_chernobylite_block.png"},
|
||||
description = S("Chernobylite Block"),
|
||||
tiles = { "technic_chernobylite_block.png" },
|
||||
is_ground_content = true,
|
||||
groups = {cracky=1, radioactive=4, level=2},
|
||||
groups = { cracky = 1, radioactive = 4, level = 2 },
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
light_source = 2,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:water"},
|
||||
neighbors = {"technic:corium_source"},
|
||||
nodenames = { "group:water" },
|
||||
neighbors = { "technic:corium_source" },
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
|
@ -448,36 +448,36 @@ minetest.register_abm({
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:corium_flowing"},
|
||||
neighbors = {"group:water"},
|
||||
nodenames = { "technic:corium_flowing" },
|
||||
neighbors = { "group:water" },
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
minetest.set_node(pos, {name="technic:chernobylite_block"})
|
||||
minetest.set_node(pos, { name = "technic:chernobylite_block" })
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:corium_flowing"},
|
||||
nodenames = { "technic:corium_flowing" },
|
||||
interval = 5,
|
||||
chance = (griefing and 10 or 1),
|
||||
action = function(pos, node)
|
||||
minetest.set_node(pos, {name="technic:chernobylite_block"})
|
||||
minetest.set_node(pos, { name = "technic:chernobylite_block" })
|
||||
end,
|
||||
})
|
||||
|
||||
if griefing then
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:corium_source", "technic:corium_flowing"},
|
||||
nodenames = { "technic:corium_source", "technic:corium_flowing" },
|
||||
interval = 4,
|
||||
chance = 4,
|
||||
action = function(pos, node)
|
||||
for _, offset in ipairs({
|
||||
vector.new(1,0,0),
|
||||
vector.new(-1,0,0),
|
||||
vector.new(0,0,1),
|
||||
vector.new(0,0,-1),
|
||||
vector.new(0,-1,0),
|
||||
vector.new(1, 0, 0),
|
||||
vector.new(-1, 0, 0),
|
||||
vector.new(0, 0, 1),
|
||||
vector.new(0, 0, -1),
|
||||
vector.new(0, -1, 0),
|
||||
}) do
|
||||
if math.random(8) == 1 then
|
||||
minetest.dig_node(vector.add(pos, offset))
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
technic.receiver = "RE"
|
||||
technic.producer = "PR"
|
||||
technic.producer_receiver = "PR_RE"
|
||||
technic.battery = "BA"
|
||||
technic.battery = "BA"
|
||||
|
||||
technic.machines = {}
|
||||
technic.machines = {}
|
||||
technic.power_tools = {}
|
||||
technic.networks = {}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ function technic.register_can(d)
|
|||
local charge = get_can_level(itemstack)
|
||||
if charge == data.can_capacity then return end
|
||||
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
||||
minetest.log("action", user:get_player_name().." tried to take "..node.name.." at protected position "..minetest.pos_to_string(pointed_thing.under).." with a "..data.can_name)
|
||||
minetest.log("action", user:get_player_name() .. " tried to take " .. node.name .. " at protected position " .. minetest.pos_to_string(pointed_thing.under) .. " with a " .. data.can_name)
|
||||
return
|
||||
end
|
||||
minetest.remove_node(pointed_thing.under)
|
||||
|
@ -60,10 +60,10 @@ function technic.register_can(d)
|
|||
local charge = get_can_level(itemstack)
|
||||
if charge == 0 then return end
|
||||
if minetest.is_protected(pos, user:get_player_name()) then
|
||||
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
|
||||
end
|
||||
minetest.set_node(pos, {name=data.liquid_source_name})
|
||||
minetest.set_node(pos, { name = data.liquid_source_name })
|
||||
charge = charge - 1
|
||||
itemstack:set_metadata(tostring(charge))
|
||||
set_can_wear(itemstack, charge, data.can_capacity)
|
||||
|
@ -89,9 +89,9 @@ technic.register_can({
|
|||
minetest.register_craft({
|
||||
output = 'technic:water_can 1',
|
||||
recipe = {
|
||||
{'technic:zinc_ingot', 'technic:rubber','technic:zinc_ingot'},
|
||||
{'technic:carbon_steel_ingot', '', 'technic:carbon_steel_ingot'},
|
||||
{'technic:zinc_ingot', 'technic:carbon_steel_ingot', 'technic:zinc_ingot'},
|
||||
{ 'technic:zinc_ingot', 'technic:rubber', 'technic:zinc_ingot' },
|
||||
{ 'technic:carbon_steel_ingot', '', 'technic:carbon_steel_ingot' },
|
||||
{ 'technic:zinc_ingot', 'technic:carbon_steel_ingot', 'technic:zinc_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -107,8 +107,8 @@ technic.register_can({
|
|||
minetest.register_craft({
|
||||
output = 'technic:lava_can 1',
|
||||
recipe = {
|
||||
{'technic:zinc_ingot', 'technic:stainless_steel_ingot','technic:zinc_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' },
|
||||
{ 'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot' },
|
||||
{ 'technic:zinc_ingot', 'technic:stainless_steel_ingot', 'technic:zinc_ingot' },
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- 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)
|
||||
local chainsaw_charge_per_node = 12
|
||||
-- Cut down tree leaves. Leaf decay may cause slowness on large trees
|
||||
|
@ -10,13 +10,13 @@ local chainsaw_leaves = true
|
|||
-- The default trees
|
||||
local timber_nodenames = {
|
||||
["default:acacia_tree"] = true,
|
||||
["default:aspen_tree"] = true,
|
||||
["default:jungletree"] = true,
|
||||
["default:papyrus"] = true,
|
||||
["default:cactus"] = true,
|
||||
["default:tree"] = true,
|
||||
["default:apple"] = true,
|
||||
["default:pine_tree"] = true,
|
||||
["default:aspen_tree"] = true,
|
||||
["default:jungletree"] = true,
|
||||
["default:papyrus"] = true,
|
||||
["default:cactus"] = true,
|
||||
["default:tree"] = true,
|
||||
["default:apple"] = true,
|
||||
["default:pine_tree"] = true,
|
||||
}
|
||||
|
||||
if chainsaw_leaves then
|
||||
|
@ -31,7 +31,7 @@ end
|
|||
if minetest.get_modpath("technic_worldgen") or
|
||||
minetest.get_modpath("moretrees") then
|
||||
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
|
||||
timber_nodenames["moretrees:rubber_tree_leaves"] = true
|
||||
end
|
||||
|
@ -39,60 +39,60 @@ end
|
|||
|
||||
-- Support moretrees if it is there
|
||||
if minetest.get_modpath("moretrees") then
|
||||
timber_nodenames["moretrees:acacia_trunk"] = true
|
||||
timber_nodenames["moretrees:apple_tree_trunk"] = true
|
||||
timber_nodenames["moretrees:beech_trunk"] = true
|
||||
timber_nodenames["moretrees:birch_trunk"] = true
|
||||
timber_nodenames["moretrees:fir_trunk"] = true
|
||||
timber_nodenames["moretrees:oak_trunk"] = true
|
||||
timber_nodenames["moretrees:palm_trunk"] = true
|
||||
timber_nodenames["moretrees:pine_trunk"] = true
|
||||
timber_nodenames["moretrees:sequoia_trunk"] = true
|
||||
timber_nodenames["moretrees:spruce_trunk"] = true
|
||||
timber_nodenames["moretrees:willow_trunk"] = true
|
||||
timber_nodenames["moretrees:jungletree_trunk"] = true
|
||||
timber_nodenames["moretrees:acacia_trunk"] = true
|
||||
timber_nodenames["moretrees:apple_tree_trunk"] = true
|
||||
timber_nodenames["moretrees:beech_trunk"] = true
|
||||
timber_nodenames["moretrees:birch_trunk"] = true
|
||||
timber_nodenames["moretrees:fir_trunk"] = true
|
||||
timber_nodenames["moretrees:oak_trunk"] = true
|
||||
timber_nodenames["moretrees:palm_trunk"] = true
|
||||
timber_nodenames["moretrees:pine_trunk"] = true
|
||||
timber_nodenames["moretrees:sequoia_trunk"] = true
|
||||
timber_nodenames["moretrees:spruce_trunk"] = true
|
||||
timber_nodenames["moretrees:willow_trunk"] = true
|
||||
timber_nodenames["moretrees:jungletree_trunk"] = true
|
||||
|
||||
if chainsaw_leaves then
|
||||
timber_nodenames["moretrees:acacia_leaves"] = true
|
||||
timber_nodenames["moretrees:apple_tree_leaves"] = true
|
||||
timber_nodenames["moretrees:oak_leaves"] = true
|
||||
timber_nodenames["moretrees:fir_leaves"] = true
|
||||
timber_nodenames["moretrees:fir_leaves_bright"] = true
|
||||
timber_nodenames["moretrees:sequoia_leaves"] = true
|
||||
timber_nodenames["moretrees:birch_leaves"] = true
|
||||
timber_nodenames["moretrees:birch_leaves"] = true
|
||||
timber_nodenames["moretrees:palm_leaves"] = true
|
||||
timber_nodenames["moretrees:spruce_leaves"] = true
|
||||
timber_nodenames["moretrees:spruce_leaves"] = true
|
||||
timber_nodenames["moretrees:pine_leaves"] = true
|
||||
timber_nodenames["moretrees:willow_leaves"] = true
|
||||
timber_nodenames["moretrees:jungletree_leaves_green"] = true
|
||||
timber_nodenames["moretrees:acacia_leaves"] = true
|
||||
timber_nodenames["moretrees:apple_tree_leaves"] = true
|
||||
timber_nodenames["moretrees:oak_leaves"] = true
|
||||
timber_nodenames["moretrees:fir_leaves"] = true
|
||||
timber_nodenames["moretrees:fir_leaves_bright"] = true
|
||||
timber_nodenames["moretrees:sequoia_leaves"] = true
|
||||
timber_nodenames["moretrees:birch_leaves"] = true
|
||||
timber_nodenames["moretrees:birch_leaves"] = true
|
||||
timber_nodenames["moretrees:palm_leaves"] = true
|
||||
timber_nodenames["moretrees:spruce_leaves"] = true
|
||||
timber_nodenames["moretrees:spruce_leaves"] = true
|
||||
timber_nodenames["moretrees:pine_leaves"] = true
|
||||
timber_nodenames["moretrees:willow_leaves"] = true
|
||||
timber_nodenames["moretrees:jungletree_leaves_green"] = true
|
||||
timber_nodenames["moretrees:jungletree_leaves_yellow"] = true
|
||||
timber_nodenames["moretrees:jungletree_leaves_red"] = true
|
||||
timber_nodenames["moretrees:acorn"] = true
|
||||
timber_nodenames["moretrees:coconut"] = true
|
||||
timber_nodenames["moretrees:spruce_cone"] = true
|
||||
timber_nodenames["moretrees:pine_cone"] = true
|
||||
timber_nodenames["moretrees:fir_cone"] = true
|
||||
timber_nodenames["moretrees:apple_blossoms"] = true
|
||||
timber_nodenames["moretrees:jungletree_leaves_red"] = true
|
||||
timber_nodenames["moretrees:acorn"] = true
|
||||
timber_nodenames["moretrees:coconut"] = true
|
||||
timber_nodenames["moretrees:spruce_cone"] = true
|
||||
timber_nodenames["moretrees:pine_cone"] = true
|
||||
timber_nodenames["moretrees:fir_cone"] = true
|
||||
timber_nodenames["moretrees:apple_blossoms"] = true
|
||||
end
|
||||
end
|
||||
|
||||
-- Support growing_trees
|
||||
if minetest.get_modpath("growing_trees") then
|
||||
timber_nodenames["growing_trees:trunk"] = true
|
||||
timber_nodenames["growing_trees:medium_trunk"] = true
|
||||
timber_nodenames["growing_trees:big_trunk"] = true
|
||||
timber_nodenames["growing_trees:trunk_top"] = true
|
||||
timber_nodenames["growing_trees:trunk_sprout"] = true
|
||||
timber_nodenames["growing_trees:trunk"] = true
|
||||
timber_nodenames["growing_trees:medium_trunk"] = true
|
||||
timber_nodenames["growing_trees:big_trunk"] = true
|
||||
timber_nodenames["growing_trees:trunk_top"] = true
|
||||
timber_nodenames["growing_trees:trunk_sprout"] = true
|
||||
timber_nodenames["growing_trees:branch_sprout"] = true
|
||||
timber_nodenames["growing_trees:branch"] = true
|
||||
timber_nodenames["growing_trees:branch_xmzm"] = true
|
||||
timber_nodenames["growing_trees:branch_xpzm"] = true
|
||||
timber_nodenames["growing_trees:branch_xmzp"] = true
|
||||
timber_nodenames["growing_trees:branch_xpzp"] = true
|
||||
timber_nodenames["growing_trees:branch_zz"] = true
|
||||
timber_nodenames["growing_trees:branch_xx"] = true
|
||||
timber_nodenames["growing_trees:branch"] = true
|
||||
timber_nodenames["growing_trees:branch_xmzm"] = true
|
||||
timber_nodenames["growing_trees:branch_xpzm"] = true
|
||||
timber_nodenames["growing_trees:branch_xmzp"] = true
|
||||
timber_nodenames["growing_trees:branch_xpzp"] = true
|
||||
timber_nodenames["growing_trees:branch_zz"] = true
|
||||
timber_nodenames["growing_trees:branch_xx"] = true
|
||||
|
||||
if chainsaw_leaves then
|
||||
timber_nodenames["growing_trees:leaves"] = true
|
||||
|
@ -101,31 +101,31 @@ end
|
|||
|
||||
-- Support growing_cactus
|
||||
if minetest.get_modpath("growing_cactus") then
|
||||
timber_nodenames["growing_cactus:sprout"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_vertical"] = true
|
||||
timber_nodenames["growing_cactus:sprout"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_vertical"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_vertical_fixed"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_xp"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_xm"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_zp"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_zm"] = true
|
||||
timber_nodenames["growing_cactus:trunk"] = true
|
||||
timber_nodenames["growing_cactus:branch_trunk"] = true
|
||||
timber_nodenames["growing_cactus:branch"] = true
|
||||
timber_nodenames["growing_cactus:branch_xp"] = true
|
||||
timber_nodenames["growing_cactus:branch_xm"] = true
|
||||
timber_nodenames["growing_cactus:branch_zp"] = true
|
||||
timber_nodenames["growing_cactus:branch_zm"] = true
|
||||
timber_nodenames["growing_cactus:branch_zz"] = true
|
||||
timber_nodenames["growing_cactus:branch_xx"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_xp"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_xm"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_zp"] = true
|
||||
timber_nodenames["growing_cactus:branch_sprout_zm"] = true
|
||||
timber_nodenames["growing_cactus:trunk"] = true
|
||||
timber_nodenames["growing_cactus:branch_trunk"] = true
|
||||
timber_nodenames["growing_cactus:branch"] = true
|
||||
timber_nodenames["growing_cactus:branch_xp"] = true
|
||||
timber_nodenames["growing_cactus:branch_xm"] = true
|
||||
timber_nodenames["growing_cactus:branch_zp"] = true
|
||||
timber_nodenames["growing_cactus:branch_zm"] = true
|
||||
timber_nodenames["growing_cactus:branch_zz"] = true
|
||||
timber_nodenames["growing_cactus:branch_xx"] = true
|
||||
end
|
||||
|
||||
-- Support farming_plus
|
||||
if minetest.get_modpath("farming_plus") then
|
||||
if chainsaw_leaves then
|
||||
timber_nodenames["farming_plus:banana_leaves"] = true
|
||||
timber_nodenames["farming_plus:banana"] = true
|
||||
timber_nodenames["farming_plus:cocoa_leaves"] = true
|
||||
timber_nodenames["farming_plus:cocoa"] = true
|
||||
timber_nodenames["farming_plus:banana"] = true
|
||||
timber_nodenames["farming_plus:cocoa_leaves"] = true
|
||||
timber_nodenames["farming_plus:cocoa"] = true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -299,8 +299,11 @@ end
|
|||
local function chainsaw_dig(pos, current_charge)
|
||||
-- Start sawing things down
|
||||
local remaining_charge = recursive_dig(pos, current_charge)
|
||||
minetest.sound_play("chainsaw", {pos = pos, gain = 1.0,
|
||||
max_hear_distance = 10})
|
||||
minetest.sound_play("chainsaw", {
|
||||
pos = pos,
|
||||
gain = 1.0,
|
||||
max_hear_distance = 10
|
||||
})
|
||||
|
||||
-- Now drop items for the player
|
||||
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({
|
||||
output = "technic:chainsaw",
|
||||
recipe = {
|
||||
{"technic:stainless_steel_ingot", trigger, "technic:battery"},
|
||||
{"technic:fine_copper_wire", "technic:motor", "technic:battery"},
|
||||
{"", "", "technic:stainless_steel_ingot"},
|
||||
{ "technic:stainless_steel_ingot", trigger, "technic:battery" },
|
||||
{ "technic:fine_copper_wire", "technic:motor", "technic:battery" },
|
||||
{ "", "", "technic:stainless_steel_ingot" },
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ local S = technic.getter
|
|||
technic.register_power_tool("technic:flashlight", flashlight_max_charge)
|
||||
|
||||
minetest.register_alias("technic:light_off", "air")
|
||||
|
||||
|
||||
minetest.register_tool("technic:flashlight", {
|
||||
description = S("Flashlight"),
|
||||
inventory_image = "technic_flashlight.png",
|
||||
|
@ -20,9 +20,9 @@ minetest.register_tool("technic:flashlight", {
|
|||
minetest.register_craft({
|
||||
output = "technic:flashlight",
|
||||
recipe = {
|
||||
{"technic:rubber", "default:glass", "technic:rubber"},
|
||||
{"technic:stainless_steel_ingot", "technic:battery", "technic:stainless_steel_ingot"},
|
||||
{"", "technic:battery", ""}
|
||||
{ "technic:rubber", "default:glass", "technic:rubber" },
|
||||
{ "technic:stainless_steel_ingot", "technic:battery", "technic:stainless_steel_ingot" },
|
||||
{ "", "technic:battery", "" }
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -97,7 +97,7 @@ minetest.register_globalstep(function(dtime)
|
|||
elseif (player_moved or not was_wielding[player_name]) and flashlight_weared then
|
||||
local node = minetest.get_node_or_nil(rounded_pos)
|
||||
if node and node.name == "air" then
|
||||
minetest.set_node(rounded_pos, {name="technic:light"})
|
||||
minetest.set_node(rounded_pos, { name = "technic:light" })
|
||||
end
|
||||
local node = minetest.get_node_or_nil(old_pos)
|
||||
if node and node.name == "technic:light" then
|
||||
|
@ -111,9 +111,9 @@ end)
|
|||
|
||||
minetest.register_node("technic:light", {
|
||||
drawtype = "glasslike",
|
||||
tiles = {"technic_light.png"},
|
||||
tiles = { "technic_light.png" },
|
||||
paramtype = "light",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
groups = { not_in_creative_inventory = 1 },
|
||||
drop = "",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
local path = technic.modpath.."/tools"
|
||||
local path = technic.modpath .. "/tools"
|
||||
|
||||
if technic.config:get_bool("enable_mining_drill") then
|
||||
dofile(path.."/mining_drill.lua")
|
||||
dofile(path .. "/mining_drill.lua")
|
||||
end
|
||||
if technic.config:get_bool("enable_mining_laser") then
|
||||
dofile(path.."/mining_lasers.lua")
|
||||
dofile(path .. "/mining_lasers.lua")
|
||||
end
|
||||
if technic.config:get_bool("enable_flashlight") then
|
||||
dofile(path.."/flashlight.lua")
|
||||
dofile(path .. "/flashlight.lua")
|
||||
end
|
||||
dofile(path.."/cans.lua")
|
||||
dofile(path.."/chainsaw.lua")
|
||||
dofile(path.."/tree_tap.lua")
|
||||
dofile(path.."/sonic_screwdriver.lua")
|
||||
dofile(path.."/prospector.lua")
|
||||
dofile(path.."/vacuum.lua")
|
||||
dofile(path .. "/cans.lua")
|
||||
dofile(path .. "/chainsaw.lua")
|
||||
dofile(path .. "/tree_tap.lua")
|
||||
dofile(path .. "/sonic_screwdriver.lua")
|
||||
dofile(path .. "/prospector.lua")
|
||||
dofile(path .. "/vacuum.lua")
|
||||
|
||||
if minetest.get_modpath("screwdriver") then
|
||||
-- compatibility alias
|
||||
|
|
|
@ -1,141 +1,141 @@
|
|||
local max_charge = {50000, 200000, 650000}
|
||||
local power_usage_per_node = {200, 500, 800}
|
||||
local max_charge = { 50000, 200000, 650000 }
|
||||
local power_usage_per_node = { 200, 500, 800 }
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:mining_drill',
|
||||
recipe = {
|
||||
{'moreores:tin_ingot', 'technic:diamond_drill_head', 'moreores:tin_ingot'},
|
||||
{'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'},
|
||||
{'', 'technic:red_energy_crystal', 'default:copper_ingot'},
|
||||
{ 'moreores:tin_ingot', 'technic:diamond_drill_head', 'moreores:tin_ingot' },
|
||||
{ 'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot' },
|
||||
{ '', 'technic:red_energy_crystal', 'default:copper_ingot' },
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'technic:mining_drill_mk2',
|
||||
recipe = {
|
||||
{'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head'},
|
||||
{'technic:stainless_steel_ingot', 'technic:mining_drill', 'technic:stainless_steel_ingot'},
|
||||
{'', 'technic:green_energy_crystal', ''},
|
||||
{ 'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head' },
|
||||
{ 'technic:stainless_steel_ingot', 'technic:mining_drill', 'technic:stainless_steel_ingot' },
|
||||
{ '', 'technic:green_energy_crystal', '' },
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'technic:mining_drill_mk3',
|
||||
recipe = {
|
||||
{'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:blue_energy_crystal', ''},
|
||||
{ '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:blue_energy_crystal', '' },
|
||||
}
|
||||
})
|
||||
for i = 1, 4 do
|
||||
minetest.register_craft({
|
||||
output = 'technic:mining_drill_mk3',
|
||||
recipe = {
|
||||
{'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:blue_energy_crystal', ''},
|
||||
{ '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:blue_energy_crystal', '' },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local mining_drill_mode_text = {
|
||||
{S("Single node.")},
|
||||
{S("3 nodes deep.")},
|
||||
{S("3 nodes wide.")},
|
||||
{S("3 nodes tall.")},
|
||||
{S("3x3 nodes.")},
|
||||
{ S("Single node.") },
|
||||
{ S("3 nodes deep.") },
|
||||
{ S("3 nodes wide.") },
|
||||
{ S("3 nodes tall.") },
|
||||
{ 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
|
||||
minetest.record_protection_violation(pos, player:get_player_name())
|
||||
return
|
||||
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 == "default:lava_source" 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_flowing" then minetest.remove_node(pos) return end
|
||||
minetest.node_dig(pos,node,player)
|
||||
minetest.node_dig(pos, node, player)
|
||||
end
|
||||
|
||||
local function drill_dig_it1 (player)
|
||||
local dir=player:get_look_dir()
|
||||
if math.abs(dir.x)>math.abs(dir.z) then
|
||||
if dir.x>0 then return 0 end
|
||||
local function drill_dig_it1(player)
|
||||
local dir = player:get_look_dir()
|
||||
if math.abs(dir.x) > math.abs(dir.z) then
|
||||
if dir.x > 0 then return 0 end
|
||||
return 1
|
||||
end
|
||||
if dir.z>0 then return 2 end
|
||||
if dir.z > 0 then return 2 end
|
||||
return 3
|
||||
end
|
||||
|
||||
local function drill_dig_it2 (pos,player)
|
||||
pos.y=pos.y+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z-2
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z+1
|
||||
pos.y=pos.y-1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z-2
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z+1
|
||||
pos.y=pos.y-1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z-2
|
||||
drill_dig_it0 (pos,player)
|
||||
local function drill_dig_it2(pos, player)
|
||||
pos.y = pos.y + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z - 2
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z + 1
|
||||
pos.y = pos.y - 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z - 2
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z + 1
|
||||
pos.y = pos.y - 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z - 2
|
||||
drill_dig_it0(pos, player)
|
||||
end
|
||||
|
||||
local function drill_dig_it3 (pos,player)
|
||||
pos.y=pos.y+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x-2
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
pos.y=pos.y-1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x-2
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
pos.y=pos.y-1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x-2
|
||||
drill_dig_it0 (pos,player)
|
||||
local function drill_dig_it3(pos, player)
|
||||
pos.y = pos.y + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x - 2
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
pos.y = pos.y - 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x - 2
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
pos.y = pos.y - 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x - 2
|
||||
drill_dig_it0(pos, player)
|
||||
end
|
||||
|
||||
local function drill_dig_it4 (pos,player)
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x-2
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
pos.z=pos.z+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x-2
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
pos.z=pos.z-2
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x-2
|
||||
drill_dig_it0 (pos,player)
|
||||
local function drill_dig_it4(pos, player)
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x - 2
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
pos.z = pos.z + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x - 2
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
pos.z = pos.z - 2
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x - 2
|
||||
drill_dig_it0(pos, player)
|
||||
end
|
||||
|
||||
local function cost_to_use(drill_type, mode)
|
||||
|
@ -154,7 +154,7 @@ local function drill_dig_it(pos, player, mode)
|
|||
if mode == 1 then
|
||||
drill_dig_it0(pos, player)
|
||||
end
|
||||
|
||||
|
||||
if mode == 2 then -- 3 deep
|
||||
dir = drill_dig_it1(player)
|
||||
if dir == 0 then -- x+
|
||||
|
@ -164,71 +164,71 @@ local function drill_dig_it(pos, player, mode)
|
|||
pos.x = pos.x + 1
|
||||
drill_dig_it0(pos, player)
|
||||
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)
|
||||
pos.x=pos.x-1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x-1
|
||||
drill_dig_it0 (pos,player)
|
||||
end
|
||||
if dir==2 then -- z+
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z+1
|
||||
drill_dig_it0 (pos,player)
|
||||
if dir == 2 then -- z+
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z + 1
|
||||
drill_dig_it0(pos, player)
|
||||
end
|
||||
if dir==3 then -- z-
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z-1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z-1
|
||||
drill_dig_it0 (pos,player)
|
||||
if dir == 3 then -- z-
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z - 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z - 1
|
||||
drill_dig_it0(pos, player)
|
||||
end
|
||||
end
|
||||
|
||||
if mode==3 then -- 3 wide
|
||||
dir=drill_dig_it1(player)
|
||||
if dir==0 or dir==1 then -- x
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.z=pos.z-2
|
||||
drill_dig_it0 (pos,player)
|
||||
end
|
||||
if dir==2 or dir==3 then -- z
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x+1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.x=pos.x-2
|
||||
drill_dig_it0 (pos,player)
|
||||
end
|
||||
end
|
||||
|
||||
if mode==4 then -- 3 tall, selected in the middle
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.y=pos.y-1
|
||||
drill_dig_it0 (pos,player)
|
||||
pos.y=pos.y-1
|
||||
drill_dig_it0 (pos,player)
|
||||
end
|
||||
|
||||
if mode==5 then -- 3 x 3
|
||||
local dir=player:get_look_dir()
|
||||
if math.abs(dir.y)<0.5 then
|
||||
dir=drill_dig_it1(player)
|
||||
if dir==0 or dir==1 then -- x
|
||||
drill_dig_it2(pos,player)
|
||||
end
|
||||
if dir==2 or dir==3 then -- z
|
||||
drill_dig_it3(pos,player)
|
||||
end
|
||||
else
|
||||
drill_dig_it4(pos,player)
|
||||
if mode == 3 then -- 3 wide
|
||||
dir = drill_dig_it1(player)
|
||||
if dir == 0 or dir == 1 then -- x
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.z = pos.z - 2
|
||||
drill_dig_it0(pos, player)
|
||||
end
|
||||
if dir == 2 or dir == 3 then -- z
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x + 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.x = pos.x - 2
|
||||
drill_dig_it0(pos, player)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.sound_play("mining_drill", {pos = pos, gain = 1.0, max_hear_distance = 10,})
|
||||
|
||||
if mode == 4 then -- 3 tall, selected in the middle
|
||||
drill_dig_it0(pos, player)
|
||||
pos.y = pos.y - 1
|
||||
drill_dig_it0(pos, player)
|
||||
pos.y = pos.y - 1
|
||||
drill_dig_it0(pos, player)
|
||||
end
|
||||
|
||||
if mode == 5 then -- 3 x 3
|
||||
local dir = player:get_look_dir()
|
||||
if math.abs(dir.y) < 0.5 then
|
||||
dir = drill_dig_it1(player)
|
||||
if dir == 0 or dir == 1 then -- x
|
||||
drill_dig_it2(pos, player)
|
||||
end
|
||||
if dir == 2 or dir == 3 then -- z
|
||||
drill_dig_it3(pos, player)
|
||||
end
|
||||
else
|
||||
drill_dig_it4(pos, player)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.sound_play("mining_drill", { pos = pos, gain = 1.0, max_hear_distance = 10, })
|
||||
end
|
||||
|
||||
local function pos_is_pointable(pos)
|
||||
|
@ -237,49 +237,49 @@ local function pos_is_pointable(pos)
|
|||
return nodedef and nodedef.pointable
|
||||
end
|
||||
|
||||
local function mining_drill_mk2_setmode(user,itemstack)
|
||||
local player_name=user:get_player_name()
|
||||
local item=itemstack:to_table()
|
||||
local meta=minetest.deserialize(item["metadata"])
|
||||
if meta==nil then
|
||||
meta={}
|
||||
mode=0
|
||||
local function mining_drill_mk2_setmode(user, itemstack)
|
||||
local player_name = user:get_player_name()
|
||||
local item = itemstack:to_table()
|
||||
local meta = minetest.deserialize(item["metadata"])
|
||||
if meta == nil then
|
||||
meta = {}
|
||||
mode = 0
|
||||
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))
|
||||
meta["mode"]=0
|
||||
mode=0
|
||||
meta["mode"] = 0
|
||||
mode = 0
|
||||
end
|
||||
mode=(meta["mode"])
|
||||
mode=mode+1
|
||||
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])
|
||||
itemstack:set_name("technic:mining_drill_mk2_"..mode);
|
||||
meta["mode"]=mode
|
||||
itemstack:set_metadata(minetest.serialize(meta))
|
||||
mode = (meta["mode"])
|
||||
mode = mode + 1
|
||||
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])
|
||||
itemstack:set_name("technic:mining_drill_mk2_" .. mode);
|
||||
meta["mode"] = mode
|
||||
itemstack:set_metadata(minetest.serialize(meta))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local function mining_drill_mk3_setmode(user,itemstack)
|
||||
local player_name=user:get_player_name()
|
||||
local item=itemstack:to_table()
|
||||
local meta=minetest.deserialize(item["metadata"])
|
||||
if meta==nil then
|
||||
meta={}
|
||||
mode=0
|
||||
local function mining_drill_mk3_setmode(user, itemstack)
|
||||
local player_name = user:get_player_name()
|
||||
local item = itemstack:to_table()
|
||||
local meta = minetest.deserialize(item["metadata"])
|
||||
if meta == nil then
|
||||
meta = {}
|
||||
mode = 0
|
||||
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))
|
||||
meta["mode"]=0
|
||||
mode=0
|
||||
meta["mode"] = 0
|
||||
mode = 0
|
||||
end
|
||||
mode=(meta["mode"])
|
||||
mode=mode+1
|
||||
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])
|
||||
itemstack:set_name("technic:mining_drill_mk3_"..mode);
|
||||
meta["mode"]=mode
|
||||
itemstack:set_metadata(minetest.serialize(meta))
|
||||
mode = (meta["mode"])
|
||||
mode = mode + 1
|
||||
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])
|
||||
itemstack:set_name("technic:mining_drill_mk3_" .. mode);
|
||||
meta["mode"] = mode
|
||||
itemstack:set_metadata(minetest.serialize(meta))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
@ -374,14 +374,14 @@ minetest.register_tool("technic:mining_drill_mk2", {
|
|||
technic.register_power_tool("technic:mining_drill_mk2", max_charge[2])
|
||||
|
||||
for i = 1, 4 do
|
||||
technic.register_power_tool("technic:mining_drill_mk2_"..i, max_charge[2])
|
||||
minetest.register_tool("technic:mining_drill_mk2_"..i, {
|
||||
technic.register_power_tool("technic:mining_drill_mk2_" .. i, max_charge[2])
|
||||
minetest.register_tool("technic:mining_drill_mk2_" .. i, {
|
||||
description = S("Mining Drill Mk%d Mode %d"):format(2, i),
|
||||
inventory_image = "technic_mining_drill_mk2.png^technic_tool_mode"..i..".png",
|
||||
inventory_image = "technic_mining_drill_mk2.png^technic_tool_mode" .. i .. ".png",
|
||||
wield_image = "technic_mining_drill_mk2.png",
|
||||
wear_represents = "technic_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)
|
||||
mining_drill_mk2_handler(itemstack, user, pointed_thing)
|
||||
return itemstack
|
||||
|
@ -395,25 +395,25 @@ minetest.register_tool("technic:mining_drill_mk3", {
|
|||
wear_represents = "technic_RE_charge",
|
||||
on_refill = technic.refill_RE_charge,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
mining_drill_mk3_handler(itemstack,user,pointed_thing)
|
||||
return itemstack
|
||||
mining_drill_mk3_handler(itemstack, user, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
technic.register_power_tool("technic:mining_drill_mk3", max_charge[3])
|
||||
|
||||
for i=1,5,1 do
|
||||
technic.register_power_tool("technic:mining_drill_mk3_"..i, max_charge[3])
|
||||
minetest.register_tool("technic:mining_drill_mk3_"..i, {
|
||||
for i = 1, 5, 1 do
|
||||
technic.register_power_tool("technic:mining_drill_mk3_" .. i, max_charge[3])
|
||||
minetest.register_tool("technic:mining_drill_mk3_" .. i, {
|
||||
description = S("Mining Drill Mk%d Mode %d"):format(3, i),
|
||||
inventory_image = "technic_mining_drill_mk3.png^technic_tool_mode"..i..".png",
|
||||
inventory_image = "technic_mining_drill_mk3.png^technic_tool_mode" .. i .. ".png",
|
||||
wield_image = "technic_mining_drill_mk3.png",
|
||||
wear_represents = "technic_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)
|
||||
mining_drill_mk3_handler(itemstack,user,pointed_thing)
|
||||
return itemstack
|
||||
mining_drill_mk3_handler(itemstack, user, pointed_thing)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
local mining_lasers_list = {
|
||||
-- {<num>, <range of the laser shots>, <max_charge>, <charge_per_shot>},
|
||||
{"1", 7, 50000, 1000},
|
||||
{"2", 14, 200000, 2000},
|
||||
{"3", 21, 650000, 3000},
|
||||
-- {<num>, <range of the laser shots>, <max_charge>, <charge_per_shot>},
|
||||
{ "1", 7, 50000, 1000 },
|
||||
{ "2", 14, 200000, 2000 },
|
||||
{ "3", 21, 650000, 3000 },
|
||||
}
|
||||
|
||||
local S = technic.getter
|
||||
|
@ -10,25 +10,25 @@ local S = technic.getter
|
|||
minetest.register_craft({
|
||||
output = 'technic:laser_mk1',
|
||||
recipe = {
|
||||
{'default:diamond', 'technic:brass_ingot', 'default:obsidian_glass'},
|
||||
{'', 'technic:brass_ingot', 'technic:red_energy_crystal'},
|
||||
{'', '', 'default:copper_ingot'},
|
||||
{ 'default:diamond', 'technic:brass_ingot', 'default:obsidian_glass' },
|
||||
{ '', 'technic:brass_ingot', 'technic:red_energy_crystal' },
|
||||
{ '', '', 'default:copper_ingot' },
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'technic:laser_mk2',
|
||||
recipe = {
|
||||
{'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk1'},
|
||||
{'', 'technic:carbon_steel_ingot', 'technic:green_energy_crystal'},
|
||||
{'', '', 'default:copper_ingot'},
|
||||
{ 'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk1' },
|
||||
{ '', 'technic:carbon_steel_ingot', 'technic:green_energy_crystal' },
|
||||
{ '', '', 'default:copper_ingot' },
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = 'technic:laser_mk3',
|
||||
recipe = {
|
||||
{'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk2'},
|
||||
{'', 'technic:carbon_steel_ingot', 'technic:blue_energy_crystal'},
|
||||
{'', '', 'default:copper_ingot'},
|
||||
{ 'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk2' },
|
||||
{ '', 'technic:carbon_steel_ingot', 'technic:blue_energy_crystal' },
|
||||
{ '', '', 'default:copper_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -38,8 +38,8 @@ local function laser_node(pos, node, player)
|
|||
minetest.remove_node(pos)
|
||||
minetest.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=0, y=2, z=0},
|
||||
acceleration = {x=0, y=-1, z=0},
|
||||
velocity = { x = 0, y = 2, z = 0 },
|
||||
acceleration = { x = 0, y = -1, z = 0 },
|
||||
expirationtime = 1.5,
|
||||
size = 6 + math.random() * 2,
|
||||
texture = "smoke_puff.png^[transform" .. math.random(0, 7),
|
||||
|
@ -70,7 +70,7 @@ local function laser_shoot(player, range, particle_texture, sound)
|
|||
size = 1,
|
||||
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
|
||||
if minetest.is_protected(pos, player_name) then
|
||||
minetest.record_protection_violation(pos, player_name)
|
||||
|
@ -88,10 +88,10 @@ end
|
|||
|
||||
|
||||
for _, m in pairs(mining_lasers_list) do
|
||||
technic.register_power_tool("technic:laser_mk"..m[1], m[3])
|
||||
minetest.register_tool("technic:laser_mk"..m[1], {
|
||||
technic.register_power_tool("technic:laser_mk" .. m[1], m[3])
|
||||
minetest.register_tool("technic:laser_mk" .. m[1], {
|
||||
description = S("Mining Laser Mk%d"):format(m[1]),
|
||||
inventory_image = "technic_mining_laser_mk"..m[1]..".png",
|
||||
inventory_image = "technic_mining_laser_mk" .. m[1] .. ".png",
|
||||
stack_max = 1,
|
||||
wear_represents = "technic_RE_charge",
|
||||
on_refill = technic.refill_RE_charge,
|
||||
|
@ -103,7 +103,7 @@ for _, m in pairs(mining_lasers_list) do
|
|||
|
||||
-- If there's enough charge left, fire the laser
|
||||
if meta.charge >= m[4] then
|
||||
laser_shoot(user, m[2], "technic_laser_beam_mk"..m[1]..".png", "technic_laser_mk"..m[1])
|
||||
laser_shoot(user, m[2], "technic_laser_beam_mk" .. m[1] .. ".png", "technic_laser_mk" .. m[1])
|
||||
if not technic.creative_mode then
|
||||
meta.charge = meta.charge - m[4]
|
||||
technic.set_RE_wear(itemstack, meta.charge, m[3])
|
||||
|
|
|
@ -35,20 +35,20 @@ minetest.register_tool("technic:prospector", {
|
|||
end
|
||||
local start_pos = pointed_thing.under
|
||||
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 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 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 base_pos = vector.add(start_pos, vector.multiply(vector.add(right, up), -toolmeta.look_radius))
|
||||
local found = false
|
||||
for f = 0, toolmeta.look_depth-1 do
|
||||
for r = 0, look_diameter-1 do
|
||||
for u = 0, look_diameter-1 do
|
||||
for f = 0, toolmeta.look_depth - 1 do
|
||||
for r = 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
|
||||
end
|
||||
end
|
||||
end
|
||||
if math.random() < 0.02 then found = not found end
|
||||
minetest.chat_send_player(user:get_player_name(), minetest.registered_nodes[toolmeta.target].description.." is "..(found and "present" or "absent").." in "..look_diameter.."x"..look_diameter.."x"..toolmeta.look_depth.." region")
|
||||
minetest.sound_play("technic_prospector_"..(found and "hit" or "miss"), { pos = vector.add(user:getpos(), { x = 0, y = 1, z = 0 }), gain = 1.0, max_hear_distance = 10 })
|
||||
minetest.chat_send_player(user:get_player_name(), minetest.registered_nodes[toolmeta.target].description .. " is " .. (found and "present" or "absent") .. " in " .. look_diameter .. "x" .. look_diameter .. "x" .. toolmeta.look_depth .. " region")
|
||||
minetest.sound_play("technic_prospector_" .. (found and "hit" or "miss"), { pos = vector.add(user:getpos(), { x = 0, y = 1, z = 0 }), gain = 1.0, max_hear_distance = 10 })
|
||||
return toolstack
|
||||
end,
|
||||
on_place = function(toolstack, user, pointed_thing)
|
||||
|
@ -64,40 +64,40 @@ minetest.register_tool("technic:prospector", {
|
|||
end
|
||||
local look_diameter = toolmeta.look_radius * 2 + 1
|
||||
minetest.show_formspec(user:get_player_name(), "technic:prospector_control",
|
||||
"size[7,8.5]"..
|
||||
"item_image[0,0;1,1;"..toolstack:get_name().."]"..
|
||||
"label[1,0;"..minetest.formspec_escape(toolstack:get_definition().description).."]"..
|
||||
(toolmeta.target ~= "" and
|
||||
"label[0,1.5;Current target:]"..
|
||||
"label[0,2;"..minetest.formspec_escape(minetest.registered_nodes[toolmeta.target].description).."]"..
|
||||
"item_image[0,2.5;1,1;"..toolmeta.target.."]" or
|
||||
"label[0,1.5;No target set]")..
|
||||
(pointed and
|
||||
"label[3.5,1.5;May set new target:]"..
|
||||
"label[3.5,2;"..minetest.formspec_escape(minetest.registered_nodes[pointed].description).."]"..
|
||||
"item_image[3.5,2.5;1,1;"..pointed.."]"..
|
||||
"button_exit[3.5,3.65;2,0.5;target_"..pointed..";Set target]" or
|
||||
"label[3.5,1.5;No new target available]")..
|
||||
"label[0,4.5;Region cross section:]"..
|
||||
"label[0,5;"..look_diameter.."x"..look_diameter.."]"..
|
||||
"label[3.5,4.5;Set region cross section:]"..
|
||||
"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[5.5,5.15;1,0.5;look_radius_3;7x7]"..
|
||||
"label[0,6;Region depth:]"..
|
||||
"label[0,6.5;"..toolmeta.look_depth.."]"..
|
||||
"label[3.5,6;Set region depth:]"..
|
||||
"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[5.5,6.65;1,0.5;look_depth_21;21]"..
|
||||
"label[0,7.5;Accuracy:]"..
|
||||
"label[0,8;98%]")
|
||||
"size[7,8.5]" ..
|
||||
"item_image[0,0;1,1;" .. toolstack:get_name() .. "]" ..
|
||||
"label[1,0;" .. minetest.formspec_escape(toolstack:get_definition().description) .. "]" ..
|
||||
(toolmeta.target ~= "" and
|
||||
"label[0,1.5;Current target:]" ..
|
||||
"label[0,2;" .. minetest.formspec_escape(minetest.registered_nodes[toolmeta.target].description) .. "]" ..
|
||||
"item_image[0,2.5;1,1;" .. toolmeta.target .. "]" or
|
||||
"label[0,1.5;No target set]") ..
|
||||
(pointed and
|
||||
"label[3.5,1.5;May set new target:]" ..
|
||||
"label[3.5,2;" .. minetest.formspec_escape(minetest.registered_nodes[pointed].description) .. "]" ..
|
||||
"item_image[3.5,2.5;1,1;" .. pointed .. "]" ..
|
||||
"button_exit[3.5,3.65;2,0.5;target_" .. pointed .. ";Set target]" or
|
||||
"label[3.5,1.5;No new target available]") ..
|
||||
"label[0,4.5;Region cross section:]" ..
|
||||
"label[0,5;" .. look_diameter .. "x" .. look_diameter .. "]" ..
|
||||
"label[3.5,4.5;Set region cross section:]" ..
|
||||
"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[5.5,5.15;1,0.5;look_radius_3;7x7]" ..
|
||||
"label[0,6;Region depth:]" ..
|
||||
"label[0,6.5;" .. toolmeta.look_depth .. "]" ..
|
||||
"label[3.5,6;Set region depth:]" ..
|
||||
"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[5.5,6.65;1,0.5;look_depth_21;21]" ..
|
||||
"label[0,7.5;Accuracy:]" ..
|
||||
"label[0,8;98%]")
|
||||
return
|
||||
end,
|
||||
end,
|
||||
})
|
||||
|
||||
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
|
||||
local toolstack = user:get_wielded_item()
|
||||
if toolstack:get_name() ~= "technic:prospector" then return true end
|
||||
|
@ -117,12 +117,12 @@ minetest.register_on_player_receive_fields(function(user, formname, fields)
|
|||
user:set_wielded_item(toolstack)
|
||||
return true
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "technic:prospector",
|
||||
recipe = {
|
||||
{"moreores:pick_silver", "moreores:mithril_block", "pipeworks:teleport_tube_1"},
|
||||
{"technic:brass_ingot", "technic:control_logic_unit", "technic:brass_ingot"},
|
||||
{"", "technic:blue_energy_crystal", ""},
|
||||
{ "moreores:pick_silver", "moreores:mithril_block", "pipeworks:teleport_tube_1" },
|
||||
{ "technic:brass_ingot", "technic:control_logic_unit", "technic:brass_ingot" },
|
||||
{ "", "technic:blue_energy_crystal", "" },
|
||||
}
|
||||
})
|
||||
|
|
|
@ -33,7 +33,7 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
|
|||
local ndef = minetest.registered_nodes[node.name]
|
||||
if not ndef or not ndef.paramtype2 == "facedir" or
|
||||
(ndef.drawtype == "nodebox" and
|
||||
not ndef.node_box.type == "fixed") or
|
||||
not ndef.node_box.type == "fixed") or
|
||||
node.param2 == nil then
|
||||
return
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ local function screwdriver_handler(itemstack, user, pointed_thing, mode)
|
|||
return
|
||||
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
|
||||
local rotationPart = node.param2 % 32 -- get first 4 bits
|
||||
|
@ -86,13 +86,13 @@ minetest.register_tool("technic:sonic_screwdriver", {
|
|||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "technic:sonic_screwdriver",
|
||||
recipe = {
|
||||
{"", "default:diamond", ""},
|
||||
{"mesecons_materials:fiber", "technic:battery", "mesecons_materials:fiber"},
|
||||
{"mesecons_materials:fiber", "moreores:mithril_ingot", "mesecons_materials:fiber"}
|
||||
{ "", "default:diamond", "" },
|
||||
{ "mesecons_materials:fiber", "technic:battery", "mesecons_materials:fiber" },
|
||||
{ "mesecons_materials:fiber", "moreores:mithril_ingot", "mesecons_materials:fiber" }
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.getter
|
||||
local mesecons_materials = minetest.get_modpath("mesecons_materials")
|
||||
|
||||
|
@ -21,7 +20,7 @@ minetest.register_tool("technic:treetap", {
|
|||
end
|
||||
node.name = "moretrees:rubber_tree_trunk_empty"
|
||||
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
|
||||
local item_wear = tonumber(itemstack:get_wear())
|
||||
item_wear = item_wear + 819
|
||||
|
@ -38,8 +37,8 @@ minetest.register_tool("technic:treetap", {
|
|||
minetest.register_craft({
|
||||
output = "technic:treetap",
|
||||
recipe = {
|
||||
{"pipeworks:tube_1", "group:wood", "default:stick"},
|
||||
{"", "default:stick", "default:stick"}
|
||||
{ "pipeworks:tube_1", "group:wood", "default:stick" },
|
||||
{ "", "default:stick", "default:stick" }
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -62,11 +61,11 @@ minetest.register_craftitem("technic:rubber", {
|
|||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"moretrees:rubber_tree_trunk_empty"},
|
||||
nodenames = { "moretrees:rubber_tree_trunk_empty" },
|
||||
interval = 60,
|
||||
chance = 15,
|
||||
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"
|
||||
minetest.swap_node(pos, node)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-- Configuration
|
||||
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_range = 8 -- 8 - Area in which to pick up objects
|
||||
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_range = 8 -- 8 - Area in which to pick up objects
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
|
@ -44,7 +44,7 @@ minetest.register_tool("technic:vacuum", {
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
technic.set_RE_wear(itemstack, meta.charge, vacuum_max_charge)
|
||||
itemstack:set_metadata(minetest.serialize(meta))
|
||||
return itemstack
|
||||
|
@ -54,8 +54,8 @@ minetest.register_tool("technic:vacuum", {
|
|||
minetest.register_craft({
|
||||
output = 'technic:vacuum',
|
||||
recipe = {
|
||||
{'pipeworks:tube_1', 'pipeworks:filter', 'technic:battery'},
|
||||
{'pipeworks:tube_1', 'technic:motor', 'technic:battery'},
|
||||
{'technic:stainless_steel_ingot', '', ''},
|
||||
{ 'pipeworks:tube_1', 'pipeworks:filter', 'technic:battery' },
|
||||
{ 'pipeworks:tube_1', 'technic:motor', 'technic:battery' },
|
||||
{ 'technic:stainless_steel_ingot', '', '' },
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,22 +1,32 @@
|
|||
|
||||
technic.chests.groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
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.groups = {
|
||||
snappy = 2,
|
||||
choppy = 2,
|
||||
oddly_breakable_by_hand = 2,
|
||||
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 = {
|
||||
insert_object = function(pos, node, stack, direction)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:add_item("main",stack)
|
||||
return inv:add_item("main", stack)
|
||||
end,
|
||||
can_insert = function(pos, node, stack, direction)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:room_for_item("main",stack)
|
||||
return inv:room_for_item("main", stack)
|
||||
end,
|
||||
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)
|
||||
|
@ -35,17 +45,19 @@ end
|
|||
function technic.chests.inv_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
return inv_change(pos, count, player)
|
||||
end
|
||||
|
||||
function technic.chests.inv_put(pos, listname, index, stack, player)
|
||||
return inv_change(pos, stack:get_count(), player)
|
||||
end
|
||||
|
||||
function technic.chests.inv_take(pos, listname, index, stack, player)
|
||||
return inv_change(pos, stack:get_count(), player)
|
||||
end
|
||||
|
||||
function technic.chests.on_inv_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
minetest.log("action", player:get_player_name()..
|
||||
" moves stuff in chest at "
|
||||
..minetest.pos_to_string(pos))
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" moves stuff in chest at "
|
||||
.. minetest.pos_to_string(pos))
|
||||
end
|
||||
|
||||
function technic.chests.on_inv_put(pos, listname, index, stack, player)
|
||||
|
@ -56,7 +68,7 @@ end
|
|||
|
||||
function technic.chests.on_inv_take(pos, listname, index, stack, player)
|
||||
minetest.log("action", player:get_player_name() ..
|
||||
" takes " .. stack:get_name() ..
|
||||
" takes " .. stack:get_name() ..
|
||||
" from chest at " .. minetest.pos_to_string(pos))
|
||||
end
|
||||
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
minetest.register_craft({
|
||||
output = 'technic:copper_chest 1',
|
||||
recipe = {
|
||||
{'default:copper_ingot','default:copper_ingot','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' },
|
||||
{ 'default:copper_ingot', 'technic:iron_chest', 'default:copper_ingot' },
|
||||
{ 'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:copper_locked_chest 1',
|
||||
recipe = {
|
||||
{'default:copper_ingot','default:copper_ingot','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' },
|
||||
{ 'default:copper_ingot', 'technic:iron_locked_chest', 'default:copper_ingot' },
|
||||
{ 'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:copper_locked_chest 1',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'technic:copper_chest'},
|
||||
{ 'default:steel_ingot' },
|
||||
{ 'technic:copper_chest' },
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local material_list
|
||||
if minetest.get_modpath("moreores") then
|
||||
material_list = { 'silver' }
|
||||
|
@ -11,18 +10,18 @@ for _, material in ipairs(material_list) do
|
|||
minetest.register_craft({
|
||||
output = 'technic:gold_chest',
|
||||
recipe = {
|
||||
{'default:gold_ingot','default:gold_ingot','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' },
|
||||
{ 'default:gold_ingot', "technic:" .. material .. "_chest", 'default:gold_ingot' },
|
||||
{ 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:gold_locked_chest',
|
||||
recipe = {
|
||||
{'default:gold_ingot','default:gold_ingot','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' },
|
||||
{ 'default:gold_ingot', "technic:" .. material .. "_locked_chest", 'default:gold_ingot' },
|
||||
{ 'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot' },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
@ -30,8 +29,8 @@ end
|
|||
minetest.register_craft({
|
||||
output = 'technic:gold_locked_chest',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'technic:gold_chest'},
|
||||
{ 'default:steel_ingot' },
|
||||
{ 'technic:gold_chest' },
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ local modpath = minetest.get_modpath("technic_chests")
|
|||
technic = rawget(_G, "technic") or {}
|
||||
technic.chests = {}
|
||||
|
||||
dofile(modpath.."/common.lua")
|
||||
dofile(modpath.."/register.lua")
|
||||
dofile(modpath.."/wooden_chest.lua")
|
||||
dofile(modpath.."/iron_chest.lua")
|
||||
dofile(modpath.."/copper_chest.lua")
|
||||
dofile(modpath.."/silver_chest.lua")
|
||||
dofile(modpath.."/gold_chest.lua")
|
||||
dofile(modpath.."/mithril_chest.lua")
|
||||
dofile(modpath .. "/common.lua")
|
||||
dofile(modpath .. "/register.lua")
|
||||
dofile(modpath .. "/wooden_chest.lua")
|
||||
dofile(modpath .. "/iron_chest.lua")
|
||||
dofile(modpath .. "/copper_chest.lua")
|
||||
dofile(modpath .. "/silver_chest.lua")
|
||||
dofile(modpath .. "/gold_chest.lua")
|
||||
dofile(modpath .. "/mithril_chest.lua")
|
||||
|
||||
|
|
|
@ -8,26 +8,26 @@ end
|
|||
minetest.register_craft({
|
||||
output = 'technic:iron_chest 1',
|
||||
recipe = {
|
||||
{cast_iron_ingot,cast_iron_ingot,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 },
|
||||
{ cast_iron_ingot, 'default:chest', cast_iron_ingot },
|
||||
{ cast_iron_ingot, cast_iron_ingot, cast_iron_ingot },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:iron_locked_chest 1',
|
||||
recipe = {
|
||||
{cast_iron_ingot,cast_iron_ingot,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 },
|
||||
{ cast_iron_ingot, 'default:chest_locked', cast_iron_ingot },
|
||||
{ cast_iron_ingot, cast_iron_ingot, cast_iron_ingot },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:iron_locked_chest 1',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'technic:iron_chest'},
|
||||
{ 'default:steel_ingot' },
|
||||
{ 'technic:iron_chest' },
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@ if minetest.get_modpath("moreores") then
|
|||
minetest.register_craft({
|
||||
output = 'technic:mithril_chest 1',
|
||||
recipe = {
|
||||
{'moreores:mithril_ingot','moreores:mithril_ingot','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' },
|
||||
{ 'moreores:mithril_ingot', 'technic:gold_chest', 'moreores:mithril_ingot' },
|
||||
{ 'moreores:mithril_ingot', 'moreores:mithril_ingot', 'moreores:mithril_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:mithril_locked_chest 1',
|
||||
recipe = {
|
||||
{'moreores:mithril_ingot','moreores:mithril_ingot','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' },
|
||||
{ 'moreores:mithril_ingot', 'technic:gold_locked_chest', 'moreores:mithril_ingot' },
|
||||
{ 'moreores:mithril_ingot', 'moreores:mithril_ingot', 'moreores:mithril_ingot' },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
@ -21,8 +21,8 @@ end
|
|||
minetest.register_craft({
|
||||
output = 'technic:mithril_locked_chest 1',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'technic:mithril_chest'},
|
||||
{ 'default:steel_ingot' },
|
||||
{ 'technic:mithril_chest' },
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -7,37 +7,37 @@ if not minetest.get_modpath("pipeworks") then
|
|||
local pipeworks_meta = {}
|
||||
setmetatable(pipeworks, pipeworks_meta)
|
||||
local dummy = function()
|
||||
end
|
||||
end
|
||||
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...")
|
||||
pipeworks[key] = dummy
|
||||
return dummy
|
||||
end
|
||||
print("[technic_chests] WARNING: variable or method '" .. key .. "' not present in dummy pipeworks table - assuming it is a method...")
|
||||
pipeworks[key] = dummy
|
||||
return dummy
|
||||
end
|
||||
pipeworks.after_place = dummy
|
||||
pipeworks.after_dig = dummy
|
||||
end
|
||||
|
||||
local chest_mark_colors = {
|
||||
{"black", S("Black")},
|
||||
{"blue", S("Blue")},
|
||||
{"brown", S("Brown")},
|
||||
{"cyan", S("Cyan")},
|
||||
{"dark_green", S("Dark Green")},
|
||||
{"dark_grey", S("Dark Grey")},
|
||||
{"green", S("Green")},
|
||||
{"grey", S("Grey")},
|
||||
{"magenta", S("Magenta")},
|
||||
{"orange", S("Orange")},
|
||||
{"pink", S("Pink")},
|
||||
{"red", S("Red")},
|
||||
{"violet", S("Violet")},
|
||||
{"white", S("White")},
|
||||
{"yellow", S("Yellow")},
|
||||
{ "black", S("Black") },
|
||||
{ "blue", S("Blue") },
|
||||
{ "brown", S("Brown") },
|
||||
{ "cyan", S("Cyan") },
|
||||
{ "dark_green", S("Dark Green") },
|
||||
{ "dark_grey", S("Dark Grey") },
|
||||
{ "green", S("Green") },
|
||||
{ "grey", S("Grey") },
|
||||
{ "magenta", S("Magenta") },
|
||||
{ "orange", S("Orange") },
|
||||
{ "pink", S("Pink") },
|
||||
{ "red", S("Red") },
|
||||
{ "violet", S("Violet") },
|
||||
{ "white", S("White") },
|
||||
{ "yellow", S("Yellow") },
|
||||
}
|
||||
|
||||
|
||||
local function colorid_to_postfix(id)
|
||||
return chest_mark_colors[id] and "_"..chest_mark_colors[id][1] or ""
|
||||
return chest_mark_colors[id] and "_" .. chest_mark_colors[id][1] or ""
|
||||
end
|
||||
|
||||
|
||||
|
@ -45,11 +45,11 @@ local function get_color_buttons(coleft, lotop)
|
|||
local buttons_string = ""
|
||||
for y = 0, 3 do
|
||||
for x = 0, 3 do
|
||||
local file_name = "technic_colorbutton"..(y * 4 + x)..".png"
|
||||
buttons_string = buttons_string.."image_button["
|
||||
..(coleft + 0.1 + x * 0.7)..","..(lotop + 0.1 + y * 0.7)
|
||||
..";0.8,0.8;"..file_name..";color_button"
|
||||
..(y * 4 + x + 1)..";]"
|
||||
local file_name = "technic_colorbutton" .. (y * 4 + x) .. ".png"
|
||||
buttons_string = buttons_string .. "image_button["
|
||||
.. (coleft + 0.1 + x * 0.7) .. "," .. (lotop + 0.1 + y * 0.7)
|
||||
.. ";0.8,0.8;" .. file_name .. ";color_button"
|
||||
.. (y * 4 + x + 1) .. ";]"
|
||||
end
|
||||
end
|
||||
return buttons_string
|
||||
|
@ -58,9 +58,9 @@ end
|
|||
|
||||
local function check_color_buttons(pos, meta, chest_name, fields)
|
||||
for i = 1, 16 do
|
||||
if fields["color_button"..i] then
|
||||
if fields["color_button" .. i] then
|
||||
local node = minetest.get_node(pos)
|
||||
node.name = chest_name..colorid_to_postfix(i)
|
||||
node.name = chest_name .. colorid_to_postfix(i)
|
||||
minetest.swap_node(pos, node)
|
||||
meta:set_string("color", i)
|
||||
return
|
||||
|
@ -74,20 +74,20 @@ local function set_formspec(pos, data, page)
|
|||
local formspec = data.base_formspec
|
||||
if data.autosort then
|
||||
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
|
||||
if data.infotext then
|
||||
local formspec_infotext = minetest.formspec_escape(meta:get_string("infotext"))
|
||||
if page == "main" then
|
||||
formspec = formspec.."image_button["..(data.hileft+2.1)..",0.1;0.8,0.8;"
|
||||
.."technic_pencil_icon.png;edit_infotext;]"
|
||||
.."label["..(data.hileft+3)..",0;"..formspec_infotext.."]"
|
||||
formspec = formspec .. "image_button[" .. (data.hileft + 2.1) .. ",0.1;0.8,0.8;"
|
||||
.. "technic_pencil_icon.png;edit_infotext;]"
|
||||
.. "label[" .. (data.hileft + 3) .. ",0;" .. formspec_infotext .. "]"
|
||||
elseif page == "edit_infotext" then
|
||||
formspec = formspec.."image_button["..(data.hileft+2.1)..",0.1;0.8,0.8;"
|
||||
.."technic_checkmark_icon.png;save_infotext;]"
|
||||
.."field["..(data.hileft+3.3)..",0.2;4.8,1;"
|
||||
.."infotext_box;"..S("Edit chest description:")..";"
|
||||
..formspec_infotext.."]"
|
||||
formspec = formspec .. "image_button[" .. (data.hileft + 2.1) .. ",0.1;0.8,0.8;"
|
||||
.. "technic_checkmark_icon.png;save_infotext;]"
|
||||
.. "field[" .. (data.hileft + 3.3) .. ",0.2;4.8,1;"
|
||||
.. "infotext_box;" .. S("Edit chest description:") .. ";"
|
||||
.. formspec_infotext .. "]"
|
||||
end
|
||||
end
|
||||
if data.color then
|
||||
|
@ -98,7 +98,7 @@ local function set_formspec(pos, data, page)
|
|||
else
|
||||
colorName = S("None")
|
||||
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
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
|
@ -166,7 +166,7 @@ local function get_receive_fields(name, data)
|
|||
end
|
||||
if data.color then
|
||||
-- This sets the node
|
||||
local nn = "technic:"..lname..(data.locked and "_locked" or "").."_chest"
|
||||
local nn = "technic:" .. lname .. (data.locked and "_locked" or "") .. "_chest"
|
||||
check_color_buttons(pos, meta, nn, fields)
|
||||
end
|
||||
meta:get_inventory():set_size("main", data.width * data.height)
|
||||
|
@ -202,20 +202,20 @@ function technic.chests:definition(name, data)
|
|||
data.ovheight = data.lotop + 4
|
||||
|
||||
local locked_after_place = nil
|
||||
local front = {"technic_"..lname.."_chest_front.png"}
|
||||
data.base_formspec = "size["..data.ovwidth..","..data.ovheight.."]"..
|
||||
"label[0,0;"..S("%s Chest"):format(name).."]"..
|
||||
"list[context;main;"..data.hileft..",1;"..data.width..","..data.height..";]"..
|
||||
"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["..data.hileft..",1;"..data.width..","..data.height..";technic_"..lname.."_chest_inventory.png]"..
|
||||
"background["..data.loleft..","..data.lotop..";8,4;technic_main_inventory.png]"..
|
||||
local front = { "technic_" .. lname .. "_chest_front.png" }
|
||||
data.base_formspec = "size[" .. data.ovwidth .. "," .. data.ovheight .. "]" ..
|
||||
"label[0,0;" .. S("%s Chest"):format(name) .. "]" ..
|
||||
"list[context;main;" .. data.hileft .. ",1;" .. data.width .. "," .. data.height .. ";]" ..
|
||||
"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[" .. data.hileft .. ",1;" .. data.width .. "," .. data.height .. ";technic_" .. lname .. "_chest_inventory.png]" ..
|
||||
"background[" .. data.loleft .. "," .. data.lotop .. ";8,4;technic_main_inventory.png]" ..
|
||||
"listring[]"
|
||||
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
|
||||
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)
|
||||
end
|
||||
|
||||
if data.locked then
|
||||
|
@ -223,11 +223,10 @@ function technic.chests:definition(name, data)
|
|||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
meta:set_string("infotext",
|
||||
S("%s Locked Chest (owned by %s)")
|
||||
:format(name, meta:get_string("owner")))
|
||||
S("%s Locked Chest (owned by %s)"):format(name, meta:get_string("owner")))
|
||||
pipeworks.after_place(pos)
|
||||
end
|
||||
table.insert(front, "technic_"..lname.."_chest_lock_overlay.png")
|
||||
table.insert(front, "technic_" .. lname .. "_chest_lock_overlay.png")
|
||||
else
|
||||
locked_after_place = pipeworks.after_place
|
||||
end
|
||||
|
@ -241,9 +240,11 @@ function technic.chests:definition(name, data)
|
|||
|
||||
local def = {
|
||||
description = desc,
|
||||
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", table.concat(front, "^")},
|
||||
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", table.concat(front, "^")
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = self.groups,
|
||||
tube = self.tube,
|
||||
|
@ -251,7 +252,6 @@ function technic.chests:definition(name, data)
|
|||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = locked_after_place,
|
||||
after_dig_node = pipeworks.after_dig,
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", S("%s Chest"):format(name))
|
||||
|
@ -263,11 +263,11 @@ function technic.chests:definition(name, data)
|
|||
on_receive_fields = get_receive_fields(name, data),
|
||||
on_metadata_inventory_move = self.on_inv_move,
|
||||
on_metadata_inventory_put = self.on_inv_put,
|
||||
on_metadata_inventory_take = self.on_inv_take,
|
||||
on_metadata_inventory_take = self.on_inv_take,
|
||||
on_blast = function(pos)
|
||||
local 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)
|
||||
return drops
|
||||
end,
|
||||
|
@ -277,7 +277,7 @@ function technic.chests:definition(name, data)
|
|||
def.allow_metadata_inventory_put = self.inv_put
|
||||
def.allow_metadata_inventory_take = self.inv_take
|
||||
def.on_blast = function() end
|
||||
def.can_dig = function(pos,player)
|
||||
def.can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main") and default.can_interact_with_node(player, pos)
|
||||
|
@ -309,15 +309,15 @@ end
|
|||
function technic.chests:register(name, data)
|
||||
local def = technic.chests:definition(name, data)
|
||||
|
||||
local nn = "technic:"..name:lower()..(data.locked and "_locked" or "").."_chest"
|
||||
minetest.register_node(":"..nn, def)
|
||||
local nn = "technic:" .. name:lower() .. (data.locked and "_locked" or "") .. "_chest"
|
||||
minetest.register_node(":" .. nn, def)
|
||||
|
||||
if data.color then
|
||||
local mk_front
|
||||
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
|
||||
mk_front = function (overlay) return def.tiles[6].."^"..overlay end
|
||||
mk_front = function(overlay) return def.tiles[6] .. "^" .. overlay end
|
||||
end
|
||||
for i = 1, 15 do
|
||||
local postfix = colorid_to_postfix(i)
|
||||
|
@ -327,10 +327,9 @@ function technic.chests:register(name, data)
|
|||
end
|
||||
colordef.drop = nn
|
||||
colordef.groups = self.groups_noinv
|
||||
colordef.tiles = { def.tiles[1], def.tiles[2], def.tiles[3], def.tiles[4], def.tiles[5], mk_front("technic_chest_overlay"..postfix..".png") }
|
||||
minetest.register_node(":"..nn..postfix, colordef)
|
||||
colordef.tiles = { def.tiles[1], def.tiles[2], def.tiles[3], def.tiles[4], def.tiles[5], mk_front("technic_chest_overlay" .. postfix .. ".png") }
|
||||
minetest.register_node(":" .. nn .. postfix, colordef)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@ if minetest.get_modpath("moreores") then
|
|||
minetest.register_craft({
|
||||
output = 'technic:silver_chest',
|
||||
recipe = {
|
||||
{'moreores:silver_ingot','moreores:silver_ingot','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' },
|
||||
{ 'moreores:silver_ingot', 'technic:copper_chest', 'moreores:silver_ingot' },
|
||||
{ 'moreores:silver_ingot', 'moreores:silver_ingot', 'moreores:silver_ingot' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:silver_locked_chest',
|
||||
recipe = {
|
||||
{'moreores:silver_ingot','moreores:silver_ingot','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' },
|
||||
{ 'moreores:silver_ingot', 'technic:copper_locked_chest', 'moreores:silver_ingot' },
|
||||
{ 'moreores:silver_ingot', 'moreores:silver_ingot', 'moreores:silver_ingot' },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
@ -21,8 +21,8 @@ end
|
|||
minetest.register_craft({
|
||||
output = 'technic:silver_locked_chest',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'technic:silver_chest'},
|
||||
{ 'default:steel_ingot' },
|
||||
{ 'technic:silver_chest' },
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
technic.config = technic.config or Settings(minetest.get_worldpath().."/technic.conf")
|
||||
technic.config = technic.config or Settings(minetest.get_worldpath() .. "/technic.conf")
|
||||
|
||||
local conf_table = technic.config:to_table()
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local S = technic.worldgen.gettext
|
||||
|
||||
minetest.register_craftitem(":technic:uranium_lump", {
|
||||
|
@ -10,7 +9,7 @@ minetest.register_alias("technic:uranium", "technic:uranium_lump")
|
|||
minetest.register_craftitem(":technic:uranium_ingot", {
|
||||
description = S("Uranium Ingot"),
|
||||
inventory_image = "technic_uranium_ingot.png",
|
||||
groups = {uranium_ingot=1},
|
||||
groups = { uranium_ingot = 1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":technic:chromium_lump", {
|
||||
|
@ -79,16 +78,16 @@ local function register_block(block, ingot)
|
|||
minetest.register_craft({
|
||||
output = block,
|
||||
recipe = {
|
||||
{ingot, ingot, ingot},
|
||||
{ingot, ingot, ingot},
|
||||
{ingot, ingot, ingot},
|
||||
{ ingot, ingot, ingot },
|
||||
{ ingot, ingot, ingot },
|
||||
{ ingot, ingot, ingot },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = ingot.." 9",
|
||||
output = ingot .. " 9",
|
||||
recipe = {
|
||||
{block}
|
||||
{ block }
|
||||
}
|
||||
})
|
||||
end
|
||||
|
|
|
@ -5,14 +5,14 @@ technic.worldgen = {
|
|||
gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
|
||||
}
|
||||
|
||||
dofile(modpath.."/config.lua")
|
||||
dofile(modpath.."/nodes.lua")
|
||||
dofile(modpath.."/oregen.lua")
|
||||
dofile(modpath.."/crafts.lua")
|
||||
dofile(modpath .. "/config.lua")
|
||||
dofile(modpath .. "/nodes.lua")
|
||||
dofile(modpath .. "/oregen.lua")
|
||||
dofile(modpath .. "/crafts.lua")
|
||||
|
||||
-- Rubber trees, moretrees also supplies these
|
||||
if not minetest.get_modpath("moretrees") then
|
||||
dofile(modpath.."/rubber.lua")
|
||||
dofile(modpath .. "/rubber.lua")
|
||||
else
|
||||
-- older versions of technic provided rubber trees regardless
|
||||
minetest.register_alias("technic:rubber_sapling", "moretrees:rubber_tree_sapling")
|
||||
|
@ -21,6 +21,6 @@ end
|
|||
|
||||
-- mg suppport
|
||||
if minetest.get_modpath("mg") then
|
||||
dofile(modpath.."/mg.lua")
|
||||
dofile(modpath .. "/mg.lua")
|
||||
end
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user