6 Commits

Author SHA1 Message Date
cac6914270 Infinite stacks fix 2014-01-12 16:52:42 +01:00
902cd07218 Actually call the mvps callback 2014-01-03 15:19:43 +01:00
83ecc59e5b Mesecons mvps support, better frames 2014-01-03 13:39:12 +01:00
a93a61a329 A few fixes 2014-01-02 14:07:15 +01:00
b05e764e77 Make those frames able to move 2014-01-02 11:26:50 +01:00
5aa229d454 First tests 2014-01-02 11:00:42 +01:00
286 changed files with 3901 additions and 4328 deletions

View File

@ -1,22 +1,14 @@
Technic technic 0.4.7
=======
Credits for contributing to the project (in alphabetical order): Technic mod for Minetest 0.4.7
* kpoppel
* Nekogloop
* Nore/Novatux
* ShadowNinja
* VanessaE
* And many others...
FAQ Credits for contributing to the project:
--- Nekogloop
ShadowNinja
1. My technic circuit doesn't work. No power is distrubuted. VanessaE
* A: Make sure you have a switching station connected. Nore/Novatux
kpoppel
License And many others for ideas/inspiring
-------
See mod folders for their licences
License:
LGPLv2+

View File

@ -1,3 +1 @@
default default
intllib?

View File

@ -4,33 +4,18 @@
local technic = technic or {} local technic = technic or {}
technic.concrete_posts = {} technic.concrete_posts = {}
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if intllib then
S = intllib.Getter()
else
S = function(s) return s end
end
minetest.register_alias("technic:concrete_post", "technic:concrete_post0") minetest.register_alias("technic:concrete_post", "technic:concrete_post0")
minetest.register_alias("technic:concrete_post32", "technic:concrete_post12") minetest.register_alias("technic:concrete_post32", "technic:concrete_post12")
minetest.register_alias("technic:concrete_post33", "technic:concrete_post3") minetest.register_alias("technic:concrete_post33", "technic:concrete_post3")
minetest.register_alias("technic:concrete_post34", "technic:concrete_post28") minetest.register_alias("technic:concrete_post34", "technic:concrete_post28")
minetest.register_alias("technic:concrete_post35", "technic:concrete_post19") minetest.register_alias("technic:concrete_post35", "technic:concrete_post19")
local steel_ingot
if minetest.get_modpath("technic_worldgen") then
steel_ingot = "technic:carbon_steel_ingot"
else
steel_ingot = "default:steel_ingot"
end
minetest.register_craft({ minetest.register_craft({
output = 'technic:rebar 6', output = 'technic:rebar 6',
recipe = { recipe = {
{'','', steel_ingot}, {'','', 'default:steel_ingot'},
{'',steel_ingot,''}, {'','default:steel_ingot',''},
{steel_ingot, '', ''}, {'default:steel_ingot', '', ''},
} }
}) })
@ -76,12 +61,12 @@ local box_x2 = {0, -0.3, -0.1, -0.5, 0.3, 0.1}
local box_z2 = {-0.1, -0.3, 0, 0.1, 0.3, -0.5} local box_z2 = {-0.1, -0.3, 0, 0.1, 0.3, -0.5}
minetest.register_craftitem(":technic:rebar", { minetest.register_craftitem(":technic:rebar", {
description = S("Rebar"), description = "Rebar",
inventory_image = "technic_rebar.png", inventory_image = "technic_rebar.png",
}) })
minetest.register_node(":technic:concrete", { minetest.register_node(":technic:concrete", {
description = S("Concrete Block"), description = "Concrete Block",
tile_images = {"technic_concrete_block.png",}, tile_images = {"technic_concrete_block.png",},
groups = {cracky=1, level=2, concrete=1}, groups = {cracky=1, level=2, concrete=1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
@ -94,7 +79,7 @@ minetest.register_node(":technic:concrete", {
}) })
minetest.register_node(":technic:blast_resistant_concrete", { minetest.register_node(":technic:blast_resistant_concrete", {
description = S("Blast-resistant Concrete Block"), description = "Blast-resistant Concrete Block",
tile_images = {"technic_blast_resistant_concrete_block.png",}, tile_images = {"technic_blast_resistant_concrete_block.png",},
groups={cracky=1, level=3, concrete=1}, groups={cracky=1, level=3, concrete=1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
@ -107,7 +92,7 @@ minetest.register_node(":technic:blast_resistant_concrete", {
}) })
minetest.register_node(":technic:concrete_post_platform", { minetest.register_node(":technic:concrete_post_platform", {
description = S("Concrete Post Platform"), description = "Concrete Post Platform",
tile_images = {"technic_concrete_block.png",}, tile_images = {"technic_concrete_block.png",},
groups={cracky=1, level=2}, groups={cracky=1, level=2},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
@ -237,7 +222,7 @@ for platform = 0, 1 do
end end
minetest.register_node(":technic:concrete_post"..id, { minetest.register_node(":technic:concrete_post"..id, {
description = S("Concrete Post"), description = "Concrete Post",
tiles = {"technic_concrete_block.png"}, tiles = {"technic_concrete_block.png"},
groups = groups, groups = groups,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),

View File

@ -1,10 +0,0 @@
# German Translation for technic_concrete
# Deutsche Übersetzung von technic_concrete
# by Xanthin
Rebar = Bewehrungsstab
Concrete Block = Betonblock
Blast-resistant Concrete Block = Explosionsbestaendiger Betonblock
Concrete Post Platform = Betonpfostenplattform
Concrete Post = Betonpfosten

View File

@ -1,8 +0,0 @@
# technic_concrete translation template
Rebar =
Concrete Block =
Blast-resistant Concrete Block =
Concrete Post Platform =
Concrete Post =

View File

@ -2,5 +2,3 @@ default
moreblocks moreblocks
technic_worldgen technic_worldgen
concrete concrete
intllib?

View File

@ -1,17 +1,11 @@
-- Minetest 0.4.6 mod: extranodes -- Minetest 0.4.6 mod: extranodes
-- namespace: technic -- namespace: technic
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if intllib then
S = intllib.Getter()
else
S = function(s) return s end
end
--register stairslike nodes --register stairslike nodes
register_stair_slab_panel_micro("technic", "marble", "technic:marble", register_stair_slab_panel_micro("technic", "marble", "technic:marble",
{cracky=2, not_in_creative_inventory=1}, {cracky=2, not_in_creative_inventory=1},
{"technic_marble.png"}, {"technic_marble.png"},
S("Marble"), "Marble",
"marble", "marble",
"facedir", "facedir",
0) 0)
@ -19,7 +13,7 @@ register_stair_slab_panel_micro("technic", "marble", "technic:marble",
register_stair_slab_panel_micro("technic", "marble_bricks", "technic:marble_bricks", register_stair_slab_panel_micro("technic", "marble_bricks", "technic:marble_bricks",
{cracky=2, not_in_creative_inventory=1}, {cracky=2, not_in_creative_inventory=1},
{"technic_marble_bricks.png"}, {"technic_marble_bricks.png"},
S("Marble Bricks"), "Marble Bricks",
"marble_bricks", "marble_bricks",
"facedir", "facedir",
0) 0)
@ -27,7 +21,7 @@ register_stair_slab_panel_micro("technic", "marble_bricks", "technic:marble_bric
register_stair_slab_panel_micro("technic", "granite", "technic:granite", register_stair_slab_panel_micro("technic", "granite", "technic:granite",
{cracky=3, not_in_creative_inventory=1}, {cracky=3, not_in_creative_inventory=1},
{"technic_granite.png"}, {"technic_granite.png"},
S("Granite"), "Granite",
"granite", "granite",
"facedir", "facedir",
0) 0)
@ -35,7 +29,7 @@ register_stair_slab_panel_micro("technic", "granite", "technic:granite",
register_stair_slab_panel_micro("technic", "concrete", "technic:concrete", register_stair_slab_panel_micro("technic", "concrete", "technic:concrete",
{cracky=3, not_in_creative_inventory=1}, {cracky=3, not_in_creative_inventory=1},
{"technic_concrete_block.png"}, {"technic_concrete_block.png"},
S("Concrete"), "Concrete",
"concrete", "concrete",
"facedir", "facedir",
0) 0)

View File

@ -1,9 +0,0 @@
# German Translation for technic_extranodes
# Deutsche Übersetzung von technic_extranodes
# by Xanthin
Marble = Marmor
Marble Bricks = Marmorziegel
Granite = Granit
Concrete = Beton

View File

@ -1,7 +0,0 @@
# technic_extranodes translation template
Marble =
Marble Bricks =
Granite =
Concrete =

View File

@ -1,68 +0,0 @@
Notes on iron and steel
=======================
Alloying iron with carbon is of huge importance, but in some processes
the alloying is an implicit side effect rather than the product of
explicit mixing, so it is a complex area. In the real world, there is
a huge variety of kinds of iron and steel, differing in the proportion
of carbon included and in other elements added to the mix.
The Minetest default mod doesn't distinguish between types of iron and
steel at all. This mod introduces multiple types in order to get a bit
of complexity and flavour.
Leaving aside explicit addition of other elements, the iron/carbon
spectrum is here represented by three substances: wrought iron,
carbon steel, and cast iron. Wrought iron has low carbon content
(less than 0.25%), resists shattering, and is easily welded, but is
relatively soft and susceptible to rusting. It was used for rails,
gates, chains, wire, pipes, fasteners, and other purposes. Cast iron
has high carbon content (2.1% to 4%), is especially hard, and resists
corrosion, but is relatively brittle, and difficult to work. It was used
to build large structures such as bridges, and for cannons, cookware,
and engine cylinders. Carbon steel has medium carbon content (0.25%
to 2.1%), and intermediate properties: moderately hard and also tough,
somewhat resistant to corrosion. It is now used for most of the purposes
previously satisfied by wrought iron and many of those of cast iron,
but has historically been especially important for its use in swords,
armour, skyscrapers, large bridges, and machines.
Historically, the first form of iron to be refined was wrought iron,
produced from ore by a low-temperature furnace process in which the
ore/iron remains solid and impurities (slag) are progressively removed.
Cast iron, by contrast, was produced somewhat later by a high-temperature
process in a blast furnace, in which the metal is melted, and carbon is
unavoidably incorporated from the furnace's fuel. (In fact, it's done
in two stages, first producing pig iron from ore, and then remelting the
pig iron to cast as cast iron.) Carbon steel requires a more advanced
process, in which molten pig iron is processed to remove the carbon,
and then a controlled amount of carbon is explicitly mixed back in.
Other processes are possible to refine iron ore and to adjust its
carbon content.
Unfortunately, Minetest doesn't let us readily distinguish between
low-temperature and high-temperature processes: in the default game, the
same furnace is used both to cook food (low temperature) and to cast metal
ingots (varying high temperatures). So we can't sensibly have wrought
iron and cast iron produced by different types of furnace. Nor can
furnace recipes discriminate by which kind of fuel is used (and thus
by the availability of carbon). The alloy furnace allows for explicit
alloying, which appropriately represents how carbon steel is made, but
is not sensible for the other two, and is a relatively advanced process.
About the only option to make a second iron-processing furnace process
readily available is to cook multiple times; happily, this bears a slight
resemblance to the real process with pig iron as an intermediate product.
The default mod's refined iron, which it calls "steel", is identified
with this mod's wrought iron. Cooking an iron lump (representing ore)
initially produces wrought iron; the cooking process here represents a
low-temperature bloomery process. Cooking wrought iron then produces
cast iron; this time the cooking process represents a blast furnace.
Alloy cooking wrought iron with coal dust (carbon) produces carbon steel;
this represents the explicit mixing stage of carbon steel production.
Additionally, alloy cooking carbon steel with coal dust produces cast
iron, which is logical but not very useful. Furthermore, to make it
possible to turn any of the forms of iron into any other, cooking carbon
steel or cast iron produces wrought iron, in an abbreviated form of the
bloomery process. As usual for metals, the same cooking and alloying
processes can be performed in parallel forms on ingots or dust.

View File

@ -1,15 +0,0 @@
Technic
=======
License
-------
Copyright (C) 2012-2014 Maciej Kasatkin (RealBadAngel)
Technic chests code is licensed under the GNU LGPLv2+.
Texture licenses:
RealBadAngel: (WTFPL)
* Everything.

View File

@ -21,3 +21,6 @@ for k, v in pairs(defaults) do
end end
end end
-- Create the config file if it doesn't exist
technic.config:write()

View File

@ -1,17 +1,53 @@
-- tubes crafting recipes -- tubes crafting recipes
minetest.register_craft({ minetest.register_craft({
output = 'pipeworks:accelerator_tube_1', output = 'pipeworks:tube_000000 9',
recipe = {
{'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'},
{'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'},
{'technic:stainless_steel_ingot', 'default:glass', 'technic:stainless_steel_ingot'},
}
})
minetest.register_craft({
output = 'pipeworks:mese_tube_000000',
recipe = {
{'default:mese_crystal_fragment', 'pipeworks:tube_000000', 'default:mese_crystal_fragment'},
}
})
minetest.register_craft({
output = 'pipeworks:accelerator_tube_000000',
recipe = { recipe = {
{'technic:copper_coil', 'pipeworks:tube_1', 'technic:copper_coil'}, {'technic:copper_coil', 'pipeworks:tube_000000', 'technic:copper_coil'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'pipeworks:teleport_tube_1', output = 'pipeworks:detector_tube_off_000000',
recipe = {
{'mesecons:mesecon', 'pipeworks:tube_000000', 'mesecons:mesecon'},
}
})
minetest.register_craft({
output = 'pipeworks:sand_tube_000000',
recipe = {
{'default:sand', 'pipeworks:tube_000000', 'default:sand'},
}
})
minetest.register_craft({
output = 'pipeworks:mese_sand_tube_000000',
recipe = {
{'default:mese_crystal_fragment', 'pipeworks:sand_tube_000000', 'default:mese_crystal_fragment'},
}
})
minetest.register_craft({
output = 'pipeworks:teleport_tube_000000',
recipe = { recipe = {
{'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'},
{'pipeworks:tube_1', 'technic:control_logic_unit', 'pipeworks:tube_1'}, {'pipeworks:tube_000000', 'technic:control_logic_unit', 'pipeworks:tube_000000'},
{'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'}, {'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'},
} }
}) })
@ -61,57 +97,39 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = 'technic:fine_gold_wire 2',
recipe = {
{'', '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', ''},
}
})
minetest.register_craft({ minetest.register_craft({
output = 'technic:copper_coil 1', output = 'technic:copper_coil 1',
recipe = { recipe = {
{'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire'}, {'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'},
{'technic:wrought_iron_ingot', '', 'technic:wrought_iron_ingot'}, {'default:steel_ingot', '', 'default:steel_ingot'},
{'technic:fine_copper_wire', 'technic:wrought_iron_ingot', 'technic:fine_copper_wire'}, {'technic:fine_copper_wire', 'default:steel_ingot', 'technic:fine_copper_wire'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:motor', output = 'technic:motor',
recipe = { recipe = {
{'technic:carbon_steel_ingot', 'technic:copper_coil', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'},
{'technic:carbon_steel_ingot', 'technic:copper_coil', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'technic:copper_coil', 'default:steel_ingot'},
{'technic:carbon_steel_ingot', 'default:copper_ingot', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'default:copper_ingot', 'default:steel_ingot'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_transformer', output = 'technic:lv_transformer',
recipe = { recipe = {
{'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'}, {'default:iron_lump', 'default:iron_lump', 'default:iron_lump'},
{'technic:copper_coil', 'technic:wrought_iron_ingot', 'technic:copper_coil'}, {'technic:copper_coil', 'default:iron_lump', 'technic:copper_coil'},
{'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'}, {'default:iron_lump', 'default:iron_lump', 'default:iron_lump'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:mv_transformer', output = 'technic:mv_transformer',
recipe = { recipe = {
{'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'technic:copper_coil', 'technic:carbon_steel_ingot', 'technic:copper_coil'}, {'technic:copper_coil', 'default:steel_ingot', 'technic:copper_coil'},
{'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
} }
}) })
@ -149,21 +167,17 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = "technic:machine_casing",
recipe = {
{ "technic:cast_iron_ingot", "technic:cast_iron_ingot", "technic:cast_iron_ingot" },
{ "technic:cast_iron_ingot", "technic:brass_ingot", "technic:cast_iron_ingot" },
{ "technic:cast_iron_ingot", "technic:cast_iron_ingot", "technic:cast_iron_ingot" },
},
})
-- Remove some recipes
minetest.register_craftitem("technic:nothing", { minetest.register_craftitem("technic:nothing", {
description = "", description = "",
inventory_image = "blank.png", inventory_image = "blank.png",
}) })
minetest.register_craft({
type = "shapeless",
output = "technic:nothing",
recipe = {"default:copper_ingot", "default:steel_ingot"}
})
if minetest.register_craft_predict then if minetest.register_craft_predict then
minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craft_inv) minetest.register_craft_predict(function(itemstack, player, old_craft_grid, craft_inv)
if itemstack:get_name() == "technic:nothing" then if itemstack:get_name() == "technic:nothing" then
@ -172,30 +186,3 @@ if minetest.register_craft_predict then
end) end)
end end
-- Bronze
minetest.register_craft({
type = "shapeless",
output = "technic:nothing",
recipe = {"default:copper_ingot", "default:steel_ingot"}
})
-- Accelerator tube
minetest.register_craft({
output = "technic:nothing",
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" }
},
})
-- Teleport tube
minetest.register_craft({
output = "technic:nothing",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "default:desert_stone", "default:mese_block", "default:desert_stone" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})

View File

@ -4,4 +4,3 @@ pipeworks
mesecons mesecons
mesecons_mvps? mesecons_mvps?
intllib? intllib?
unified_inventory?

View File

@ -1,45 +1,10 @@
minetest.swap_node = minetest.swap_node or function(pos, node) function get_item_meta (string)
local oldmeta = minetest.get_meta(pos):to_table() if string.find(string, "return {") then
minetest.set_node(pos, node) return minetest.deserialize(string)
minetest.get_meta(pos):from_table(oldmeta) else return nil
end
-- Only changes name, keeps other params
function technic.swap_node(pos, name)
local node = minetest.get_node(pos)
if node.name ~= name then
node.name = name
minetest.swap_node(pos, node)
end end
return node.name
end end
-- Fully charge RE chargeable item. function set_item_meta (table)
-- Must be defined early to reference in item definitions. return minetest.serialize(table)
function technic.refill_RE_charge(stack)
local max_charge = technic.power_tools[stack:get_name()]
if not max_charge then return stack end
technic.set_RE_wear(stack, max_charge, max_charge)
local meta = minetest.deserialize(stack:get_metadata()) or {}
meta.charge = max_charge
stack:set_metadata(minetest.serialize(meta))
return stack
end end
--------------------------------------------------------------------------------
local function resolve_name(function_name)
local a = _G
for key in string.gmatch(function_name, "([^%.]+)(%.?)") do
if a[key] then
a = a[key]
else
return nil
end
end
return a
end
function technic.function_exists(function_name)
return type(resolve_name(function_name)) == 'function'
end
--------------------------------------------------------------------------------

View File

@ -40,6 +40,27 @@ dofile(modpath.."/tools/init.lua")
-- Aliases for legacy node/item names -- Aliases for legacy node/item names
dofile(modpath.."/legacy.lua") dofile(modpath.."/legacy.lua")
function has_locked_chest_privilege(meta, player)
if player:get_player_name() ~= meta:get_string("owner") then
return false
end
return true
end
-- Swap nodes out. Return the node name.
function hacky_swap_node(pos, name)
local node = minetest.get_node(pos)
if node.name ~= name then
local meta = minetest.get_meta(pos)
local meta_table = meta:to_table()
node.name = name
minetest.set_node(pos, node)
meta = minetest.get_meta(pos)
meta:from_table(meta_table)
end
return node.name
end
if minetest.setting_get("log_mod") then if minetest.setting_get("log_mod") then
print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start)) print(S("[Technic] Loaded in %f seconds"):format(os.clock() - load_start))
end end

View File

@ -32,8 +32,6 @@ minetest.register_tool("technic:blue_energy_crystal", {
"technic_diamond_block_blue.png", "technic_diamond_block_blue.png",
"technic_diamond_block_blue.png", "technic_diamond_block_blue.png",
"technic_diamond_block_blue.png"), "technic_diamond_block_blue.png"),
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
tool_capabilities = { tool_capabilities = {
max_drop_level = 0, max_drop_level = 0,
groupcaps = { groupcaps = {
@ -48,8 +46,6 @@ minetest.register_tool("technic:green_energy_crystal", {
"technic_diamond_block_green.png", "technic_diamond_block_green.png",
"technic_diamond_block_green.png", "technic_diamond_block_green.png",
"technic_diamond_block_green.png"), "technic_diamond_block_green.png"),
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
tool_capabilities = { tool_capabilities = {
max_drop_level = 0, max_drop_level = 0,
groupcaps = { groupcaps = {
@ -64,8 +60,6 @@ minetest.register_tool("technic:red_energy_crystal", {
"technic_diamond_block_red.png", "technic_diamond_block_red.png",
"technic_diamond_block_red.png", "technic_diamond_block_red.png",
"technic_diamond_block_red.png"), "technic_diamond_block_red.png"),
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
tool_capabilities = { tool_capabilities = {
max_drop_level = 0, max_drop_level = 0,
groupcaps = { groupcaps = {
@ -80,16 +74,6 @@ minetest.register_craftitem("technic:fine_copper_wire", {
inventory_image = "technic_fine_copper_wire.png", inventory_image = "technic_fine_copper_wire.png",
}) })
minetest.register_craftitem("technic:fine_gold_wire", {
description = S("Fine Gold Wire"),
inventory_image = "technic_fine_gold_wire.png",
})
minetest.register_craftitem("technic:fine_silver_wire", {
description = S("Fine Silver Wire"),
inventory_image = "technic_fine_silver_wire.png",
})
minetest.register_craftitem("technic:copper_coil", { minetest.register_craftitem("technic:copper_coil", {
description = S("Copper Coil"), description = S("Copper Coil"),
inventory_image = "technic_copper_coil.png", inventory_image = "technic_copper_coil.png",
@ -154,12 +138,3 @@ minetest.register_craftitem("technic:carbon_cloth", {
inventory_image = "technic_carbon_cloth.png", inventory_image = "technic_carbon_cloth.png",
}) })
minetest.register_node("technic:machine_casing", {
description = S("Machine Casing"),
groups = {cracky=2},
sunlight_propagates = true,
paramtype = "light",
drawtype = "allfaces",
tiles = {"technic_machine_casing.png"},
sounds = default.node_sound_stone_defaults(),
})

View File

@ -17,10 +17,6 @@ technic.legacy_nodenames = {
["technic:electric_furnace_active"] = "technic:lv_electric_furnace_active", ["technic:electric_furnace_active"] = "technic:lv_electric_furnace_active",
["technic:grinder"] = "technic:lv_grinder", ["technic:grinder"] = "technic:lv_grinder",
["technic:grinder_active"] = "technic:lv_grinder_active", ["technic:grinder_active"] = "technic:lv_grinder_active",
["technic:extractor"] = "technic:lv_extractor",
["technic:extractor_active"] = "technic:lv_extractor_active",
["technic:compressor"] = "technic:lv_compressor",
["technic:compressor_active"] = "technic:lv_compressor_active",
["technic:hv_battery_box"] = "technic:hv_battery_box0", ["technic:hv_battery_box"] = "technic:hv_battery_box0",
["technic:hv_cable"] = "technic:hv_cable0", ["technic:hv_cable"] = "technic:hv_cable0",
["technic:lv_cable"] = "technic:lv_cable0", ["technic:lv_cable"] = "technic:lv_cable0",
@ -28,7 +24,6 @@ technic.legacy_nodenames = {
["technic:mv_battery_box"] = "technic:mv_battery_box0", ["technic:mv_battery_box"] = "technic:mv_battery_box0",
["technic:generator"] = "technic:lv_generator", ["technic:generator"] = "technic:lv_generator",
["technic:generator_active"] = "technic:lv_generator_active", ["technic:generator_active"] = "technic:lv_generator_active",
["technic:iron_dust"] = "technic:wrought_iron_dust",
} }
for old, new in pairs(technic.legacy_nodenames) do for old, new in pairs(technic.legacy_nodenames) do

View File

@ -1,188 +0,0 @@
# German Translation for Technic Mod
# Deutsche Uebersetzung des Technic Mods
# by Xanthin
## Misc
[Technic] Loaded in %f seconds = [Technic] ist in %f Sekunden geladen
## Items
Silicon Wafer = Siliziumscheibe
Doped Silicon Wafer = Dotierte Siliziumscheibe
Enriched Uranium = Angereichertes Uran
Uranium Fuel = Uranbrennstoff
Diamond Drill Head = Diamantbohrkopf
Blue Energy Crystal = Blauer Energiekristall
Green Energy Crystal = Gruener Energiekristall
Red Energy Crystal = Roter Energiekristall
Fine Copper Wire = Feinkupferdraht
Copper Coil = Kupferspule
Electric Motor = Elektromotor
Low Voltage Transformer = Niederspannungstransformator
Medium Voltage Transformer = Mittelspannungstransformator
High Voltage Transformer = Hochspannungstransformator
Control Logic Unit = Steuer- und Regelungseinheit
Mixed Metal Ingot = Mischmetallbarren
Composite Plate = Verbundplatte
Copper Plate = Kupferplatte
Carbon Plate = Kohlefaserplatte
Graphite = Graphit
Carbon Cloth = Kohlefasergewebe
Raw Latex = Rohlatex
Rubber Fiber = Gummifaser
## Machine misc
Machine cannot be removed because it is not empty = Die Maschine kann nicht entfernt werden, weil sie noch nicht leer ist.
Inventory move disallowed due to protection = Das Inventar ist geschuetzt, Zugriff verweigert.
# $1: Machine name (Includes tier)
%s Active = %s ist eingeschaltet
%s Disabled = %s ist ausgeschaltet
%s Enabled =
%s Idle = %s ist bereit
%s Improperly Placed = %s ist falsch plaziert
%s Unpowered = %s hat keine Stromversorgung
%s Out Of Fuel = %s hat keinen Brennstoff
%s Has Bad Cabling = %s ist falsch verkabelt
%s Has No Network = %s hat kein Netzwerk
%s Finished = %s ist fertig
Enable/Disable = Einschalten/Ausschalten
Range = Reichweite
Upgrade Slots = Verbesserungsfaecher
In: = Rein:
Out: = Raus:
Slot %d = Fach %d
Mode: %s = Methode: %s
single items = Einzelstuecke
whole stacks = Ganzer Stapel
## Machine names
# $1: Tier
%s Alloy Furnace = %s Legierungsofen
%s Battery Box = %s Batteriebox
%s Cable = %s Kabel
%s CNC Machine = %s CNC-Maschine
%s Compressor = %s Kompressor
%s Extractor = %s Extraktor
%s Forcefield Emitter = %s Kraftfeld-Emitter
%s Furnace = %s Ofen
%s Grinder = %s Schleifmaschine
%s Music Player = %s Musikspieler
%s Quarry = %s Steinbruch
%s Tool Workshop = %s Werkzeugwerkstatt
Arrayed Solar %s Generator = %s Solaranlage
Fuel-Fired %s Generator = %s Kohle-Generator
Geothermal %s Generator = %s Geothermie-Generator
Hydro %s Generator = %s Wassermuehle
Nuclear %s Generator Core = %s Reaktorkern
Small Solar %s Generator = %s Solarmodul
Wind %s Generator = %s Windmuehle
Injector = Injektor
Constructor Mk%d = Konstruktor Modell %d
Frame = Rahmen
Frame Motor = Rahmenmotor
Template = Schablone
Template (replacing) = Schablone (ersetzend)
Template motor = Schablonenmotor
Template tool = Schablonenwerkzeug
Battery Box = Batteriebox
Supply Converter = Stromumwandler
Switching Station = Schaltanlage
Fuel-Fired Alloy Furnace = Kohle-Legierungsofen
Fuel-Fired Furnace = Kohle-Ofen
Wind Mill Frame = Windmuehlengeruest
Forcefield = Kraftfeld
Nuclear Reactor Rod Compartment = Brennstabfaecher
## Machine-specific
# $1: Pruduced EU
Charge = Aufladen
Discharge = Entladen
Power level = Energiestufe
# $1: Tier $2: current_charge $3: max_charge
%s Battery Box: %d/%d = %s Batteriebox: %d/%d
# $1: Machine name $2: Supply $3: Demand
%s. Supply: %d Demand: %d = %s. Versorgung: %d Bedarf: %d
Production at %d%% = Produktion bei %d%%
Choose Milling Program: = Waehle ein Fraesprogramm:
Slim Elements half / normal height: = Schmale Elemente von halber / normaler Hoehe:
Current track %s = Aktueller Titel %s
## CNC
Cylinder = Zylinder
Element Cross = Halbes Kreuzelement
Element Cross Double = Kreuzelement
Element Edge = Halbes Eckelement
Element Edge Double = Eckelement
Element End = Halbes Endelement
Element End Double = Endelement
Element Straight = Halbes aufrechtes Element
Element Straight Double = Aufrechtes Element
Element T = Halbes T-Element
Element T Double = T-Element
Horizontal Cylinder = Liegender Zylinder
One Curved Edge Block = Block mit einer abgerundeten Kante
Pyramid = Pyramide
Slope = Schraege
Slope Edge = Schraege mit Ecke
Slope Inner Edge = Schraege mit Innenecke
Slope Lying = Liegende Schraege
Slope Upside Down = Umgedrehte Schraege
Slope Upside Down Edge = Umgedrehte Schraege mit Ecke
Slope Upside Down Inner Edge = Umgedrehte Schraege mit Innenecke
Sphere = Kugel
Spike = Spitze
Stick = Stange
Two Curved Edge Block = Block mit zwei abgerundeten Kanten
Brick = Ziegel:
Cobble = Pflasterstein:
Dirt = Erde:
Leaves = Laub:
Sandstone = Sandstein:
Stone = Stein:
Tree = Baumstamm:
Wooden = Holz:
## Grinder Recipes
# $1: Name
%s Dust = %sstaub
Akalin = Akalin
Alatro = Alatro
Arol = Arol
Brass = Messing
Bronze = Bronze
Carbon Steel = Kohlenstoffstahl
Cast Iron = Gusseisen
Chromium = Chrom
Coal = Kohle
Copper = Kupfer
Gold = Gold
Mithril = Mithril
Silver = Silber
Stainless Steel = Edelstahl
Talinite = Talinite
Tin = Zinn
Wrought Iron = Schmiedeeisen
Zinc = Zink
## Tools
RE Battery = Akkubatterie
Water Can = Wasserkanister
Lava Can = Lavakanister
Chainsaw = Kettensaege
Flashlight = Taschenlampe
3 nodes deep. = 3 Bloecke tief.
3 nodes tall. = 3 Bloecke hoch.
3 nodes wide. = 3 Bloecke breit.
3x3 nodes. = 3x3 Bloecke.
Use while sneaking to change Mining Drill Mk%d modes. = Halte die Shift-Taste beim Benutzen gedrueckt, um die Funktion des Bergbaubohrers Modell %d zu aendern.
Mining Drill Mk%d Mode %d = Bergbaubohrer Modell %d Funktion %d
Mining Drill Mk%d = Bergbaubohrer Modell %d
Mining Laser Mk%d = Bergbaulaser Modell %d
Single node. = Einzelblock
Sonic Screwdriver = Schallschraubendreher
Tree Tap = Baumzapfhahn
## Craft descriptions
Alloy cooking =
Grinding =
Compressing =
Extracting =

View File

@ -1,3 +1,4 @@
# es.txt
# Spanish Translation for Technic Mod # Spanish Translation for Technic Mod
# Traduccion al Español del Mod Technic # Traduccion al Español del Mod Technic
# Autor: Diego Martínez <kaeza> # Autor: Diego Martínez <kaeza>
@ -32,10 +33,8 @@ Rubber Fiber = Fibra de Hule
## Machine misc ## Machine misc
Machine cannot be removed because it is not empty = La maquina no puede removerse porque no esta vacia Machine cannot be removed because it is not empty = La maquina no puede removerse porque no esta vacia
Inventory move disallowed due to protection =
# $1: Machine name (Includes tier) # $1: Machine name (Includes tier)
%s Active = %s Activo %s Active = %s Activo
%s Enabled =
%s Idle = %s Quieto %s Idle = %s Quieto
%s Unpowered = %s Sin Energia %s Unpowered = %s Sin Energia
%s Out Of Fuel = %s Sin Combustible %s Out Of Fuel = %s Sin Combustible
@ -52,38 +51,29 @@ Enable/Disable = Habilitar/Deshabilitar
%s Alloy Furnace = Horno de Aleacion %s %s Alloy Furnace = Horno de Aleacion %s
%s Battery Box = Caja de Bateria %s %s Battery Box = Caja de Bateria %s
%s Cable = Cable %s %s Cable = Cable %s
%s CNC Machine = Maquina CNC %s %s Electric Furnace = Horno Electrico %s
%s Compressor = Compresor %s
%s Extractor = Extractor %s
%s Forcefield Emitter = Emisor de Campo de Fuerza %s
%s Furnace = Horno %s
%s Grinder = Amoladora %s %s Grinder = Amoladora %s
%s Music Player = Reproductor de Musica %s %s Generator = Generador %s
%s Quarry = Cantera %s %s Solar Array = Panel Solar %s
%s Tool Workshop = Taller de Herramientas %s
Arrayed Solar %s Generator = Panel Solar %s
Fuel-Fired %s Generator = Generador a Carbon %s
Geothermal %s Generator = Generador Geotermico %s
Hydro %s Generator = Molino de Agua %s
Nuclear %s Generator Core = Nucleo de Reactor Nuclear %s
Small Solar %s Generator = Panel Solar %s
Wind %s Generator = Molino de Viento %s
Injector =
Constructor Mk%d =
Frame =
Frame Motor =
Template =
Template (replacing) =
Template Motor =
Template Tool =
Supply Converter = Convertidor de Alimentacion Supply Converter = Convertidor de Alimentacion
Switching Station = Estacion de Conmutacion Switching Station = Estacion de Conmutacion
Battery Box = Caja de Baterias Battery Box = Caja de Baterias
Fuel-Fired Alloy Furnace = Horno de Aleacion a Carbon Quarry = Cantera
Fuel-Fired Furnace = Horno a Carbon CNC Machine = Maquina CNC
Music Player = Reproductor de Musica
Extractor = Extractor
Coal Alloy Furnace = Horno de Aleacion a Carbon
Tool WorkShop = Taller de Herramientas
Forcefield = Campo de Fuerza Forcefield = Campo de Fuerza
Forcefield Emitter = Emisor de Campo de Fuerza
Compressor = Compresor
Geothermal Generator = Generador Geotermico
Water Mill = Molino de Agua
Nuclear Reactor Rod Compartment = Compartimiento para Vara de Reactor Nuclear Nuclear Reactor Rod Compartment = Compartimiento para Vara de Reactor Nuclear
Nuclear Reactor Core = Nucleo de Reactor Nuclear
Wind Mill = Molino de Viento
Wind Mill Frame = Armazon de Molino de Viento Wind Mill Frame = Armazon de Molino de Viento
Solar Panel = Panel Solar
## Machine-specific ## Machine-specific
# $1: Pruduced EU # $1: Pruduced EU
@ -123,6 +113,7 @@ Slope Edge = Borde de Rampa
Slope = Rampa Slope = Rampa
Element T = Elemento T Element T = Elemento T
Cylinder = Cilindro Cylinder = Cilindro
Steel = Acero
Cobble = Adoquines Cobble = Adoquines
Stone = Piedra Stone = Piedra
Brick = Ladrillo Brick = Ladrillo
@ -139,22 +130,19 @@ Alatro = Alatro
Arol = Arol Arol = Arol
Brass = Laton Brass = Laton
Bronze = Bronce Bronze = Bronce
Carbon Steel = Acero al Carbono
Cast Iron = Hierro Fundido
Chromium = Cromo Chromium = Cromo
Coal = Carbon Coal = Carbon
Copper = Cobre Copper = Cobre
Gold = Oro Gold = Oro
Iron = Hierro
Mithril = Mitrilo Mithril = Mitrilo
Silver = Plata Silver = Plata
Stainless Steel = Acero Inoxidable Stainless Steel = Acero Inoxidable
Talinite = Talinita Talinite = Talinita
Tin = Estanio Tin = Estanio
Wrought Iron = Hierro Forjado
Zinc = Zinc Zinc = Zinc
## Tools ## Tools
RE Battery =
Water Can = Bidon de Agua Water Can = Bidon de Agua
Lava Can = Bidon de Lava Lava Can = Bidon de Lava
Chainsaw = Motosierra Chainsaw = Motosierra
@ -163,7 +151,7 @@ Flashlight = Linterna
3 nodes tall. = 3 nodos de alto. 3 nodes tall. = 3 nodos de alto.
3 nodes wide. = 3 nodos de ancho. 3 nodes wide. = 3 nodos de ancho.
3x3 nodes. = 3x3 nodos. 3x3 nodes. = 3x3 nodos.
Use while sneaking to change Mining Drill Mk%d modes. = Manten pulsado Mayus y Usar para cambiar el modo del Taladro de Mineria Mk%d. Hold shift and use to change Mining Drill Mk%d modes. = Manten pulsado Mayus y Usar para cambiar el modo del Taladro de Mineria Mk%d.
Mining Drill Mk%d Mode %d = Taladro de Mineria Mk%d Modo %d Mining Drill Mk%d Mode %d = Taladro de Mineria Mk%d Modo %d
Mining Drill Mk%d = Taladro de Mineria Mk%d Mining Drill Mk%d = Taladro de Mineria Mk%d
Mining Laser Mk%d = Laser de Mineria Mk%d Mining Laser Mk%d = Laser de Mineria Mk%d
@ -171,8 +159,3 @@ Single node. = Nodo simple.
Sonic Screwdriver = Destonillador Sonico Sonic Screwdriver = Destonillador Sonico
Tree Tap = Grifo de Arbol Tree Tap = Grifo de Arbol
## Craft descriptions
Alloy cooking =
Grinding =
Compressing =
Extracting =

View File

@ -29,11 +29,9 @@ Rubber Fiber = Fibra di gomma
## Machine misc ## Machine misc
Machine cannot be removed because it is not empty = La macchina non può essere rimossa perchè non è vuota Machine cannot be removed because it is not empty = La macchina non può essere rimossa perchè non è vuota
Inventory move disallowed due to protection = Impossibile muovere l'inventario a causa della protezione
# $1: Machine name (Includes tier) # $1: Machine name (Includes tier)
%s Active = %s Attivo %s Active = %s Attivo
%s Disabled = %s Disabilitato %s Disabled = %s Disabilitato
%s Enabled =
%s Idle = %s Inattivo %s Idle = %s Inattivo
%s Improperly Placed = %s Piazzato impropiamente %s Improperly Placed = %s Piazzato impropiamente
%s Unpowered = %s Non alimentato %s Unpowered = %s Non alimentato
@ -43,51 +41,36 @@ Inventory move disallowed due to protection = Impossibile muovere l'inventario a
%s Finished = %s Finito %s Finished = %s Finito
Enable/Disable = Abilita/Disabilita Enable/Disable = Abilita/Disabilita
Range = Raggio Range = Raggio
Upgrade Slots =
In: = Ingresso:
Out: = Uscita:
Slot %d =
Mode: %s = Modalità: %s
single items = Singolo elemento
whole stacks = pila completa
## Machine names ## Machine names
# $1: Tier # $1: Tier
%s Alloy Furnace = %s Fornace per leghe %s Alloy Furnace = %s Fornace per leghe
%s Battery Box = %s Box batterie %s Battery Box = %s Box batterie
%s Cable = Cavo %s %s Cable = Cavo %s
%s CNC Machine = Tornio CNC %s %s Electric Furnace = %s Fornace elettrica
%s Compressor = Compressore %s
%s Extractor = Estrattore %s
%s Forcefield Emitter = Emettitore di campo di forza %s
%s Furnace = %s Fornace
%s Grinder = %s Tritatutto %s Grinder = %s Tritatutto
%s Music Player = Music Player %s %s Generator = %s Generatore
%s Quarry = Cava %s %s Solar Array = %s Pannello Solare
%s Tool Workshop = Officina per attrezzi %s
Arrayed Solar %s Generator = %s Pannello Solare
Fuel-Fired %s Generator = %s Generatore a carbone
Geothermal %s Generator = %s Generatore Geotermico
Hydro %s Generator = Turbina Elettrica %s
Nuclear %s Generator Core = Reattore nucleare %s
Small Solar %s Generator = %s Pannello solare
Wind %s Generator = %s Generatore eolico
Injector = Ignettore
Constructor Mk%d = Costruttore Mk%d
Frame = Cornice
Frame Motor = Cornice del motore
Template =
Template (replacing) = Template (rimpiazzato)
Template Motor =
Template Tool =
Battery Box = Box batterie Battery Box = Box batterie
Supply Converter = Trasformatore Supply Converter = Trasformatore
Switching Station = Stazione di controllo Switching Station = Stazione di controllo
Fuel-Fired Alloy Furnace = Fornace per leghe a carbone CNC Machine = Tornio CNC
Fuel-Fired Furnace = Fornace a carbone Coal Alloy Furnace = Fornace per leghe a carbone
Extractor = Estrattore
Compressor = Compressore
Solar Panel = Pannello solare
Geothermal Generator = Generatore Geotermico
Music Player = Music Player
Water Mill = Turbina Elettrica
Tool WorkShop = Officina per attrezzi
Wind Mill = Generatore eolico
Wind Mill Frame = Pala eolica Wind Mill Frame = Pala eolica
Forcefield Emitter = Emettitore di campo di forza
Forcefield = Campo di forza Forcefield = Campo di forza
Nuclear Reactor Core = Reattore nucleare
Nuclear Reactor Rod Compartment = Compartimento combustibile nucleare Nuclear Reactor Rod Compartment = Compartimento combustibile nucleare
Quarry = Cava
## Machine-specific ## Machine-specific
# $1: Pruduced EU # $1: Pruduced EU
@ -99,41 +82,39 @@ Power level = Livello di potenza
# $1: Machine name $2: Supply $3: Demand # $1: Machine name $2: Supply $3: Demand
%s. Supply: %d Demand: %d = %s. Prodotto: %d Consumato: %d %s. Supply: %d Demand: %d = %s. Prodotto: %d Consumato: %d
Production at %d%% = Produzione a %d%% Production at %d%% = Produzione a %d%%
Choose Milling Program: = Scegliere un programma di Fresatura
Slim Elements half / normal height: = Metà elementi sottili / altezza normale:
Current track %s = Traccia corrente %s
## CNC ## CNC
Cylinder = Cilindro Cylinder = Cilindro
Element Cross = Elemento a croce Element Cross = Elemento a croce
Element Cross Double = Elemento a croce doppio Element Cross Double = Elemento a croce doppio
Element Edge = Elemento bordo Element Edge =
Element Edge Double = Elemento bordo doppio Element Edge Double =
Element End = Elemento finale Element End = Elemento finale
Element End Double = Elemento finale doppio Element End Double = Elemento finale doppio
Element Straight = Elemento dritto Element Straight =
Element Straight Double = Elemento dritto doppio Element Straight Double =
Element T = Elemento a T Element T = Elemento a T
Element T Double = Elemento a T doppio Element T Double = Elemento a T doppio
Horizontal Cylinder = Cilindro orizzontale Horizontal Cylinder = Cilindro orizzontale
One Curved Edge Block = Blocco con bordo curvo One Curved Edge Block =
Pyramid = Piramide Pyramid = Piramide
Slope = Inclinato Slope =
Slope Edge = Bordo inclinato Slope Edge =
Slope Inner Edge = Bordo interno inclinato Slope Inner Edge =
Slope Lying = Pendenza bugiarda Slope Lying =
Slope Upside Down = Pendenza capovolta Slope Upside Down =
Slope Upside Down Edge = Bordo inclinato capovolto Slope Upside Down Edge =
Slope Upside Down Inner Edge = Bordo interno inclinato capovolto Slope Upside Down Inner Edge =
Sphere = Sfera Sphere = Sfera
Spike = Spuntone Spike =
Stick = Bastone Stick = Bastone
Two Curved Edge Block = Blocco con bordo a doppia curva Two Curved Edge Block =
Brick = Mattone Brick = Mattone
Cobble = Ciottolato Cobble = Ciottolato
Dirt = Terra Dirt = Terra
Leaves = Foglie Leaves = Foglie
Sandstone = Arenaria Sandstone = Arenaria
Steel = Acciaio
Stone = Pietra Stone = Pietra
Tree = Albero Tree = Albero
Wooden = Legno Wooden = Legno
@ -146,22 +127,19 @@ Alatro = Alatro
Arol = Arol Arol = Arol
Brass = Ottone Brass = Ottone
Bronze = Bronzo Bronze = Bronzo
Carbon Steel = Acciaio al Carbonio
Cast Iron = Ghisa
Chromium = Cromo Chromium = Cromo
Coal = Carbone Coal = Carbone
Copper = Rame Copper = Rame
Gold = Oro Gold = Oro
Iron = Ferro
Mithril = Mithril Mithril = Mithril
Silver = Argento Silver = Argento
Stainless Steel = Acciaio Inossidabile Stainless Steel = Acciaio Inossidabile
Talinite = Talinite Talinite = Talinite
Tin = Stagno Tin = Stagno
Wrought Iron = Ferro Battuto
Zinc = Zinco Zinc = Zinco
## Tools ## Tools
RE Battery =
Water Can = Serbatoio d'acqua Water Can = Serbatoio d'acqua
Lava Can = Serbatoio di lava Lava Can = Serbatoio di lava
Chainsaw = Motosega Chainsaw = Motosega
@ -170,16 +148,10 @@ Flashlight = Torcia
3 nodes tall. = 3 nodi in altezza. 3 nodes tall. = 3 nodi in altezza.
3 nodes wide. = 3 nodi in larghezza. 3 nodes wide. = 3 nodi in larghezza.
3x3 nodes. = 3x3 nodi. 3x3 nodes. = 3x3 nodi.
Use while sneaking to change Mining Drill Mk%d modes. = Premi shift (freccia grossa) e usa per cambiare modalità nella trivella da miniera Mk%d. Hold shift and use to change Mining Drill Mk%d modes. = Premi shift (freccia grossa) e usa per cambiare modalità nella trivella da miniera Mk%d.
Mining Drill Mk%d Mode %d = Trivella mk%d in modalità %d Mining Drill Mk%d Mode %d = Trivella mk%d in modalità %d
Mining Drill Mk%d = Trivella da miniera mk%d Mining Drill Mk%d = Trivella da miniera mk%d
Mining Laser Mk%d = Laser da miniera mk%d Mining Laser Mk%d = Laser da miniera mk%d
Single node. = Nodo singolo. Single node. = Nodo singolo.
Sonic Screwdriver = Cacciavite sonico Sonic Screwdriver = Cacciavite sonico
Tree Tap = Batti albero Tree Tap = Batti albero
## Craft descriptions
Alloy cooking = Cottura lege
Grinding = Macinazione
Compressing = Compressione
Extracting = Estrazione

View File

@ -32,14 +32,11 @@ Rubber Fiber =
## Machine misc ## Machine misc
Machine cannot be removed because it is not empty = Machine cannot be removed because it is not empty =
Inventory move disallowed due to protection =
# $1: Machine name (Includes tier) # $1: Machine name (Includes tier)
%s Active = %s Active =
%s Disabled = %s Disabled =
%s Enabled =
%s Idle = %s Idle =
%s Improperly Placed = %s Improperly Placed =
%s is empty =
%s Unpowered = %s Unpowered =
%s Out Of Fuel = %s Out Of Fuel =
%s Has Bad Cabling = %s Has Bad Cabling =
@ -47,51 +44,36 @@ Inventory move disallowed due to protection =
%s Finished = %s Finished =
Enable/Disable = Enable/Disable =
Range = Range =
Upgrade Slots =
In: =
Out: =
Slot %d =
Mode: %s =
single items =
whole stacks =
## Machine names ## Machine names
# $1: Tier # $1: Tier
%s Alloy Furnace = %s Alloy Furnace =
%s Battery Box = %s Battery Box =
%s Cable = %s Cable =
%s CNC Machine = %s Electric Furnace =
%s Compressor =
%s Extractor =
%s Forcefield Emitter =
%s Furnace =
%s Grinder = %s Grinder =
%s Music Player = %s Generator =
%s Quarry = %s Solar Array =
%s Tool Workshop =
Arrayed Solar %s Generator =
Fuel-Fired %s Generator =
Geothermal %s Generator =
Hydro %s Generator =
Nuclear %s Generator Core =
Small Solar %s Generator =
Wind %s Generator =
Injector =
Constructor Mk%d =
Frame =
Frame Motor =
Template =
Template (replacing) =
Template Motor =
Template Tool =
Battery Box = Battery Box =
Supply Converter = Supply Converter =
Switching Station = Switching Station =
Fuel-Fired Alloy Furnace = CNC Machine =
Fuel-Fired Furnace = Coal Alloy Furnace =
Extractor =
Compressor =
Solar Panel =
Geothermal Generator =
Music Player =
Water Mill =
Tool WorkShop =
Wind Mill =
Wind Mill Frame = Wind Mill Frame =
Forcefield Emitter =
Forcefield = Forcefield =
Nuclear Reactor Core =
Nuclear Reactor Rod Compartment = Nuclear Reactor Rod Compartment =
Quarry =
## Machine-specific ## Machine-specific
# $1: Pruduced EU # $1: Pruduced EU
@ -103,9 +85,6 @@ Power level =
# $1: Machine name $2: Supply $3: Demand # $1: Machine name $2: Supply $3: Demand
%s. Supply: %d Demand: %d = %s. Supply: %d Demand: %d =
Production at %d%% = Production at %d%% =
Choose Milling Program: =
Slim Elements half / normal height: =
Current track %s =
## CNC ## CNC
Cylinder = Cylinder =
@ -138,6 +117,7 @@ Cobble =
Dirt = Dirt =
Leaves = Leaves =
Sandstone = Sandstone =
Steel =
Stone = Stone =
Tree = Tree =
Wooden = Wooden =
@ -150,22 +130,19 @@ Alatro =
Arol = Arol =
Brass = Brass =
Bronze = Bronze =
Carbon Steel =
Cast Iron =
Chromium = Chromium =
Coal = Coal =
Copper = Copper =
Gold = Gold =
Iron =
Mithril = Mithril =
Silver = Silver =
Stainless Steel = Stainless Steel =
Talinite = Talinite =
Tin = Tin =
Wrought Iron =
Zinc = Zinc =
## Tools ## Tools
RE Battery =
Water Can = Water Can =
Lava Can = Lava Can =
Chainsaw = Chainsaw =
@ -174,7 +151,7 @@ Flashlight =
3 nodes tall. = 3 nodes tall. =
3 nodes wide. = 3 nodes wide. =
3x3 nodes. = 3x3 nodes. =
Use while sneaking to change Mining Drill Mk%d modes. = Hold shift and use to change Mining Drill Mk%d modes. =
Mining Drill Mk%d Mode %d = Mining Drill Mk%d Mode %d =
Mining Drill Mk%d = Mining Drill Mk%d =
Mining Laser Mk%d = Mining Laser Mk%d =
@ -182,8 +159,4 @@ Single node. =
Sonic Screwdriver = Sonic Screwdriver =
Tree Tap = Tree Tap =
## Craft descriptions
Alloy cooking =
Grinding =
Compressing =
Extracting =

View File

@ -10,12 +10,10 @@ minetest.register_craft({
technic.register_battery_box({ technic.register_battery_box({
tier = "HV", tier = "HV",
max_charge = 1000000, max_charge = 1500000,
charge_rate = 100000, charge_rate = 100000,
discharge_rate = 400000, discharge_rate = 400000,
charge_step = 10000, charge_step = 10000,
discharge_step = 40000, discharge_step = 40000,
upgrade = 1,
tube = 1,
}) })

View File

@ -14,9 +14,9 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:forcefield_emitter_off', output = 'technic:forcefield_emitter_off',
recipe = { recipe = {
{'default:mese', 'technic:motor', 'default:mese' }, {'default:mese', 'technic:deployer_off', 'default:mese' },
{'technic:deployer_off', 'technic:machine_casing', 'technic:deployer_off'}, {'technic:deployer_off', 'technic:motor', 'technic:deployer_off'},
{'default:mese', 'technic:hv_cable0', 'default:mese' }, {'default:mese', 'technic:deployer_off', 'default:mese' },
} }
}) })
@ -62,34 +62,35 @@ local function update_forcefield(pos, range, active)
vm:update_map() vm:update_map()
end end
local function set_forcefield_formspec(meta) local get_forcefield_formspec = function(range)
local formspec = "size[5,1.5]".. return "size[3,1.5]"..
"field[2,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]" "field[1,0.5;2,1;range;"..S("Range")..";"..range.."]"..
if meta:get_int("enabled") == 0 then "button[0,1;3,1;toggle;"..S("Enable/Disable").."]"
formspec = formspec.."button[0,1;5,1;enable;"..S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
else
formspec = formspec.."button[0,1;5,1;disable;"..S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
end
meta:set_string("formspec", formspec)
end end
local forcefield_receive_fields = function(pos, formname, fields, sender) local forcefield_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if fields.range then local range = tonumber(fields.range) or 0
local range = tonumber(fields.range) or 0
-- Smallest field is 5. Anything less is asking for trouble. if fields.toggle then
-- Largest is 20. It is a matter of pratical node handling. if meta:get_int("enabled") == 1 then
-- At the maximim range updating the forcefield takes about 0.2s meta:set_int("enabled", 0)
range = math.max(range, 5) else
range = math.min(range, 20) meta:set_int("enabled", 1)
if meta:get_int("range") ~= range then
update_forcefield(pos, meta:get_int("range"), false)
meta:set_int("range", range)
end end
end end
if fields.enable then meta:set_int("enabled", 1) end
if fields.disable then meta:set_int("enabled", 0) end -- Smallest field is 5. Anything less is asking for trouble.
set_forcefield_formspec(meta) -- Largest is 20. It is a matter of pratical node handling.
-- At the maximim range updating the forcefield takes about 0.2s
range = math.max(range, 5)
range = math.min(range, 20)
if meta:get_int("range") ~= range then
update_forcefield(pos, meta:get_int("range"), false)
meta:set_int("range", range)
meta:set_string("formspec", get_forcefield_formspec(range))
end
end end
local mesecons = { local mesecons = {
@ -104,7 +105,7 @@ local mesecons = {
} }
minetest.register_node("technic:forcefield_emitter_off", { minetest.register_node("technic:forcefield_emitter_off", {
description = S("%s Forcefield Emitter"):format("HV"), description = S("Forcefield Emitter"),
tiles = {"technic_forcefield_emitter_off.png"}, tiles = {"technic_forcefield_emitter_off.png"},
groups = {cracky = 1}, groups = {cracky = 1},
on_receive_fields = forcefield_receive_fields, on_receive_fields = forcefield_receive_fields,
@ -114,14 +115,14 @@ minetest.register_node("technic:forcefield_emitter_off", {
meta:set_int("HV_EU_demand", 0) meta:set_int("HV_EU_demand", 0)
meta:set_int("range", 10) meta:set_int("range", 10)
meta:set_int("enabled", 0) meta:set_int("enabled", 0)
meta:set_string("infotext", S("%s Forcefield Emitter"):format("HV")) meta:set_string("formspec", get_forcefield_formspec(10))
set_forcefield_formspec(meta) meta:set_string("infotext", S("Forcefield Emitter"))
end, end,
mesecons = mesecons mesecons = mesecons
}) })
minetest.register_node("technic:forcefield_emitter_on", { minetest.register_node("technic:forcefield_emitter_on", {
description = S("%s Forcefield Emitter"):format("HV"), description = S("Forcefield Emitter"),
tiles = {"technic_forcefield_emitter_on.png"}, tiles = {"technic_forcefield_emitter_on.png"},
groups = {cracky = 1, not_in_creative_inventory=1}, groups = {cracky = 1, not_in_creative_inventory=1},
drop = "technic:forcefield_emitter_off", drop = "technic:forcefield_emitter_off",
@ -139,7 +140,7 @@ minetest.register_node("technic:forcefield_emitter_on", {
}) })
minetest.register_node("technic:forcefield", { minetest.register_node("technic:forcefield", {
description = S("%s Forcefield"):format("HV"), description = S("Forcefield"),
sunlight_propagates = true, sunlight_propagates = true,
drawtype = "glasslike", drawtype = "glasslike",
groups = {not_in_creative_inventory=1, unbreakable=1}, groups = {not_in_creative_inventory=1, unbreakable=1},
@ -165,7 +166,7 @@ minetest.register_abm({
local eu_input = meta:get_int("HV_EU_input") local eu_input = meta:get_int("HV_EU_input")
local eu_demand = meta:get_int("HV_EU_demand") local eu_demand = meta:get_int("HV_EU_demand")
local enabled = meta:get_int("enabled") local enabled = meta:get_int("enabled")
local machine_name = S("%s Forcefield Emitter"):format("HV") local machine_name = S("Forcefield Emitter")
-- Power off automatically if no longer connected to a switching station -- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "HV") technic.switching_station_timeout_count(pos, "HV")
@ -177,7 +178,7 @@ minetest.register_abm({
if node.name == "technic:forcefield_emitter_on" then if node.name == "technic:forcefield_emitter_on" then
meta:set_int("HV_EU_demand", 0) meta:set_int("HV_EU_demand", 0)
update_forcefield(pos, meta:get_int("range"), false) update_forcefield(pos, meta:get_int("range"), false)
technic.swap_node(pos, "technic:forcefield_emitter_off") hacky_swap_node(pos, "technic:forcefield_emitter_off")
meta:set_string("infotext", S("%s Disabled"):format(machine_name)) meta:set_string("infotext", S("%s Disabled"):format(machine_name))
return return
end end
@ -185,11 +186,11 @@ minetest.register_abm({
meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
if node.name == "technic:forcefield_emitter_on" then if node.name == "technic:forcefield_emitter_on" then
update_forcefield(pos, meta:get_int("range"), false) update_forcefield(pos, meta:get_int("range"), false)
technic.swap_node(pos, "technic:forcefield_emitter_off") hacky_swap_node(pos, "technic:forcefield_emitter_off")
end end
elseif eu_input >= power_requirement then elseif eu_input >= power_requirement then
if node.name == "technic:forcefield_emitter_off" then if node.name == "technic:forcefield_emitter_off" then
technic.swap_node(pos, "technic:forcefield_emitter_on") hacky_swap_node(pos, "technic:forcefield_emitter_on")
meta:set_string("infotext", S("%s Active"):format(machine_name)) meta:set_string("infotext", S("%s Active"):format(machine_name))
end end
update_forcefield(pos, meta:get_int("range"), true) update_forcefield(pos, meta:get_int("range"), true)

View File

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

View File

@ -3,16 +3,11 @@ 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.."/cables.lua")
dofile(path.."/quarry.lua")
dofile(path.."/forcefield.lua")
dofile(path.."/battery_box.lua") dofile(path.."/battery_box.lua")
-- Generators
dofile(path.."/solar_array.lua") dofile(path.."/solar_array.lua")
dofile(path.."/nuclear_reactor.lua") dofile(path.."/nuclear_reactor.lua")
dofile(path.."/generator.lua") dofile(path.."/generator.lua")
-- Machines
dofile(path.."/quarry.lua")
dofile(path.."/forcefield.lua")

View File

@ -1,6 +1,6 @@
-- The enriched uranium rod driven EU generator. -- The enriched uranium rod driven EU generator.
-- A very large and advanced machine providing vast amounts of power. -- A very large and advanced machine providing vast amounts of power.
-- Very efficient but also expensive to run as it needs uranium. (10000EU 86400 ticks (one week)) -- Very efficient but also expensive to run as it needs uranium. (10000EU 86400 ticks (24h))
-- Provides HV EUs that can be down converted as needed. -- Provides HV EUs that can be down converted as needed.
-- --
-- The nuclear reactor core needs water and a protective shield to work. -- The nuclear reactor core needs water and a protective shield to work.
@ -17,8 +17,8 @@ minetest.register_craft({
output = 'technic:hv_nuclear_reactor_core', output = 'technic:hv_nuclear_reactor_core',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
{'technic:stainless_steel_ingot', 'technic:machine_casing', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'},
{'technic:stainless_steel_ingot', 'technic:hv_cable0', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
} }
}) })
@ -49,7 +49,7 @@ local nodebox = {
} }
minetest.register_node("technic:hv_nuclear_reactor_core", { minetest.register_node("technic:hv_nuclear_reactor_core", {
description = S("Nuclear %s Generator Core"):format("HV"), description = S("Nuclear Reactor Core"),
tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"}, "technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
@ -65,7 +65,7 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
}, },
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Nuclear %s Generator Core"):format("HV")) meta:set_string("infotext", S("Nuclear Reactor Core"))
meta:set_int("HV_EU_supply", 0) meta:set_int("HV_EU_supply", 0)
-- Signal to the switching station that this device burns some -- Signal to the switching station that this device burns some
-- sort of fuel and needs special handling -- sort of fuel and needs special handling
@ -75,10 +75,17 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("src", 6) inv:set_size("src", 6)
end, end,
can_dig = technic.machine_can_dig, can_dig = function(pos, player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.get_meta(pos);
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
allow_metadata_inventory_move = technic.machine_inventory_move, if not inv:is_empty("src") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
}) })
minetest.register_node("technic:hv_nuclear_reactor_core_active", { minetest.register_node("technic:hv_nuclear_reactor_core_active", {
@ -96,10 +103,17 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
type = "fixed", type = "fixed",
fixed = nodebox fixed = nodebox
}, },
can_dig = technic.machine_can_dig, can_dig = function(pos, player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.get_meta(pos);
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
allow_metadata_inventory_move = technic.machine_inventory_move, if not inv:is_empty("src") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
}) })
local check_reactor_structure = function(pos) local check_reactor_structure = function(pos)
@ -194,7 +208,7 @@ minetest.register_abm({
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local machine_name = S("Nuclear %s Generator Core"):format("HV") local machine_name = S("Nuclear Reactor Core")
local burn_time = meta:get_int("burn_time") or 0 local burn_time = meta:get_int("burn_time") or 0
if burn_time >= burn_ticks or burn_time == 0 then if burn_time >= burn_ticks or burn_time == 0 then
@ -214,7 +228,7 @@ minetest.register_abm({
if correct_fuel_count == 6 and if correct_fuel_count == 6 and
check_reactor_structure(pos) then check_reactor_structure(pos) then
meta:set_int("burn_time", 1) meta:set_int("burn_time", 1)
technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active") hacky_swap_node(pos, "technic:hv_nuclear_reactor_core_active")
meta:set_int("HV_EU_supply", power_supply) meta:set_int("HV_EU_supply", power_supply)
for idx, srcstack in pairs(srclist) do for idx, srcstack in pairs(srclist) do
srcstack:take_item() srcstack:take_item()
@ -226,7 +240,7 @@ minetest.register_abm({
meta:set_int("HV_EU_supply", 0) meta:set_int("HV_EU_supply", 0)
meta:set_int("burn_time", 0) meta:set_int("burn_time", 0)
meta:set_string("infotext", S("%s Idle"):format(machine_name)) meta:set_string("infotext", S("%s Idle"):format(machine_name))
technic.swap_node(pos, "technic:hv_nuclear_reactor_core") hacky_swap_node(pos, "technic:hv_nuclear_reactor_core")
elseif burn_time > 0 then elseif burn_time > 0 then
damage_nearby_players(pos) damage_nearby_players(pos)
if not check_reactor_structure(pos) then if not check_reactor_structure(pos) then

View File

@ -3,37 +3,42 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
recipe = { recipe = {
{"technic:carbon_steel_block", "pipeworks:filter", "technic:carbon_steel_block"}, {"default:steelblock", "pipeworks:filter", "default:steelblock"},
{"technic:motor", "technic:machine_casing", "technic:diamond_drill_head"}, {"default:steelblock", "technic:motor", "default:steelblock"},
{"technic:carbon_steel_block", "technic:hv_cable0", "technic:carbon_steel_block"}}, {"default:steelblock", "technic:diamond_drill_head", "default:steelblock"}},
output = "technic:quarry", output = "technic:quarry",
}) })
local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes local quarry_dig_above_nodes = 3 -- How far above the quarry we will dig nodes
local quarry_max_depth = 100 local quarry_max_depth = 100
local function set_quarry_formspec(meta) local function get_quarry_formspec(size)
local formspec = "size[3,1.5]".. return "size[3,1.5]"..
"field[1,0.5;2,1;size;Radius;"..meta:get_int("size").."]" "field[1,0.5;2,1;size;Radius;"..size.."]"..
if meta:get_int("enabled") == 0 then "button[0,1;3,1;toggle;"..S("Enable/Disable").."]"
formspec = formspec.."button[0,1;3,1;enable;"..S("%s Disabled"):format(S("%s Quarry"):format("HV")).."]"
else
formspec = formspec.."button[0,1;3,1;disable;"..S("%s Enabled"):format(S("%s Quarry"):format("HV")).."]"
end
meta:set_string("formspec", formspec)
end end
local function quarry_receive_fields(pos, formname, fields, sender) local function quarry_receive_fields(pos, formname, fields, sender)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if fields.size then local size = tonumber(fields.size)
local size = tonumber(fields.size) or 0
size = math.max(size, 2) if fields.toggle then
size = math.min(size, 8) if meta:get_int("enabled") == 0 then
meta:set_int("size", size) meta:set_int("enabled", 1)
else
meta:set_int("enabled", 0)
end
end
-- Smallest size is 2. Anything less is asking for trouble.
-- Largest is 8. It is a matter of pratical node handling.
size = math.max(size, 2)
size = math.min(size, 8)
if meta:get_int("size") ~= size then
meta:set_int("size", size)
meta:set_string("formspec", get_quarry_formspec(size))
end end
if fields.enable then meta:set_int("enabled", 1) end
if fields.disable then meta:set_int("enabled", 0) end
set_quarry_formspec(meta)
end end
local function get_quarry_center(pos, size) local function get_quarry_center(pos, size)
@ -75,7 +80,7 @@ local function quarry_dig(pos, center, size)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local drops = {} local drops = {}
local dig_y = meta:get_int("dig_y") local dig_y = meta:get_int("dig_y")
local owner = meta:get_string("owner") local owner = meta:get_int("owner")
local vm = VoxelManip() local vm = VoxelManip()
local p1 = vector.new( local p1 = vector.new(
@ -99,15 +104,19 @@ local function quarry_dig(pos, center, size)
end end
if minetest.is_protected and minetest.is_protected(digpos, owner) then if minetest.is_protected and minetest.is_protected(digpos, owner) then
meta:set_int("enabled", 0) meta:set_int("enabled", 0)
set_quarry_formspec(meta) return
return {}
end end
dig_y = digpos.y dig_y = digpos.y
local node = minetest.get_node(digpos) local node = minetest.get_node(digpos)
local node_def = minetest.registered_nodes[node.name] or { diggable = false } drops = minetest.get_node_drops(node.name, "")
if node_def.diggable and ((not node_def.can_dig) or node_def.can_dig(digpos, nil)) then minetest.dig_node(digpos)
minetest.remove_node(digpos) if minetest.get_node(digpos).name == node.name then
drops = minetest.get_node_drops(node.name, "") -- We tried to dig something undigable like a
-- filled chest. Notice that we check for a node
-- change, not for air. This is so that we get drops
-- from things like concrete posts with platforms,
-- which turn into regular concrete posts when dug.
drops = {}
end end
elseif not (dig_y < pos.y - quarry_max_depth) then elseif not (dig_y < pos.y - quarry_max_depth) then
dig_y = dig_y - 16 dig_y = dig_y - 16
@ -119,7 +128,7 @@ end
local function send_items(items, pos, node) local function send_items(items, pos, node)
for _, item in pairs(items) do for _, item in pairs(items) do
local tube_item = pipeworks.tube_item(vector.new(pos), item) local tube_item = tube_item(vector.new(pos), item)
tube_item:get_luaentity().start_pos = vector.new(pos) tube_item:get_luaentity().start_pos = vector.new(pos)
tube_item:setvelocity(vector.new(0, 1, 0)) tube_item:setvelocity(vector.new(0, 1, 0))
tube_item:setacceleration({x=0, y=0, z=0}) tube_item:setacceleration({x=0, y=0, z=0})
@ -127,28 +136,29 @@ local function send_items(items, pos, node)
end end
minetest.register_node("technic:quarry", { minetest.register_node("technic:quarry", {
description = S("%s Quarry"):format("HV"), description = S("Quarry"),
tiles = {"technic_carbon_steel_block.png", "technic_carbon_steel_block.png", tiles = {"default_steel_block.png", "default_steel_block.png",
"technic_carbon_steel_block.png", "technic_carbon_steel_block.png", "default_steel_block.png", "default_steel_block.png",
"technic_carbon_steel_block.png^default_tool_mesepick.png", "technic_carbon_steel_block.png"}, "default_steel_block.png^default_tool_mesepick.png", "default_steel_block.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2, tubedevice=1}, groups = {cracky=2, tubedevice=1},
tube = { tube = {
connect_sides = {top = 1}, connect_sides = {top = 1},
}, },
on_construct = function(pos) on_construct = function(pos)
local size = 4
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("%s Quarry"):format("HV")) meta:set_string("infotext", S("Quarry"))
meta:set_int("size", 4) meta:set_string("formspec", get_quarry_formspec(4))
set_quarry_formspec(meta) meta:set_int("size", size)
meta:set_int("dig_y", pos.y) meta:set_int("dig_y", pos.y)
end, end,
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name()) meta:set_string("owner", placer:get_player_name())
pipeworks.scan_for_tube_objects(pos) tube_scanforobjects(pos)
end, end,
after_dig_node = pipeworks.scan_for_tube_objects, after_dig_node = tube_scanforobjects,
on_receive_fields = quarry_receive_fields, on_receive_fields = quarry_receive_fields,
}) })
@ -163,7 +173,7 @@ minetest.register_abm({
local demand = 10000 local demand = 10000
local center = get_quarry_center(pos, size) local center = get_quarry_center(pos, size)
local dig_y = meta:get_int("dig_y") local dig_y = meta:get_int("dig_y")
local machine_name = S("%s Quarry"):format("HV") local machine_name = S("Quarry")
technic.switching_station_timeout_count(pos, "HV") technic.switching_station_timeout_count(pos, "HV")

View File

@ -4,9 +4,9 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:solar_array_hv 1', output = 'technic:solar_array_hv 1',
recipe = { recipe = {
{'technic:solar_array_mv', 'technic:solar_array_mv', 'technic:solar_array_mv'}, {'technic:solar_array_mv', 'technic:solar_array_mv', 'technic:solar_array_mv'},
{'technic:carbon_steel_ingot', 'technic:hv_transformer', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'technic:hv_transformer', 'default:steel_ingot'},
{'', 'technic:hv_cable0', ''}, {'', 'technic:hv_cable0', ''},
} }
}) })

View File

@ -4,11 +4,11 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_alloy_furnace', output = 'technic:lv_alloy_furnace',
recipe = { recipe = {
{'default:brick', 'default:brick', 'default:brick'}, {'default:brick', 'default:brick', 'default:brick'},
{'default:brick', 'technic:machine_casing', 'default:brick'}, {'default:brick', '', 'default:brick'},
{'default:brick', 'technic:lv_cable0', 'default:brick'}, {'default:steel_ingot', 'default:copper_ingot', 'default:steel_ingot'},
} }
}) })
technic.register_alloy_furnace({tier = "LV", speed = 1, demand = {300}}) technic.register_alloy_furnace({tier="LV", cook_time=6, demand={300}})

View File

@ -1,16 +1,43 @@
-- LV Battery box and some other nodes...
technic.register_power_tool("technic:battery", 10000)
technic.register_power_tool("technic:red_energy_crystal", 100000)
technic.register_power_tool("technic:green_energy_crystal", 250000)
technic.register_power_tool("technic:blue_energy_crystal", 500000)
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'},
}
})
minetest.register_tool("technic:battery", {
description = "RE Battery",
inventory_image = "technic_battery.png",
tool_capabilities = {
charge = 0,
max_drop_level = 0,
groupcaps = {
fleshy = {times={}, uses=10000, maxlevel=0}
}
}
})
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_battery_box0', output = 'technic:lv_battery_box0',
recipe = { recipe = {
{'group:wood', 'group:wood', 'group:wood'}, {'technic:battery', 'group:wood', 'technic:battery'},
{'technic:battery', 'technic:machine_casing', 'technic:battery'}, {'technic:battery', 'default:copper_ingot', 'technic:battery'},
{'technic:battery', 'technic:lv_cable0', 'technic:battery'}, {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
} }
}) })
technic.register_battery_box({ technic.register_battery_box({
tier = "LV", tier = "LV",
max_charge = 40000, max_charge = 50000,
charge_rate = 1000, charge_rate = 1000,
discharge_rate = 4000, discharge_rate = 4000,
charge_step = 500, charge_step = 500,

View File

@ -37,7 +37,7 @@ local twosize_products = {
local cnc_formspec = local cnc_formspec =
"invsize[9,11;]".. "invsize[9,11;]"..
"label[1,0;"..S("Choose Milling Program:").."]".. "label[1,0;Choose Milling Program:]"..
"image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]".. "image_button[1,0.5;1,1;technic_cnc_slope.png;slope; ]"..
"image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]".. "image_button[2,0.5;1,1;technic_cnc_slope_edge.png;slope_edge; ]"..
"image_button[3,0.5;1,1;technic_cnc_slope_inner_edge.png;slope_inner_edge; ]".. "image_button[3,0.5;1,1;technic_cnc_slope_inner_edge.png;slope_inner_edge; ]"..
@ -56,7 +56,7 @@ local cnc_formspec =
"image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]".. "image_button[2,2.5;1,1;technic_cnc_onecurvededge.png;onecurvededge; ]"..
"image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]".. "image_button[3,2.5;1,1;technic_cnc_twocurvededge.png;twocurvededge; ]"..
"label[1,3.5;"..S("Slim Elements half / normal height:").."]".. "label[1,3.5;Slim Elements half / normal height:]"..
"image_button[1,4;1,0.5;technic_cnc_full.png;full; ]".. "image_button[1,4;1,0.5;technic_cnc_full.png;full; ]"..
"image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]".. "image_button[1,4.5;1,0.5;technic_cnc_half.png;half; ]"..
@ -66,9 +66,9 @@ local cnc_formspec =
"image_button[5,4;1,1;technic_cnc_element_t.png;element_t; ]".. "image_button[5,4;1,1;technic_cnc_element_t.png;element_t; ]"..
"image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]".. "image_button[6,4;1,1;technic_cnc_element_edge.png;element_edge; ]"..
"label[0, 5.5;"..S("In:").."]".. "label[0, 5.5;In:]"..
"list[current_name;src;0.5,5.5;1,1;]".. "list[current_name;src;0.5,5.5;1,1;]"..
"label[4, 5.5;"..S("Out:").."]".. "label[4, 5.5;Out:]"..
"list[current_name;dst;5,5.5;4,1;]".. "list[current_name;dst;5,5.5;4,1;]"..
"list[current_player;main;0,7;8,4;]" "list[current_player;main;0,7;8,4;]"
@ -127,7 +127,7 @@ end
-- The actual block inactive state -- The actual block inactive state
minetest.register_node("technic:cnc", { minetest.register_node("technic:cnc", {
description = S("%s CNC Machine"):format("LV"), description = S("CNC Machine"),
tiles = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png", 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"}, "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"},
drawtype = "nodebox", drawtype = "nodebox",
@ -143,33 +143,45 @@ minetest.register_node("technic:cnc", {
legacy_facedir_simple = true, legacy_facedir_simple = true,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("%s CNC Machine"):format("LV")) meta:set_string("infotext", S("CNC Machine"))
meta:set_float("technic_power_machine", 1) meta:set_float("technic_power_machine", 1)
meta:set_string("formspec", cnc_formspec) meta:set_string("formspec", cnc_formspec)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("src", 1) inv:set_size("src", 1)
inv:set_size("dst", 4) inv:set_size("dst", 4)
end, end,
can_dig = technic.machine_can_dig, can_dig = function(pos,player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.get_meta(pos);
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
allow_metadata_inventory_move = technic.machine_inventory_move, if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
on_receive_fields = form_handler, on_receive_fields = form_handler,
}) })
-- Active state block -- Active state block
minetest.register_node("technic:cnc_active", { minetest.register_node("technic:cnc_active", {
description = S("%s CNC Machine"):format("LV"), description = S("CNC Machine"),
tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png", 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"}, "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
drop = "technic:cnc",
groups = {cracky=2, not_in_creative_inventory=1}, groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true, legacy_facedir_simple = true,
can_dig = technic.machine_can_dig, can_dig = function(pos,player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.get_meta(pos);
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
allow_metadata_inventory_move = technic.machine_inventory_move, if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
end
return true
end,
on_receive_fields = form_handler, on_receive_fields = form_handler,
}) })
@ -182,29 +194,36 @@ minetest.register_abm({
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local eu_input = meta:get_int("LV_EU_input") local eu_input = meta:get_int("LV_EU_input")
local machine_name = S("%s CNC Machine"):format("LV") local machine_name = S("CNC Machine")
local machine_node = "technic:cnc" local machine_node = "technic:cnc"
local demand = 450 local demand = 450
-- Setup meta data if it does not exist. state is used as an indicator of this
if not eu_input then
meta:set_int("LV_EU_demand", demand)
meta:set_int("LV_EU_input", 0)
return
end
-- Power off automatically if no longer connected to a switching station -- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "LV") technic.switching_station_timeout_count(pos, "LV")
local result = meta:get_string("cnc_product") local result = meta:get_string("cnc_product")
if inv:is_empty("src") or if inv:is_empty("src") or
(not minetest.registered_nodes[result]) or (not minetest.registered_nodes[result]) or
(not inv:room_for_item("dst", result)) then (not inv:room_for_item("dst", result)) then
technic.swap_node(pos, machine_node) hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name)) meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_string("cnc_product", "") meta:set_string("cnc_product", "")
meta:set_int("LV_EU_demand", 0)
return return
end end
if eu_input < demand then if eu_input < demand then
technic.swap_node(pos, machine_node) hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= demand then elseif eu_input >= demand then
technic.swap_node(pos, machine_node.."_active") hacky_swap_node(pos, machine_node.."_active")
meta:set_string("infotext", S("%s Active"):format(machine_name)) meta:set_string("infotext", S("%s Active"):format(machine_name))
meta:set_int("src_time", meta:get_int("src_time") + 1) meta:set_int("src_time", meta:get_int("src_time") + 1)
if meta:get_int("src_time") >= 3 then -- 3 ticks per output if meta:get_int("src_time") >= 3 then -- 3 ticks per output
@ -229,8 +248,8 @@ minetest.register_craft({
output = 'technic:cnc', output = 'technic:cnc',
recipe = { recipe = {
{'default:glass', 'technic:diamond_drill_head', 'default:glass'}, {'default:glass', 'technic:diamond_drill_head', 'default:glass'},
{'technic:control_logic_unit', 'technic:machine_casing', 'technic:motor'}, {'technic:control_logic_unit', 'technic:motor', 'default:steel_ingot'},
{'technic:carbon_steel_ingot', 'technic:lv_cable0', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'default:copper_ingot', 'default:steel_ingot'},
}, },
}) })

View File

@ -14,6 +14,13 @@ technic.cnc.programs_disable["default:dirt"] = {"technic_cnc_sphere", "technic_c
"technic_cnc_slope_edge_upsdown", "technic_cnc_slope_inner_edge_upsdown", "technic_cnc_slope_edge_upsdown", "technic_cnc_slope_inner_edge_upsdown",
"technic_cnc_stick", "technic_cnc_cylinder_horizontal"} "technic_cnc_stick", "technic_cnc_cylinder_horizontal"}
-- TREE
-------
technic.cnc.register_all("default:tree",
{snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
{"default_tree.png"},
S("Wooden"))
-- WOOD -- WOOD
------- -------
technic.cnc.register_all("default:wood", technic.cnc.register_all("default:wood",
@ -58,39 +65,10 @@ technic.cnc.register_all("default:tree",
{snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1}, {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1},
{"default_tree.png"}, {"default_tree.png"},
S("Tree")) S("Tree"))
-- STEEL
-- WROUGHT IRON
---------------
technic.cnc.register_all("default:steelblock",
{cracky=1, level=2, not_in_creative_inventory=1},
{"technic_wrought_iron_block.png"},
S("Wrought Iron"))
-- Bronze
-------- --------
technic.cnc.register_all("default:bronzeblock", technic.cnc.register_all("default:steel",
{cracky=1, level=2, not_in_creative_inventory=1}, {snappy=1, bendy=2, cracky=1, melty=2, level=2, not_in_creative_inventory=1},
{"default_bronze_block.png"}, {"default_steel_block.png"},
S("Bronze")) S("Steel"))
-- Stainless Steel
--------
technic.cnc.register_all("technic:stainless_steel_block",
{cracky=1, level=2, not_in_creative_inventory=1},
{"technic_stainless_steel_block.png"},
S("Stainless Steel"))
-- Marble
------------
technic.cnc.register_all("technic:marble",
{cracky=3, not_in_creative_inventory=1},
{"technic_marble.png"},
S("Marble"))
-- Granite
------------
technic.cnc.register_all("technic:granite",
{cracky=3, not_in_creative_inventory=1},
{"technic_granite.png"},
S("Granite"))

View File

@ -1,5 +1,5 @@
-- Fuel driven alloy furnace. This uses no EUs: -- Coal driven alloy furnace. This uses no EUs:
local S = technic.getter local S = technic.getter
@ -12,55 +12,53 @@ minetest.register_craft({
} }
}) })
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;]"
minetest.register_node("technic:coal_alloy_furnace", { minetest.register_node("technic:coal_alloy_furnace", {
description = machine_name, description = S("Coal Alloy Furnace"),
tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.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_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"},
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2}, groups = {cracky=2},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.env:get_meta(pos) local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", formspec) meta:set_string("formspec", coal_alloy_furnace_formspec)
meta:set_string("infotext", machine_name) meta:set_string("infotext", S("Coal Alloy Furnace"))
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("fuel", 1) inv:set_size("fuel", 1)
inv:set_size("src", 2) inv:set_size("src", 1)
inv:set_size("src2", 1)
inv:set_size("dst", 4) inv:set_size("dst", 4)
end, end,
can_dig = technic.machine_can_dig, can_dig = function(pos,player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.env:get_meta(pos);
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
allow_metadata_inventory_move = technic.machine_inventory_move, if not (inv:is_empty("fuel") or inv:is_empty("dst") or inv:is_empty("src") or inv:is_empty("src2") )then
return false
end
return true
end,
}) })
minetest.register_node("technic:coal_alloy_furnace_active", { minetest.register_node("technic:coal_alloy_furnace_active", {
description = machine_name, description = "Alloy Furnace",
tiles = {"technic_coal_alloy_furnace_top.png", "technic_coal_alloy_furnace_bottom.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_side.png", "technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front_active.png"},
"technic_coal_alloy_furnace_side.png", "technic_coal_alloy_furnace_front_active.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = 8, light_source = 8,
drop = "technic:coal_alloy_furnace", drop = "technic:coal_alloy_furnace",
groups = {cracky=2, not_in_creative_inventory=1}, groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
can_dig = technic.machine_can_dig, can_dig = function(pos,player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.env:get_meta(pos);
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
allow_metadata_inventory_move = technic.machine_inventory_move, if not (inv:is_empty("fuel") or inv:is_empty("dst") or
inv:is_empty("src") or inv:is_empty("src2")) then
return false
end
return true
end,
}) })
minetest.register_abm({ minetest.register_abm({
@ -70,14 +68,17 @@ minetest.register_abm({
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
if inv:get_size("src") == 1 then -- Old furnace -> convert it
inv:set_size("src", 2)
inv:set_stack("src", 2, inv:get_stack("src2", 1))
inv:set_size("src2", 0)
end
local recipe = nil local recipe = nil
local machine_name = S("Coal 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;1,1;]"..
"list[current_name;src2;3,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
for i, name in pairs({ for i, name in pairs({
"fuel_totaltime", "fuel_totaltime",
@ -90,22 +91,33 @@ minetest.register_abm({
end end
-- Get what to cook if anything -- Get what to cook if anything
local result = technic.get_recipe("alloy", inv:get_list("src")) local srcstack = inv:get_stack("src", 1)
local src2stack = inv:get_stack("src2", 1)
local recipe = technic.get_alloy_recipe(srcstack, src2stack)
if srcstack:get_name() > src2stack:get_name() then
local temp = srcstack
srcstack = src2stack
src2stack = temp
end
local was_active = false local was_active = false
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
was_active = true was_active = true
meta:set_int("fuel_time", meta:get_int("fuel_time") + 1) meta:set_int("fuel_time", meta:get_int("fuel_time") + 1)
if result then if recipe then
meta:set_int("src_time", meta:get_int("src_time") + 1) meta:set_int("src_time", meta:get_int("src_time") + 1)
if meta:get_int("src_time") >= result.time then if meta:get_int("src_time") == 6 then
meta:set_int("src_time", 0) -- check if there's room for output in "dst" list
local result_stack = ItemStack(result.output) local dst_stack = ItemStack(recipe.output)
if inv:room_for_item("dst", result_stack) then if inv:room_for_item("dst", dst_stack) then
inv:set_list("src", result.new_input) srcstack:take_item(recipe.input[1].count)
inv:add_item("dst", result_stack) inv:set_stack("src", 1, srcstack)
src2stack:take_item(recipe.input[2].count)
inv:set_stack("src2", 1, src2stack)
inv:add_item("dst", dst_stack)
end end
meta:set_int("src_time", 0)
end end
else else
meta:set_int("src_time", 0) meta:set_int("src_time", 0)
@ -116,25 +128,30 @@ minetest.register_abm({
local percent = math.floor(meta:get_float("fuel_time") / local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100) 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") hacky_swap_node(pos, "technic:coal_alloy_furnace_active")
meta:set_string("formspec", meta:set_string("formspec",
"size[8,9]".. "size[8,9]"..
"label[0,0;"..machine_name.."]".. "label[0,0;"..machine_name.."]"..
"image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
(100 - percent)..":default_furnace_fire_fg.png]".. (100 - percent)..":default_furnace_fire_fg.png]"..
"list[current_name;fuel;2,3;1,1;]".. "list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;2,1;]".. "list[current_name;src;2,1;1,1;]"..
"list[current_name;src2;3,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]".. "list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]") "list[current_player;main;0,5;8,4;]")
return return
end end
local recipe = technic.get_recipe("alloy", inv:get_list("src")) -- FIXME: Make this look more like the electrical version.
-- This code refetches the recipe to see if it can be done again after the iteration
srcstack = inv:get_stack("src", 1)
srcstack = inv:get_stack("src2", 1)
local recipe = technic.get_alloy_recipe(srcstack, src2stack)
if not recipe then if recipe then
if was_active then if was_active then
meta:set_string("infotext", S("%s is empty"):format(machine_name)) meta:set_string("infotext", "Furnace is empty")
technic.swap_node(pos, "technic:coal_alloy_furnace") hacky_swap_node(pos, "technic:coal_alloy_furnace")
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
end end
return return
@ -150,7 +167,7 @@ minetest.register_abm({
if fuel.time <= 0 then if fuel.time <= 0 then
meta:set_string("infotext", S("%s Out Of Fuel"):format(machine_name)) meta:set_string("infotext", S("%s Out Of Fuel"):format(machine_name))
technic.swap_node(pos, "technic:coal_alloy_furnace") hacky_swap_node(pos, "technic:coal_alloy_furnace")
meta:set_string("formspec", formspec) meta:set_string("formspec", formspec)
return return
end end

View File

@ -1,5 +0,0 @@
local S = technic.getter
if minetest.registered_nodes["default:furnace"].description == "Furnace" then
minetest.override_item("default:furnace", { description = S("Fuel-Fired Furnace") })
end

View File

@ -1,13 +1,170 @@
minetest.register_alias("compressor", "technic:lv_compressor") technic.compressor_recipes = {}
local S = technic.getter
technic.register_compressor_recipe = function(src, src_count, dst, dst_count)
technic.compressor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count}
if unified_inventory then
unified_inventory.register_craft({
type = "compressing",
output = dst.." "..dst_count,
items = {src.." "..src_count},
width = 0,
})
end
end
technic.get_compressor_recipe = function(item)
if technic.compressor_recipes[item.name] and
item.count >= technic.compressor_recipes[item.name].src_count then
return technic.compressor_recipes[item.name]
else
return nil
end
end
technic.register_compressor_recipe("default:snowblock", 1, "default:ice", 1)
technic.register_compressor_recipe("default:sand", 1, "default:sandstone", 1)
technic.register_compressor_recipe("default:desert_sand", 1, "default:desert_stone", 1)
technic.register_compressor_recipe("technic:mixed_metal_ingot", 1, "technic:composite_plate", 1)
technic.register_compressor_recipe("default:copper_ingot", 5, "technic:copper_plate", 1)
technic.register_compressor_recipe("technic:coal_dust", 4, "technic:graphite", 1)
technic.register_compressor_recipe("technic:carbon_cloth", 1, "technic:carbon_plate", 1)
technic.register_compressor_recipe("technic:enriched_uranium", 4, "technic:uranium_fuel", 1)
minetest.register_alias("compressor", "technic:compressor")
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_compressor', output = 'technic:compressor',
recipe = { recipe = {
{'default:stone', 'technic:motor', 'default:stone'}, {'default:stone', 'default:stone', 'default:stone'},
{'mesecons:piston', 'technic:machine_casing', 'mesecons:piston'}, {'mesecons:piston', 'technic:motor', 'mesecons:piston'},
{'default:stone', 'technic:lv_cable0', 'default:stone'}, {'default:stone', 'technic:lv_cable0', 'default:stone'},
} }
}) })
technic.register_compressor({tier = "LV", demand = {300}, speed = 1}) local compressor_formspec =
"invsize[8,9;]"..
"label[0,0;"..S("Compressor").."]"..
"list[current_name;src;3,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
minetest.register_node("technic:compressor", {
description = S("Compressor"),
tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png",
"technic_compressor_side.png", "technic_compressor_side.png",
"technic_compressor_back.png", "technic_compressor_front.png"},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Compressor"))
meta:set_string("formspec", compressor_formspec)
local inv = meta:get_inventory()
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
})
minetest.register_node("technic:compressor_active", {
description = S("Compressor"),
tiles = {"technic_compressor_top.png", "technic_compressor_bottom.png",
"technic_compressor_side.png", "technic_compressor_side.png",
"technic_compressor_back.png", "technic_compressor_front_active.png"},
paramtype2 = "facedir",
groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
})
minetest.register_abm({
nodenames = {"technic:compressor","technic:compressor_active"},
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("LV_EU_input")
local machine_name = S("Compressor")
local machine_node = "technic:compressor"
local demand = 300
-- Setup meta data if it does not exist.
if not eu_input then
meta:set_int("LV_EU_demand", demand)
meta:set_int("LV_EU_input", 0)
return
end
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "LV")
local inv = meta:get_inventory()
local empty = inv:is_empty("src")
local srcstack = inv:get_stack("src", 1)
local src_item, recipe, result = nil, nil, nil
if srcstack then
src_item = srcstack:to_table()
end
if src_item then
recipe = technic.get_compressor_recipe(src_item)
end
if recipe then
result = {name=recipe.dst_name, count=recipe.dst_count}
end
if empty or (not result) or
(not inv:room_for_item("dst", result)) then
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int("LV_EU_demand", 0)
meta:set_int("src_time", 0)
return
end
if eu_input < demand then
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= demand then
hacky_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") >= 4 then
meta:set_int("src_time", 0)
srcstack:take_item(recipe.src_count)
inv:set_stack("src", 1, srcstack)
inv:add_item("dst", result)
end
end
meta:set_int("LV_EU_demand", demand)
end
})
technic.register_machine("LV", "technic:compressor", technic.receiver)
technic.register_machine("LV", "technic:compressor_active", technic.receiver)

View File

@ -5,9 +5,9 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:electric_furnace', output = 'technic:electric_furnace',
recipe = { recipe = {
{'default:cobble', 'default:cobble', 'default:cobble'}, {'default:cobble', 'default:cobble', 'default:cobble'},
{'default:cobble', 'technic:machine_casing', 'default:cobble'}, {'default:cobble', '', 'default:cobble'},
{'default:cobble', 'technic:lv_cable0', 'default:cobble'}, {'default:steel_ingot', 'moreores:copper_ingot', 'default:steel_ingot'},
} }
}) })

View File

@ -1,13 +1,178 @@
minetest.register_alias("extractor", "technic:lv_extractor") technic.extractor_recipes ={}
local S = technic.getter
technic.register_extractor_recipe = function(src, src_count, dst, dst_count)
technic.extractor_recipes[src] = {src_count = src_count, dst_name = dst, dst_count = dst_count}
if unified_inventory then
unified_inventory.register_craft({
type = "extracting",
output = dst.." "..dst_count,
items = {src.." "..src_count},
width = 0,
})
end
end
-- Receive an ItemStack of result by an ItemStack input
technic.get_extractor_recipe = function(item)
if technic.extractor_recipes[item.name] and
item.count >= technic.extractor_recipes[item.name].src_count then
return technic.extractor_recipes[item.name]
else
return nil
end
end
technic.register_extractor_recipe("technic:coal_dust", 1, "dye:black", 2)
technic.register_extractor_recipe("default:cactus", 1, "dye:green", 2)
technic.register_extractor_recipe("default:dry_shrub", 1, "dye:brown", 2)
technic.register_extractor_recipe("flowers:geranium", 1, "dye:blue", 2)
technic.register_extractor_recipe("flowers:dandelion_white", 1, "dye:white", 2)
technic.register_extractor_recipe("flowers:dandelion_yellow", 1, "dye:yellow", 2)
technic.register_extractor_recipe("flowers:tulip", 1, "dye:orange", 2)
technic.register_extractor_recipe("flowers:rose", 1, "dye:red", 2)
technic.register_extractor_recipe("flowers:viola", 1, "dye:violet", 2)
technic.register_extractor_recipe("technic:raw_latex", 1, "technic:rubber", 3)
technic.register_extractor_recipe("moretrees:rubber_tree_trunk_empty", 1, "technic:rubber", 1)
technic.register_extractor_recipe("moretrees:rubber_tree_trunk", 1, "technic:rubber", 1)
technic.register_extractor_recipe("technic:uranium", 5, "technic:enriched_uranium", 1)
minetest.register_alias("extractor", "technic:extractor")
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_extractor', output = 'technic:extractor',
recipe = { recipe = {
{'technic:treetap', 'technic:motor', 'technic:treetap'}, {'technic:treetap', 'technic:motor', 'technic:treetap'},
{'technic:treetap', 'technic:machine_casing', 'technic:treetap'}, {'technic:treetap', 'technic:lv_cable0', 'technic:treetap'},
{'', 'technic:lv_cable0', ''}, {'', '', ''},
} }
}) })
technic.register_extractor({tier = "LV", demand = {300}, speed = 1}) local extractor_formspec =
"invsize[8,9;]"..
"label[0,0;"..S("Extractor").."]"..
"list[current_name;src;3,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"
minetest.register_node("technic:extractor", {
description = S("Extractor"),
tiles = {"technic_lv_grinder_top.png", "technic_lv_grinder_bottom.png", "technic_lv_grinder_side.png",
"technic_lv_grinder_side.png", "technic_lv_grinder_side.png", "technic_lv_grinder_front.png"},
paramtype2 = "facedir",
groups = {cracky=2},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Extractor"))
meta:set_string("formspec", extractor_formspec)
local inv = meta:get_inventory()
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
})
minetest.register_node("technic:extractor_active", {
description = S("Extractor"),
tiles = {"technic_lv_grinder_top.png", "technic_lv_grinder_bottom.png",
"technic_lv_grinder_side.png", "technic_lv_grinder_side.png",
"technic_lv_grinder_side.png", "technic_lv_grinder_front_active.png"},
paramtype2 = "facedir",
groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
})
minetest.register_abm({
nodenames = {"technic:extractor", "technic:extractor_active"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
-- The machine will automatically shut down if disconnected from power in some fashion.
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local srcstack = inv:get_stack("src", 1)
local eu_input = meta:get_int("LV_EU_input")
-- Machine information
local machine_name = S("Extractor")
local machine_node = "technic:extractor"
local demand = 300
-- Setup meta data if it does not exist.
if not eu_input then
meta:set_int("LV_EU_demand", demand)
meta:set_int("LV_EU_input", 0)
return
end
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "LV")
if srcstack then
src_item = srcstack:to_table()
end
if src_item then
recipe = technic.get_extractor_recipe(src_item)
end
if recipe then
result = {name=recipe.dst_name, count=recipe.dst_count}
end
if inv:is_empty("src") or (not recipe) or (not result) or
(not inv:room_for_item("dst", result)) then
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int("LV_EU_demand", 0)
return
end
if eu_input < demand then
-- unpowered - go idle
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= demand then
-- Powered
hacky_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") >= 4 then -- 4 ticks per output
meta:set_int("src_time", 0)
srcstack:take_item(recipe.src_count)
inv:set_stack("src", 1, srcstack)
inv:add_item("dst", result)
end
end
meta:set_int("LV_EU_demand", demand)
end
})
technic.register_machine("LV", "technic:extractor", technic.receiver)
technic.register_machine("LV", "technic:extractor_active", technic.receiver)

View File

@ -8,9 +8,9 @@ minetest.register_alias("lv_generator", "technic:lv_generator")
minetest.register_craft({ minetest.register_craft({
output = 'technic:lv_generator', output = 'technic:lv_generator',
recipe = { recipe = {
{'default:stone', 'default:stone', 'default:stone'}, {'default:stone', 'default:stone', 'default:stone'},
{'default:stone', 'technic:machine_casing', 'default:stone'}, {'default:stone', '', 'default:stone'},
{'default:stone', 'technic:lv_cable0', 'default:stone'}, {'default:stone', 'default:copper_ingot', 'default:stone'},
} }
}) })

View File

@ -10,18 +10,24 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:geothermal', output = 'technic:geothermal',
recipe = { recipe = {
{'default:stone', 'default:diamond', 'default:stone'}, {'default:stone', 'default:stone', 'default:stone'},
{'default:copper_ingot', 'technic:machine_casing', 'default:copper_ingot'}, {'default:copper_ingot', 'default:diamond', 'default:copper_ingot'},
{'default:stone', 'technic:lv_cable0', 'default:stone'}, {'default:stone', 'default:copper_ingot', 'default:stone'},
} }
}) })
minetest.register_craftitem("technic:geothermal", { minetest.register_craftitem("technic:geothermal", {
description = S("Geothermal %s Generator"):format("LV"), description = S("Geothermal Generator"),
}) })
local geothermal_formspec =
"invsize[8,4;]"..
"label[0,0;"..S("Geothermal Generator").."]"..
"list[current_player;main;0,5;8,4;]"
minetest.register_node("technic:geothermal", { minetest.register_node("technic:geothermal", {
description = S("Geothermal %s Generator"):format("LV"), description = S("Geothermal Generator"),
tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png", 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"}, "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
@ -30,13 +36,14 @@ minetest.register_node("technic:geothermal", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Geothermal %s Generator"):format("LV")) meta:set_string("infotext", S("Geothermal Generator"))
meta:set_int("LV_EU_supply", 0) meta:set_int("LV_EU_supply", 0)
meta:set_string("formspec", geothermal_formspec)
end, end,
}) })
minetest.register_node("technic:geothermal_active", { minetest.register_node("technic:geothermal_active", {
description = S("Geothermal %s Generator"):format("LV"), description = S("Geothermal Generator"),
tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.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"}, "technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
@ -95,15 +102,17 @@ minetest.register_abm({
meta:set_int("LV_EU_supply", eu_supply) meta:set_int("LV_EU_supply", eu_supply)
end end
meta:set_string("infotext", meta:set_string("formspec",
S("Geothermal %s Generator"):format("LV").." ("..production_level.."%)") "invsize[8,4;]"..
"label[0,0;"..S("Geothermal Generator").."]"..
"label[4,0;"..S("Production at %d%%"):format(production_level).."]")
if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then
technic.swap_node (pos, "technic:geothermal_active") hacky_swap_node (pos, "technic:geothermal_active")
return return
end end
if production_level == 0 then if production_level == 0 then
technic.swap_node(pos, "technic:geothermal") hacky_swap_node(pos, "technic:geothermal")
meta:set_int("LV_EU_supply", 0) meta:set_int("LV_EU_supply", 0)
end end
end end

View File

@ -3,9 +3,9 @@ minetest.register_alias("grinder", "technic:grinder")
minetest.register_craft({ minetest.register_craft({
output = 'technic:grinder', output = 'technic:grinder',
recipe = { recipe = {
{'default:desert_stone', 'default:diamond', 'default:desert_stone'}, {'default:desert_stone', 'default:desert_stone', 'default:desert_stone'},
{'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'}, {'default:desert_stone', 'default:diamond', 'default:desert_stone'},
{'default:stone', 'technic:lv_cable0', 'default:stone'}, {'default:stone', 'moreores:copper_ingot', 'default:stone'},
} }
}) })

View File

@ -3,31 +3,20 @@ 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.."/cables.lua")
dofile(path.."/battery_box.lua") dofile(path.."/battery_box.lua")
dofile(path.."/alloy_furnace.lua")
-- Generators dofile(path.."/coal_alloy_furnace.lua")
dofile(path.."/solar_panel.lua") dofile(path.."/solar_panel.lua")
dofile(path.."/solar_array.lua") dofile(path.."/solar_array.lua")
dofile(path.."/geothermal.lua") dofile(path.."/geothermal.lua")
dofile(path.."/water_mill.lua") dofile(path.."/water_mill.lua")
dofile(path.."/generator.lua") dofile(path.."/generator.lua")
-- Coal-powered machines (TODO -> move to somewhere else?)
dofile(path.."/coal_alloy_furnace.lua")
dofile(path.."/coal_furnace.lua")
-- Machines
dofile(path.."/alloy_furnace.lua")
dofile(path.."/electric_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.."/grinder.lua")
dofile(path.."/cnc.lua") dofile(path.."/cnc.lua")
dofile(path.."/cnc_api.lua") dofile(path.."/cnc_api.lua")
dofile(path.."/cnc_nodes.lua") dofile(path.."/cnc_nodes.lua")
dofile(path.."/extractor.lua")
dofile(path.."/compressor.lua")

View File

@ -7,17 +7,15 @@ minetest.register_alias("music_player", "technic:music_player")
minetest.register_craft({ minetest.register_craft({
output = 'technic:music_player', output = 'technic:music_player',
recipe = { recipe = {
{'group:wood', 'default:diamond', 'group:wood'}, {'group:wood', 'group:wood', 'group:wood'},
{'default:diamond', 'technic:machine_casing', 'default:diamond'}, {'default:diamond', 'default:diamond', 'default:diamond'},
{'default:stone', 'technic:lv_cable0', 'default:stone'}, {'default:stone', 'default:copper_ingot', 'default:stone'},
} }
}) })
local music_handles = {}
local music_player_formspec = local music_player_formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"label[0,0;"..S("%s Music Player"):format("LV").."]".. "label[0,0;"..S("Music Player").."]"..
"button[4,1;1,1;track1;1]".. "button[4,1;1,1;track1;1]"..
"button[5,1;1,1;track2;2]".. "button[5,1;1,1;track2;2]"..
"button[6,1;1,1;track3;3]".. "button[6,1;1,1;track3;3]"..
@ -29,30 +27,24 @@ local music_player_formspec =
"button[6,3;1,1;track9;9]".. "button[6,3;1,1;track9;9]"..
"button[4,4;1,2;play;Play]".. "button[4,4;1,2;play;Play]"..
"button[6,4;1,2;stop;Stop]".. "button[6,4;1,2;stop;Stop]"..
"label[4,0;"..S("Current track %s"):format("--").."]" "label[4,0;Current track --]"
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,})
end
minetest.register_node("technic:music_player", { minetest.register_node("technic:music_player", {
description = S("%s Music Player"):format("LV"), description = S("Music Player"),
tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png", 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"}, "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}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("%s Music Player"):format("LV")) meta:set_string("infotext", S("Music Player"))
meta:set_int("active", 0) meta:set_int("active", 0)
meta:set_int("current_track", 1) meta:set_int("current_track", 1)
meta:set_string("formspec", music_player_formspec) meta:set_string("formspec", music_player_formspec)
end, end,
on_receive_fields = function(pos, formanme, fields, sender) on_receive_fields = function(pos, formanme, fields, sender)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local pos_hash = minetest.hash_node_position(pos) local music_handle = meta:get_int("music_handle")
local music_handle = music_handles[pos_hash]
local current_track = meta:get_int("current_track") local current_track = meta:get_int("current_track")
if fields.track1 then current_track = 1 end if fields.track1 then current_track = 1 end
if fields.track2 then current_track = 2 end if fields.track2 then current_track = 2 end
@ -66,7 +58,7 @@ minetest.register_node("technic:music_player", {
meta:set_int("current_track", current_track) meta:set_int("current_track", current_track)
meta:set_string("formspec", meta:set_string("formspec",
"invsize[8,9;]".. "invsize[8,9;]"..
"label[0,0;"..S("%s Music Player"):format("LV").."]".. "label[0,0;"..S("Music Player").."]"..
"button[4,1;1,1;track1;1]".. "button[4,1;1,1;track1;1]"..
"button[5,1;1,1;track2;2]".. "button[5,1;1,1;track2;2]"..
"button[6,1;1,1;track3;3]".. "button[6,1;1,1;track3;3]"..
@ -78,13 +70,12 @@ minetest.register_node("technic:music_player", {
"button[6,3;1,1;track9;9]".. "button[6,3;1,1;track9;9]"..
"button[4,4;1,2;play;Play]".. "button[4,4;1,2;play;Play]"..
"button[6,4;1,2;stop;Stop]".. "button[6,4;1,2;stop;Stop]"..
"label[4,0;"..S("Current track %s") "label[4,0;Current track "
:format(current_track).."]") ..current_track.."]")
if fields.play then if fields.play then
if music_handle then if music_handle then
minetest.sound_stop(music_handle) minetest.sound_stop(music_handle)
end end
music_handle = play_track(pos, current_track)
meta:set_int("active", 1) meta:set_int("active", 1)
end end
if fields.stop then if fields.stop then
@ -93,7 +84,7 @@ minetest.register_node("technic:music_player", {
minetest.sound_stop(music_handle) minetest.sound_stop(music_handle)
end end
end end
music_handles[pos_hash] = music_handle meta:set_int("music_handle", music_handle)
end, end,
}) })
@ -104,13 +95,12 @@ minetest.register_abm({
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local eu_input = meta:get_int("LV_EU_input") local eu_input = meta:get_int("LV_EU_input")
local machine_name = S("%s Music Player"):format("LV") local machine_name = S("Music Player")
local machine_node = "technic:music_player" local machine_node = "technic:music_player"
local demand = 150 local demand = 150
local music_handle = meta:get_int("music_handle")
local current_track = meta:get_int("current_track") local current_track = meta:get_int("current_track")
local pos_hash = minetest.hash_node_position(pos)
local music_handle = music_handles[pos_hash]
-- Setup meta data if it does not exist. -- Setup meta data if it does not exist.
if not eu_input then if not eu_input then
@ -125,6 +115,9 @@ minetest.register_abm({
if meta:get_int("active") == 0 then if meta:get_int("active") == 0 then
meta:set_string("infotext", S("%s Idle"):format(machine_name)) meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int("LV_EU_demand", 0) meta:set_int("LV_EU_demand", 0)
if music_handle then
minetest.sound_stop(music_handle)
end
return return
end end
@ -132,15 +125,13 @@ minetest.register_abm({
meta:set_string("infotext", S("%s Unpowered"):format(machine_name)) meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
if music_handle then if music_handle then
minetest.sound_stop(music_handle) minetest.sound_stop(music_handle)
music_handle = nil
end end
elseif eu_input >= demand then elseif eu_input >= demand then
meta:set_string("infotext", S("%s Active"):format(machine_name)) meta:set_string("infotext", S("%s Active"):format(machine_name))
if not music_handle then music_handle = minetest.sound_play("technic_track"..current_track,
music_handle = play_track(pos, current_track) {pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,})
end meta:set_int("music_handle", music_handle)
end end
music_handles[pos_hash] = music_handle
meta:set_int("LV_EU_demand", demand) meta:set_int("LV_EU_demand", demand)
end end
}) })

View File

@ -8,9 +8,9 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:solar_array_lv 1', output = 'technic:solar_array_lv 1',
recipe = { recipe = {
{'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel'}, {'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel'},
{'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'technic:lv_transformer', 'default:steel_ingot'},
{'', 'technic:lv_cable0', ''}, {'', 'technic:lv_cable0', ''},
} }
}) })

View File

@ -9,7 +9,7 @@ minetest.register_node("technic:solar_panel", {
"technic_solar_panel_side.png", "technic_solar_panel_side.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}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
description = S("Small Solar %s Generator"):format("LV"), description = S("Solar Panel"),
active = false, active = false,
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
@ -21,7 +21,7 @@ minetest.register_node("technic:solar_panel", {
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int("LV_EU_supply", 0) meta:set_int("LV_EU_supply", 0)
meta:set_string("infotext", S("Small Solar %s Generator"):format("LV")) meta:set_string("infotext", S("Solar Panel"))
end, end,
}) })
@ -29,7 +29,7 @@ minetest.register_craft({
output = 'technic:solar_panel', output = 'technic:solar_panel',
recipe = { recipe = {
{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'}, {'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'},
{'technic:wrought_iron_ingot', 'technic:lv_cable0', 'technic:wrought_iron_ingot'}, {'default:steel_ingot', 'technic:lv_cable0', 'default:steel_ingot'},
} }
}) })
@ -48,7 +48,7 @@ minetest.register_abm({
-- To take care of some of it solar panels do not work outside daylight hours or if -- To take care of some of it solar panels do not work outside daylight hours or if
-- built below -10m -- built below -10m
local pos1 = {x=pos.x, y=pos.y+1, z=pos.z} local pos1 = {x=pos.x, y=pos.y+1, z=pos.z}
local machine_name = S("Small Solar %s Generator"):format("LV") local machine_name = S("Solar Panel")
local light = minetest.get_node_light(pos1, nil) local light = minetest.get_node_light(pos1, nil)
local time_of_day = minetest.get_timeofday() local time_of_day = minetest.get_timeofday()

View File

@ -9,14 +9,14 @@ minetest.register_alias("water_mill", "technic:water_mill")
minetest.register_craft({ minetest.register_craft({
output = 'technic:water_mill', output = 'technic:water_mill',
recipe = { recipe = {
{'default:stone', 'default:diamond', 'default:stone'}, {'default:stone', 'default:stone', 'default:stone'},
{'group:wood', 'technic:machine_casing', 'group:wood'}, {'group:wood', 'default:diamond', 'group:wood'},
{'default:stone', 'technic:lv_cable0', 'default:stone'}, {'default:stone', 'default:copper_ingot', 'default:stone'},
} }
}) })
minetest.register_node("technic:water_mill", { minetest.register_node("technic:water_mill", {
description = S("Hydro %s Generator"):format("LV"), description = S("Water Mill"),
tiles = {"technic_water_mill_top.png", "technic_machine_bottom.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",
"technic_water_mill_side.png", "technic_water_mill_side.png"}, "technic_water_mill_side.png", "technic_water_mill_side.png"},
@ -26,13 +26,13 @@ minetest.register_node("technic:water_mill", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Hydro %s Generator"):format("LV")) meta:set_string("infotext", S("Water Mill"))
meta:set_int("LV_EU_supply", 0) meta:set_int("LV_EU_supply", 0)
end, end,
}) })
minetest.register_node("technic:water_mill_active", { minetest.register_node("technic:water_mill_active", {
description = S("Hydro %s Generator"):format("LV"), description = S("Water Mill"),
tiles = {"technic_water_mill_top_active.png", "technic_machine_bottom.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",
"technic_water_mill_side.png", "technic_water_mill_side.png"}, "technic_water_mill_side.png", "technic_water_mill_side.png"},
@ -85,16 +85,16 @@ minetest.register_abm({
end end
meta:set_string("infotext", meta:set_string("infotext",
S("Hydro %s Generator"):format("LV").." ("..production_level.."%)") S("Water Mill").." ("..production_level.."%)")
if production_level > 0 and if production_level > 0 and
minetest.get_node(pos).name == "technic:water_mill" then minetest.get_node(pos).name == "technic:water_mill" then
technic.swap_node (pos, "technic:water_mill_active") hacky_swap_node (pos, "technic:water_mill_active")
meta:set_int("LV_EU_supply", 0) meta:set_int("LV_EU_supply", 0)
return return
end end
if production_level == 0 then if production_level == 0 then
technic.swap_node(pos, "technic:water_mill") hacky_swap_node(pos, "technic:water_mill")
end end
end end
}) })

View File

@ -4,11 +4,11 @@ minetest.register_craft({
output = 'technic:mv_alloy_furnace', output = 'technic:mv_alloy_furnace',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_alloy_furnace', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:lv_alloy_furnace', 'technic:stainless_steel_ingot'},
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, {'pipeworks:tube_000000', 'technic:mv_transformer', 'pipeworks:tube_000000'},
{'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:mv_cable0', '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", cook_time=4, upgrade=1, tube=1, demand={3000, 2000, 1000}})

View File

@ -11,12 +11,10 @@ minetest.register_craft({
technic.register_battery_box({ technic.register_battery_box({
tier = "MV", tier = "MV",
max_charge = 200000, max_charge = 300000,
charge_rate = 20000, charge_rate = 20000,
discharge_rate = 80000, discharge_rate = 80000,
charge_step = 2000, charge_step = 2000,
discharge_step = 8000, discharge_step = 8000,
upgrade = 1,
tube = 1,
}) })

View File

@ -1,12 +0,0 @@
-- MV compressor
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_cable0', 'technic:stainless_steel_ingot'},
}
})
technic.register_compressor({tier = "MV", demand = {800, 600, 400}, speed = 2, upgrade = 1, tube = 1})

View File

@ -9,7 +9,7 @@ minetest.register_craft({
output = 'technic:mv_electric_furnace', output = 'technic:mv_electric_furnace',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'},
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, {'pipeworks:tube_000000', 'technic:mv_transformer', 'pipeworks:tube_000000'},
{'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'},
} }
}) })

View File

@ -1,12 +0,0 @@
-- MV extractor
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_cable0', 'technic:stainless_steel_ingot'},
}
})
technic.register_extractor({tier = "MV", demand = {800, 600, 400}, speed = 2, upgrade = 1, tube = 1})

View File

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

View File

@ -4,7 +4,7 @@ minetest.register_craft({
output = 'technic:mv_grinder', output = 'technic:mv_grinder',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_grinder', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:lv_grinder', 'technic:stainless_steel_ingot'},
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'}, {'pipeworks:tube_000000', 'technic:mv_transformer', 'pipeworks:tube_000000'},
{'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'},
} }
}) })

View File

@ -3,29 +3,20 @@ technic.register_tier("MV", "Medium Voltage")
local path = technic.modpath.."/machines/MV" local path = technic.modpath.."/machines/MV"
-- Wiring stuff dofile(path.."/alloy_furnace.lua")
dofile(path.."/cables.lua")
dofile(path.."/battery_box.lua") dofile(path.."/battery_box.lua")
dofile(path.."/cables.lua")
-- Generators dofile(path.."/electric_furnace.lua")
dofile(path.."/grinder.lua")
dofile(path.."/solar_array.lua")
dofile(path.."/tool_workshop.lua")
if technic.config:get_bool("enable_wind_mill") then if technic.config:get_bool("enable_wind_mill") then
dofile(path.."/wind_mill.lua") dofile(path.."/wind_mill.lua")
end end
dofile(path.."/generator.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.."/tool_workshop.lua")
-- The power radiator supplies appliances with inductive coupled power: -- The power radiator supplies appliances with inductive coupled power:
-- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric. -- Lighting and associated textures is taken directly from VanessaE's homedecor and made electric.
-- This is currently useless, slow, and mostly copied dofile(path.."/power_radiator.lua")
--dofile(path.."/power_radiator.lua") dofile(path.."/lighting.lua")
--dofile(path.."/lighting.lua")

View File

@ -43,7 +43,7 @@ end
technic.inductive_on_punch_off = function(pos, eu_charge, swapnode) technic.inductive_on_punch_off = function(pos, eu_charge, swapnode)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_string("has_supply") ~= "" then if meta:get_string("has_supply") ~= "" then
technic.swap_node(pos, swapnode) hacky_swap_node(pos, swapnode)
meta:set_int("active", 1) meta:set_int("active", 1)
meta:set_int("EU_charge",eu_charge) meta:set_int("EU_charge",eu_charge)
--print("-----------") --print("-----------")
@ -56,7 +56,7 @@ end
technic.inductive_on_punch_on = function(pos, eu_charge, swapnode) technic.inductive_on_punch_on = function(pos, eu_charge, swapnode)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
technic.swap_node(pos, swapnode) hacky_swap_node(pos, swapnode)
meta:set_int("active", 0) meta:set_int("active", 0)
meta:set_int("EU_charge",eu_charge) meta:set_int("EU_charge",eu_charge)
--print("-----------") --print("-----------")
@ -82,7 +82,7 @@ local shutdown_inductive_appliances = function(pos)
local nodename = minetest.get_node(pos1).name local nodename = minetest.get_node(pos1).name
-- Swap the node and make sure it is off and unpowered -- Swap the node and make sure it is off and unpowered
if string.sub(nodename, -7) == "_active" then if string.sub(nodename, -7) == "_active" then
technic.swap_node(pos1, string.sub(nodename, 1, -8)) hacky_swap_node(pos1, string.sub(nodename, 1, -8))
meta1:set_int("active", 0) meta1:set_int("active", 0)
meta1:set_int("EU_charge", 0) meta1:set_int("EU_charge", 0)
end end
@ -108,7 +108,7 @@ local toggle_on_off_inductive_appliances = function(pos, node, puncher)
end end
minetest.register_node("technic:power_radiator", { minetest.register_node("technic:power_radiator", {
description = "MV Power Radiator", description = "Power Radiator",
tiles = {"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", tiles = {"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png",
"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, "technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"},
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
@ -124,7 +124,7 @@ minetest.register_node("technic:power_radiator", {
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_int("MV_EU_demand",1) -- Demand on the primary side when idle meta:set_int("MV_EU_demand",1) -- Demand on the primary side when idle
meta:set_int("connected_EU_demand",0) -- Potential demand of connected appliances meta:set_int("connected_EU_demand",0) -- Potential demand of connected appliances
meta:set_string("infotext", "MV Power Radiator") meta:set_string("infotext", "Power Radiator")
end, end,
on_dig = function(pos, node, digger) on_dig = function(pos, node, digger)
shutdown_inductive_appliances(pos) shutdown_inductive_appliances(pos)
@ -138,9 +138,9 @@ minetest.register_node("technic:power_radiator", {
minetest.register_craft({ minetest.register_craft({
output = 'technic:power_radiator 1', output = 'technic:power_radiator 1',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
{'technic:copper_coil', 'technic:machine_casing', 'technic:copper_coil'}, {'technic:copper_coil', 'technic:mv_transformer', 'technic:copper_coil'},
{'technic:rubber', 'technic:mv_cable0', 'technic:rubber'}, {'technic:rubber', 'technic:mv_cable0', 'technic:rubber'},
} }
}) })
@ -158,7 +158,7 @@ minetest.register_abm({
if eu_input == 0 then if eu_input == 0 then
-- No power -- No power
meta:set_string("infotext", "MV Power Radiator is unpowered"); meta:set_string("infotext", "Power Radiator is unpowered");
-- meta:set_int("active", 1) -- used for setting textures someday maybe -- meta:set_int("active", 1) -- used for setting textures someday maybe
shutdown_inductive_appliances(pos) shutdown_inductive_appliances(pos)
meta:set_int("connected_EU_demand", 0) meta:set_int("connected_EU_demand", 0)
@ -201,7 +201,7 @@ minetest.register_abm({
-- The appliance has power from this node. Spend power if it is on. -- 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) used_charge = used_charge + math.floor(meta1:get_int("EU_charge") / eff_factor)
end end
meta:set_string("infotext", "MV Power Radiator is powered (" meta:set_string("infotext", "Power Radiator is powered ("
..math.floor(used_charge / max_charge * 100) ..math.floor(used_charge / max_charge * 100)
.."% of maximum power)"); .."% of maximum power)");
if used_charge == 0 then if used_charge == 0 then

View File

@ -2,13 +2,11 @@
minetest.register_craft({ minetest.register_craft({
output = 'technic:solar_array_mv 1', output = 'technic:solar_array_mv 1',
recipe = { recipe = {
{'technic:solar_array_lv', 'technic:solar_array_lv', 'technic:solar_array_lv'}, {'technic:solar_array_lv', 'technic:solar_array_lv', 'technic:solar_array_lv'},
{'technic:carbon_steel_ingot', 'technic:mv_transformer', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'technic:mv_transformer', 'default:steel_ingot'},
{'', 'technic:mv_cable0', ''}, {'', 'technic:mv_cable0', ''},
} }
}) })
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")

View File

@ -8,34 +8,41 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:tool_workshop', output = 'technic:tool_workshop',
recipe = { recipe = {
{'group:wood', 'default:diamond', 'group:wood'}, {'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'technic:machine_casing', 'group:wood'}, {'group:wood', 'default:diamond', 'group:wood'},
{'default:stone', 'technic:mv_cable0', 'default:stone'}, {'default:stone', 'default:copper_ingot', 'default:stone'},
} }
}) })
local workshop_formspec = local workshop_formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"list[current_name;src;3,1;1,1;]".. "list[current_name;src;3,1;1,1;]"..
"label[0,0;"..S("%s Tool Workshop"):format("MV").."]".. "label[0,0;"..S("Tool Workshop").."]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"
minetest.register_node("technic:tool_workshop", { minetest.register_node("technic:tool_workshop", {
description = S("%s Tool Workshop"):format("MV"), description = S("Tool Workshop"),
tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png", 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"}, "technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("%s Tool Workshop"):format("MV")) meta:set_string("infotext", S("Tool Workshop"))
meta:set_string("formspec", workshop_formspec) meta:set_string("formspec", workshop_formspec)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("src", 1) inv:set_size("src", 1)
end, end,
can_dig = technic.machine_can_dig, can_dig = function(pos,player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.get_meta(pos);
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
if not inv:is_empty("src") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
end
return true
end,
}) })
minetest.register_abm({ minetest.register_abm({
@ -46,7 +53,7 @@ minetest.register_abm({
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local eu_input = meta:get_int("MV_EU_input") local eu_input = meta:get_int("MV_EU_input")
local machine_name = S("%s Tool Workshop"):format("MV") local machine_name = S("Tool Workshop")
local machine_node = "technic:tool_workshop" local machine_node = "technic:tool_workshop"
local demand = 5000 local demand = 5000
@ -60,18 +67,11 @@ minetest.register_abm({
-- Power off automatically if no longer connected to a switching station -- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, "MV") technic.switching_station_timeout_count(pos, "MV")
local repairable = false srcstack = inv:get_stack("src", 1)
local srcstack = inv:get_stack("src", 1) if inv:is_empty("src") or
if not srcstack:is_empty() then srcstack:get_wear() == 0 or
local itemdef = minetest.registered_items[srcstack:get_name()] srcstack:get_name() == "technic:water_can" or
if itemdef and srcstack:get_name() == "technic:lava_can" then
(not itemdef.wear_represents or
itemdef.wear_represents == "mechanical_wear") and
srcstack:get_wear() ~= 0 then
repairable = true
end
end
if not repairable then
meta:set_string("infotext", S("%s Idle"):format(machine_name)) meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int("MV_EU_demand", 0) meta:set_int("MV_EU_demand", 0)
return return

View File

@ -4,25 +4,25 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = 'technic:wind_mill_frame 5', output = 'technic:wind_mill_frame 5',
recipe = { recipe = {
{'technic:carbon_steel_ingot', '', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', '', 'default:steel_ingot'},
{'', 'technic:carbon_steel_ingot', ''}, {'', 'default:steel_ingot', ''},
{'technic:carbon_steel_ingot', '', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', '', 'default:steel_ingot'},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'technic:wind_mill', output = 'technic:wind_mill',
recipe = { recipe = {
{'', 'technic:motor', ''}, {'', 'default:steel_ingot', ''},
{'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot'}, {'default:steel_ingot', 'technic:motor', 'default:steel_ingot'},
{'', 'technic:mv_cable0', ''}, {'', 'default:steelblock', ''},
} }
}) })
minetest.register_node("technic:wind_mill_frame", { minetest.register_node("technic:wind_mill_frame", {
description = S("Wind Mill Frame"), description = S("Wind Mill Frame"),
drawtype = "glasslike_framed", drawtype = "glasslike_framed",
tiles = {"technic_carbon_steel_block.png", "default_glass.png"}, tiles = {"default_steel_block.png", "default_glass.png"},
sunlight_propagates = true, sunlight_propagates = true,
groups = {cracky=3}, groups = {cracky=3},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
@ -30,8 +30,8 @@ minetest.register_node("technic:wind_mill_frame", {
}) })
minetest.register_node("technic:wind_mill", { minetest.register_node("technic:wind_mill", {
description = S("Wind %s Generator"):format("MV"), description = S("Wind Mill"),
tiles = {"technic_carbon_steel_block.png"}, tiles = {"default_steel_block.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=1}, groups = {cracky=1},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
@ -48,7 +48,7 @@ minetest.register_node("technic:wind_mill", {
}, },
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Wind %s Generator"):format("MV")) meta:set_string("infotext", S("Wind Mill"))
meta:set_int("MV_EU_supply", 0) meta:set_int("MV_EU_supply", 0)
end, end,
}) })
@ -72,7 +72,7 @@ minetest.register_abm({
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local machine_name = S("Wind %s Generator"):format("MV") local machine_name = S("Wind Mill")
local power = math.min(pos.y * 100, 5000) local power = math.min(pos.y * 100, 5000)
if not check_wind_mill(pos) then if not check_wind_mill(pos) then

View File

@ -1,7 +1,278 @@
local S = technic.getter minetest.register_craft({
type = "shapeless",
output = 'technic:constructor_mk1_off 1',
recipe = {'technic:nodebreaker_off', 'technic:deployer_off'},
local function deploy_node(inv, slot_name, pos1, node1, node) })
minetest.register_craft({
type = "shapeless",
output = 'technic:constructor_mk2_off 1',
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'},
})
mk1_on = function(pos, node)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local pos1={}
pos1.x=pos.x
pos1.y=pos.y
pos1.z=pos.z
if node.param2==3 then pos1.x=pos1.x+1 end
if node.param2==2 then pos1.z=pos1.z+1 end
if node.param2==1 then pos1.x=pos1.x-1 end
if node.param2==0 then pos1.z=pos1.z-1 end
if node.name == "technic:constructor_mk1_off" then
hacky_swap_node(pos,"technic:constructor_mk1_on")
nodeupdate(pos)
local node1=minetest.get_node(pos1)
deploy_node (inv,"slot1",pos1,node1,node)
end
end
mk1_off = function(pos, node)
if node.name == "technic:constructor_mk1_on" then
hacky_swap_node(pos,"technic:constructor_mk1_off")
nodeupdate(pos)
end
end
minetest.register_node("technic:constructor_mk1_off", {
description = "Constructor MK1",
tile_images = {"technic_constructor_mk1_top_off.png","technic_constructor_mk1_bottom_off.png","technic_constructor_mk1_side2_off.png","technic_constructor_mk1_side1_off.png",
"technic_constructor_back.png","technic_constructor_front_off.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2},
mesecons= {effector={action_on=mk1_on}},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;Constructor MK1]"..
"label[5,0;Slot 1]"..
"list[current_name;slot1;6,0;1,1;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Constructor MK1")
local inv = meta:get_inventory()
inv:set_size("slot1", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("slot1")
end,
})
minetest.register_node("technic:constructor_mk1_on", {
description = "Constructor MK1",
tile_images = {"technic_constructor_mk1_top_on.png","technic_constructor_mk1_bottom_on.png","technic_constructor_mk1_side2_on.png","technic_constructor_mk1_side1_on.png",
"technic_constructor_back.png","technic_constructor_front_on.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon = 2,not_in_creative_inventory=1},
mesecons= {effector={action_off=mk1_off}},
sounds = default.node_sound_stone_defaults(),
})
--Constructor MK2
mk2_on = function(pos, node)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local pos1={}
local pos2={}
pos1.x=pos.x
pos1.y=pos.y
pos1.z=pos.z
pos2.x=pos.x
pos2.y=pos.y
pos2.z=pos.z
if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 end
if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 end
if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 end
if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 end
if node.name == "technic:constructor_mk2_off" then
hacky_swap_node(pos,"technic:constructor_mk2_on")
nodeupdate(pos)
local node1=minetest.get_node(pos1)
deploy_node (inv,"slot1",pos1,node1,node)
local node1=minetest.get_node(pos2)
deploy_node (inv,"slot2",pos2,node1,node)
end
end
mk2_off = function(pos, node)
if node.name == "technic:constructor_mk2_on" then
hacky_swap_node(pos,"technic:constructor_mk2_off")
nodeupdate(pos)
end
end
minetest.register_node("technic:constructor_mk2_off", {
description = "Constructor MK2",
tile_images = {"technic_constructor_mk2_top_off.png","technic_constructor_mk2_bottom_off.png","technic_constructor_mk2_side2_off.png","technic_constructor_mk2_side1_off.png",
"technic_constructor_back.png","technic_constructor_front_off.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2},
mesecons= {effector={action_on=mk2_on}},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;Constructor MK2]"..
"label[5,0;Slot 1]"..
"list[current_name;slot1;6,0;1,1;]"..
"label[5,1;Slot 2]"..
"list[current_name;slot2;6,1;1,1;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Constructor MK2")
local inv = meta:get_inventory()
inv:set_size("slot1", 1)
inv:set_size("slot2", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false then return false end
return true
end,
})
minetest.register_node("technic:constructor_mk2_on", {
description = "Constructor MK2",
tile_images = {"technic_constructor_mk2_top_on.png","technic_constructor_mk2_bottom_on.png","technic_constructor_mk2_side2_on.png","technic_constructor_mk2_side1_on.png",
"technic_constructor_back.png","technic_constructor_front_on.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2, not_in_creative_inventory=1},
mesecons= {effector={action_off=mk2_off}},
sounds = default.node_sound_stone_defaults(),
})
-- Constructor MK3
mk3_on = function(pos, node)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local pos1={}
local pos2={}
local pos3={}
local pos4={}
pos1.x=pos.x
pos1.y=pos.y
pos1.z=pos.z
pos2.x=pos.x
pos2.y=pos.y
pos2.z=pos.z
pos3.x=pos.x
pos3.y=pos.y
pos3.z=pos.z
pos4.x=pos.x
pos4.y=pos.y
pos4.z=pos.z
if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 pos3.x=pos3.x+3 pos4.x=pos4.x+4 end
if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 pos3.z=pos3.z+3 pos4.z=pos4.z+4 end
if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 pos3.x=pos3.x-3 pos4.x=pos4.x-4 end
if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 pos3.z=pos3.z-3 pos4.z=pos4.z-4 end
if node.name == "technic:constructor_mk3_off" then
hacky_swap_node(pos,"technic:constructor_mk3_on")
nodeupdate(pos)
local node1=minetest.get_node(pos1)
deploy_node (inv,"slot1",pos1,node1,node)
local node1=minetest.get_node(pos2)
deploy_node (inv,"slot2",pos2,node1,node)
local node1=minetest.get_node(pos3)
deploy_node (inv,"slot3",pos3,node1,node)
local node1=minetest.get_node(pos4)
deploy_node (inv,"slot4",pos4,node1,node)
end
end
mk3_off = function(pos, node)
if node.name == "technic:constructor_mk3_on" then
hacky_swap_node(pos,"technic:constructor_mk3_off")
nodeupdate(pos)
end
end
minetest.register_node("technic:constructor_mk3_off", {
description = "Constructor MK3",
tile_images = {"technic_constructor_mk3_top_off.png","technic_constructor_mk3_bottom_off.png","technic_constructor_mk3_side2_off.png","technic_constructor_mk3_side1_off.png",
"technic_constructor_back.png","technic_constructor_front_off.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2},
mesecons= {effector={action_on=mk3_on}},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;Constructor MK2]"..
"label[5,0;Slot 1]"..
"list[current_name;slot1;6,0;1,1;]"..
"label[5,1;Slot 2]"..
"list[current_name;slot2;6,1;1,1;]"..
"label[5,2;Slot 3]"..
"list[current_name;slot3;6,2;1,1;]"..
"label[5,3;Slot 4]"..
"list[current_name;slot4;6,3;1,1;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Constructor MK3")
local inv = meta:get_inventory()
inv:set_size("slot1", 1)
inv:set_size("slot2", 1)
inv:set_size("slot3", 1)
inv:set_size("slot4", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false or inv:is_empty("slot3")==false or inv:is_empty("slot4")==false then return false end
return true
end,
})
minetest.register_node("technic:constructor_mk3_on", {
description = "Constructor MK3",
tile_images = {"technic_constructor_mk3_top_on.png","technic_constructor_mk3_bottom_on.png","technic_constructor_mk3_side2_on.png","technic_constructor_mk3_side1_on.png",
"technic_constructor_back.png","technic_constructor_front_on.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,not_in_creative_inventory=1},
mesecons= {effector={action_off=mk3_off}},
sounds = default.node_sound_stone_defaults(),
})
deploy_node =function (inv, slot_name, pos1, node1, node)
if node1.name == "air" then if node1.name == "air" then
if not inv:is_empty(slot_name) then if not inv:is_empty(slot_name) then
stack1=inv:get_list(slot_name) stack1=inv:get_list(slot_name)
@ -71,294 +342,3 @@ local function deploy_node(inv, slot_name, pos1, node1, node)
end end
end end
minetest.register_craft({
type = "shapeless",
output = 'technic:constructor_mk1_off 1',
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'},
})
minetest.register_craft({
type = "shapeless",
output = 'technic:constructor_mk3_off 1',
recipe = {'technic:constructor_mk2_off', 'technic:constructor_mk2_off'},
})
local function mk1_on(pos, node)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local pos1={}
pos1.x=pos.x
pos1.y=pos.y
pos1.z=pos.z
if node.param2==3 then pos1.x=pos1.x+1 end
if node.param2==2 then pos1.z=pos1.z+1 end
if node.param2==1 then pos1.x=pos1.x-1 end
if node.param2==0 then pos1.z=pos1.z-1 end
if node.name == "technic:constructor_mk1_off" then
technic.swap_node(pos,"technic:constructor_mk1_on")
nodeupdate(pos)
local node1=minetest.get_node(pos1)
deploy_node (inv,"slot1",pos1,node1,node)
end
end
local function mk1_off(pos, node)
if node.name == "technic:constructor_mk1_on" then
technic.swap_node(pos,"technic:constructor_mk1_off")
nodeupdate(pos)
end
end
minetest.register_node("technic:constructor_mk1_off", {
description = S("Constructor Mk%d"):format(1),
tile_images = {"technic_constructor_mk1_top_off.png","technic_constructor_mk1_bottom_off.png","technic_constructor_mk1_side2_off.png","technic_constructor_mk1_side1_off.png",
"technic_constructor_back.png","technic_constructor_front_off.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2},
mesecons= {effector={action_on=mk1_on}},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;"..S("Constructor Mk%d"):format(1).."]"..
"label[5,0;"..S("Slot %d"):format(1).."]"..
"list[current_name;slot1;6,0;1,1;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", S("Constructor Mk%d"):format(1))
local inv = meta:get_inventory()
inv:set_size("slot1", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("slot1")
end,
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
})
minetest.register_node("technic:constructor_mk1_on", {
description = S("Constructor Mk%d"):format(1),
tile_images = {"technic_constructor_mk1_top_on.png","technic_constructor_mk1_bottom_on.png","technic_constructor_mk1_side2_on.png","technic_constructor_mk1_side1_on.png",
"technic_constructor_back.png","technic_constructor_front_on.png"},
paramtype2 = "facedir",
drop = "technic:constructor_mk1_off",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon = 2,not_in_creative_inventory=1},
mesecons= {effector={action_off=mk1_off}},
sounds = default.node_sound_stone_defaults(),
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
})
--Constructor Mk2
local function mk2_on(pos, node)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local pos1={}
local pos2={}
pos1.x=pos.x
pos1.y=pos.y
pos1.z=pos.z
pos2.x=pos.x
pos2.y=pos.y
pos2.z=pos.z
if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 end
if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 end
if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 end
if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 end
if node.name == "technic:constructor_mk2_off" then
technic.swap_node(pos,"technic:constructor_mk2_on")
nodeupdate(pos)
local node1=minetest.get_node(pos1)
deploy_node (inv,"slot1",pos1,node1,node)
local node1=minetest.get_node(pos2)
deploy_node (inv,"slot2",pos2,node1,node)
end
end
local function mk2_off(pos, node)
if node.name == "technic:constructor_mk2_on" then
technic.swap_node(pos,"technic:constructor_mk2_off")
nodeupdate(pos)
end
end
minetest.register_node("technic:constructor_mk2_off", {
description = S("Constructor Mk%d"):format(2),
tile_images = {"technic_constructor_mk2_top_off.png","technic_constructor_mk2_bottom_off.png","technic_constructor_mk2_side2_off.png","technic_constructor_mk2_side1_off.png",
"technic_constructor_back.png","technic_constructor_front_off.png"},
is_ground_content = true,
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2},
mesecons= {effector={action_on=mk2_on}},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;"..S("Constructor Mk%d"):format(2).."]"..
"label[5,0;"..S("Slot %d"):format(1).."]"..
"list[current_name;slot1;6,0;1,1;]"..
"label[5,1;"..S("Slot %d"):format(2).."]"..
"list[current_name;slot2;6,1;1,1;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", S("Constructor Mk%d"):format(2))
local inv = meta:get_inventory()
inv:set_size("slot1", 1)
inv:set_size("slot2", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false then return false end
return true
end,
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
})
minetest.register_node("technic:constructor_mk2_on", {
description = S("Constructor Mk%d"):format(2),
tile_images = {"technic_constructor_mk2_top_on.png","technic_constructor_mk2_bottom_on.png","technic_constructor_mk2_side2_on.png","technic_constructor_mk2_side1_on.png",
"technic_constructor_back.png","technic_constructor_front_on.png"},
is_ground_content = true,
paramtype2 = "facedir",
drop = "technic:constructor_mk2_off",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2, not_in_creative_inventory=1},
mesecons = {effector={action_off=mk2_off}},
sounds = default.node_sound_stone_defaults(),
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
})
-- Constructor Mk3
local function mk3_on(pos, node)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local pos1={}
local pos2={}
local pos3={}
local pos4={}
pos1.x=pos.x
pos1.y=pos.y
pos1.z=pos.z
pos2.x=pos.x
pos2.y=pos.y
pos2.z=pos.z
pos3.x=pos.x
pos3.y=pos.y
pos3.z=pos.z
pos4.x=pos.x
pos4.y=pos.y
pos4.z=pos.z
if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 pos3.x=pos3.x+3 pos4.x=pos4.x+4 end
if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 pos3.z=pos3.z+3 pos4.z=pos4.z+4 end
if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 pos3.x=pos3.x-3 pos4.x=pos4.x-4 end
if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 pos3.z=pos3.z-3 pos4.z=pos4.z-4 end
if node.name == "technic:constructor_mk3_off" then
technic.swap_node(pos,"technic:constructor_mk3_on")
nodeupdate(pos)
local node1=minetest.get_node(pos1)
deploy_node (inv,"slot1",pos1,node1,node)
local node1=minetest.get_node(pos2)
deploy_node (inv,"slot2",pos2,node1,node)
local node1=minetest.get_node(pos3)
deploy_node (inv,"slot3",pos3,node1,node)
local node1=minetest.get_node(pos4)
deploy_node (inv,"slot4",pos4,node1,node)
end
end
local function mk3_off(pos, node)
if node.name == "technic:constructor_mk3_on" then
technic.swap_node(pos,"technic:constructor_mk3_off")
nodeupdate(pos)
end
end
minetest.register_node("technic:constructor_mk3_off", {
description = S("Constructor Mk%d"):format(3),
tile_images = {"technic_constructor_mk3_top_off.png","technic_constructor_mk3_bottom_off.png","technic_constructor_mk3_side2_off.png","technic_constructor_mk3_side1_off.png",
"technic_constructor_back.png","technic_constructor_front_off.png"},
paramtype2 = "facedir",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2},
mesecons = {effector={action_on=mk3_on}},
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;"..S("Constructor Mk%d"):format(3).."]"..
"label[5,0;"..S("Slot %d"):format(1).."]"..
"list[current_name;slot1;6,0;1,1;]"..
"label[5,1;"..S("Slot %d"):format(2).."]"..
"list[current_name;slot2;6,1;1,1;]"..
"label[5,2;"..S("Slot %d"):format(3).."]"..
"list[current_name;slot3;6,2;1,1;]"..
"label[5,3;"..S("Slot %d"):format(4).."]"..
"list[current_name;slot4;6,3;1,1;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", S("Constructor Mk%d"):format(3))
local inv = meta:get_inventory()
inv:set_size("slot1", 1)
inv:set_size("slot2", 1)
inv:set_size("slot3", 1)
inv:set_size("slot4", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false or inv:is_empty("slot3")==false or inv:is_empty("slot4")==false then return false end
return true
end,
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
})
minetest.register_node("technic:constructor_mk3_on", {
description = S("Constructor Mk%d"):format(3),
tile_images = {"technic_constructor_mk3_top_on.png","technic_constructor_mk3_bottom_on.png","technic_constructor_mk3_side2_on.png","technic_constructor_mk3_side1_on.png",
"technic_constructor_back.png","technic_constructor_front_on.png"},
is_ground_content = true,
paramtype2 = "facedir",
drop = "technic:constructor_mk3_off",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,not_in_creative_inventory=1},
mesecons = {effector={action_off=mk3_off}},
sounds = default.node_sound_stone_defaults(),
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
})

View File

@ -1,6 +1,3 @@
local S = technic.getter
frames = {} frames = {}
local infinite_stacks = minetest.setting_getbool("creative_mode") and minetest.get_modpath("unified_inventory") == nil local infinite_stacks = minetest.setting_getbool("creative_mode") and minetest.get_modpath("unified_inventory") == nil
@ -47,7 +44,7 @@ local function get_face(pos,ppos,pvect)
end end
end end
local function lines(str) function lines(str)
local t = {} local t = {}
local function helper(line) table.insert(t, line) return "" end local function helper(line) table.insert(t, line) return "" end
helper((str:gsub("(.-)\r?\n", helper))) helper((str:gsub("(.-)\r?\n", helper)))
@ -207,7 +204,7 @@ local nodeboxes= {
minetest.register_node("technic:frame_"..nameext,{ minetest.register_node("technic:frame_"..nameext,{
description = S("Frame"), description = "Frame",
tiles = {"technic_frame.png"}, tiles = {"technic_frame.png"},
groups=groups, groups=groups,
drawtype = "nodebox", drawtype = "nodebox",
@ -542,19 +539,15 @@ local function frame_motor_on(pos, node)
nnode.name = frames_pos[pos_to_string(nnodepos)] nnode.name = frames_pos[pos_to_string(nnodepos)]
end end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_int("last_moved") == minetest.get_gametime() then
return
end
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
if minetest.registered_nodes[nnode.name].frame==1 then if minetest.registered_nodes[nnode.name].frame==1 then
local connected_nodes=get_connected_nodes(nnodepos) local connected_nodes=get_connected_nodes(nnodepos)
move_nodes_vect(connected_nodes,dir,pos,owner) move_nodes_vect(connected_nodes,dir,pos,owner)
end end
minetest.get_meta(vector.add(pos, dir)):set_int("last_moved", minetest.get_gametime())
end end
minetest.register_node("technic:frame_motor",{ minetest.register_node("technic:frame_motor",{
description = S("Frame Motor"), description = "Frame motor",
tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png",
"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,mesecon=2}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2},
@ -607,7 +600,7 @@ local function swap_template(pos, new)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local saved_node = meta:get_string("saved_node") local saved_node = meta:get_string("saved_node")
meta:set_string("saved_node", "") meta:set_string("saved_node", "")
technic.swap_node(pos, new) hacky_swap_node(pos, new)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("saved_node", saved_node) meta:set_string("saved_node", saved_node)
end end
@ -745,7 +738,7 @@ local function template_on_destruct(pos, node)
end end
minetest.register_node("technic:template",{ minetest.register_node("technic:template",{
description = S("Template"), description = "Template",
tiles = {"technic_mv_cable.png"}, tiles = {"technic_mv_cable.png"},
drop = "", drop = "",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
@ -757,7 +750,7 @@ minetest.register_node("technic:template",{
}) })
minetest.register_node("technic:template_disabled",{ minetest.register_node("technic:template_disabled",{
description = S("Template"), description = "Template",
tiles = {"technic_hv_cable.png"}, tiles = {"technic_hv_cable.png"},
drop = "", drop = "",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1},
@ -770,7 +763,7 @@ minetest.register_node("technic:template_disabled",{
}) })
minetest.register_node("technic:template_connector",{ minetest.register_node("technic:template_connector",{
description = S("Template"), description = "Template",
tiles = {"technic_lv_cable.png"}, tiles = {"technic_lv_cable.png"},
drop = "", drop = "",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1},
@ -782,7 +775,7 @@ minetest.register_node("technic:template_connector",{
}) })
minetest.register_craftitem("technic:template_replacer",{ minetest.register_craftitem("technic:template_replacer",{
description = S("Template (replacing)"), description = "Template (replacing)",
inventory_image = "technic_template_replacer.png", inventory_image = "technic_template_replacer.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local p = pointed_thing.under local p = pointed_thing.under
@ -802,11 +795,11 @@ minetest.register_craftitem("technic:template_replacer",{
}) })
minetest.register_tool("technic:template_tool",{ minetest.register_tool("technic:template_tool",{
description = S("Template Tool"), description = "Template tool",
inventory_image = "technic_template_tool.png", inventory_image = "technic_template_tool.png",
on_use = function(itemstack, puncher, pointed_thing) on_use = function(itemstack, puncher, pointed_thing)
local pos = pointed_thing.under local pos = pointed_thing.under
if pos == nil or (minetest.is_protected and minetest.is_protected(pos, puncher:get_player_name())) then if pos == nil or (minetest.is_protected and minetest.is_protected(pos, placer:get_player_name())) then
return nil return nil
end end
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
@ -847,19 +840,15 @@ local function template_motor_on(pos, node)
local dir = minetest.facedir_to_dir(node.param2) local dir = minetest.facedir_to_dir(node.param2)
local nnode=minetest.get_node(nnodepos) local nnode=minetest.get_node(nnodepos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if meta:get_int("last_moved") == minetest.get_gametime() then
return
end
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
if nnode.name == "technic:template" then if nnode.name == "technic:template" then
local connected_nodes=get_template_nodes(nnodepos) local connected_nodes=get_template_nodes(nnodepos)
move_nodes_vect(connected_nodes,dir,pos,owner) move_nodes_vect(connected_nodes,dir,pos,owner)
end end
minetest.get_meta(vector.add(pos, dir)):set_int("last_moved", minetest.get_gametime())
end end
minetest.register_node("technic:template_motor",{ minetest.register_node("technic:template_motor",{
description = S("Template Motor"), description = "Template motor",
tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png",
"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,mesecon=2}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2},
@ -885,7 +874,7 @@ minetest.register_craft({
output = 'technic:frame_motor', output = 'technic:frame_motor',
recipe = { recipe = {
{'', 'technic:frame_111111', ''}, {'', 'technic:frame_111111', ''},
{'group:mesecon_conductor_craftable', 'technic:motor', 'group:mesecon_conductor_craftable'}, {'group:mesecons_conductor_craftable', 'technic:motor', 'group:mesecons_conductor_craftable'},
{'', 'technic:frame_111111', ''}, {'', 'technic:frame_111111', ''},
} }
}) })
@ -913,7 +902,7 @@ minetest.register_craft({
output = 'technic:template_motor', output = 'technic:template_motor',
recipe = { recipe = {
{'', 'technic:template', ''}, {'', 'technic:template', ''},
{'group:mesecon_conductor_craftable', 'technic:motor', 'group:mesecon_conductor_craftable'}, {'group:mesecons_conductor_craftable', 'technic:motor', 'group:mesecons_conductor_craftable'},
{'', 'technic:template', ''}, {'', 'technic:template', ''},
} }
}) })

View File

@ -1,7 +1,78 @@
minetest.register_craftitem("technic:injector", {
description = "Injector",
stack_max = 99,
})
local S = technic.getter minetest.register_craft({
output = 'technic:injector 1',
recipe = {
{'', 'technic:control_logic_unit',''},
{'', 'default:chest',''},
{'', 'pipeworks:tube_000000',''},
}
})
local function inject_items (pos) minetest.register_node("technic:injector", {
description = "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 = chest_groups1,
tube = tubes_properties,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;Injector]"..
"button[0,1;.8,.8;mode;]"..
"label[.8,1;Mode: single items]"..
"list[current_name;main;0,2;8,2;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Injector")
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
meta:set_string("mode","single items")
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_receive_fields = function(pos, formanme, fields, sender)
local meta = minetest.env:get_meta(pos)
local mode=meta:get_string("mode")
if fields.mode then
if mode=="single items" then mode="whole stacks"
else mode="single items"
end
local mode=meta:set_string("mode",mode)
end
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;Injector]"..
"button[0,1;.8,.8;mode;]"..
"label[.8,1;Mode: "..mode.."]"..
"list[current_name;main;0,2;8,2;]"..
"list[current_player;main;0,5;8,4;]")
end,
})
minetest.register_abm({
nodenames = {"technic:injector"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local pos1={}
pos1.x = pos.x
pos1.y = pos.y-1
pos1.z = pos.z
local meta=minetest.env:get_meta(pos1)
if meta:get_int("tubelike")==1 then inject_items (pos) end
end,
})
function inject_items (pos)
local meta=minetest.env:get_meta(pos) local meta=minetest.env:get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local mode=meta:get_string("mode") local mode=meta:get_string("mode")
@ -13,7 +84,7 @@ local function inject_items (pos)
local item0=stack:to_table() local item0=stack:to_table()
if item0 then if item0 then
item0["count"]="1" item0["count"]="1"
local item1=pipeworks.tube_item({x=pos.x,y=pos.y,z=pos.z},item0) local item1=tube_item({x=pos.x,y=pos.y,z=pos.z},item0)
item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z} item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z}
item1:setvelocity({x=0, y=-1, z=0}) item1:setvelocity({x=0, y=-1, z=0})
item1:setacceleration({x=0, y=0, z=0}) item1:setacceleration({x=0, y=0, z=0})
@ -31,7 +102,7 @@ local function inject_items (pos)
if stack then if stack then
local item0=stack:to_table() local item0=stack:to_table()
if item0 then if item0 then
local item1=pipeworks.tube_item({x=pos.x,y=pos.y,z=pos.z},item0) local item1=tube_item({x=pos.x,y=pos.y,z=pos.z},item0)
item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z} item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z}
item1:setvelocity({x=0, y=-1, z=0}) item1:setvelocity({x=0, y=-1, z=0})
item1:setacceleration({x=0, y=0, z=0}) item1:setacceleration({x=0, y=0, z=0})
@ -44,77 +115,3 @@ local function inject_items (pos)
end end
end end
minetest.register_craft({
output = 'technic:injector 1',
recipe = {
{'', 'technic:control_logic_unit',''},
{'', 'default:chest',''},
{'', 'pipeworks:tube_1',''},
}
})
minetest.register_node("technic:injector", {
description = S("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},
tube = {connect_sides={bottom=1}},
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;"..S("Injector").."]"..
"button[0,1;.8,.8;mode;]"..
"label[.8,1;"..S("Mode: %s"):format("single items").."]"..
"list[current_name;main;0,2;8,2;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", S("Injector"))
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
meta:set_string("mode","single items")
end,
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_receive_fields = function(pos, formanme, fields, sender)
local meta = minetest.env:get_meta(pos)
local mode=meta:get_string("mode")
if fields.mode then
if mode == "single items" then
mode = "whole stacks"
else
mode = "single items"
end
meta:set_string("mode", mode)
end
meta:set_string("formspec",
"invsize[8,9;]"..
"label[0,0;"..S("Injector").."]"..
"button[0,1;.8,.8;mode;]"..
"label[.8,1;"..S("Mode: %s"):format(S(mode)).."]"..
"list[current_name;main;0,2;8,2;]"..
"list[current_player;main;0,5;8,4;]")
end,
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
})
minetest.register_abm({
nodenames = {"technic:injector"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local pos1={}
pos1.x = pos.x
pos1.y = pos.y-1
pos1.z = pos.z
local meta=minetest.env:get_meta(pos1)
if meta:get_int("tubelike")==1 then inject_items (pos) end
end,
})

View File

@ -1,10 +1,287 @@
local S = technic.getter local S = technic.getter
function technic.register_alloy_furnace(data) -- Register alloy recipes
data.typename = "alloy" technic.alloy_recipes = {}
data.machine_name = "alloy_furnace"
data.machine_desc = S("%s Alloy Furnace") -- Register recipe in a table
technic.register_base_machine(data) technic.register_alloy_recipe = function(metal1, count1, metal2, count2, result, count3)
in1 = {
name = metal1,
count = count1,
}
in2 = {
name = metal2,
count = count2,
}
-- Sort the inputs alphebetically
if in1.name > in2.name then
local temp = in1
in1 = in2
in2 = temp
end
technic.alloy_recipes[in1.name.." "..in2.name] = {
input = {in1, in2},
output = {
name = result,
count = count3,
},
}
if unified_inventory then
unified_inventory.register_craft({
type = "alloy",
output = result.." "..count3,
items = {metal1.." "..count1, metal2.." "..count2},
width = 2,
})
end
end end
-- Retrieve a recipe given the input metals.
function technic.get_alloy_recipe(stack1, stack2)
-- Sort the stacks alphebetically
if stack1:get_name() > stack2:get_name() then
local temp = stack1
stack1 = stack2
stack2 = temp
end
for _, recipe in pairs(technic.alloy_recipes) do
if recipe.input[1].name == stack1:get_name() and
recipe.input[2].name == stack2:get_name() and
stack1:get_count() >= recipe.input[1].count and
stack2:get_count() >= recipe.input[2].count then
return recipe
end
end
end
technic.register_alloy_recipe("technic:copper_dust", 3, "technic:tin_dust", 1, "technic:bronze_dust", 4)
technic.register_alloy_recipe("default:copper_ingot", 3, "moreores:tin_ingot", 1, "moreores:bronze_ingot", 4)
technic.register_alloy_recipe("technic:iron_dust", 3, "technic:chromium_dust", 1, "technic:stainless_steel_dust", 4)
technic.register_alloy_recipe("default:steel_ingot", 3, "technic:chromium_ingot", 1, "technic:stainless_steel_ingot", 4)
technic.register_alloy_recipe("technic:copper_dust", 2, "technic:zinc_dust", 1, "technic:brass_dust", 3)
technic.register_alloy_recipe("default:copper_ingot", 2, "technic:zinc_ingot", 1, "technic:brass_ingot", 3)
technic.register_alloy_recipe("default:sand", 2, "technic:coal_dust", 2, "technic:silicon_wafer", 1)
technic.register_alloy_recipe("technic:silicon_wafer", 1, "technic:gold_dust", 1, "technic:doped_silicon_wafer", 1)
function technic.register_alloy_furnace(data)
local tier = data.tier
local ltier = string.lower(tier)
local tube_side_texture = data.tube and "technic_"..ltier.."_alloy_furnace_side_tube.png"
or "technic_"..ltier.."_alloy_furnace_side.png"
local groups = {cracky=2}
local active_groups = {cracky=2, not_in_creative_inventory=1}
if data.tube then
groups.tubedevice = 1
groups.tubedevice_receiver = 1
active_groups.tubedevice = 1
active_groups.tubedevice_receiver = 1
end
local formspec =
"invsize[8,10;]"..
"label[0,0;"..S("%s Alloy Furnace"):format(tier).."]"..
"list[current_name;src;3,1;1,2;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,6;8,4;]"
if data.upgrade then
formspec = formspec..
"list[current_name;upgrade1;1,4;1,1;]"..
"list[current_name;upgrade2;2,4;1,1;]"..
"label[1,5;Upgrade Slots]"
end
data.formspec = formspec
local tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("src", 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("src", stack)
end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
}
minetest.register_node("technic:"..ltier.."_alloy_furnace", {
description = S("%s Alloy Furnace"):format(tier),
tiles = {"technic_"..ltier.."_alloy_furnace_top.png",
"technic_"..ltier.."_alloy_furnace_bottom.png",
tube_side_texture,
tube_side_texture,
"technic_"..ltier.."_alloy_furnace_side.png",
"technic_"..ltier.."_alloy_furnace_front.png"},
paramtype2 = "facedir",
groups = groups,
tube = tube,
technic = data,
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local name = minetest.get_node(pos).name
local data = minetest.registered_nodes[name].technic
meta:set_string("infotext", S("%s Alloy Furnace"):format(data.tier))
meta:set_string("formspec", data.formspec)
meta:set_int("tube_time", 0)
local inv = meta:get_inventory()
inv:set_size("src", 2)
inv:set_size("dst", 4)
inv:set_size("upgrade1", 1)
inv:set_size("upgrade2", 1)
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") or
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
})
minetest.register_node("technic:"..ltier.."_alloy_furnace_active",{
description = S(tier.." Alloy Furnace"),
tiles = {"technic_"..ltier.."_alloy_furnace_top.png",
"technic_"..ltier.."_alloy_furnace_bottom.png",
tube_side_texture,
tube_side_texture,
"technic_"..ltier.."_alloy_furnace_side.png",
"technic_"..ltier.."_alloy_furnace_front_active.png"},
paramtype2 = "facedir",
light_source = 8,
drop = "technic:"..ltier.."_alloy_furnace",
groups = active_groups,
tube = tube,
technic = data,
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
can_dig = function(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") or
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
-- These three makes sure upgrades are not moved in or out while the furnace is active.
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "src" or listname == "dst" then
return stack:get_count()
else
return 0 -- Disallow the move
end
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if listname == "src" or listname == "dst" then
return stack:get_count()
else
return 0 -- Disallow the move
end
end,
allow_metadata_inventory_move = function(pos, from_list, to_list, to_list, to_index, count, player)
return 0
end,
})
minetest.register_abm({
nodenames = {"technic:"..ltier.."_alloy_furnace", "technic:"..ltier.."_alloy_furnace_active"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local data = minetest.registered_nodes[node.name].technic
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local eu_input = meta:get_int(data.tier.."_EU_input")
-- Machine information
local machine_name = S("%s Alloy Furnace"):format(data.tier)
local machine_node = "technic:"..string.lower(data.tier).."_alloy_furnace"
local machine_demand = data.demand
-- Setup meta data if it does not exist.
if not eu_input then
meta:set_int(data.tier.."_EU_demand", machine_demand[1])
meta:set_int(data.tier.."_EU_input", 0)
end
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, data.tier)
local EU_upgrade, tube_upgrade = 0, 0
if data.upgrade then
EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta)
end
if data.tube then
technic.handle_machine_pipeworks(pos, tube_upgrade)
end
-- Get what to cook if anything
local srcstack = inv:get_stack("src", 1)
local src2stack = inv:get_stack("src", 2)
local recipe = technic.get_alloy_recipe(srcstack, src2stack)
local result = recipe and ItemStack(recipe.output) or nil
-- Sort the stacks alphabetically
if srcstack:get_name() > src2stack:get_name() then
local temp = srcstack
srcstack = src2stack
src2stack = temp
end
if not result or
not inv:room_for_item("dst", result) then
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int(data.tier.."_EU_demand", 0)
return
end
if eu_input < machine_demand[EU_upgrade+1] then
-- Unpowered - go idle
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= machine_demand[EU_upgrade+1] then
-- Powered
hacky_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") == data.cook_time then
meta:set_int("src_time", 0)
-- check if there's room for output and that we have the materials
if inv:room_for_item("dst", result) then
srcstack:take_item(recipe.input[1].count)
inv:set_stack("src", 1, srcstack)
src2stack:take_item(recipe.input[2].count)
inv:set_stack("src", 2, src2stack)
-- Put result in "dst" list
inv:add_item("dst", result)
else
next_state = 1
end
end
end
meta:set_int(data.tier.."_EU_demand", machine_demand[EU_upgrade+1])
end,
})
technic.register_machine(tier, "technic:"..ltier.."_alloy_furnace", technic.receiver)
technic.register_machine(tier, "technic:"..ltier.."_alloy_furnace_active", technic.receiver)
end -- End registration

View File

@ -1,28 +0,0 @@
local S = technic.getter
technic.register_recipe_type("alloy", S("Alloy cooking"), 2)
function technic.register_alloy_recipe(data)
data.time = data.time or 6
technic.register_recipe("alloy", 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"},
{"technic:wrought_iron_ingot", "technic:coal_dust", "technic:carbon_steel_ingot"},
{"technic:carbon_steel_dust", "technic:coal_dust", "technic:cast_iron_dust"},
{"technic:carbon_steel_ingot", "technic:coal_dust", "technic:cast_iron_ingot"},
{"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"},
}
for _, data in pairs(recipes) do
technic.register_alloy_recipe({input = {data[1], data[2]}, output = data[3]})
end

View File

@ -1,67 +1,11 @@
local S = technic.getter local S = technic.getter
technic.register_power_tool("technic:battery", 10000)
technic.register_power_tool("technic:red_energy_crystal", 50000)
technic.register_power_tool("technic:green_energy_crystal", 150000)
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'},
}
})
minetest.register_tool("technic:battery", {
description = S("RE Battery"),
inventory_image = "technic_battery.png",
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
tool_capabilities = {
charge = 0,
max_drop_level = 0,
groupcaps = {
fleshy = {times={}, uses=10000, maxlevel=0}
}
}
})
local tube = {
insert_object = function(pos, node, stack, direction)
if direction.y == 0 then
return stack
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if direction.y > 0 then
return inv:add_item("src", stack)
else
return inv:add_item("dst", stack)
end
end,
can_insert = function(pos, node, stack, direction)
if direction.y == 0 then
return false
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if direction.y > 0 then
return inv:room_for_item("src", stack)
else
return inv:room_for_item("dst", stack)
end
end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
}
function technic.register_battery_box(data) function technic.register_battery_box(data)
local tier = data.tier local tier = data.tier
local ltier = string.lower(tier) local ltier = string.lower(tier)
local formspec = data.formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"image[1,1;1,2;technic_power_meter_bg.png]".. "image[1,1;1,2;technic_power_meter_bg.png]"..
"list[current_name;src;3,1;1,1;]".. "list[current_name;src;3,1;1,1;]"..
@ -72,25 +16,12 @@ function technic.register_battery_box(data)
"label[5,0;"..S("Discharge").."]".. "label[5,0;"..S("Discharge").."]"..
"label[1,3;"..S("Power level").."]".. "label[1,3;"..S("Power level").."]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"
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").."]"
end
for i = 0, 8 do for i = 0, 8 do
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2} local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
if i ~= 0 then if i ~= 0 then
groups.not_in_creative_inventory = 1 groups.not_in_creative_inventory = 1
end 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), description = S("%s Battery Box"):format(tier),
tiles = {"technic_"..ltier.."_battery_box_top.png", tiles = {"technic_"..ltier.."_battery_box_top.png",
@ -100,30 +31,35 @@ function technic.register_battery_box(data)
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png", "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"}, "technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"},
groups = groups, groups = groups,
tube = data.tube and tube or nil,
paramtype2 = "facedir",
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
drop = "technic:"..ltier.."_battery_box0", drop = "technic:"..ltier.."_battery_box0",
technic = data,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local data = minetest.registered_nodes[node.name].technic
meta:set_string("infotext", S("%s Battery Box"):format(tier)) meta:set_string("infotext", S("%s Battery Box"):format(data.tier))
meta:set_string("formspec", formspec) meta:set_string("formspec", data.formspec)
meta:set_int(tier.."_EU_demand", 0) meta:set_int(data.tier.."_EU_demand", 0)
meta:set_int(tier.."_EU_supply", 0) meta:set_int(data.tier.."_EU_supply", 0)
meta:set_int(tier.."_EU_input", 0) meta:set_int(data.tier.."_EU_input", 0)
meta:set_float("internal_EU_charge", 0) meta:set_float("internal_EU_charge", 0)
inv:set_size("src", 1) inv:set_size("src", 1)
inv:set_size("dst", 1) inv:set_size("dst", 1)
inv:set_size("upgrade1", 1)
inv:set_size("upgrade2", 1)
end, end,
can_dig = technic.machine_can_dig, can_dig = function(pos, player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.get_meta(pos);
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
allow_metadata_inventory_move = technic.machine_inventory_move, if not inv:is_empty("src") or not inv:is_empty("dst") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
}) })
end end
@ -137,19 +73,17 @@ function technic.register_battery_box(data)
interval = 1, interval = 1,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local data = minetest.registered_nodes[node.name].technic
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local eu_input = meta:get_int(tier.."_EU_input") local eu_input = meta:get_int(data.tier.."_EU_input")
local current_charge = meta:get_int("internal_EU_charge") local current_charge = meta:get_int("internal_EU_charge")
local max_charge = data.max_charge
local charge_rate = data.charge_rate
local discharge_rate = data.discharge_rate
-- Power off automatically if no longer connected to a switching station -- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, tier) technic.switching_station_timeout_count(pos, data.tier)
local EU_upgrade, tube_upgrade = 0, 0
if data.upgrade then
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 -- Charge/discharge the battery with the input EUs
if eu_input >= 0 then if eu_input >= 0 then
current_charge = math.min(current_charge + eu_input, max_charge) current_charge = math.min(current_charge + eu_input, max_charge)
@ -158,30 +92,16 @@ function technic.register_battery_box(data)
end end
-- Charging/discharging tools here -- Charging/discharging tools here
local tool_full, tool_empty current_charge = technic.charge_tools(meta,
current_charge, tool_full = technic.charge_tools(meta,
current_charge, data.charge_step) current_charge, data.charge_step)
current_charge, tool_empty = technic.discharge_tools(meta, current_charge = technic.discharge_tools(meta,
current_charge, data.discharge_step, current_charge, data.discharge_step, max_charge)
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)
end
-- We allow batteries to charge on less than the demand -- We allow batteries to charge on less than the demand
meta:set_int(tier.."_EU_demand", meta:set_int(data.tier.."_EU_demand",
math.min(data.charge_rate, max_charge - current_charge)) math.min(charge_rate, max_charge - current_charge))
meta:set_int(tier.."_EU_supply", meta:set_int(data.tier.."_EU_supply",
math.min(data.discharge_rate, current_charge)) math.min(discharge_rate, current_charge))
meta:set_int("internal_EU_charge", current_charge) meta:set_int("internal_EU_charge", current_charge)
@ -191,19 +111,18 @@ function technic.register_battery_box(data)
charge_count = math.max(charge_count, 0) charge_count = math.max(charge_count, 0)
local last_count = meta:get_float("last_side_shown") local last_count = meta:get_float("last_side_shown")
if charge_count ~= last_count then if charge_count ~= last_count then
technic.swap_node(pos,"technic:"..ltier.."_battery_box"..charge_count) hacky_swap_node(pos,"technic:"..string.lower(data.tier).."_battery_box"..charge_count)
meta:set_float("last_side_shown", charge_count) meta:set_float("last_side_shown", charge_count)
end end
local charge_percent = math.floor(current_charge / max_charge * 100) local charge_percent = math.floor(current_charge / max_charge * 100)
meta:set_string("formspec", meta:set_string("formspec",
formspec.. data.formspec..
"image[1,1;1,2;technic_power_meter_bg.png" "image[1,1;1,2;technic_power_meter_bg.png"
.."^[lowpart:"..charge_percent .."^[lowpart:"..charge_percent
..":technic_power_meter_fg.png]") ..":technic_power_meter_fg.png]")
local infotext = S("%s Battery Box: %d/%d"):format(tier, local infotext = S("%s Battery Box: %d/%d"):format(data.tier, current_charge, max_charge)
current_charge, max_charge)
if eu_input == 0 then if eu_input == 0 then
infotext = S("%s Idle"):format(infotext) infotext = S("%s Idle"):format(infotext)
end end
@ -223,16 +142,17 @@ end -- End registration
function technic.charge_tools(meta, batt_charge, charge_step) function technic.charge_tools(meta, batt_charge, charge_step)
local inv = meta:get_inventory() local inv = meta:get_inventory()
if inv:is_empty("src") then if inv:is_empty("src") then
return batt_charge, false return batt_charge
end end
local srcstack = inv:get_stack("src", 1) local srcstack = inv:get_stack("src", 1)
local src_meta = get_item_meta(srcstack:get_metadata())
local toolname = srcstack:get_name() local toolname = srcstack:get_name()
if not technic.power_tools[toolname] then if not technic.power_tools[toolname] then
return batt_charge, false return batt_charge
end end
-- Set meta data for the tool if it didn't do it itself -- Set meta data for the tool if it didn't do it itself
src_meta = minetest.deserialize(srcstack:get_metadata()) src_meta = get_item_meta(srcstack:get_metadata())
src_meta = src_meta or {} src_meta = src_meta or {}
if not src_meta.charge then if not src_meta.charge then
src_meta.charge = 0 src_meta.charge = 0
@ -240,10 +160,8 @@ function technic.charge_tools(meta, batt_charge, charge_step)
-- Do the charging -- Do the charging
local item_max_charge = technic.power_tools[toolname] local item_max_charge = technic.power_tools[toolname]
local tool_charge = src_meta.charge local tool_charge = src_meta.charge
if tool_charge >= item_max_charge then if tool_charge >= item_max_charge or batt_charge <= 0 then
return batt_charge, true return batt_charge
elseif batt_charge <= 0 then
return batt_charge, false
end end
charge_step = math.min(charge_step, batt_charge) charge_step = math.min(charge_step, batt_charge)
charge_step = math.min(charge_step, item_max_charge - tool_charge) charge_step = math.min(charge_step, item_max_charge - tool_charge)
@ -251,24 +169,24 @@ function technic.charge_tools(meta, batt_charge, charge_step)
batt_charge = batt_charge - charge_step batt_charge = batt_charge - charge_step
technic.set_RE_wear(srcstack, tool_charge, item_max_charge) technic.set_RE_wear(srcstack, tool_charge, item_max_charge)
src_meta.charge = tool_charge src_meta.charge = tool_charge
srcstack:set_metadata(minetest.serialize(src_meta)) srcstack:set_metadata(set_item_meta(src_meta))
inv:set_stack("src", 1, srcstack) inv:set_stack("src", 1, srcstack)
return batt_charge, (tool_charge == item_max_charge) return batt_charge
end end
function technic.discharge_tools(meta, batt_charge, charge_step, max_charge) function technic.discharge_tools(meta, batt_charge, charge_step, max_charge)
local inv = meta:get_inventory() local inv = meta:get_inventory()
if inv:is_empty("dst") then if inv:is_empty("dst") then
return batt_charge, false return batt_charge
end end
srcstack = inv:get_stack("dst", 1) srcstack = inv:get_stack("dst", 1)
local toolname = srcstack:get_name() local toolname = srcstack:get_name()
if technic.power_tools[toolname] == nil then if technic.power_tools[toolname] == nil then
return batt_charge, false return batt_charge
end end
-- Set meta data for the tool if it didn't do it itself :-( -- Set meta data for the tool if it didn't do it itself :-(
local src_meta = minetest.deserialize(srcstack:get_metadata()) local src_meta = get_item_meta(srcstack:get_metadata())
src_meta = src_meta or {} src_meta = src_meta or {}
if not src_meta.charge then if not src_meta.charge then
src_meta.charge = 0 src_meta.charge = 0
@ -277,10 +195,8 @@ function technic.discharge_tools(meta, batt_charge, charge_step, max_charge)
-- Do the discharging -- Do the discharging
local item_max_charge = technic.power_tools[toolname] local item_max_charge = technic.power_tools[toolname]
local tool_charge = src_meta.charge local tool_charge = src_meta.charge
if tool_charge <= 0 then if tool_charge <= 0 or batt_charge >= max_charge then
return batt_charge, true return batt_charge
elseif batt_charge >= max_charge then
return batt_charge, false
end end
charge_step = math.min(charge_step, max_charge - batt_charge) charge_step = math.min(charge_step, max_charge - batt_charge)
charge_step = math.min(charge_step, tool_charge) charge_step = math.min(charge_step, tool_charge)
@ -288,8 +204,8 @@ function technic.discharge_tools(meta, batt_charge, charge_step, max_charge)
batt_charge = batt_charge + charge_step batt_charge = batt_charge + charge_step
technic.set_RE_wear(srcstack, tool_charge, item_max_charge) technic.set_RE_wear(srcstack, tool_charge, item_max_charge)
src_meta.charge = tool_charge src_meta.charge = tool_charge
srcstack:set_metadata(minetest.serialize(src_meta)) srcstack:set_metadata(set_item_meta(src_meta))
inv:set_stack("dst", 1, srcstack) inv:set_stack("dst", 1, srcstack)
return batt_charge, (tool_charge == 0) return batt_charge
end end

View File

@ -62,9 +62,12 @@ end
minetest.register_on_placenode(function(pos, node) minetest.register_on_placenode(function(pos, node)
for tier, machine_list in pairs(technic.machines) do for tier, machine_list in pairs(technic.machines) do
if machine_list[node.name] ~= nil then for machine_name, _ in pairs(machine_list) do
technic.update_cables(pos, tier, true) if node.name == machine_name then
technic.networks = {} technic.update_cables(pos, tier, true)
technic.networks = {}
return
end
end end
end end
end) end)
@ -72,9 +75,12 @@ end)
minetest.register_on_dignode(function(pos, node) minetest.register_on_dignode(function(pos, node)
for tier, machine_list in pairs(technic.machines) do for tier, machine_list in pairs(technic.machines) do
if machine_list[node.name] ~= nil then for machine_name, _ in pairs(machine_list) do
technic.update_cables(pos, tier, true) if node.name == machine_name then
technic.networks = {} technic.update_cables(pos, tier, true)
technic.networks = {}
return
end
end end
end end
end) end)

View File

@ -1,6 +1,4 @@
local S = technic.getter
function technic.handle_machine_upgrades(meta) function technic.handle_machine_upgrades(meta)
-- Get the names of the upgrades -- Get the names of the upgrades
local inv = meta:get_inventory() local inv = meta:get_inventory()
@ -37,27 +35,23 @@ function technic.handle_machine_upgrades(meta)
end end
function technic.send_items(pos, x_velocity, z_velocity, output_name) function technic.send_items(pos, x_velocity, z_velocity)
-- Send items on their way in the pipe system. -- Send items on their way in the pipe system.
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 inv = meta:get_inventory()
local i = 0 local i = 0
for _, stack in ipairs(inv:get_list(output_name)) do for _, stack in ipairs(inv:get_list("dst")) do
i = i + 1 i = i + 1
if stack then if stack then
local item0 = stack:to_table() local item0 = stack:to_table()
if item0 then if item0 then
item0["count"] = "1" item0["count"] = "1"
local item1 = pipeworks.tube_item({x=pos.x, y=pos.y, z=pos.z}, item0) local item1 = tube_item({x=pos.x, y=pos.y, z=pos.z}, item0)
item1:get_luaentity().start_pos = {x=pos.x, y=pos.y, z=pos.z} item1:get_luaentity().start_pos = {x=pos.x, y=pos.y, z=pos.z}
item1:setvelocity({x=x_velocity, y=0, z=z_velocity}) item1:setvelocity({x=x_velocity, y=0, z=z_velocity})
item1:setacceleration({x=0, y=0, z=0}) item1:setacceleration({x=0, y=0, z=0})
stack:take_item(1) stack:take_item(1)
inv:set_stack(output_name, i, stack) inv:set_stack("dst", i, stack)
return return
end end
end end
@ -85,11 +79,7 @@ function technic.smelt_item(meta, result, speed)
end end
end end
function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function) function technic.handle_machine_pipeworks(pos, tube_upgrade)
if send_function == nil then
send_function = technic.send_items
end
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
@ -110,48 +100,12 @@ function technic.handle_machine_pipeworks(pos, tube_upgrade, send_function)
end end
tube_time = meta:get_int("tube_time") tube_time = meta:get_int("tube_time")
tube_time = tube_time + tube_upgrade tube_time = tube_time + tube_upgrade
if tube_time >= 2 then if tube_time > 3 then
tube_time = 0 tube_time = 0
if output_tube_connected then if output_tube_connected then
send_function(pos, x_velocity, z_velocity) technic.send_items(pos, x_velocity, z_velocity)
end end
end end
meta:set_int("tube_time", tube_time) meta:set_int("tube_time", tube_time)
end end
function technic.machine_can_dig(pos, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") or
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end
local function inv_change(pos, player, count)
if minetest.is_protected(pos, player:get_player_name()) then
minetest.chat_send_player(player:get_player_name(),
S("Inventory move disallowed due to protection"))
return 0
end
return count
end
function technic.machine_inventory_put(pos, listname, index, stack, player)
return inv_change(pos, player, stack:get_count())
end
function technic.machine_inventory_take(pos, listname, index, stack, player)
return inv_change(pos, player, stack:get_count())
end
function technic.machine_inventory_move(pos, from_list, from_index,
to_list, to_index, count, player)
return inv_change(pos, player, count)
end

View File

@ -1,9 +0,0 @@
local S = technic.getter
function technic.register_compressor(data)
data.typename = "compressing"
data.machine_name = "compressor"
data.machine_desc = S("%s Compressor")
technic.register_base_machine(data)
end

View File

@ -1,24 +0,0 @@
local S = technic.getter
technic.register_recipe_type("compressing", S("Compressing"))
function technic.register_compressor_recipe(data)
data.time = data.time or 4
technic.register_recipe("compressing", data)
end
local recipes = {
{"default:snowblock", "default:ice"},
{"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:enriched_uranium 4", "technic:uranium_fuel"},
}
for _, data in pairs(recipes) do
technic.register_compressor_recipe({input = {data[1]}, output = data[2]})
end

View File

@ -2,8 +2,199 @@
local S = technic.getter local S = technic.getter
function technic.register_electric_furnace(data) function technic.register_electric_furnace(data)
data.typename = "cooking" local tier = data.tier
data.machine_name = "electric_furnace" local ltier = string.lower(tier)
data.machine_desc = S("%s Furnace")
technic.register_base_machine(data) local tube_side_texture = data.tube and "technic_"..ltier.."_electric_furnace_side_tube.png"
end or "technic_"..ltier.."_electric_furnace_side.png"
local tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("src",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("src", stack)
end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
}
local formspec =
"invsize[8,10;]"..
"list[current_name;src;3,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,6;8,4;]"..
"label[0,0;"..S("%s Electric Furnace"):format(tier).."]"
if data.upgrade then
formspec = formspec..
"list[current_name;upgrade1;1,4;1,1;]"..
"list[current_name;upgrade2;2,4;1,1;]"..
"label[1,5;Upgrade Slots]"
end
data.formspec = formspec
minetest.register_node("technic:"..ltier.."_electric_furnace", {
description = S("%s Electric furnace"):format(tier),
tiles = {"technic_"..ltier.."_electric_furnace_top.png",
"technic_"..ltier.."_electric_furnace_bottom.png",
tube_side_texture,
tube_side_texture,
"technic_"..ltier.."_electric_furnace_side.png",
"technic_"..ltier.."_electric_furnace_front.png"},
paramtype2 = "facedir",
groups = {cracky=2, tubedevice=1, tubedevice_receiver=1},
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
tube = tube,
technic = data,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local name = minetest.get_node(pos).name
local data = minetest.registered_nodes[name].technic
meta:set_string("infotext", S("%s Electric furnace"):format(data.tier))
meta:set_int("tube_time", 0)
meta:set_string("formspec", data.formspec)
local inv = meta:get_inventory()
inv:set_size("src", 1)
inv:set_size("dst", 4)
inv:set_size("upgrade1", 1)
inv:set_size("upgrade2", 1)
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") or
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
})
minetest.register_node("technic:"..ltier.."_electric_furnace_active", {
description = tier.." Electric furnace",
tiles = {"technic_"..ltier.."_electric_furnace_top.png",
"technic_"..ltier.."_electric_furnace_bottom.png",
tube_side_texture,
tube_side_texture,
"technic_"..ltier.."_electric_furnace_side.png",
"technic_"..ltier.."_electric_furnace_front_active.png"},
paramtype2 = "facedir",
groups = {cracky=2, tubedevice=1, tubedevice_receiver=1, not_in_creative_inventory=1},
light_source = 8,
legacy_facedir_simple = true,
sounds = default.node_sound_stone_defaults(),
tube = tube,
technic = data,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local name = minetest.get_node(pos).name
local data = minetest.registered_nodes[name].technic
meta:set_string("infotext", S("%s Electric furnace", data.tier))
meta:set_int("tube_time", 0)
meta:set_string("formspec", data.formspec)
local inv = meta:get_inventory()
inv:set_size("src", 1)
inv:set_size("dst", 4)
inv:set_size("upgrade1", 1)
inv:set_size("upgrade2", 1)
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") or
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
-- These three makes sure upgrades are not moved in or out while the furnace is active.
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "src" or listname == "dst" then
return stack:get_stack_max()
else
return 0 -- Disallow the move
end
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if listname == "src" or listname == "dst" then
return stack:get_stack_max()
else
return 0 -- Disallow the move
end
end,
allow_metadata_inventory_move = function(pos, from_list, to_list, to_list, to_index, count, player)
return 0
end,
})
minetest.register_abm({
nodenames = {"technic:"..ltier.."_electric_furnace",
"technic:"..ltier.."_electric_furnace_active"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local data = minetest.registered_nodes[node.name].technic
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local eu_input = meta:get_int(data.tier.."_EU_input")
-- Machine information
local machine_name = S("%s Electric Furnace"):format(data.tier)
local machine_node = "technic:"..string.lower(data.tier).."_electric_furnace"
local machine_demand = data.demand
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, data.tier)
-- Check upgrade slots
local EU_upgrade, tube_upgrade = 0, 0
if data.upgrade then
EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta)
end
if data.tube then
technic.handle_machine_pipeworks(pos, tube_upgrade)
end
local result = minetest.get_craft_result({
method = "cooking",
width = 1,
items = inv:get_list("src")})
if not result or result.time == 0 or
not inv:room_for_item("dst", result.item) then
meta:set_int(data.tier.."_EU_demand", 0)
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name))
return
end
if eu_input < machine_demand[EU_upgrade+1] then
-- Unpowered - go idle
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= machine_demand[EU_upgrade+1] then
-- Powered
hacky_swap_node(pos, machine_node.."_active")
meta:set_string("infotext", S("%s Active"):format(machine_name))
technic.smelt_item(meta, result, data.speed)
end
meta:set_int(data.tier.."_EU_demand", machine_demand[EU_upgrade+1])
end,
})
technic.register_machine(tier, "technic:"..ltier.."_electric_furnace", technic.receiver)
technic.register_machine(tier, "technic:"..ltier.."_electric_furnace_active", technic.receiver)
end -- End registration

View File

@ -1,9 +0,0 @@
local S = technic.getter
function technic.register_extractor(data)
data.typename = "extracting"
data.machine_name = "extractor"
data.machine_desc = S("%s Extractor")
technic.register_base_machine(data)
end

View File

@ -1,35 +0,0 @@
local S = technic.getter
technic.register_recipe_type("extracting", S("Extracting"))
function technic.register_extractor_recipe(data)
data.time = data.time or 4
technic.register_recipe("extracting", data)
end
local recipes = {
-- Dyes
{"technic:coal_dust", "dye:black 2"},
{"default:cactus", "dye:green 2"},
{"default:dry_shrub", "dye:brown 2"},
{"flowers:geranium", "dye:blue 2"},
{"flowers:dandelion_white", "dye:white 2"},
{"flowers:dandelion_yellow", "dye:yellow 2"},
{"flowers:tulip", "dye:orange 2"},
{"flowers:rose", "dye:red 2"},
{"flowers:viola", "dye:violet 2"},
-- Rubber
{"technic:raw_latex", "technic:rubber 3"},
{"moretrees:rubber_tree_trunk_empty", "technic:rubber"},
{"moretrees:rubber_tree_trunk", "technic:rubber"},
-- Other
{"technic:uranium 5", "technic:enriched_uranium"},
}
for _, data in pairs(recipes) do
technic.register_extractor_recipe({input = {data[1]}, output = data[2]})
end

View File

@ -1,81 +1,70 @@
local S = technic.getter
local tube = { local S = technic.getter
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("src", 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("src", stack)
end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
}
function technic.register_generator(data) function technic.register_generator(data)
local tier = data.tier local tier = data.tier
local ltier = string.lower(tier) local ltier = string.lower(tier)
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
local active_groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}
if data.tube then
groups.tubedevice = 1
groups.tubedevice_receiver = 1
active_groups.tubedevice = 1
active_groups.tubedevice_receiver = 1
end
local generator_formspec = local generator_formspec =
"invsize[8,9;]".. "invsize[8,9;]"..
"label[0,0;"..S("Fuel-Fired %s Generator"):format(tier).."]".. "label[0,0;"..S("%s Generator"):format(tier).."]"..
"list[current_name;src;3,1;1,1;]".. "list[current_name;src;3,1;1,1;]"..
"image[4,1;1,1;default_furnace_fire_bg.png]".. "image[4,1;1,1;default_furnace_fire_bg.png]"..
"list[current_player;main;0,5;8,4;]" "list[current_player;main;0,5;8,4;]"
local desc = S("Fuel-Fired %s Generator"):format(tier) local desc = S("%s Generator"):format(tier)
minetest.register_node("technic:"..ltier.."_generator", { minetest.register_node("technic:"..ltier.."_generator", {
description = desc, description = desc,
tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"}, "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = groups, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
tube = data.tube and tube or nil,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("infotext", desc) meta:set_string("infotext", desc)
meta:set_int(data.tier.."_EU_supply", 0) meta:set_int(data.tier.."_EU_supply", 0)
meta:set_int("burn_time", 0) meta:set_int("burn_time", 0)
meta:set_int("tube_time", 0)
meta:set_string("formspec", generator_formspec) meta:set_string("formspec", generator_formspec)
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size("src", 1) inv:set_size("src", 1)
end, end,
can_dig = technic.machine_can_dig, can_dig = function(pos, player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.get_meta(pos)
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
allow_metadata_inventory_move = technic.machine_inventory_move, if not inv:is_empty("src") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
}) })
minetest.register_node("technic:"..ltier.."_generator_active", { minetest.register_node("technic:"..ltier.."_generator_active", {
description = desc, description = desc,
tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png", tiles = {"technic_"..ltier.."_generator_top.png", "technic_machine_bottom.png",
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_side.png",
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"}, "technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = active_groups, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
not_in_creative_inventory=1},
legacy_facedir_simple = true, legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
tube = data.tube and tube or nil,
drop = "technic:"..ltier.."_generator", drop = "technic:"..ltier.."_generator",
can_dig = technic.machine_can_dig, can_dig = function(pos, player)
allow_metadata_inventory_put = technic.machine_inventory_put, local meta = minetest.get_meta(pos)
allow_metadata_inventory_take = technic.machine_inventory_take, local inv = meta:get_inventory()
allow_metadata_inventory_move = technic.machine_inventory_move, if not inv:is_empty("src") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
}) })
minetest.register_abm({ minetest.register_abm({
nodenames = {"technic:"..ltier.."_generator", "technic:"..ltier.."_generator_active"}, nodenames = {"technic:"..ltier.."_generator", "technic:"..ltier.."_generator_active"},
@ -87,7 +76,7 @@ function technic.register_generator(data)
local burn_totaltime = meta:get_int("burn_totaltime") local burn_totaltime = meta:get_int("burn_totaltime")
-- If more to burn and the energy produced was used: produce some more -- If more to burn and the energy produced was used: produce some more
if burn_time > 0 then if burn_time > 0 then
meta:set_int(tier.."_EU_supply", data.supply) meta:set_int(data.tier.."_EU_supply", data.supply)
burn_time = burn_time - 1 burn_time = burn_time - 1
meta:set_int("burn_time", burn_time) meta:set_int("burn_time", burn_time)
end end
@ -96,12 +85,10 @@ function technic.register_generator(data)
local inv = meta:get_inventory() 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 fuellist = inv:get_list("src")
local fuel = minetest.get_craft_result( fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
{method = "fuel", width = 1,
items = fuellist})
if not fuel or fuel.time == 0 then if not fuel or fuel.time == 0 then
meta:set_string("infotext", S("%s Out Of Fuel"):format(desc)) meta:set_string("infotext", S("%s Out Of Fuel"):format(desc))
technic.swap_node(pos, "technic:"..ltier.."_generator") hacky_swap_node(pos, "technic:"..ltier.."_generator")
return return
end end
meta:set_int("burn_time", fuel.time) meta:set_int("burn_time", fuel.time)
@ -109,11 +96,11 @@ function technic.register_generator(data)
local stack = inv:get_stack("src", 1) local stack = inv:get_stack("src", 1)
stack:take_item() stack:take_item()
inv:set_stack("src", 1, stack) inv:set_stack("src", 1, stack)
technic.swap_node(pos, "technic:"..ltier.."_generator_active") hacky_swap_node(pos, "technic:"..ltier.."_generator_active")
meta:set_int(tier.."_EU_supply", data.supply) meta:set_int(data.tier.."_EU_supply", data.supply)
else else
technic.swap_node(pos, "technic:"..ltier.."_generator") hacky_swap_node(pos, "technic:"..ltier.."_generator")
meta:set_int(tier.."_EU_supply", 0) meta:set_int(data.tier.."_EU_supply", 0)
end end
end end
if burn_totaltime == 0 then burn_totaltime = 1 end if burn_totaltime == 0 then burn_totaltime = 1 end
@ -121,14 +108,14 @@ function technic.register_generator(data)
meta:set_string("infotext", desc.." ("..percent.."%)") meta:set_string("infotext", desc.." ("..percent.."%)")
meta:set_string("formspec", meta:set_string("formspec",
"size[8, 9]".. "size[8, 9]"..
"label[0, 0;"..minetest.formspec_escape(desc).."]".. "label[0, 0;Generator]"..
"list[current_name;src;3, 1;1, 1;]".. "list[current_name;src;3, 1;1, 1;]"..
"image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:".. "image[4, 1;1, 1;default_furnace_fire_bg.png^[lowpart:"..
(percent)..":default_furnace_fire_fg.png]".. (percent)..":default_furnace_fire_fg.png]"..
"list[current_player;main;0, 5;8, 4;]") "list[current_player;main;0, 5;8, 4;]")
end end
}) })
technic.register_machine(tier, "technic:"..ltier.."_generator", technic.producer) technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer)
technic.register_machine(tier, "technic:"..ltier.."_generator_active", technic.producer) technic.register_machine(data.tier, "technic:"..ltier.."_generator", technic.producer)
end end

View File

@ -2,8 +2,185 @@
local S = technic.getter local S = technic.getter
function technic.register_grinder(data) function technic.register_grinder(data)
data.typename = "grinding" local tier = data.tier
data.machine_name = "grinder" local ltier = string.lower(tier)
data.machine_desc = S("%s Grinder") local tube = {
technic.register_base_machine(data) insert_object = function(pos, node, stack, direction)
end local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("src", 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("src", stack)
end,
connect_sides = {left=1, right=1, back=1, top=1, bottom=1},
}
local formspec =
"invsize[8,10;]"..
"list[current_name;src;3,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,6;8,4;]"..
"label[0,0;"..tier.." Grinder]"
if data.upgrade then
formspec = formspec..
"list[current_name;upgrade1;1,4;1,1;]"..
"list[current_name;upgrade2;2,4;1,1;]"..
"label[1,5;Upgrade Slots]"
end
data.formspec = formspec
minetest.register_node("technic:"..ltier.."_grinder", {
description = S("%s Grinder"):format(tier),
tiles = {"technic_"..ltier.."_grinder_top.png", "technic_"..ltier.."_grinder_bottom.png",
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_side.png",
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_front.png"},
paramtype2 = "facedir",
groups = {cracky=2, tubedevice=1, tubedevice_receiver=1},
technic = data,
tube = tube,
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local data = minetest.registered_nodes[node.name].technic
meta:set_string("infotext", S("%s Grinder"):format(data.tier))
meta:set_int("tube_time", 0)
meta:set_string("formspec", data.formspec)
local inv = meta:get_inventory()
inv:set_size("src", 1)
inv:set_size("dst", 4)
inv:set_size("upgrade1", 1)
inv:set_size("upgrade2", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") or
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
})
minetest.register_node("technic:"..ltier.."_grinder_active",{
description = S("%s Grinder"):format(tier),
tiles = {"technic_"..ltier.."_grinder_top.png", "technic_"..ltier.."_grinder_bottom.png",
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_side.png",
"technic_"..ltier.."_grinder_side.png", "technic_"..ltier.."_grinder_front_active.png"},
paramtype2 = "facedir",
groups = {cracky=2, tubedevice=1, tubedevice_receiver=1, not_in_creative_inventory=1},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
technic = data,
tube = tube,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if not inv:is_empty("src") or not inv:is_empty("dst") or
not inv:is_empty("upgrade1") or not inv:is_empty("upgrade2") then
minetest.chat_send_player(player:get_player_name(),
S("Machine cannot be removed because it is not empty"))
return false
else
return true
end
end,
-- These three makes sure upgrades are not moved in or out while the grinder is active.
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "src" or listname == "dst" then
return stack:get_stack_max()
else
return 0 -- Disallow the move
end
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if listname == "src" or listname == "dst" then
return stack:get_stack_max()
else
return 0 -- Disallow the move
end
end,
allow_metadata_inventory_move = function(pos, from_list, to_list, to_list, to_index, count, player)
return 0
end,
})
minetest.register_abm({
nodenames = {"technic:"..ltier.."_grinder","technic:"..ltier.."_grinder_active"},
interval = 1,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local data = minetest.registered_nodes[node.name].technic
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local eu_input = meta:get_int(data.tier.."_EU_input")
local machine_name = S("%s Grinder"):format(data.tier)
local machine_node = "technic:"..string.lower(data.tier).."_grinder"
local machine_demand = data.demand
-- Setup meta data if it does not exist.
if not eu_input then
meta:set_int(data.tier.."_EU_demand", machine_demand[1])
meta:set_int(data.tier.."_EU_input", 0)
return
end
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, data.tier)
local EU_upgrade, tube_upgrade = 0, 0
if data.upgrade then
EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta)
end
if data.tube then
technic.handle_machine_pipeworks(pos, tube_upgrade)
end
local result = technic.get_grinder_recipe(inv:get_stack("src", 1))
if not result then
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int(data.tier.."_EU_demand", 0)
return
end
if eu_input < machine_demand[EU_upgrade+1] then
-- Unpowered - go idle
hacky_swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
elseif eu_input >= machine_demand[EU_upgrade+1] then
-- Powered
hacky_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") >= result.time / data.speed then
meta:set_int("src_time", 0)
local result_stack = ItemStack(result.output)
if inv:room_for_item("dst", result_stack) then
srcstack = inv:get_stack("src", 1)
srcstack:take_item()
inv:set_stack("src", 1, srcstack)
inv:add_item("dst", result_stack)
end
end
end
meta:set_int(data.tier.."_EU_demand", machine_demand[EU_upgrade+1])
end
})
technic.register_machine(tier, "technic:"..ltier.."_grinder", technic.receiver)
technic.register_machine(tier, "technic:"..ltier.."_grinder_active", technic.receiver)
end -- End registration

View File

@ -1,46 +1,64 @@
local S = technic.getter local S = technic.getter
technic.register_recipe_type("grinding", S("Grinding")) technic.grinder_recipes = {}
function technic.register_grinder_recipe(data) function technic.register_grinder_recipe(data)
data.time = data.time or 3 data.time = data.time or 3
technic.register_recipe("grinding", data) technic.grinder_recipes[data.input] = data
if unified_inventory then
unified_inventory.register_craft({
type = "grinding",
output = data.output,
items = {data.input},
width = 0,
})
end
end end
-- Receive an ItemStack of result by an ItemStack input
function technic.get_grinder_recipe(itemstack)
return technic.grinder_recipes[itemstack:get_name()]
end
-- Sorted alphebeticaly
local recipes = { local recipes = {
-- Dusts {"default:bronze_ingot", "technic:bronze_dust 1"},
{"default:coal_lump", "technic:coal_dust 2"}, {"default:coal_lump", "technic:coal_dust 2"},
{"default:cobble", "default:gravel"},
{"default:copper_ingot", "technic:copper_dust 1"},
{"default:copper_lump", "technic:copper_dust 2"}, {"default:copper_lump", "technic:copper_dust 2"},
{"default:desert_stone", "default:desert_sand"}, {"default:desert_stone", "default:desert_sand"},
{"default:gold_ingot", "technic:gold_dust 1"},
{"default:gold_lump", "technic:gold_dust 2"}, {"default:gold_lump", "technic:gold_dust 2"},
{"default:iron_lump", "technic:wrought_iron_dust 2"},
{"moreores:mithril_lump", "technic:mithril_dust 2"},
{"moreores:silver_lump", "technic:silver_dust 2"},
{"moreores:tin_lump", "technic:tin_dust 2"},
{"technic:chromium_lump", "technic:chromium_dust 2"},
{"technic:zinc_lump", "technic:zinc_dust 2"},
-- Other
{"default:cobble", "default:gravel"},
{"default:gravel", "default:dirt"}, {"default:gravel", "default:dirt"},
{"default:iron_lump", "technic:iron_dust 2"},
{"default:steel_ingot", "technic:iron_dust 1"},
{"default:stone", "default:sand"}, {"default:stone", "default:sand"},
{"gloopores:alatro_lump", "technic:alatro_dust 2"},
{"gloopores:kalite_lump", "technic:kalite_dust 2"},
{"gloopores:arol_lump", "technic:arol_dust 2"},
{"gloopores:talinite_lump", "technic:talinite_dust 2"},
{"gloopores:akalin_lump", "technic:akalin_dust 2"},
{"moreores:mithril_ingot", "technic:mithril_dust 1"},
{"moreores:mithril_lump", "technic:mithril_dust 2"},
{"moreores:silver_ingot", "technic:silver_dust 1"},
{"moreores:silver_lump", "technic:silver_dust 2"},
{"moreores:tin_ingot", "technic:tin_dust 1"},
{"moreores:tin_lump", "technic:tin_dust 2"},
{"technic:chromium_ingot", "technic:chromium_dust 1"},
{"technic:chromium_lump", "technic:chromium_dust 2"},
{"technic:zinc_ingot", "technic:zinc_dust 1"},
{"technic:zinc_lump", "technic:zinc_dust 2"},
{"technic:brass_ingot", "technic:brass_dust 1"},
} }
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"})
end
if minetest.get_modpath("homedecor") then if minetest.get_modpath("homedecor") then
table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"}) table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"})
end end
for _, data in pairs(recipes) do for _, data in pairs(recipes) do
technic.register_grinder_recipe({input = {data[1]}, output = data[2]}) technic.register_grinder_recipe({input=data[1], output=data[2]})
end end
local function register_dust(name, ingot) local function register_dust(name, ingot)
@ -57,32 +75,26 @@ local function register_dust(name, ingot)
recipe = "technic:"..lname.."_dust", recipe = "technic:"..lname.."_dust",
output = ingot, output = ingot,
}) })
technic.register_grinder_recipe({ input = {ingot}, output = "technic:"..lname.."_dust 1" })
end end
end end
-- Sorted alphibeticaly -- Sorted alphibeticaly
register_dust("Akalin", "glooptest:akalin_ingot")
register_dust("Alatro", "glooptest:alatro_ingot")
register_dust("Arol", "glooptest:arol_ingot")
register_dust("Brass", "technic:brass_ingot") register_dust("Brass", "technic:brass_ingot")
register_dust("Bronze", "default:bronze_ingot") register_dust("Bronze", "default:bronze_ingot")
register_dust("Carbon Steel", "technic:carbon_steel_ingot")
register_dust("Cast Iron", "technic:cast_iron_ingot")
register_dust("Chromium", "technic:chromium_ingot") register_dust("Chromium", "technic:chromium_ingot")
register_dust("Coal", nil) register_dust("Coal", nil)
register_dust("Copper", "default:copper_ingot") register_dust("Copper", "default:copper_ingot")
register_dust("Gold", "default:gold_ingot") register_dust("Gold", "default:gold_ingot")
register_dust("Iron", "default:steel_ingot")
register_dust("Mithril", "moreores:mithril_ingot") register_dust("Mithril", "moreores:mithril_ingot")
register_dust("Silver", "moreores:silver_ingot") register_dust("Silver", "moreores:silver_ingot")
register_dust("Stainless Steel", "technic:stainless_steel_ingot") register_dust("Stainless Steel", "technic:stainless_steel_ingot")
register_dust("Talinite", "glooptest:talinite_ingot")
register_dust("Tin", "moreores:tin_ingot") register_dust("Tin", "moreores:tin_ingot")
register_dust("Wrought Iron", "technic:wrought_iron_ingot")
register_dust("Zinc", "technic:zinc_ingot") register_dust("Zinc", "technic:zinc_ingot")
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
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
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",

View File

@ -1,29 +1,12 @@
local path = technic.modpath.."/machines/register" local path = technic.modpath.."/machines/register"
dofile(path.."/common.lua") dofile(path.."/alloy_furnace.lua")
-- Wiring stuff
dofile(path.."/cables.lua")
dofile(path.."/battery_box.lua") dofile(path.."/battery_box.lua")
dofile(path.."/cables.lua")
-- Generators dofile(path.."/common.lua")
dofile(path.."/electric_furnace.lua")
dofile(path.."/grinder.lua")
dofile(path.."/grinder_recipes.lua")
dofile(path.."/solar_array.lua") dofile(path.."/solar_array.lua")
dofile(path.."/generator.lua") dofile(path.."/generator.lua")
-- API for machines
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")
-- Machines
dofile(path.."/alloy_furnace.lua")
dofile(path.."/electric_furnace.lua")
dofile(path.."/grinder.lua")
dofile(path.."/extractor.lua")
dofile(path.."/compressor.lua")

View File

@ -1,168 +0,0 @@
local S = technic.getter
local tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:add_item("src", 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("src", stack)
end,
connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1},
}
function technic.register_base_machine(data)
local typename = data.typename
local numitems = technic.recipes[typename].numitems
local machine_name = data.machine_name
local machine_desc = data.machine_desc
local tier = data.tier
local ltier = string.lower(tier)
local groups = {cracky = 2}
local active_groups = {cracky = 2, not_in_creative_inventory = 1}
if data.tube then
groups.tubedevice = 1
groups.tubedevice_receiver = 1
active_groups.tubedevice = 1
active_groups.tubedevice_receiver = 1
end
local formspec =
"invsize[8,9;]"..
"list[current_name;src;"..(4-numitems)..",1;"..numitems..",1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]"..
"label[0,0;"..machine_desc:format(tier).."]"
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").."]"
end
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"},
paramtype2 = "facedir",
groups = groups,
tube = data.tube and tube or nil,
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
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_string("formspec", formspec)
local inv = meta:get_inventory()
inv:set_size("src", numitems)
inv:set_size("dst", 4)
inv:set_size("upgrade1", 1)
inv:set_size("upgrade2", 1)
end,
can_dig = technic.machine_can_dig,
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
})
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"},
paramtype2 = "facedir",
drop = "technic:"..ltier.."_"..machine_name,
groups = active_groups,
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
tube = data.tube and tube or nil,
can_dig = technic.machine_can_dig,
allow_metadata_inventory_put = technic.machine_inventory_put,
allow_metadata_inventory_take = technic.machine_inventory_take,
allow_metadata_inventory_move = technic.machine_inventory_move,
})
minetest.register_abm({
nodenames = {"technic:"..ltier.."_"..machine_name,
"technic:"..ltier.."_"..machine_name.."_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 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
-- 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)
return
end
-- Power off automatically if no longer connected to a switching station
technic.switching_station_timeout_count(pos, tier)
local EU_upgrade, tube_upgrade = 0, 0
if data.upgrade then
EU_upgrade, tube_upgrade = technic.handle_machine_upgrades(meta)
end
if data.tube then
technic.handle_machine_pipeworks(pos, tube_upgrade)
end
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)
return
end
if eu_input < machine_demand[EU_upgrade+1] then
-- Unpowered - go idle
technic.swap_node(pos, machine_node)
meta:set_string("infotext", S("%s Unpowered"):format(machine_desc_tier))
elseif eu_input >= machine_demand[EU_upgrade+1] then
-- Powered
technic.swap_node(pos, machine_node.."_active")
meta:set_string("infotext", S("%s Active"):format(machine_desc_tier))
meta:set_int("src_time", meta:get_int("src_time") + 1)
if meta:get_int("src_time") >= result.time / data.speed then
meta:set_int("src_time", 0)
local result_stack = ItemStack(result.output)
if inv:room_for_item("dst", result_stack) then
inv:set_list("src", result.new_input)
inv:add_item("dst", result_stack)
end
end
end
meta:set_int(tier.."_EU_demand", machine_demand[EU_upgrade+1])
end
})
technic.register_machine(tier, "technic:"..ltier.."_"..machine_name, technic.receiver)
technic.register_machine(tier, "technic:"..ltier.."_"..machine_name.."_active", technic.receiver)
end -- End registration

View File

@ -1,88 +0,0 @@
technic.recipes = {cooking = {numitems = 1}}
function technic.register_recipe_type(typename, desc, numitems)
numitems = numitems or 1
if unified_inventory and unified_inventory.register_craft_type then
unified_inventory.register_craft_type(typename, {
description = desc,
height = numitems,
width = 1,
})
end
technic.recipes[typename] = {numitems = numitems, recipes = {}}
end
local function get_recipe_index(items)
local l = {}
for i, stack in ipairs(items) do
l[i] = ItemStack(stack):get_name()
end
table.sort(l)
return table.concat(l, "/")
end
local function register_recipe(typename, data)
-- Handle aliases
for i, stack in ipairs(data.input) do
data.input[i] = ItemStack(stack):to_string()
end
data.output = ItemStack(data.output):to_string()
local recipe = {time = data.time, input = {}, output = data.output}
local index = get_recipe_index(data.input)
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 then
unified_inventory.register_craft({
type = typename,
output = data.output,
items = data.input,
width = 0,
})
end
end
function technic.register_recipe(typename, data)
minetest.after(0.01, register_recipe, typename, data) -- Handle aliases
end
function technic.get_recipe(typename, items)
if typename == "cooking" then -- Already builtin in Minetest, so use that
local result, new_input = minetest.get_craft_result({
method = "cooking",
width = 1,
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}
end
end
local index = get_recipe_index(items)
local recipe = technic.recipes[typename].recipes[index]
if recipe then
local new_input = {}
for i, stack in ipairs(items) do
if stack:get_count() < recipe.input[stack:get_name()] then
print(stack:get_name())
return nil
else
new_input[i] = ItemStack(stack)
new_input[i]:take_item(recipe.input[stack:get_name()])
end
end
return {time = recipe.time,
new_input = new_input,
output = recipe.output}
else
return nil
end
end

View File

@ -11,7 +11,7 @@ function technic.register_solar_array(data)
"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}, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
description = S("Arrayed Solar %s Generator"):format(tier), description = S("%s Solar Array"):format(tier),
active = false, active = false,
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
@ -19,9 +19,11 @@ function technic.register_solar_array(data)
type = "fixed", type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
}, },
technic = data,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
local tier = minetest.registered_nodes[name].technic.tier
meta:set_int(tier.."_EU_supply", 0) meta:set_int(tier.."_EU_supply", 0)
end, end,
}) })
@ -40,7 +42,8 @@ function technic.register_solar_array(data)
-- To take care of some of it solar panels do not work outside daylight hours or if -- To take care of some of it solar panels do not work outside daylight hours or if
-- built below -10m -- built below -10m
local pos1 = {} local pos1 = {}
local machine_name = S("Arrayed Solar %s Generator"):format(tier) local data = minetest.registered_nodes[node.name].technic
local machine_name = S("%s Solar Array"):format(data.tier)
pos1.y = pos.y + 1 pos1.y = pos.y + 1
pos1.x = pos.x pos1.x = pos.x
pos1.z = pos.z pos1.z = pos.z
@ -57,10 +60,10 @@ function technic.register_solar_array(data)
charge_to_give = math.max(charge_to_give, 0) charge_to_give = math.max(charge_to_give, 0)
charge_to_give = math.min(charge_to_give, data.power * 50) charge_to_give = math.min(charge_to_give, data.power * 50)
meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..charge_to_give.."EU)") meta:set_string("infotext", S("%s Active"):format(machine_name).." ("..charge_to_give.."EU)")
meta:set_int(tier.."_EU_supply", charge_to_give) meta:set_int(data.tier.."_EU_supply", charge_to_give)
else else
meta:set_string("infotext", S("%s Idle"):format(machine_name)) meta:set_string("infotext", S("%s Idle"):format(machine_name))
meta:set_int(tier.."_EU_supply", 0) meta:set_int(data.tier.."_EU_supply", 0)
end end
end, end,
}) })

View File

@ -32,9 +32,9 @@ minetest.register_node("technic:supply_converter", {
minetest.register_craft({ minetest.register_craft({
output = 'technic:supply_converter 1', output = 'technic:supply_converter 1',
recipe = { recipe = {
{'technic:stainless_steel_ingot', 'technic:rubber', 'technic:stainless_steel_ingot'}, {'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
{'technic:mv_transformer', 'technic:machine_casing', 'technic:lv_transformer'}, {'technic:mv_transformer', 'technic:mv_cable0', 'technic:lv_transformer'},
{'technic:mv_cable0', 'technic:rubber', 'technic:lv_cable0'}, {'technic:mv_cable0', 'technic:rubber', 'technic:lv_cable0'},
} }
}) })
@ -76,6 +76,6 @@ minetest.register_abm({
}) })
for tier, machines in pairs(technic.machines) do for tier, machines in pairs(technic.machines) do
technic.register_machine(tier, "technic:supply_converter", technic.producer_receiver) technic.register_machine(tier, "technic:supply_converter", technic.battery)
end end

View File

@ -35,9 +35,9 @@ local S = technic.getter
minetest.register_craft({ minetest.register_craft({
output = "technic:switching_station", output = "technic:switching_station",
recipe = { recipe = {
{"", "technic:lv_transformer", ""}, {"default:steel_ingot", "technic:lv_transformer", "default:steel_ingot"},
{"default:copper_ingot", "technic:machine_casing", "default:copper_ingot"}, {"default:copper_ingot", "technic:lv_cable0", "default:copper_ingot"},
{"technic:lv_cable0", "technic:lv_cable0", "technic:lv_cable0"} {"default:steel_ingot", "technic:lv_cable0", "default:steel_ingot"}
} }
}) })
@ -67,7 +67,7 @@ minetest.register_node("technic:switching_station",{
-- A node must be touched by the station continuously in order to function -- A node must be touched by the station continuously in order to function
function technic.switching_station_timeout_count(pos, tier) function technic.switching_station_timeout_count(pos, tier)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local timeout = meta:get_int(tier.."_EU_timeout") timeout = meta:get_int(tier.."_EU_timeout")
if timeout == 0 then if timeout == 0 then
meta:set_int(tier.."_EU_input", 0) meta:set_int(tier.."_EU_input", 0)
else else
@ -106,9 +106,6 @@ local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, all_nodes, pos, m
add_new_cable_node(PR_nodes, pos) add_new_cable_node(PR_nodes, pos)
elseif machines[name] == technic.receiver then elseif machines[name] == technic.receiver then
add_new_cable_node(RE_nodes, pos) add_new_cable_node(RE_nodes, pos)
elseif machines[name] == technic.producer_receiver then
add_new_cable_node(PR_nodes, pos)
add_new_cable_node(RE_nodes, pos)
elseif machines[name] == technic.battery then elseif machines[name] == technic.battery then
add_new_cable_node(BA_nodes, pos) add_new_cable_node(BA_nodes, pos)
end end

View File

@ -3,7 +3,6 @@
technic.receiver = "RE" technic.receiver = "RE"
technic.producer = "PR" technic.producer = "PR"
technic.producer_receiver = "PR_RE"
technic.battery = "BA" technic.battery = "BA"
technic.machines = {} technic.machines = {}
@ -45,15 +44,7 @@ end
-- Wear down a tool depending on the remaining charge. -- Wear down a tool depending on the remaining charge.
function technic.set_RE_wear(itemstack, item_load, max_load) function technic.set_RE_wear(itemstack, item_load, max_load)
if (minetest.registered_items[itemstack:get_name()].wear_represents or "mechanical_wear") ~= "technic_RE_charge" then return itemstack end local temp = 65536 - math.floor(item_load / max_load * 65535)
local temp
if item_load == 0 then
temp = 0
else
temp = 65536 - math.floor(item_load / max_load * 65535)
if temp > 65535 then temp = 65535 end
if temp < 1 then temp = 1 end
end
itemstack:set_wear(temp) itemstack:set_wear(temp)
return itemstack return itemstack
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 B

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

View File

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 745 B

Some files were not shown because too many files have changed in this diff Show More