Merge branch 'pandorabox' of github.com:pandorabox-io/technic into pandorabox

This commit is contained in:
Thomas Rudin
2018-11-09 08:05:20 +01:00
34 changed files with 983 additions and 315 deletions

View File

@ -4,3 +4,5 @@ concrete
unifieddyes? unifieddyes?
intllib? intllib?
moreblocks? moreblocks?
steel?
streetsmod?

View File

@ -103,7 +103,7 @@ if minetest.get_modpath("moreblocks") then
end end
local iclip_def = { local iclip_def = {
description = "Insulator/cable clip", description = S("Insulator/cable clip"),
drawtype = "mesh", drawtype = "mesh",
mesh = "technic_insulator_clip.obj", mesh = "technic_insulator_clip.obj",
tiles = {"technic_insulator_clip.png"}, tiles = {"technic_insulator_clip.png"},
@ -113,7 +113,7 @@ local iclip_def = {
} }
local iclipfence_def = { local iclipfence_def = {
description = "Insulator/cable clip", description = S("Insulator/cable clip"),
tiles = {"technic_insulator_clip.png"}, tiles = {"technic_insulator_clip.png"},
is_ground_content = false, is_ground_content = false,
paramtype = "light", paramtype = "light",
@ -146,27 +146,60 @@ local iclipfence_def = {
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
} }
local sclip_tex = {
"technic_insulator_clip.png",
{ name = "strut.png^steel_strut_overlay.png", color = "white" },
{ name = "strut.png", color = "white" }
}
local streetsmod = minetest.get_modpath("streets") or minetest.get_modpath ("steelsupport")
-- cheapie's fork breaks it into several individual mods, with differernt names for the same content.
if streetsmod then
sclip_tex = {
"technic_insulator_clip.png",
{ name = "streets_support.png^technic_steel_strut_overlay.png", color = "white" },
{ name = "streets_support.png", color = "white" }
}
end
local sclip_def = {
description = S("Steel strut with insulator/cable clip"),
drawtype = "mesh",
mesh = "technic_steel_strut_with_insulator_clip.obj",
tiles = sclip_tex,
paramtype = "light",
paramtype2 = "wallmounted",
is_ground_content = false,
sounds = default.node_sound_stone_defaults(),
groups = { choppy=1, cracky=1 },
backface_culling = false
}
if minetest.get_modpath("unifieddyes") then if minetest.get_modpath("unifieddyes") then
iclip_def.paramtype2 = "colorwallmounted" iclip_def.paramtype2 = "colorwallmounted"
iclip_def.palette = "unifieddyes_palette_colorwallmounted.png" iclip_def.palette = "unifieddyes_palette_colorwallmounted.png"
iclip_def.after_place_node = function(pos, placer, itemstack, pointed_thing) iclip_def.after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end end
iclip_def.after_dig_node = unifieddyes.after_dig_node
iclip_def.groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1} iclip_def.groups = {choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1}
iclipfence_def.paramtype2 = "color" iclipfence_def.paramtype2 = "color"
iclipfence_def.palette = "unifieddyes_palette_extended.png" iclipfence_def.palette = "unifieddyes_palette_extended.png"
iclipfence_def.on_construct = unifieddyes.on_construct iclipfence_def.on_construct = unifieddyes.on_construct
iclipfence_def.after_place_node = unifieddyes.recolor_on_place
iclipfence_def.after_dig_node = unifieddyes.after_dig_node
iclipfence_def.groups = {fence=1, choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1} iclipfence_def.groups = {fence=1, choppy=1, snappy=1, oddly_breakable_by_hand=1, ud_param2_colorable = 1}
iclipfence_def.place_param2 = 171 -- medium amber, low saturation, closest color to default:wood
sclip_def.paramtype2 = "colorwallmounted"
sclip_def.palette = "unifieddyes_palette_colorwallmounted.png"
sclip_def.after_place_node = function(pos, placer, itemstack, pointed_thing)
unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
end
sclip_def.groups = {choppy=1, cracky=1, ud_param2_colorable = 1}
end end
minetest.register_node(":technic:insulator_clip", iclip_def) minetest.register_node(":technic:insulator_clip", iclip_def)
minetest.register_node(":technic:insulator_clip_fencepost", iclipfence_def) minetest.register_node(":technic:insulator_clip_fencepost", iclipfence_def)
minetest.register_node(":technic:steel_strut_with_insulator_clip", sclip_def)
minetest.register_craft({ minetest.register_craft({
output = "technic:insulator_clip", output = "technic:insulator_clip",
@ -185,3 +218,94 @@ minetest.register_craft({
{ "technic:raw_latex", "default:fence_wood", "technic:raw_latex"}, { "technic:raw_latex", "default:fence_wood", "technic:raw_latex"},
} }
}) })
local steelmod = minetest.get_modpath("steel")
if steelmod then
minetest.register_craft({
output = "technic:steel_strut_with_insulator_clip",
recipe = {
{"technic:insulator_clip_fencepost"},
{"steel:strut_mount"}
}
})
minetest.register_craft({
output = "technic:steel_strut_with_insulator_clip",
recipe = {
{"technic:insulator_clip_fencepost", "" },
{"steel:strut", "default:steel_ingot" },
}
})
end
if streetsmod then
minetest.register_craft({
output = "technic:steel_strut_with_insulator_clip",
recipe = {
{"technic:insulator_clip_fencepost", "" },
{"streets:steel_support", "default:steel_ingot" },
}
})
end
if minetest.get_modpath("unifieddyes") then
unifieddyes.register_color_craft({
output = "technic:insulator_clip_fencepost",
palette = "extended",
type = "shapeless",
neutral_node = "technic:insulator_clip_fencepost",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
unifieddyes.register_color_craft({
output = "technic:insulator_clip",
palette = "wallmounted",
type = "shapeless",
neutral_node = "technic:insulator_clip",
recipe = {
"NEUTRAL_NODE",
"MAIN_DYE"
}
})
unifieddyes.register_color_craft({
output = "technic:steel_strut_with_insulator_clip",
palette = "wallmounted",
type = "shapeless",
neutral_node = "",
recipe = {
"technic:steel_strut_with_insulator_clip",
"MAIN_DYE"
}
})
if steelmod then
unifieddyes.register_color_craft({
output = "technic:steel_strut_with_insulator_clip",
palette = "wallmounted",
neutral_node = "",
recipe = {
{ "technic:insulator_clip_fencepost", "MAIN_DYE" },
{ "steel:strut_mount", "" },
}
})
end
if streetsmod then
unifieddyes.register_color_craft({
output = "technic:steel_strut_with_insulator_clip",
palette = "wallmounted",
neutral_node = "technic:steel_strut_with_insulator_clip",
recipe = {
{ "technic:insulator_clip_fencepost", "MAIN_DYE" },
{ "streets:steel_support", "default:steel_ingot" },
}
})
end
end

View File

@ -0,0 +1,246 @@
# Blender v2.79 (sub 0) OBJ File: 'technic steel strut with insulator clip.blend'
# www.blender.org
o Cube_Cube_Material.001
v -0.375000 0.500532 -0.250000
v -0.249997 0.562500 -0.249997
v 0.249997 0.562500 -0.249997
v 0.375000 0.500532 -0.250000
v 0.249997 0.562500 0.249997
v 0.375000 0.500532 0.250000
v -0.249997 0.562500 0.249997
v -0.375000 0.500532 0.250000
v 0.187500 0.562500 -0.187500
v -0.168668 0.718750 0.168668
v 0.168668 0.718750 0.168668
v 0.187500 0.750000 0.187500
v -0.187500 0.750000 0.187500
v 0.168668 0.718750 -0.168668
v 0.187500 0.750000 -0.187500
v -0.168668 0.718750 -0.168668
v -0.187500 0.750000 -0.187500
v 0.250000 0.750000 -0.250000
v 0.250000 0.750000 0.250000
v -0.250000 0.750000 -0.250000
v -0.250000 1.250000 -0.250000
v 0.250000 1.250000 -0.250000
v 0.250000 1.250000 0.250000
v -0.250000 1.250000 0.250000
v -0.250000 0.750000 0.250000
v -0.168668 0.593750 0.168668
v 0.168668 0.593750 0.168668
v 0.187500 0.625000 0.187500
v -0.187500 0.625000 0.187500
v 0.168668 0.593750 -0.168668
v 0.187500 0.625000 -0.187500
v -0.168668 0.593750 -0.168668
v -0.187500 0.625000 -0.187500
v -0.168668 0.656250 0.168668
v 0.168668 0.656250 0.168668
v 0.187500 0.687500 0.187500
v -0.187500 0.687500 0.187500
v 0.168668 0.656250 -0.168668
v 0.187500 0.687500 -0.187500
v -0.168668 0.656250 -0.168668
v -0.187500 0.687500 -0.187500
v 0.187500 0.562500 0.187500
v -0.187500 0.562500 0.187500
v -0.187500 0.562500 -0.187500
v -0.499468 -0.499468 -0.499468
v -0.499468 0.500000 -0.499468
v 0.499468 -0.499468 -0.499468
v -0.499468 -0.499468 0.499468
v -0.499468 0.500000 0.499468
v 0.499468 -0.499468 0.499468
v 0.499468 0.500000 -0.499468
v 0.499468 0.500000 0.499468
vt 1.000000 0.875000
vt 0.937500 0.750000
vt 0.937500 0.250000
vt 1.000000 0.125000
vt 0.250000 0.875000
vt 0.250000 0.750000
vt 0.750000 0.750000
vt 0.750000 0.875000
vt 0.000000 0.125000
vt 0.062500 0.250000
vt 0.062500 0.750000
vt 0.000000 0.875000
vt 0.750000 0.250000
vt 0.687500 0.687500
vt 0.687500 0.312500
vt 0.312500 0.687500
vt 0.250000 0.250000
vt 0.312500 0.312500
vt 0.331332 1.218750
vt 0.668668 1.218750
vt 0.687500 1.250000
vt 0.312500 1.250000
vt 0.531250 0.666667
vt 0.531250 0.333333
vt 0.500000 0.312500
vt 0.500000 0.687500
vt 0.531250 0.333333
vt 0.531250 0.666667
vt 0.500000 0.687500
vt 0.500000 0.312500
vt 0.331332 1.218750
vt 0.668668 1.218750
vt 0.687500 1.250000
vt 0.312500 1.250000
vt 0.687500 0.312500
vt 0.750000 0.250000
vt 0.750000 0.750000
vt 0.687500 0.687500
vt 0.500000 0.250000
vt 0.500000 0.750000
vt 0.000000 0.750000
vt 0.000000 0.250000
vt 0.500000 0.250000
vt 0.000000 0.250000
vt 0.000000 0.750000
vt 0.500000 0.750000
vt 0.500000 0.250000
vt 0.500000 0.750000
vt 0.000000 0.750000
vt 0.000000 0.250000
vt 0.000000 0.250000
vt 0.500000 0.750000
vt 0.250000 0.250000
vt 0.750000 0.250000
vt 0.750000 0.750000
vt 0.250000 0.750000
vt 0.250000 0.750000
vt 0.312500 0.687500
vt 0.250000 0.250000
vt 0.312500 0.312500
vt 0.250000 0.125000
vt 0.750000 0.125000
vt 0.331332 1.093750
vt 0.668668 1.093750
vt 0.687500 1.125000
vt 0.312500 1.125000
vt 0.656250 0.666667
vt 0.656250 0.333333
vt 0.625000 0.312500
vt 0.625000 0.687500
vt 0.656250 0.333333
vt 0.656250 0.666667
vt 0.625000 0.687500
vt 0.625000 0.312500
vt 0.331332 1.093750
vt 0.668668 1.093750
vt 0.687500 1.125000
vt 0.312500 1.125000
vt 0.331332 1.156250
vt 0.668668 1.156250
vt 0.687500 1.187500
vt 0.312500 1.187500
vt 0.593750 0.666667
vt 0.593750 0.333333
vt 0.562500 0.312500
vt 0.562500 0.687500
vt 0.593750 0.333333
vt 0.593750 0.666667
vt 0.562500 0.687500
vt 0.562500 0.312500
vt 0.331332 1.156250
vt 0.668668 1.156250
vt 0.687500 1.187500
vt 0.312500 1.187500
vt 0.312500 1.062500
vt 0.687500 1.062500
vt 0.687500 0.312500
vt 0.687500 0.312500
vt 0.687500 0.687500
vt 0.312500 1.062500
vt 0.687500 1.062500
vt 0.000000 0.750000
vt 0.000000 0.250000
vt 1.000000 0.250000
vt 1.000000 0.750000
vt 1.000000 1.000000
vt -0.000000 1.000000
vt 0.000000 -0.000000
vt 1.000000 -0.000000
vt 1.000000 1.000000
vt -0.000000 1.000000
vt 0.000000 -0.000000
vt 1.000000 -0.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 1.000000 -0.000000
vt 1.000000 1.000000
vt 1.000000 1.000000
vt 0.000000 0.000000
vt -0.000000 0.000000
vn 0.0000 0.0000 -1.0000
vn 0.4442 0.8960 -0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 1.0000 -0.0000
vn 0.0000 -0.5161 0.8565
vn 0.8565 -0.5161 0.0000
vn -0.8565 -0.5161 0.0000
vn 0.0000 -0.5161 -0.8565
vn -0.0000 -1.0000 -0.0000
vn 1.0000 -0.0000 0.0000
vn -1.0000 0.0000 -0.0000
vn -0.4442 0.8960 -0.0000
vn -0.0000 0.5161 0.8565
vn 0.8565 0.5161 -0.0000
vn -0.8565 0.5161 -0.0000
vn 0.0000 0.5161 -0.8565
g Cube_Cube_Material.001_Cube_Cube_Material.001_clip
s 1
f 1/1/1 2/2/1 3/3/1 4/4/1
f 4/5/2 3/6/2 5/7/2 6/8/2
f 6/9/3 5/10/3 7/11/3 8/12/3
f 7/13/4 5/7/4 42/14/4 43/15/4
f 5/7/4 3/6/4 9/16/4 42/14/4
f 2/17/4 7/13/4 43/15/4 44/18/4
f 3/6/4 2/17/4 44/18/4 9/16/4
f 10/19/5 11/20/5 12/21/5 13/22/5
f 11/23/6 14/24/6 15/25/6 12/26/6
f 16/27/7 10/28/7 13/29/7 17/30/7
f 14/31/8 16/32/8 17/33/8 15/34/8
f 15/35/9 18/36/9 19/37/9 12/38/9
f 20/39/1 21/40/1 22/41/1 18/42/1
f 18/43/10 22/44/10 23/45/10 19/46/10
f 19/47/3 23/48/3 24/49/3 25/50/3
f 21/51/11 20/39/11 25/52/11 24/49/11
f 21/53/4 24/54/4 23/55/4 22/56/4
f 12/38/9 19/37/9 25/57/9 13/58/9
f 13/58/9 25/57/9 20/59/9 17/60/9
f 17/60/9 20/59/9 18/36/9 15/35/9
f 2/17/12 1/61/12 8/62/12 7/13/12
f 26/63/5 27/64/5 28/65/5 29/66/5
f 27/67/6 30/68/6 31/69/6 28/70/6
f 32/71/7 26/72/7 29/73/7 33/74/7
f 30/75/8 32/76/8 33/77/8 31/78/8
f 34/79/5 35/80/5 36/81/5 37/82/5
f 35/83/6 38/84/6 39/85/6 36/86/6
f 40/87/7 34/88/7 37/89/7 41/90/7
f 38/91/8 40/92/8 41/93/8 39/94/8
f 37/82/13 36/81/13 11/20/13 10/19/13
f 36/86/14 39/85/14 14/24/14 11/23/14
f 41/90/15 37/89/15 10/28/15 16/27/15
f 39/94/16 41/93/16 16/32/16 14/31/16
f 43/95/13 42/96/13 27/64/13 26/63/13
f 42/14/14 9/97/14 30/68/14 27/67/14
f 44/98/15 43/99/15 26/72/15 32/71/15
f 9/100/16 44/101/16 32/76/16 30/75/16
f 29/66/13 28/65/13 35/80/13 34/79/13
f 28/70/14 31/69/14 38/84/14 35/83/14
f 33/74/15 29/73/15 34/88/15 40/87/15
f 31/78/16 33/77/16 40/92/16 38/91/16
f 8/102/9 1/103/9 4/104/9 6/105/9
g Cube_Cube_Material.001_Cube_Cube_Material.001_sides_with_band
s off
f 47/106/10 51/107/10 52/108/10 50/109/10
f 48/110/11 49/111/11 46/112/11 45/113/11
f 47/114/9 50/115/9 48/116/9 45/117/9
f 51/118/4 46/112/4 49/111/4 52/119/4
g Cube_Cube_Material.001_Cube_Cube_Material.001_sides_without_band
f 45/113/1 46/120/1 51/107/1 47/121/1
f 50/109/3 52/119/3 49/111/3 48/122/3

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

View File

@ -14,8 +14,13 @@ The technic modpack depends on some other modpacks:
* pipeworks, which supports the automation of item transport * pipeworks, which supports the automation of item transport
* moreores, which provides some additional ore types * moreores, which provides some additional ore types
This manual doesn't explain how to use these other modpacks, which ought This manual doesn't explain how to use these other modpacks, which have
to (but actually don't) have their own manuals. their own manuals:
* [Minetest Game Documentation](https://wiki.minetest.net/Main_Page)
* [Mesecons Documentation](http://mesecons.net/items.html)
* [Pipeworks Documentation](https://github.com/minetest-mods/pipeworks/wiki)
* [Moreores Forum Post](https://forum.minetest.net/viewtopic.php?t=549)
Recipes for constructable items in technic are generally not guessable, Recipes for constructable items in technic are generally not guessable,
and are also not specifically documented here. You should use a and are also not specifically documented here. You should use a
@ -68,10 +73,11 @@ own for its electrical conductivity, or as the base component of alloys.
Although common, it is very heavily used, and most of the time it will Although common, it is very heavily used, and most of the time it will
be the material that most limits your activity. be the material that most limits your activity.
Tin is supplied by the moreores mod. It is found from elevation +8 Tin is part of the basic Minetest game (having migrated there from
downwards, with no elevation-dependent variations in abundance beyond moreores). It is found from elevation +8 downwards, with no
that point. It is a common metal. Its main use in pure form is as a elevation-dependent variations in abundance beyond that point.
component of electrical batteries. Apart from that its main purpose is It is a common metal. Its main use in pure form is as a component
of electrical batteries. Apart from that its main purpose is
as the secondary ingredient in bronze (the base being copper), but bronze as the secondary ingredient in bronze (the base being copper), but bronze
is itself little used. Its abundance is well in excess of its usage, is itself little used. Its abundance is well in excess of its usage,
so you will usually have a surplus of it. so you will usually have a surplus of it.
@ -986,7 +992,7 @@ through a side.
The furnace, alloy furnace, grinder, extractor, compressor, and centrifuge The furnace, alloy furnace, grinder, extractor, compressor, and centrifuge
have much in common. Each implements some industrial process that have much in common. Each implements some industrial process that
transforms items into other items, and they manner in which they present transforms items into other items, and the manner in which they present
these processes as powered machines is essentially identical. these processes as powered machines is essentially identical.
Most of the processing machines operate on inputs of only a single type Most of the processing machines operate on inputs of only a single type
@ -1011,7 +1017,7 @@ input slot, this is perfectly simple behavior. The alloy furnace is more
complex: it will put an arriving item in either input slot, preferring to complex: it will put an arriving item in either input slot, preferring to
stack it with existing items of the same type. It doesn't matter which stack it with existing items of the same type. It doesn't matter which
slot each of the alloy furnace's inputs is in, so it doesn't matter that slot each of the alloy furnace's inputs is in, so it doesn't matter that
there's no direct control ovar that, but there is a risk that supplying there's no direct control over that, but there is a risk that supplying
a lot of one item type through tubes will result in both slots containing a lot of one item type through tubes will result in both slots containing
the same type of item, leaving no room for the second input. the same type of item, leaving no room for the second input.
@ -1195,7 +1201,7 @@ power generators
### fuel-fired generators ### ### fuel-fired generators ###
The fiel-fired generators are electrical power generators that generate The fuel-fired generators are electrical power generators that generate
power by the combustion of fuel. Versions of them are available for power by the combustion of fuel. Versions of them are available for
all three voltages (LV, MV, and HV). These are all capable of burning all three voltages (LV, MV, and HV). These are all capable of burning
any type of combustible fuel, such as coal. They are relatively easy any type of combustible fuel, such as coal. They are relatively easy

View File

@ -4,11 +4,11 @@ local conf_table = technic.config:to_table()
local defaults = { local defaults = {
enable_mining_drill = "true", enable_mining_drill = "true",
enable_mining_laser = "true", enable_mining_laser = "false",
enable_flashlight = "false", enable_flashlight = "false",
enable_wind_mill = "false", enable_wind_mill = "false",
enable_frames = "false", enable_frames = "false",
enable_corium_griefing = "false", enable_corium_griefing = "true",
enable_radiation_protection = "true", enable_radiation_protection = "true",
enable_entity_radiation_damage = "true", enable_entity_radiation_damage = "true",
enable_longterm_radiation_damage = "true", enable_longterm_radiation_damage = "true",

View File

@ -0,0 +1,13 @@
-- HV Electric Furnace
minetest.register_craft({
output = 'technic:hv_electric_furnace',
recipe = {
{'technic:stainless_steel_ingot', 'technic:mv_electric_furnace', 'technic:stainless_steel_ingot'},
{'pipeworks:tube_1', 'technic:hv_transformer', 'pipeworks:tube_1'},
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
}
})
technic.register_electric_furnace({tier="HV", upgrade=1, tube=1, demand={4000, 2000, 1000}, speed=8})

View File

@ -0,0 +1,13 @@
-- HV grinder
minetest.register_craft({
output = 'technic:hv_grinder',
recipe = {
{'technic:stainless_steel_ingot', 'technic:mv_grinder', 'technic:stainless_steel_ingot'},
{'pipeworks:tube_1', 'technic:hv_transformer', 'pipeworks:tube_1'},
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
}
})
technic.register_grinder({tier="HV", demand={1200, 900, 600}, speed=4, upgrade=1, tube=1})

View File

@ -15,4 +15,6 @@ dofile(path.."/generator.lua")
-- Machines -- Machines
dofile(path.."/quarry.lua") dofile(path.."/quarry.lua")
dofile(path.."/forcefield.lua") dofile(path.."/forcefield.lua")
dofile(path.."/electric_furnace.lua")
dofile(path.."/grinder.lua")

View File

@ -1,6 +1,6 @@
-- A water mill produces LV EUs by exploiting flowing water across it -- A water mill produces LV EUs by exploiting flowing water across it
-- It is a LV EU supplyer and fairly low yield (max 120EUs) -- It is a LV EU supplyer and fairly low yield (max 180EUs)
-- It is a little under half as good as the thermal generator. -- It is a little over half as good as the thermal generator.
local S = technic.getter local S = technic.getter
@ -29,11 +29,9 @@ end
local run = function(pos, node) local run = function(pos, node)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local water_flow = 0 local water_flow = 0
local lava_nodes = 0
local production_level = 0 local production_level = 0
local eu_supply = 0 local eu_supply = 0
local max_output = 35 * 45 -- four param2's at 15 makes 60, cap it lower for "overload protection" local max_output = 4 * 45 -- keeping it around 180, little more than previous 150 :)
-- (plus we want the gen to report 100% if three sides have full flow)
local positions = { local positions = {
{x=pos.x+1, y=pos.y, z=pos.z}, {x=pos.x+1, y=pos.y, z=pos.z},
@ -49,7 +47,7 @@ local run = function(pos, node)
end end
end end
eu_supply = math.min(35 * water_flow, max_output) eu_supply = math.min(4 * water_flow, max_output)
production_level = math.floor(100 * eu_supply / max_output) production_level = math.floor(100 * eu_supply / max_output)
meta:set_int("LV_EU_supply", eu_supply) meta:set_int("LV_EU_supply", eu_supply)

View File

@ -0,0 +1,105 @@
-- A Hydro Turbine produces MV EUs by exploiting flowing water across it
-- It is a MV EU supplyer and fairly high yield (max 1800EUs)
local S = technic.getter
local cable_entry = "^technic_cable_connection_overlay.png"
minetest.register_alias("hydro_turbine", "technic:hydro_turbine")
minetest.register_craft({
output = 'technic:hydro_turbine',
recipe = {
{'technic:stainless_steel_ingot', 'technic:water_mill', 'technic:stainless_steel_ingot'},
{'technic:water_mill', 'technic:mv_transformer', 'technic:water_mill'},
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'},
}
})
local function get_water_flow(pos)
local node = minetest.get_node(pos)
if minetest.get_item_group(node.name, "water") == 3 then
return node.param2 -- returns approx. water flow, if any
end
return 0
end
---
-- 10 times better than LV hydro because of 2 extra water mills and 4 stainless steel, a transformer and whatnot ;P.
-- Man hydro turbines are tough and long lasting. So, give it some value :)
local run = function(pos, node)
local meta = minetest.get_meta(pos)
local water_flow = 0
local production_level = 0
local eu_supply = 0
local max_output = 40 * 45 -- Generates 1800EU/s
local positions = {
{x=pos.x+1, y=pos.y, z=pos.z},
{x=pos.x-1, y=pos.y, z=pos.z},
{x=pos.x, y=pos.y, z=pos.z+1},
{x=pos.x, y=pos.y, z=pos.z-1},
}
for _, p in pairs(positions) do
water_flow = water_flow + get_water_flow(p)
end
eu_supply = math.min(40 * water_flow, max_output)
production_level = math.floor(100 * eu_supply / max_output)
meta:set_int("MV_EU_supply", eu_supply)
meta:set_string("infotext",
S("Hydro %s Generator"):format("MV").." ("..production_level.."%)")
if production_level > 0 and
minetest.get_node(pos).name == "technic:hydro_turbine" then
technic.swap_node(pos, "technic:hydro_turbine_active")
meta:set_int("MV_EU_supply", 0)
return
end
if production_level == 0 then
technic.swap_node(pos, "technic:hydro_turbine")
end
end
minetest.register_node("technic:hydro_turbine", {
description = S("Hydro %s Generator"):format("MV"),
tiles = {
"technic_hydro_turbine_top.png",
"technic_machine_bottom.png"..cable_entry,
"technic_hydro_turbine_side.png",
"technic_hydro_turbine_side.png",
"technic_hydro_turbine_side.png",
"technic_hydro_turbine_side.png"
},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
technic_machine=1, technic_mv=1},
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("Hydro %s Generator"):format("MV"))
meta:set_int("MV_EU_supply", 0)
end,
technic_run = run,
})
minetest.register_node("technic:hydro_turbine_active", {
description = S("Hydro %s Generator"):format("MV"),
tiles = {"technic_hydro_turbine_top_active.png", "technic_machine_bottom.png",
"technic_hydro_turbine_side.png", "technic_hydro_turbine_side.png",
"technic_hydro_turbine_side.png", "technic_hydro_turbine_side.png"},
paramtype2 = "facedir",
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
technic_machine=1, technic_mv=1, not_in_creative_inventory=1},
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
drop = "technic:hydro_turbine",
technic_run = run,
technic_disabled_machine_name = "technic:hydro_turbine",
})
technic.register_machine("MV", "technic:hydro_turbine", technic.producer)
technic.register_machine("MV", "technic:hydro_turbine_active", technic.producer)

View File

@ -13,6 +13,7 @@ if technic.config:get_bool("enable_wind_mill") then
end end
dofile(path.."/generator.lua") dofile(path.."/generator.lua")
dofile(path.."/solar_array.lua") dofile(path.."/solar_array.lua")
dofile(path.."/hydro_turbine.lua")
-- Machines -- Machines
dofile(path.."/alloy_furnace.lua") dofile(path.."/alloy_furnace.lua")

View File

@ -1,9 +1,9 @@
local S = technic.getter local S = technic.getter
frames = {} frames = {}
local infinite_stacks = minetest.settings:get_bool("creative_mode") and minetest.get_modpath("unified_inventory") == nil local infinite_stacks = minetest.settings:get_bool("creative_mode")
and minetest.get_modpath("unified_inventory") == nil
local frames_pos = {} local frames_pos = {}
@ -12,45 +12,60 @@ local frames_pos = {}
local function get_face(pos, ppos, pvect) local function get_face(pos, ppos, pvect)
-- Raytracer to get which face has been clicked -- Raytracer to get which face has been clicked
ppos = { x = ppos.x - pos.x, y = ppos.y - pos.y + 1.5, z = ppos.z - pos.z } ppos = { x = ppos.x - pos.x, y = ppos.y - pos.y + 1.5, z = ppos.z - pos.z }
if pvect.x > 0 then if pvect.x > 0 then
local t = (-0.5 - ppos.x) / pvect.x local t = (-0.5 - ppos.x) / pvect.x
local y_int = ppos.y + t * pvect.y local y_int = ppos.y + t * pvect.y
local z_int = ppos.z + t * pvect.z local z_int = ppos.z + t * pvect.z
if y_int>-0.45 and y_int<0.45 and z_int>-0.45 and z_int<0.45 then return 1 end if y_int > -0.45 and y_int < 0.45 and z_int > -0.45 and z_int < 0.45 then
return 1
end
elseif pvect.x < 0 then elseif pvect.x < 0 then
local t = (0.5 - ppos.x) / pvect.x local t = (0.5 - ppos.x) / pvect.x
local y_int = ppos.y + t * pvect.y local y_int = ppos.y + t * pvect.y
local z_int = ppos.z + t * pvect.z local z_int = ppos.z + t * pvect.z
if y_int>-0.45 and y_int<0.45 and z_int>-0.45 and z_int<0.45 then return 2 end if y_int > -0.45 and y_int < 0.45 and z_int > -0.45 and z_int < 0.45 then
return 2
end end
end
if pvect.y > 0 then if pvect.y > 0 then
local t = (-0.5 - ppos.y) / pvect.y local t = (-0.5 - ppos.y) / pvect.y
local x_int = ppos.x + t * pvect.x local x_int = ppos.x + t * pvect.x
local z_int = ppos.z + t * pvect.z local z_int = ppos.z + t * pvect.z
if x_int>-0.45 and x_int<0.45 and z_int>-0.45 and z_int<0.45 then return 3 end if x_int > -0.45 and x_int < 0.45 and z_int > -0.45 and z_int < 0.45 then
return 3
end
elseif pvect.y < 0 then elseif pvect.y < 0 then
local t = (0.5 - ppos.y) / pvect.y local t = (0.5 - ppos.y) / pvect.y
local x_int = ppos.x + t * pvect.x local x_int = ppos.x + t * pvect.x
local z_int = ppos.z + t * pvect.z local z_int = ppos.z + t * pvect.z
if x_int>-0.45 and x_int<0.45 and z_int>-0.45 and z_int<0.45 then return 4 end if x_int > -0.45 and x_int < 0.45 and z_int > -0.45 and z_int < 0.45 then
return 4
end end
end
if pvect.z > 0 then if pvect.z > 0 then
local t = (-0.5 - ppos.z) / pvect.z local t = (-0.5 - ppos.z) / pvect.z
local x_int = ppos.x + t * pvect.x local x_int = ppos.x + t * pvect.x
local y_int = ppos.y + t * pvect.y local y_int = ppos.y + t * pvect.y
if x_int>-0.45 and x_int<0.45 and y_int>-0.45 and y_int<0.45 then return 5 end if x_int > -0.45 and x_int < 0.45 and y_int > -0.45 and y_int < 0.45 then
return 5
end
elseif pvect.z < 0 then elseif pvect.z < 0 then
local t = (0.5 - ppos.z) / pvect.z local t = (0.5 - ppos.z) / pvect.z
local x_int = ppos.x + t * pvect.x local x_int = ppos.x + t * pvect.x
local y_int = ppos.y + t * pvect.y local y_int = ppos.y + t * pvect.y
if x_int>-0.45 and x_int<0.45 and y_int>-0.45 and y_int<0.45 then return 6 end if x_int > -0.45 and x_int < 0.45 and y_int > -0.45 and y_int < 0.45 then
return 6
end
end end
end end
local function lines(str) local 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))
return t return t
end end
@ -68,7 +83,9 @@ end
local function pos_in_list(l, pos) local function pos_in_list(l, pos)
for _, p in ipairs(l) do for _, p in ipairs(l) do
if p.x==pos.x and p.y==pos.y and p.z==pos.z then return true end if p.x == pos.x and p.y == pos.y and p.z == pos.z then
return true
end
end end
return false return false
end end
@ -100,22 +117,33 @@ local function move_nodes_vect(poslist,vect,must_not_move,owner)
end end
end end
end end
for _, pos in ipairs(poslist) do for _, pos in ipairs(poslist) do
local npos = vector.add(pos, vect) local npos = vector.add(pos, vect)
local name = minetest.get_node(npos).name local name = minetest.get_node(npos).name
if ((name~="air" and minetest.registered_nodes[name].liquidtype=="none") or frames_pos[pos_to_string(npos)]) and not(pos_in_list(poslist,npos)) then if (name ~= "air" and minetest.registered_nodes[name].liquidtype == "none" or
frames_pos[pos_to_string(npos)]) and not pos_in_list(poslist, npos) then
return return
end end
--[[if pos.x==must_not_move.x and pos.y==must_not_move.y and pos.z==must_not_move.z then
return
end]]
end end
local nodelist = {} local nodelist = {}
for _, pos in ipairs(poslist) do for _, pos in ipairs(poslist) do
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos):to_table() local meta = minetest.get_meta(pos):to_table()
nodelist[#(nodelist)+1] = {oldpos = pos, pos = vector.add(pos, vect), node = node, meta = meta} local timer = minetest.get_node_timer(pos)
nodelist[#nodelist + 1] = {
oldpos = pos,
pos = vector.add(pos, vect),
node = node,
meta = meta,
timer = {
timeout = timer:get_timeout(),
elapsed = timer:get_elapsed()
}
}
end end
local objects = {} local objects = {}
for _, pos in ipairs(poslist) do for _, pos in ipairs(poslist) do
for _, object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do for _, object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
@ -125,14 +153,20 @@ local function move_nodes_vect(poslist,vect,must_not_move,owner)
end end
end end
end end
for _, obj in ipairs(objects) do for _, obj in ipairs(objects) do
obj:setpos(vector.add(obj:getpos(), vect)) obj:setpos(vector.add(obj:getpos(), vect))
end end
for _, n in ipairs(nodelist) do for _, n in ipairs(nodelist) do
local npos = n.pos local npos = n.pos
minetest.set_node(npos, n.node) minetest.set_node(npos, n.node)
local meta = minetest.get_meta(npos) local meta = minetest.get_meta(npos)
meta:from_table(n.meta) meta:from_table(n.meta)
local timer = minetest.get_node_timer(npos)
if n.timer.timeout ~= 0 or n.timer.elapsed ~= 0 then
timer:set(n.timer.timeout, n.timer.elapsed)
end
for __, pos in ipairs(poslist) do for __, pos in ipairs(poslist) do
if npos.x == pos.x and npos.y == pos.y and npos.z == pos.z then if npos.x == pos.x and npos.y == pos.y and npos.z == pos.z then
table.remove(poslist, __) table.remove(poslist, __)
@ -140,19 +174,20 @@ local function move_nodes_vect(poslist,vect,must_not_move,owner)
end end
end end
end end
for __, pos in ipairs(poslist) do for __, pos in ipairs(poslist) do
minetest.remove_node(pos) minetest.remove_node(pos)
end end
for _, callback in ipairs(mesecon.on_mvps_move) do for _, callback in ipairs(mesecon.on_mvps_move) do
callback(nodelist) callback(nodelist)
end end
end end
local function is_supported_node(name) local function is_supported_node(name)
return ((string.find(name, "tube") ~= nil) and (string.find(name, "pipeworks") ~= nil)) return string.find(name, "tube") and string.find(name, "pipeworks")
end end
-- Frames -- Frames
for xm = 0, 1 do for xm = 0, 1 do
for xp = 0, 1 do for xp = 0, 1 do
@ -166,6 +201,7 @@ local b=7/16
local nodeboxes = { local nodeboxes = {
{ -a, -a, -a, -b, a, -b }, { -a, -a, -a, -b, a, -b },
{ -a, -a, b, -b, a, a }, { -a, -a, b, -b, a, a },
{ b, -a, b, a, a, a }, { b, -a, b, a, a, a },
{ b, -a, -a, a, a, -b }, { b, -a, -a, a, a, -b },
@ -201,7 +237,7 @@ local nodeboxes= {
table.insert(nodeboxes, { -b, -b, -a, b, b, -b }) table.insert(nodeboxes, { -b, -b, -a, b, b, -b })
end end
local nameext=tostring(xm)..tostring(xp)..tostring(ym)..tostring(yp)..tostring(zm)..tostring(zp) local nameext = string.format("%d%d%d%d%d%d", xm, xp, ym, yp, zm, zp)
local groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 } local groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2 }
if nameext ~= "111111" then groups.not_in_creative_inventory = 1 end if nameext ~= "111111" then groups.not_in_creative_inventory = 1 end
@ -223,33 +259,44 @@ local nodeboxes= {
frame = 1, frame = 1,
drop = "technic:frame_111111", drop = "technic:frame_111111",
sunlight_propagates = true, sunlight_propagates = true,
frame_connect_all = function(nodename) frame_connect_all = function(nodename)
l2 = {} l2 = {}
l1={{x=-1,y=0,z=0},{x=1,y=0,z=0},{x=0,y=-1,z=0},{x=0,y=1,z=0},{x=0,y=0,z=-1},{x=0,y=0,z=1}} l1 = {
{ x = -1, y = 0, z = 0 }, { x = 1, y = 0, z = 0 },
{ x = 0, y = -1, z = 0 }, { x = 0, y = 1, z = 0 },
{ x = 0, y = 0, z = -1 }, { x = 0, y = 0, z = 1 }
}
for i, dir in ipairs(l1) do for i, dir in ipairs(l1) do
if string.sub(nodename, -7 + i, -7 + i) == "1" then if string.sub(nodename, -7 + i, -7 + i) == "1" then
l2[#(l2)+1]=dir l2[#l2 + 1] = dir
end end
end end
return l2 return l2
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
local ppos = puncher:getpos() local ppos = puncher:getpos()
local pvect = puncher:get_look_dir() local pvect = puncher:get_look_dir()
local pface = get_face(pos, ppos, pvect) local pface = get_face(pos, ppos, pvect)
if pface == nil then return end if pface == nil then return end
local nodename = node.name local nodename = node.name
local newstate=tostring(1-tonumber(string.sub(nodename,-7+pface,-7+pface))) local newstate = tostring(1 - tonumber(string.sub(nodename, pface - 7, pface - 7)))
if pface <= 5 then if pface <= 5 then
nodename=string.sub(nodename,1,-7+pface-1)..newstate..string.sub(nodename,-7+pface+1) nodename = string.sub(nodename, 1, pface - 7 - 1)..newstate..string.sub(nodename, pface - 7 + 1)
else else
nodename = string.sub(nodename, 1, -2)..newstate nodename = string.sub(nodename, 1, -2)..newstate
end end
node.name = nodename node.name = nodename
minetest.set_node(pos, node) minetest.set_node(pos, node)
end, end,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.is_protected(pos, placer:get_player_name()) then if minetest.is_protected(pos, placer:get_player_name()) then
minetest.log("action", placer:get_player_name() minetest.log("action", placer:get_player_name()
.. " tried to place " .. itemstack:get_name() .. " tried to place " .. itemstack:get_name()
@ -258,7 +305,9 @@ local nodeboxes= {
minetest.record_protection_violation(pos, placer:get_player_name()) minetest.record_protection_violation(pos, placer:get_player_name())
return itemstack return itemstack
end end
if pos == nil then return end if pos == nil then return end
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
if node.name ~= "air" then if node.name ~= "air" then
if is_supported_node(node.name) then if is_supported_node(node.name) then
@ -268,11 +317,13 @@ local nodeboxes= {
else else
minetest.set_node(pos, { name = itemstack:get_name() }) minetest.set_node(pos, { name = itemstack:get_name() })
end end
if not infinite_stacks then if not infinite_stacks then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack
end, end,
on_rightclick = function(pos, node, placer, itemstack, pointed_thing) on_rightclick = function(pos, node, placer, itemstack, pointed_thing)
if is_supported_node(itemstack:get_name()) then if is_supported_node(itemstack:get_name()) then
if minetest.is_protected(pos, placer:get_player_name()) then if minetest.is_protected(pos, placer:get_player_name()) then
@ -291,7 +342,7 @@ local nodeboxes= {
-- Run callback -- Run callback
if def.after_place_node then if def.after_place_node then
-- Copy place_to because callback can modify it -- Copy place_to because callback can modify it
local pos_copy = {x=pos.x, y=pos.y, z=pos.z} local pos_copy = vector.new(pos)
if def.after_place_node(pos_copy, placer, itemstack) then if def.after_place_node(pos_copy, placer, itemstack) then
take_item = false take_item = false
end end
@ -346,15 +397,17 @@ minetest.register_entity("technic:frame_entity", {
set_node = function(self, node) set_node = function(self, node)
self.node = node self.node = node
local pos = self.object:getpos() local pos = vector.round(self.object:getpos())
pos = {x = math.floor(pos.x+0.5), y = math.floor(pos.y+0.5), z = math.floor(pos.z+0.5)}
frames_pos[pos_to_string(pos)] = node.name frames_pos[pos_to_string(pos)] = node.name
local stack = ItemStack(node.name) local stack = ItemStack(node.name)
local itemtable = stack:to_table() local itemtable = stack:to_table()
local itemname = nil local itemname = nil
if itemtable then if itemtable then
itemname = stack:to_table().name itemname = stack:to_table().name
end end
local item_texture = nil local item_texture = nil
local item_type = "" local item_type = ""
if minetest.registered_items[itemname] then if minetest.registered_items[itemname] then
@ -379,8 +432,7 @@ minetest.register_entity("technic:frame_entity", {
dig = function(self) dig = function(self)
minetest.handle_node_drops(self.object:getpos(), { ItemStack("technic:frame_111111") }, self.last_puncher) minetest.handle_node_drops(self.object:getpos(), { ItemStack("technic:frame_111111") }, self.last_puncher)
local pos = self.object:getpos() local pos = vector.round(self.object:getpos())
pos = {x = math.floor(pos.x+0.5), y = math.floor(pos.y+0.5), z = math.floor(pos.z+0.5)}
frames_pos[pos_to_string(pos)] = nil frames_pos[pos_to_string(pos)] = nil
self.object:remove() self.object:remove()
end, end,
@ -396,18 +448,21 @@ minetest.register_entity("technic:frame_entity", {
else else
self.damage_object:get_luaentity().remaining_time = 0.25 self.damage_object:get_luaentity().remaining_time = 0.25
end end
self.last_puncher = puncher self.last_puncher = puncher
local ppos = puncher:getpos() local ppos = puncher:getpos()
local pvect = puncher:get_look_dir() local pvect = puncher:get_look_dir()
local pface = get_face(pos, ppos, pvect) local pface = get_face(pos, ppos, pvect)
if pface == nil then return end if pface == nil then return end
local nodename = self.node.name local nodename = self.node.name
local newstate = tostring(1-tonumber(string.sub(nodename, -7+pface, -7+pface))) local newstate = tostring(1 - tonumber(string.sub(nodename, pface - 7, pface - 7)))
if pface <= 5 then if pface <= 5 then
nodename = string.sub(nodename, 1, -7+pface-1)..newstate..string.sub(nodename, -7+pface+1) nodename = string.sub(nodename, 1, pface - 7 - 1)..newstate..string.sub(nodename, pface - 7 + 1)
else else
nodename = string.sub(nodename, 1, -2)..newstate nodename = string.sub(nodename, 1, -2)..newstate
end end
self.node.name = nodename self.node.name = nodename
self:set_node(self.node) self:set_node(self.node)
end, end,
@ -417,14 +472,19 @@ minetest.register_entity("technic:frame_entity", {
local ppos = clicker:getpos() local ppos = clicker:getpos()
local pvect = clicker:get_look_dir() local pvect = clicker:get_look_dir()
local pface = get_face(pos, ppos, pvect) local pface = get_face(pos, ppos, pvect)
if pface == nil then return end
local pos_under = {x = math.floor(pos.x+0.5), y = math.floor(pos.y+0.5), z = math.floor(pos.z+0.5)} if pface == nil then
return
end
local pos_under = vector.round(pos)
local pos_above = { x = pos_under.x, y = pos_under.y, z = pos_under.z } local pos_above = { x = pos_under.x, y = pos_under.y, z = pos_under.z }
local index = ({ "x", "y", "z" })[math.floor((pface + 1) / 2)] local index = ({ "x", "y", "z" })[math.floor((pface + 1) / 2)]
pos_above[index] = pos_above[index] + 2 * ((pface + 1)%2) - 1 pos_above[index] = pos_above[index] + 2 * ((pface + 1)%2) - 1
local pointed_thing = { type = "node", under = pos_under, above = pos_above } local pointed_thing = { type = "node", under = pos_under, above = pos_above }
local itemstack = clicker:get_wielded_item() local itemstack = clicker:get_wielded_item()
local itemdef = minetest.registered_items[itemstack:get_name()] local itemdef = minetest.registered_items[itemstack:get_name()]
if itemdef ~= nil then if itemdef ~= nil then
itemdef.on_place(itemstack, clicker, pointed_thing) itemdef.on_place(itemstack, clicker, pointed_thing)
end end
@ -471,7 +531,11 @@ mesecon.register_on_mvps_move(function(moved_nodes)
local to_move = {} local to_move = {}
for _, n in ipairs(moved_nodes) do for _, n in ipairs(moved_nodes) do
if frames_pos[pos_to_string(n.oldpos)] ~= nil then if frames_pos[pos_to_string(n.oldpos)] ~= nil then
to_move[#to_move+1] = {pos = n.pos, oldpos = n.oldpos, name = frames_pos[pos_to_string(n.oldpos)]} to_move[#to_move + 1] = {
pos = n.pos,
oldpos = n.oldpos,
name = frames_pos[pos_to_string(n.oldpos)]
}
frames_pos[pos_to_string(n.oldpos)] = nil frames_pos[pos_to_string(n.oldpos)] = nil
end end
end end
@ -481,7 +545,8 @@ mesecon.register_on_mvps_move(function(moved_nodes)
local objects = minetest.get_objects_inside_radius(t.oldpos, 0.1) local objects = minetest.get_objects_inside_radius(t.oldpos, 0.1)
for _, obj in ipairs(objects) do for _, obj in ipairs(objects) do
local entity = obj:get_luaentity() local entity = obj:get_luaentity()
if entity and (entity.name == "technic:frame_entity" or entity.name == "technic:damage_entity") then if entity and (entity.name == "technic:frame_entity" or
entity.name == "technic:damage_entity") then
obj:setpos(t.pos) obj:setpos(t.pos)
end end
end end
@ -511,10 +576,10 @@ local function connected(pos,c,adj)
if frames_pos[pos_to_string(pos1)] then if frames_pos[pos_to_string(pos1)] then
nodename = frames_pos[pos_to_string(pos1)] nodename = frames_pos[pos_to_string(pos1)]
end end
if not(pos_in_list(c,pos1)) and nodename~="air" and if not pos_in_list(c, pos1) and nodename ~= "air" and
(minetest.registered_nodes[nodename].frames_can_connect == nil or (minetest.registered_nodes[nodename].frames_can_connect == nil or
minetest.registered_nodes[nodename].frames_can_connect(pos1, vect)) then minetest.registered_nodes[nodename].frames_can_connect(pos1, vect)) then
c[#(c)+1]=pos1 c[#c + 1] = pos1
if minetest.registered_nodes[nodename].frame == 1 then if minetest.registered_nodes[nodename].frame == 1 then
local adj = minetest.registered_nodes[nodename].frame_connect_all(nodename) local adj = minetest.registered_nodes[nodename].frame_connect_all(nodename)
connected(pos1, c, adj) connected(pos1, c, adj)
@ -534,39 +599,55 @@ local function get_connected_nodes(pos)
end end
local function frame_motor_on(pos, node) local function frame_motor_on(pos, node)
local dirs = {{x=0,y=1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=-1,z=0}} local dirs = {
{ x = 0, y = 1, z = 0 }, { x = 0, y = 0, z = 1 },
{ x = 0, y = 0, z = -1 }, { x = 1, y = 0, z = 0 },
{ x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 }
}
local nnodepos = vector.add(pos, dirs[math.floor(node.param2 / 4) + 1]) local nnodepos = vector.add(pos, dirs[math.floor(node.param2 / 4) + 1])
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)
if frames_pos[pos_to_string(nnodepos)] then if frames_pos[pos_to_string(nnodepos)] then
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 if meta:get_int("last_moved") == minetest.get_gametime() then
return return
end 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()) 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 = S("Frame Motor"),
tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", tiles = {
"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, "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"
},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, mesecon = 2 }, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, mesecon = 2 },
paramtype2 = "facedir", paramtype2 = "facedir",
mesecons = { effector = { action_on = frame_motor_on } }, mesecons = { effector = { action_on = frame_motor_on } },
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())
end, end,
frames_can_connect = function(pos, dir) frames_can_connect = function(pos, dir)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local dir2 = ({{x=0,y=1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=-1,z=0}})[math.floor(node.param2/4)+1] local dir2 = ({
{ x= 0 , y = 1, z = 0 }, { x = 0, y = 0, z = 1 },
{ x = 0, y = 0, z = -1 }, { x = 1, y = 0, z = 0 },
{ x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 }
})[math.floor(node.param2 / 4) + 1]
return dir2.x ~= -dir.x or dir2.y ~= -dir.y or dir2.z ~= -dir.z return dir2.x ~= -dir.x or dir2.y ~= -dir.y or dir2.z ~= -dir.z
end end
}) })
@ -575,13 +656,19 @@ minetest.register_node("technic:frame_motor",{
-- Templates -- Templates
local function template_connected(pos, c, connectors) local function template_connected(pos, c, connectors)
for _,vect in ipairs({{x=0,y=1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=-1,z=0}}) do local vects = {
{ x = 0, y = 1, z = 0 }, { x = 0, y = 0, z = 1 },
{ x = 0, y = 0, z = -1 }, { x = 1, y = 0, z = 0 },
{ x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 }
}
for _, vect in ipairs(vects) do
local pos1 = vector.add(pos, vect) local pos1 = vector.add(pos, vect)
local nodename = minetest.get_node(pos1).name local nodename = minetest.get_node(pos1).name
if not(pos_in_list(c,pos1)) and (nodename=="technic:template" or nodename == "technic:template_connector")then if not pos_in_list(c, pos1) and (nodename == "technic:template" or
nodename == "technic:template_connector") then
local meta = minetest.get_meta(pos1) local meta = minetest.get_meta(pos1)
if meta:get_string("connected") == "" then if meta:get_string("connected") == "" then
c[#(c)+1]=pos1 c[#c + 1] = pos1
template_connected(pos1, c, connectors) template_connected(pos1, c, connectors)
if nodename == "technic:template_connector" then if nodename == "technic:template_connector" then
connectors[#connectors + 1] = pos1 connectors[#connectors + 1] = pos1
@ -624,6 +711,7 @@ local function save_node(pos)
meta:set_string("connected", "") meta:set_string("connected", "")
return return
end end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local meta0 = meta:to_table() local meta0 = meta:to_table()
for _, list in pairs(meta0.inventory) do for _, list in pairs(meta0.inventory) do
@ -631,6 +719,7 @@ local function save_node(pos)
list[key] = stack:to_string() list[key] = stack:to_string()
end end
end end
node.meta = meta0 node.meta = meta0
minetest.set_node(pos, { name = "technic:template" }) minetest.set_node(pos, { name = "technic:template" })
return node return node
@ -650,25 +739,27 @@ end
local function expand_template(pos) local function expand_template(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local c = meta:get_string("connected") local c = meta:get_string("connected")
if c == "" then return end if c == "" then return end
c = minetest.deserialize(c) c = minetest.deserialize(c)
for _, vect in ipairs(c) do for _, vect in ipairs(c) do
local pos1 = vector.add(pos, vect) local pos1 = vector.add(pos, vect)
local saved_node = save_node(pos1) local saved_node = save_node(pos1)
local meta1 = minetest.get_meta(pos1) local meta1 = minetest.get_meta(pos1)
if saved_node ~= nil then if saved_node ~= nil then
meta1:set_string("saved_node", minetest.serialize(saved_node)) meta1:set_string("saved_node", minetest.serialize(saved_node))
else
--meta1:set_string("saved_node", "")
end end
end end
end end
local function compress_templates(pos) local function compress_templates(pos)
local templates, connectors = get_templates(pos) local templates, connectors = get_templates(pos)
if #connectors == 0 then if #connectors == 0 then
connectors = { pos } connectors = { pos }
end end
for _, cn in ipairs(connectors) do for _, cn in ipairs(connectors) do
local meta = minetest.get_meta(cn) local meta = minetest.get_meta(cn)
local c = {} local c = {}
@ -681,7 +772,7 @@ local function compress_templates(pos)
local cc = {} local cc = {}
for _, p in ipairs(connectors) do for _, p in ipairs(connectors) do
local np = vector.subtract(p, cn) local np = vector.subtract(p, cn)
if (np.x ~= 0 or np.y ~= 0 or np.z ~= 0) then if np.x ~= 0 or np.y ~= 0 or np.z ~= 0 then
cc[pos_to_string(np)] = true cc[pos_to_string(np)] = true
end end
end end
@ -701,6 +792,7 @@ local function template_drops(pos, node, oldmeta, digger)
local c = oldmeta.fields.connected local c = oldmeta.fields.connected
local cc = oldmeta.fields.connectors_connected local cc = oldmeta.fields.connectors_connected
local drops local drops
if c == "" or c == nil then if c == "" or c == nil then
drops = { "technic:template 1" } drops = { "technic:template 1" }
else else
@ -722,7 +814,7 @@ local function template_drops(pos, node, oldmeta, digger)
end end
else else
local stack_max = 99 local stack_max = 99
local num = #(minetest.deserialize(c)) local num = #minetest.deserialize(c)
drops = {} drops = {}
while num > stack_max do while num > stack_max do
drops[#drops + 1] = "technic:template "..stack_max drops[#drops + 1] = "technic:template "..stack_max
@ -732,6 +824,7 @@ local function template_drops(pos, node, oldmeta, digger)
end end
end end
end end
minetest.handle_node_drops(pos, drops, digger) minetest.handle_node_drops(pos, drops, digger)
end end
@ -806,7 +899,7 @@ minetest.register_tool("technic: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, puncher:get_player_name()) then
return nil return nil
end end
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
@ -835,14 +928,18 @@ local function get_template_nodes(pos)
local pos1 = vector.add(pos, vect) local pos1 = vector.add(pos, vect)
local nodename = minetest.get_node(pos1).name local nodename = minetest.get_node(pos1).name
if not(pos_in_list(c, pos1)) and nodename ~= "air" then if not(pos_in_list(c, pos1)) and nodename ~= "air" then
c[#(c)+1]=pos1 c[#c + 1] = pos1
end end
end end
return c return c
end end
local function template_motor_on(pos, node) local function template_motor_on(pos, node)
local dirs = {{x=0,y=1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=-1,z=0}} local dirs = {
{ x = 0, y = 1, z = 0 }, { x = 0, y = 0, z = 1 },
{ x = 0, y = 0, z = -1 }, { x = 1, y = 0, z = 0 },
{ x = -1, y = 0, z = 0 }, { x = 0, y = -1, z = 0 }
}
local nnodepos = vector.add(pos, dirs[math.floor(node.param2 / 4) + 1]) local nnodepos = vector.add(pos, dirs[math.floor(node.param2 / 4) + 1])
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)
@ -860,8 +957,14 @@ end
minetest.register_node("technic:template_motor", { minetest.register_node("technic:template_motor", {
description = S("Template Motor"), description = S("Template Motor"),
tiles = {"pipeworks_filter_top.png^[transformR90", "technic_lv_cable.png", "technic_lv_cable.png", tiles = {
"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png"}, "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"
},
groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, mesecon = 2 }, groups = { snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, mesecon = 2 },
paramtype2 = "facedir", paramtype2 = "facedir",
mesecons = { effector = { action_on = template_motor_on } }, mesecons = { effector = { action_on = template_motor_on } },

View File

@ -11,6 +11,8 @@ end
local recipes = { local recipes = {
{"default:snowblock", "default:ice"}, {"default:snowblock", "default:ice"},
{"default:sand 2", "default:sandstone"}, {"default:sand 2", "default:sandstone"},
{"default:desert_sand 2", "default:desert_sandstone"},
{"default:silver_sand 2", "default:silver_sandstone"},
{"default:desert_sand", "default:desert_stone"}, {"default:desert_sand", "default:desert_stone"},
{"technic:mixed_metal_ingot", "technic:composite_plate"}, {"technic:mixed_metal_ingot", "technic:composite_plate"},
{"default:copper_ingot 5", "technic:copper_plate"}, {"default:copper_ingot 5", "technic:copper_plate"},
@ -21,10 +23,21 @@ local recipes = {
-- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner -- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner
minetest.clear_craft({ minetest.clear_craft({
output = "default:sandstone",
recipe = { recipe = {
{'group:sand', 'group:sand'}, {"default:sand", "default:sand"},
{'group:sand', 'group:sand'} {"default:sand", "default:sand"},
},
})
minetest.clear_craft({
recipe = {
{"default:desert_sand", "default:desert_sand"},
{"default:desert_sand", "default:desert_sand"},
},
})
minetest.clear_craft({
recipe = {
{"default:silver_sand", "default:silver_sand"},
{"default:silver_sand", "default:silver_sand"},
}, },
}) })

View File

@ -36,13 +36,21 @@ if minetest.get_modpath("dye") then
-- overwrite the existing crafting recipes -- overwrite the existing crafting recipes
local dyes = {"white", "red", "yellow", "blue", "violet", "orange"} local dyes = {"white", "red", "yellow", "blue", "violet", "orange"}
for _, color in ipairs(dyes) do for _, color in ipairs(dyes) do
minetest.clear_craft({
type = "shapeless",
recipe = {"group:flower,color_"..color},
})
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "dye:"..color.." 1", output = "dye:"..color.." 1",
recipe = {"group:flower,color_"..color}, recipe = {"group:flower,color_"..color},
}) })
end end
minetest.clear_craft({
type = "shapeless",
recipe = {"group:coal"},
})
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "dye:black 1", output = "dye:black 1",
@ -50,6 +58,10 @@ if minetest.get_modpath("dye") then
}) })
if unifieddyes then if unifieddyes then
minetest.clear_craft({
type = "shapeless",
recipe = {"default:cactus"},
})
minetest.register_craft({ minetest.register_craft({
type = "shapeless", type = "shapeless",
output = "dye:green 1", output = "dye:green 1",

View File

@ -28,12 +28,24 @@ local recipes = {
{"default:cobble", "default:gravel"}, {"default:cobble", "default:gravel"},
{"default:gravel", "default:sand"}, {"default:gravel", "default:sand"},
{"default:sandstone", "default:sand 2"}, -- reverse recipe can be found in the compressor {"default:sandstone", "default:sand 2"}, -- reverse recipe can be found in the compressor
{"default:desert_sandstone", "default:desert_sand 2"}, -- reverse recipe can be found in the compressor
{"default:silver_sandstone", "default:silver_sand 2"}, -- reverse recipe can be found in the compressor
} }
-- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe) -- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe)
minetest.clear_craft({ minetest.clear_craft({
recipe = { recipe = {
{'default:sandstone'} {"default:sandstone"}
},
})
minetest.clear_craft({
recipe = {
{"default:desert_sandstone"}
},
})
minetest.clear_craft({
recipe = {
{"default:silver_sandstone"}
}, },
}) })

View File

@ -234,6 +234,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)
if not technic.powerctrl_state then return end if not technic.powerctrl_state then return end
local t0 = minetest.get_us_time()
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local meta1 = nil local meta1 = nil
local pos1 = {} local pos1 = {}
@ -403,6 +404,12 @@ minetest.register_abm({
meta1:set_int(eu_input_str, math.floor(eu_demand * charge_factor)) meta1:set_int(eu_input_str, math.floor(eu_demand * charge_factor))
--dprint("Charging battery:"..math.floor(eu_demand*charge_factor)) --dprint("Charging battery:"..math.floor(eu_demand*charge_factor))
end end
local t1 = minetest.get_us_time()
local diff = t1 - t0
if diff > 20000 then
minetest.log("warning", "[technic] [+supply] switching station abm took " .. diff .. " us at " .. minetest.pos_to_string(pos))
end
return return
end end
@ -426,6 +433,11 @@ minetest.register_abm({
meta1:set_int(eu_input_str, math.floor(eu_supply * charge_factor)) meta1:set_int(eu_input_str, math.floor(eu_supply * charge_factor))
--dprint("Discharging battery:"..math.floor(eu_supply*charge_factor)) --dprint("Discharging battery:"..math.floor(eu_supply*charge_factor))
end end
local t1 = minetest.get_us_time()
local diff = t1 - t0
if diff > 20000 then
minetest.log("warning", "[technic] [-supply] switching station abm took " .. diff .. " us at " .. minetest.pos_to_string(pos))
end
return return
end end
@ -444,6 +456,12 @@ minetest.register_abm({
meta1:set_int(eu_input_str, 0) meta1:set_int(eu_input_str, 0)
end end
local t1 = minetest.get_us_time()
local diff = t1 - t0
if diff > 20000 then -- 50ms
minetest.log("warning", "[technic] switching station abm took " .. diff .. " us at " .. minetest.pos_to_string(pos))
end
end, end,
}) })

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 753 B

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 B

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

View File

@ -304,7 +304,7 @@ function technic.chests:definition(name, data)
def.can_dig = function(pos,player) def.can_dig = function(pos,player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:is_empty("main") and default.can_interact_with_node(player, pos) return inv:is_empty("main") and player and player:is_player() and default.can_interact_with_node(player, pos)
end end
def.on_skeleton_key_use = function(pos, player, newsecret) def.on_skeleton_key_use = function(pos, player, newsecret)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -167,7 +167,7 @@ minetest.register_on_generated(function(minp, maxp)
for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do
local c = data[a:index(x, y, z)] local c = data[a:index(x, y, z)]
if (c == c_lava or c == c_lava_flowing) if (c == c_lava or c == c_lava_flowing)
and sulfur_noise:get_3d({x = x, y = z, z = z}) >= 0.4 then and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then
for i in a:iter( for i in a:iter(
math.max(minp.x, x - grid_size), math.max(minp.x, x - grid_size),
math.max(minp.y, y - grid_size), math.max(minp.y, y - grid_size),