many worldgen mods and gonna try technic now
This commit is contained in:
1 parent
bac6ac94a3
commit
548749cb1a
4811 files changed
+163271
-1
No files matched your search
@@ -0,0 +1,14 @@
|
||||
-- LV Alloy furnace
|
||||
|
||||
-- FIXME: kpoppel: I'd like to introduce an induction heating element here...
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_alloy_furnace',
|
||||
recipe = {
|
||||
{'default:brick', 'default:brick', 'default:brick'},
|
||||
{'default:brick', 'technic:machine_casing', 'default:brick'},
|
||||
{'default:brick', 'technic:lv_cable', 'default:brick'},
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_alloy_furnace({tier = "LV", speed = 1, demand = {300}})
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
-- LV Battery box
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_battery_box0',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'technic:battery', 'technic:machine_casing', 'technic:battery'},
|
||||
{'technic:battery', 'technic:lv_cable', 'technic:battery'},
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_battery_box({
|
||||
tier = "LV",
|
||||
max_charge = 40000,
|
||||
charge_rate = 1000,
|
||||
discharge_rate = 4000,
|
||||
charge_step = 500,
|
||||
discharge_step = 800,
|
||||
})
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
minetest.register_alias("lv_cable", "technic:lv_cable")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_cable 6',
|
||||
recipe = {
|
||||
{'default:paper', 'default:paper', 'default:paper'},
|
||||
{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'},
|
||||
{'default:paper', 'default:paper', 'default:paper'},
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_cable("LV", 2/16)
|
||||
|
||||
if minetest.get_modpath("digilines") then
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
if minetest.get_modpath("digistuff") then
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_digi_cable 1',
|
||||
type = "shapeless",
|
||||
recipe = {'digistuff:digimese', 'technic:lv_cable'}
|
||||
})
|
||||
else
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_digi_cable 1',
|
||||
recipe = {
|
||||
{'digilines:wire_std_00000000', 'digilines:wire_std_00000000', 'digilines:wire_std_00000000'},
|
||||
{'digilines:wire_std_00000000', 'technic:lv_cable', 'digilines:wire_std_00000000'},
|
||||
{'digilines:wire_std_00000000', 'digilines:wire_std_00000000', 'digilines:wire_std_00000000'},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
technic.register_cable("LV", 2/16, S("LV Cable (digiline)"), "_digi", {
|
||||
digiline = {
|
||||
wire = {
|
||||
rules = {
|
||||
{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}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
minetest.register_alias("compressor", "technic:lv_compressor")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_compressor',
|
||||
recipe = {
|
||||
{'default:stone', 'basic_materials:motor', 'default:stone'},
|
||||
{'mesecons:piston', 'technic:machine_casing', 'mesecons:piston'},
|
||||
{'basic_materials:silver_wire', 'technic:lv_cable', 'basic_materials:silver_wire'},
|
||||
},
|
||||
replacements = {
|
||||
{"basic_materials:silver_wire", "basic_materials:empty_spool"},
|
||||
{"basic_materials:silver_wire", "basic_materials:empty_spool"}
|
||||
},
|
||||
})
|
||||
|
||||
technic.register_compressor({tier = "LV", demand = {300}, speed = 1})
|
||||
@@ -0,0 +1,16 @@
|
||||
-- LV Electric Furnace
|
||||
-- This is a faster version of the stone furnace which runs on EUs
|
||||
|
||||
-- FIXME: kpoppel I'd like to introduce an induction heating element here also
|
||||
minetest.register_craft({
|
||||
output = 'technic:electric_furnace',
|
||||
recipe = {
|
||||
{'default:cobble', 'default:cobble', 'default:cobble'},
|
||||
{'default:cobble', 'technic:machine_casing', 'default:cobble'},
|
||||
{'default:cobble', 'technic:lv_cable', 'default:cobble'},
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_electric_furnace({tier="LV", demand={300}, speed = 2})
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
minetest.register_alias("extractor", "technic:lv_extractor")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_extractor',
|
||||
recipe = {
|
||||
{'technic:treetap', 'basic_materials:motor', 'technic:treetap'},
|
||||
{'technic:treetap', 'technic:machine_casing', 'technic:treetap'},
|
||||
{'', 'technic:lv_cable', ''},
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_extractor({tier = "LV", demand = {300}, speed = 1})
|
||||
@@ -0,0 +1,18 @@
|
||||
-- The electric generator.
|
||||
-- A simple device to get started on the electric machines.
|
||||
-- Inefficient and expensive in fuel (200EU per tick)
|
||||
-- Also only allows for LV machinery to run.
|
||||
|
||||
minetest.register_alias("lv_generator", "technic:lv_generator")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_generator',
|
||||
recipe = {
|
||||
{'default:stone', 'default:furnace', 'default:stone'},
|
||||
{'default:stone', 'technic:machine_casing', 'default:stone'},
|
||||
{'default:stone', 'technic:lv_cable', 'default:stone'},
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_generator({tier="LV", supply=200})
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
-- A geothermal EU generator
|
||||
-- Using hot lava and water this device can create energy from steam
|
||||
-- The machine is only producing LV EUs and can thus not drive more advanced equipment
|
||||
-- The output is a little more than the coal burning generator (max 300EUs)
|
||||
|
||||
minetest.register_alias("geothermal", "technic:geothermal")
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:geothermal',
|
||||
recipe = {
|
||||
{'technic:granite', 'default:diamond', 'technic:granite'},
|
||||
{'basic_materials:copper_wire', 'technic:machine_casing', 'basic_materials:copper_wire'},
|
||||
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
|
||||
},
|
||||
replacements = {
|
||||
{"basic_materials:copper_wire", "basic_materials:empty_spool"},
|
||||
{"basic_materials:copper_wire", "basic_materials:empty_spool"}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("technic:geothermal", {
|
||||
description = S("Geothermal %s Generator"):format("LV"),
|
||||
})
|
||||
|
||||
local check_node_around = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == "default:water_source" or node.name == "default:water_flowing" then return 1 end
|
||||
if node.name == "default:lava_source" or node.name == "default:lava_flowing" then return 2 end
|
||||
return 0
|
||||
end
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local water_nodes = 0
|
||||
local lava_nodes = 0
|
||||
local production_level = 0
|
||||
local eu_supply = 0
|
||||
|
||||
-- Correct positioning is water on one side and lava on the other.
|
||||
-- The two cannot be adjacent because the lava the turns into obsidian or rock.
|
||||
-- To get to 100% production stack the water and lava one extra block down as well:
|
||||
-- WGL (W=Water, L=Lava, G=the generator, |=an LV cable)
|
||||
-- W|L
|
||||
|
||||
local positions = {
|
||||
{x=pos.x+1, y=pos.y, z=pos.z},
|
||||
{x=pos.x+1, y=pos.y-1, z=pos.z},
|
||||
{x=pos.x-1, y=pos.y, z=pos.z},
|
||||
{x=pos.x-1, y=pos.y-1, z=pos.z},
|
||||
{x=pos.x, y=pos.y, z=pos.z+1},
|
||||
{x=pos.x, y=pos.y-1, z=pos.z+1},
|
||||
{x=pos.x, y=pos.y, z=pos.z-1},
|
||||
{x=pos.x, y=pos.y-1, z=pos.z-1},
|
||||
}
|
||||
for _, p in pairs(positions) do
|
||||
local check = check_node_around(p)
|
||||
if check == 1 then water_nodes = water_nodes + 1 end
|
||||
if check == 2 then lava_nodes = lava_nodes + 1 end
|
||||
end
|
||||
|
||||
if water_nodes == 1 and lava_nodes == 1 then production_level = 25; eu_supply = 50 end
|
||||
if water_nodes == 2 and lava_nodes == 1 then production_level = 50; eu_supply = 100 end
|
||||
if water_nodes == 1 and lava_nodes == 2 then production_level = 75; eu_supply = 200 end
|
||||
if water_nodes == 2 and lava_nodes == 2 then production_level = 100; eu_supply = 300 end
|
||||
|
||||
if production_level > 0 then
|
||||
meta:set_int("LV_EU_supply", eu_supply)
|
||||
end
|
||||
|
||||
meta:set_string("infotext",
|
||||
S("Geothermal %s Generator"):format("LV").." ("..production_level.."%)")
|
||||
|
||||
if production_level > 0 and minetest.get_node(pos).name == "technic:geothermal" then
|
||||
technic.swap_node (pos, "technic:geothermal_active")
|
||||
return
|
||||
end
|
||||
if production_level == 0 then
|
||||
technic.swap_node(pos, "technic:geothermal")
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("technic:geothermal", {
|
||||
description = S("Geothermal %s Generator"):format("LV"),
|
||||
tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
||||
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1},
|
||||
paramtype2 = "facedir",
|
||||
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("Geothermal %s Generator"):format("LV"))
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
end,
|
||||
technic_run = run,
|
||||
})
|
||||
|
||||
minetest.register_node("technic:geothermal_active", {
|
||||
description = S("Geothermal %s Generator"):format("LV"),
|
||||
tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
||||
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "technic:geothermal",
|
||||
technic_run = run,
|
||||
})
|
||||
|
||||
technic.register_machine("LV", "technic:geothermal", technic.producer)
|
||||
technic.register_machine("LV", "technic:geothermal_active", technic.producer)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
minetest.register_alias("grinder", "technic:lv_grinder")
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_grinder',
|
||||
recipe = {
|
||||
{'default:desert_stone', 'default:diamond', 'default:desert_stone'},
|
||||
{'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'},
|
||||
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_grinder({tier="LV", demand={200}, speed=1})
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
technic.register_tier("LV", "Low Voltage")
|
||||
|
||||
local path = technic.modpath.."/machines/LV"
|
||||
|
||||
-- Wiring stuff
|
||||
dofile(path.."/cables.lua")
|
||||
dofile(path.."/battery_box.lua")
|
||||
|
||||
-- Generators
|
||||
dofile(path.."/solar_panel.lua")
|
||||
dofile(path.."/solar_array.lua")
|
||||
dofile(path.."/geothermal.lua")
|
||||
dofile(path.."/water_mill.lua")
|
||||
dofile(path.."/generator.lua")
|
||||
|
||||
-- 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.."/music_player.lua")
|
||||
|
||||
dofile(path.."/lamp.lua")
|
||||
@@ -0,0 +1,246 @@
|
||||
-- LV LED and LV LED Lamp
|
||||
-- LED - a weak light source, intended primarily as a core component for LED lamps
|
||||
-- LED Lamp - a powerful light source, illuminating a 7x7x3(H) volume below itself
|
||||
-- with light bright as the sun.
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
|
||||
local illuminate = function(pos, mode)
|
||||
for y=1,3,1 do
|
||||
for x=-3,3,1 do
|
||||
for z = -3,3,1 do
|
||||
local loc = {x = pos.x - x, y = pos.y - y, z = pos.z - z}
|
||||
if mode then
|
||||
if minetest.get_node(loc).name == "air" then
|
||||
minetest.swap_node(loc, {name = "technic:dummy_light_source"})
|
||||
end
|
||||
else
|
||||
if minetest.get_node(loc).name == "technic:dummy_light_source" then
|
||||
minetest.swap_node(loc, {name = "air"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local led_on = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local machine_name = S("%s LED"):format("LV")
|
||||
local machine_node = "technic:lv_led"
|
||||
local demand = 5
|
||||
|
||||
if eu_input < demand then
|
||||
technic.swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
elseif eu_input >= demand then
|
||||
technic.swap_node(pos, machine_node.."_active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
end
|
||||
meta:set_int("LV_EU_demand", demand)
|
||||
end
|
||||
|
||||
local led_off = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local machine_name = S("%s LED"):format("LV")
|
||||
local machine_node = "technic:lv_led"
|
||||
|
||||
technic.swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
|
||||
meta:set_int("LV_EU_demand", 0)
|
||||
end
|
||||
|
||||
|
||||
|
||||
local lamp_on = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local machine_name = S("%s Lamp"):format("LV")
|
||||
local machine_node = "technic:lv_lamp"
|
||||
local demand = 50
|
||||
|
||||
if eu_input < demand then
|
||||
technic.swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
illuminate(pos, false)
|
||||
elseif eu_input >= demand then
|
||||
technic.swap_node(pos, machine_node.."_active")
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
illuminate(pos, true)
|
||||
end
|
||||
meta:set_int("LV_EU_demand", demand)
|
||||
end
|
||||
|
||||
local lamp_off = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local machine_name = S("%s Lamp"):format("LV")
|
||||
local machine_node = "technic:lv_lamp"
|
||||
|
||||
illuminate(pos, false)
|
||||
technic.swap_node(pos, machine_node)
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
meta:set_int("LV_EU_demand", 0)
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("technic:dummy_light_source", {
|
||||
description = S("Dummy light source node"),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {}
|
||||
},
|
||||
drawtype = "airlike",
|
||||
buildable_to = true,
|
||||
light_source = 14,
|
||||
sunlight_propagates = true,
|
||||
diggable = false,
|
||||
walkable = false,
|
||||
groups = { not_in_creative_inventory = 1 }
|
||||
})
|
||||
|
||||
minetest.register_node("technic:lv_led", {
|
||||
description = S("LV LED"),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.2,0.2,0.2,-0.2,-0.2,-0.2}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.2,0.2,0.2,-0.2,-0.2,-0.2}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.2,0.2,0.2,-0.2,-0.2,-0.2}
|
||||
},
|
||||
tiles = {"technic_lv_led.png"},
|
||||
inventory_image = "technic_lv_led_inv.png",
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky=2, technic_machine=1, technic_lv=1},
|
||||
connect_sides = {"front", "back", "left", "right", "top", "bottom"},
|
||||
can_dig = technic.machine_can_dig,
|
||||
technic_run = led_on,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", S("%s LED"):format("LV"))
|
||||
end,
|
||||
drop = "technic:lv_led"
|
||||
})
|
||||
|
||||
minetest.register_node("technic:lv_led_active", {
|
||||
description = S("LV LED Active"),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.2,0.2,0.2,-0.2,-0.2,-0.2}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.2,0.2,0.2,-0.2,-0.2,-0.2}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.2,0.2,0.2,-0.2,-0.2,-0.2}
|
||||
},
|
||||
tiles = {"technic_lv_led.png"},
|
||||
light_source = 9,
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky=2, technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||
connect_sides = {"front", "back", "left", "right", "top", "bottom"},
|
||||
can_dig = technic.machine_can_dig,
|
||||
technic_run = led_on,
|
||||
technic_on_disable = led_off,
|
||||
drop = "technic:lv_led"
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("technic:lv_lamp", {
|
||||
description = S("%s Lamp"):format("LV"),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.5,0.5,0.5,-0.5,-0.2,-0.5}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.5,0.5,0.5,-0.5,-0.2,-0.5}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.5,0.5,0.5,-0.5,-0.2,-0.5}
|
||||
},
|
||||
tiles = {"technic_lv_lamp_top.png", "technic_lv_lamp_bottom.png", "technic_lv_lamp_side.png",
|
||||
"technic_lv_lamp_side.png", "technic_lv_lamp_side.png", "technic_lv_lamp_side.png"},
|
||||
groups = {cracky=2, technic_machine=1, technic_lv=1},
|
||||
connect_sides = {"front", "back", "left", "right", "top",},
|
||||
can_dig = technic.machine_can_dig,
|
||||
technic_run = lamp_on,
|
||||
on_destruct = lamp_off,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", S("%s Lamp"):format("LV"))
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("technic:lv_lamp_active", {
|
||||
description = S("%s Lamp Active"):format("LV"),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.5,0.5,0.5,-0.5,-0.2,-0.5}
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.5,0.5,0.5,-0.5,-0.2,-0.5}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0.5,0.5,0.5,-0.5,-0.2,-0.5}
|
||||
},
|
||||
tiles = {"technic_lv_lamp_top.png", "technic_lv_lamp_bottom.png", "technic_lv_lamp_side.png",
|
||||
"technic_lv_lamp_side.png", "technic_lv_lamp_side.png", "technic_lv_lamp_side.png"},
|
||||
groups = {cracky=2, technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||
connect_sides = {"front", "back", "left", "right", "top"},
|
||||
light_source = 1,
|
||||
can_dig = technic.machine_can_dig,
|
||||
technic_run = lamp_on,
|
||||
on_destruct = lamp_off,
|
||||
technic_on_disable = lamp_off,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_led 2',
|
||||
recipe = {
|
||||
{'', 'homedecor:plastic_sheeting', ''},
|
||||
{'homedecor:plastic_sheeting', 'technic:doped_silicon_wafer', 'homedecor:plastic_sheeting'},
|
||||
{'', 'technic:fine_silver_wire', ''},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:lv_lamp',
|
||||
recipe = {
|
||||
{'default:glass', 'default:glass', 'default:glass'},
|
||||
{'technic:lv_led', 'technic:lv_led', 'technic:lv_led'},
|
||||
{'mesecons_materials:glue', 'technic:lv_cable', 'mesecons_materials:glue'},
|
||||
},
|
||||
})
|
||||
|
||||
technic.register_machine("LV", "technic:lv_lamp", technic.receiver)
|
||||
technic.register_machine("LV", "technic:lv_lamp_active", technic.receiver)
|
||||
|
||||
technic.register_machine("LV", "technic:lv_led", technic.receiver)
|
||||
technic.register_machine("LV", "technic:lv_led_active", technic.receiver)
|
||||
@@ -0,0 +1,131 @@
|
||||
-- LV Music player.
|
||||
-- The player can play music. But it is high ampage!
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
minetest.register_alias("music_player", "technic:music_player")
|
||||
minetest.register_craft({
|
||||
output = 'technic:music_player',
|
||||
recipe = {
|
||||
{'technic:chromium_ingot', 'default:diamond', 'technic:chromium_ingot'},
|
||||
{'default:diamond', 'technic:machine_casing', 'default:diamond'},
|
||||
{'default:mossycobble', 'technic:lv_cable', 'default:mossycobble'},
|
||||
}
|
||||
})
|
||||
|
||||
local music_handles = {}
|
||||
|
||||
local function play_track(pos, track)
|
||||
return minetest.sound_play("technic_track"..tostring(track),
|
||||
{pos = pos, gain = 1.0, loop = true, max_hear_distance = 72,})
|
||||
end
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local eu_input = meta:get_int("LV_EU_input")
|
||||
local machine_name = S("%s Music Player"):format("LV")
|
||||
local demand = 150
|
||||
|
||||
local current_track = meta:get_int("current_track")
|
||||
local pos_hash = minetest.hash_node_position(pos)
|
||||
local music_handle = music_handles[pos_hash]
|
||||
|
||||
-- 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
|
||||
|
||||
if meta:get_int("active") == 0 then
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_int("LV_EU_demand", 0)
|
||||
return
|
||||
end
|
||||
|
||||
if eu_input < demand then
|
||||
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
||||
if music_handle then
|
||||
minetest.sound_stop(music_handle)
|
||||
music_handle = nil
|
||||
end
|
||||
elseif eu_input >= demand then
|
||||
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
||||
if not music_handle then
|
||||
music_handle = play_track(pos, current_track)
|
||||
end
|
||||
end
|
||||
music_handles[pos_hash] = music_handle
|
||||
meta:set_int("LV_EU_demand", demand)
|
||||
end
|
||||
|
||||
local function stop_player(pos, node)
|
||||
local pos_hash = minetest.hash_node_position(pos)
|
||||
local music_handle = music_handles[pos_hash]
|
||||
if music_handle then
|
||||
minetest.sound_stop(music_handle)
|
||||
music_handles[pos_hash] = nil
|
||||
end
|
||||
end
|
||||
|
||||
local function set_display(meta)
|
||||
meta:set_string("formspec",
|
||||
"size[4,4.5]"..
|
||||
"item_image[0,0;1,1;technic:music_player]"..
|
||||
"label[1,0;"..S("%s Music Player"):format("LV").."]"..
|
||||
"button[0,1;1,1;track1;1]"..
|
||||
"button[1,1;1,1;track2;2]"..
|
||||
"button[2,1;1,1;track3;3]"..
|
||||
"button[0,2;1,1;track4;4]"..
|
||||
"button[1,2;1,1;track5;5]"..
|
||||
"button[2,2;1,1;track6;6]"..
|
||||
"button[0,3;1,1;track7;7]"..
|
||||
"button[1,3;1,1;track8;8]"..
|
||||
"button[2,3;1,1;track9;9]"..
|
||||
"button[3,1;1,1;stop;Stop]"..
|
||||
"label[0,4;"..minetest.formspec_escape(
|
||||
meta:get_int("active") == 0 and
|
||||
S("Stopped") or
|
||||
S("Current track %s"):format(meta:get_int("current_track"))).."]")
|
||||
end
|
||||
|
||||
minetest.register_node("technic:music_player", {
|
||||
description = S("%s Music Player"):format("LV"),
|
||||
tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png",
|
||||
"technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1},
|
||||
connect_sides = {"bottom"},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", S("%s Music Player"):format("LV"))
|
||||
set_display(meta)
|
||||
end,
|
||||
on_receive_fields = function(pos, formanme, fields, sender)
|
||||
local new_track = nil
|
||||
if fields.stop then new_track = 0 end
|
||||
if fields.track1 then new_track = 1 end
|
||||
if fields.track2 then new_track = 2 end
|
||||
if fields.track3 then new_track = 3 end
|
||||
if fields.track4 then new_track = 4 end
|
||||
if fields.track5 then new_track = 5 end
|
||||
if fields.track6 then new_track = 6 end
|
||||
if fields.track7 then new_track = 7 end
|
||||
if fields.track8 then new_track = 8 end
|
||||
if fields.track9 then new_track = 9 end
|
||||
if new_track then
|
||||
stop_player(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("active", new_track == 0 and 0 or 1)
|
||||
meta:set_int("current_track", new_track)
|
||||
set_display(meta)
|
||||
end
|
||||
end,
|
||||
on_destruct = stop_player,
|
||||
technic_run = run,
|
||||
technic_on_disable = stop_player,
|
||||
})
|
||||
|
||||
technic.register_machine("LV", "technic:music_player", technic.receiver)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
-- The solar array is an assembly of panels into a powerful array
|
||||
-- The assembly can deliver more energy than the individual panel because
|
||||
-- of the transformer unit which converts the panel output variations into
|
||||
-- a stable supply.
|
||||
-- Solar arrays are not able to store large amounts of energy.
|
||||
-- The LV arrays are used to make medium voltage arrays.
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:solar_array_lv 1',
|
||||
recipe = {
|
||||
{'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel'},
|
||||
{'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot'},
|
||||
{'', 'technic:lv_cable', ''},
|
||||
}
|
||||
})
|
||||
|
||||
technic.register_solar_array({tier="LV", power=10})
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
-- Solar panels are the building blocks of LV solar arrays
|
||||
-- They can however also be used separately but with reduced efficiency due to the missing transformer.
|
||||
-- Individual panels are less efficient than when the panels are combined into full arrays.
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:solar_panel',
|
||||
recipe = {
|
||||
{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'},
|
||||
{'basic_materials:silver_wire', 'technic:lv_cable', 'mesecons_materials:glue'},
|
||||
},
|
||||
replacements = { {"basic_materials:silver_wire", "basic_materials:empty_spool"}, },
|
||||
})
|
||||
|
||||
|
||||
local run = function(pos, node)
|
||||
-- The action here is to make the solar panel prodice power
|
||||
-- Power is dependent on the light level and the height above ground
|
||||
-- There are many ways to cheat by using other light sources like lamps.
|
||||
-- As there is no way to determine if light is sunlight that is just a shame.
|
||||
-- To take care of some of it solar panels do not work outside daylight hours or if
|
||||
-- built below 0m
|
||||
local pos1 = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local machine_name = S("Small Solar %s Generator"):format("LV")
|
||||
|
||||
local light = minetest.get_node_light(pos1, nil)
|
||||
local time_of_day = minetest.get_timeofday()
|
||||
local meta = minetest.get_meta(pos)
|
||||
if light == nil then light = 0 end
|
||||
-- turn on panel only during day time and if sufficient light
|
||||
-- I know this is counter intuitive when cheating by using other light sources underground.
|
||||
if light >= 12 and time_of_day >= 0.24 and time_of_day <= 0.76 and pos.y > -10 then
|
||||
local charge_to_give = math.floor((light + pos1.y) * 3)
|
||||
charge_to_give = math.max(charge_to_give, 0)
|
||||
charge_to_give = math.min(charge_to_give, 200)
|
||||
meta:set_string("infotext", S("@1 Active (@2)", machine_name,
|
||||
technic.EU_string(charge_to_give)))
|
||||
meta:set_int("LV_EU_supply", charge_to_give)
|
||||
else
|
||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("technic:solar_panel", {
|
||||
tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
|
||||
"technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"},
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1},
|
||||
connect_sides = {"bottom"},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
description = S("Small Solar %s Generator"):format("LV"),
|
||||
active = false,
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
meta:set_string("infotext", S("Small Solar %s Generator"):format("LV"))
|
||||
end,
|
||||
technic_run = run,
|
||||
})
|
||||
|
||||
technic.register_machine("LV", "technic:solar_panel", technic.producer)
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
-- A water mill produces LV EUs by exploiting flowing water across it
|
||||
-- It is a LV EU supplier and fairly low yield (max 180EUs)
|
||||
-- It is a little over half as good as the thermal generator.
|
||||
|
||||
local S = technic.getter
|
||||
|
||||
local cable_entry = "^technic_cable_connection_overlay.png"
|
||||
|
||||
minetest.register_alias("water_mill", "technic:water_mill")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:water_mill',
|
||||
recipe = {
|
||||
{'technic:marble', 'default:diamond', 'technic:marble'},
|
||||
{'group:wood', 'technic:machine_casing', 'group:wood'},
|
||||
{'technic:marble', 'technic:lv_cable', 'technic:marble'},
|
||||
}
|
||||
})
|
||||
|
||||
local function check_node_around_mill(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == "default:water_flowing"
|
||||
or node.name == "default:river_water_flowing" then
|
||||
return node.param2 -- returns approx. water flow, if any
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local run = function(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local water_flow = 0
|
||||
local production_level
|
||||
local eu_supply
|
||||
local max_output = 4 * 45 -- keeping it around 180, little more than previous 150 :)
|
||||
|
||||
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
|
||||
local check = check_node_around_mill(p)
|
||||
if check then
|
||||
water_flow = water_flow + check
|
||||
end
|
||||
end
|
||||
|
||||
eu_supply = math.min(4 * water_flow, max_output)
|
||||
production_level = math.floor(100 * eu_supply / max_output)
|
||||
|
||||
meta:set_int("LV_EU_supply", eu_supply)
|
||||
|
||||
meta:set_string("infotext",
|
||||
S("Hydro %s Generator"):format("LV").." ("..production_level.."%)")
|
||||
|
||||
if production_level > 0 and
|
||||
minetest.get_node(pos).name == "technic:water_mill" then
|
||||
technic.swap_node (pos, "technic:water_mill_active")
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
return
|
||||
end
|
||||
if production_level == 0 then
|
||||
technic.swap_node(pos, "technic:water_mill")
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("technic:water_mill", {
|
||||
description = S("Hydro %s Generator"):format("LV"),
|
||||
tiles = {
|
||||
"technic_water_mill_top.png",
|
||||
"technic_machine_bottom.png"..cable_entry,
|
||||
"technic_water_mill_side.png",
|
||||
"technic_water_mill_side.png",
|
||||
"technic_water_mill_side.png",
|
||||
"technic_water_mill_side.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1},
|
||||
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("LV"))
|
||||
meta:set_int("LV_EU_supply", 0)
|
||||
end,
|
||||
technic_run = run,
|
||||
})
|
||||
|
||||
minetest.register_node("technic:water_mill_active", {
|
||||
description = S("Hydro %s Generator"):format("LV"),
|
||||
tiles = {"technic_water_mill_top_active.png", "technic_machine_bottom.png",
|
||||
"technic_water_mill_side.png", "technic_water_mill_side.png",
|
||||
"technic_water_mill_side.png", "technic_water_mill_side.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||
legacy_facedir_simple = true,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "technic:water_mill",
|
||||
technic_run = run,
|
||||
technic_disabled_machine_name = "technic:water_mill",
|
||||
})
|
||||
|
||||
technic.register_machine("LV", "technic:water_mill", technic.producer)
|
||||
technic.register_machine("LV", "technic:water_mill_active", technic.producer)
|
||||
|
||||
Reference in new issue
Block a user