Add mods: technic, moreores, paintings, Nyancat (Pbj_pup). Small fix: sandwiches

This commit is contained in:
N-Nachtigal 2025-06-05 16:15:56 +02:00
parent 15e8e696a2
commit fb09deddc1
1404 changed files with 156555 additions and 211 deletions

View file

@ -0,0 +1,23 @@
-- LV Alloy furnace
local S = technic.getter
local mat = technic.materials
-- FIXME: kpoppel: I'd like to introduce an induction heating element here...
minetest.register_craft({
output = 'technic:lv_alloy_furnace',
recipe = {
{mat.brick, mat.brick, mat.brick},
{mat.brick, 'technic:machine_casing', mat.brick},
{mat.brick, 'technic:lv_cable', mat.brick},
}
})
technic.register_base_machine("technic:lv_alloy_furnace", {
typename = "alloy",
description = S("@1 Alloy Furnace", S("LV")),
insert_object = technic.insert_object_unique_stack,
can_insert = technic.can_insert_unique_stack,
tier = "LV",
speed = 1,
demand = {300}
})

View file

@ -0,0 +1,19 @@
-- 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("technic:lv_battery_box", {
tier = "LV",
max_charge = 40000,
charge_rate = 1000,
discharge_rate = 4000,
charge_step = 500,
discharge_step = 800,
})

View file

@ -0,0 +1,57 @@
local S = technic.getter
local mat = technic.materials
minetest.register_alias("lv_cable", "technic:lv_cable")
minetest.register_craft({
output = 'technic:lv_cable 6',
recipe = {
{mat.paper, mat.paper, mat.paper},
{mat.copper_ingot, mat.copper_ingot, mat.copper_ingot},
{mat.paper, mat.paper, mat.paper},
}
})
minetest.register_craft({
output = "technic:lv_cable_plate_1 5",
recipe = {
{"" , "" , "technic:lv_cable"},
{"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"},
{"" , "" , "technic:lv_cable"},
}
})
minetest.register_craft({
output = "technic:lv_cable",
recipe = {{"technic:lv_cable_plate_1"}}
})
-- Register cables
technic.register_cable("technic:lv_cable", {
tier = "LV",
size = 2/16,
description = S("@1 Cable", S("LV"))
})
technic.register_cable_plate("technic:lv_cable_plate", {
tier = "LV",
size = 2/16,
description = S("@1 Cable Plate", S("LV")),
tiles = {"technic_lv_cable.png"},
})
if minetest.get_modpath("digilines") then
technic.register_cable("technic:lv_digi_cable", {
tier = "LV",
size = 2/16,
description = S("@1 Digiline Cable", S("LV")),
digiline = { wire = { rules = technic.digilines.rules_allfaces } }
})
technic.register_cable_plate("technic:lv_digi_cable_plate", {
tier = "LV",
size = 2/16,
description = S("@1 Digiline Cable Plate", S("LV")),
digiline = { wire = { rules = technic.digilines.rules_allfaces } },
tiles = {"technic_lv_digi_cable.png"}
})
end

View file

@ -0,0 +1,26 @@
local S = technic.getter
local mat = technic.materials
minetest.register_alias("compressor", "technic:lv_compressor")
minetest.register_craft({
output = 'technic:lv_compressor',
recipe = {
{mat.stone, 'basic_materials:motor', mat.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_base_machine("technic:lv_compressor", {
typename = "compressing",
description = S("@1 Compressor", S("LV")),
tier = "LV",
demand = {300},
speed = 1
})

View file

@ -0,0 +1,22 @@
-- LV Electric Furnace
-- This is a faster version of the stone furnace which runs on EUs
local S = technic.getter
local mat = technic.materials
-- FIXME: kpoppel I'd like to introduce an induction heating element here also
minetest.register_craft({
output = 'technic:lv_electric_furnace',
recipe = {
{mat.cobble, mat.cobble, mat.cobble},
{mat.cobble, 'technic:machine_casing', mat.cobble},
{mat.cobble, 'technic:lv_cable', mat.cobble},
}
})
technic.register_base_machine("technic:lv_electric_furnace", {
typename = "cooking",
description = S("@1 Furnace", S("LV")),
tier="LV",
demand={300},
speed = 2
})

View file

@ -0,0 +1,35 @@
local S = technic.getter
minetest.register_alias("extractor", "technic:lv_extractor")
if technic.config:get_bool("enable_tree_tap") then
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', ''},
}
})
else
minetest.register_craft({
output = 'technic:lv_extractor',
recipe = {
{'basic_materials:motor', 'pipeworks:tube_1', 'basic_materials:motor'},
{'technic:carbon_steel_ingot', 'technic:machine_casing', 'technic:carbon_steel_ingot'},
{'', 'technic:lv_cable', ''},
}
})
end
technic.register_base_machine("technic:lv_extractor", {
typename = "extracting",
description = S("@1 Extractor", S("LV")),
tier = "LV",
demand = {300},
speed = 1
})

View file

@ -0,0 +1,20 @@
-- 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.
local mat = technic.materials
minetest.register_alias("lv_generator", "technic:lv_generator")
minetest.register_craft({
output = 'technic:lv_generator',
recipe = {
{mat.stone, mat.furnace, mat.stone},
{mat.stone, 'technic:machine_casing', mat.stone},
{mat.stone, 'technic:lv_cable', mat.stone},
}
})
technic.register_generator({tier="LV", supply=200})

View file

@ -0,0 +1,124 @@
-- 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
local mat = technic.materials
minetest.register_craft({
output = 'technic:geothermal',
recipe = {
{'technic:granite', mat.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 @1 Generator", S("LV")),
})
local check_node_around = function(pos)
local node = minetest.get_node(pos)
if node.name == mat.water_source or node.name == mat.water_flowing then return 1 end
if node.name == mat.lava_source or node.name == mat.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("@1 (@2% Efficiency)",
S("Geothermal @1 Generator", S("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 @1 Generator", S("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, axey=2, handy=1},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
paramtype2 = "facedir",
legacy_facedir_simple = true,
sounds = technic.sounds.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Geothermal @1 Generator", S("LV")))
meta:set_int("LV_EU_supply", 0)
end,
technic_run = run,
})
minetest.register_node("technic:geothermal_active", {
description = S("Geothermal @1 Generator", S("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, axey=2, handy=1},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
legacy_facedir_simple = true,
sounds = technic.sounds.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)

View file

@ -0,0 +1,20 @@
local S = technic.getter
local mat = technic.materials
minetest.register_alias("grinder", "technic:lv_grinder")
minetest.register_craft({
output = 'technic:lv_grinder',
recipe = {
{mat.desert_stone, mat.diamond, mat.desert_stone},
{mat.desert_stone, 'technic:machine_casing', mat.desert_stone},
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
}
})
technic.register_base_machine("technic:lv_grinder", {
typename = "grinding",
description = S("@1 Grinder", S("LV")),
tier="LV",
demand={200},
speed=1
})

View file

@ -0,0 +1,27 @@
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.."/led.lua")
dofile(path.."/lamp.lua")

View file

@ -0,0 +1,204 @@
-- LV Lamp - a powerful light source.
-- Illuminates a 7x7x3(H) volume below itself with light bright as the sun.
local S = technic.getter
local mat = technic.materials
local demand = 50
local desc = S("@1 Lamp", S("LV"))
local active_desc = S("@1 Active", desc).."\n"..S("Demand: @1", technic.EU_string(demand))
local unpowered_desc = S("@1 Unpowered", desc)
local off_desc = S("@1 Off", desc)
-- Invisible light source node used for illumination
minetest.register_node("technic:dummy_light_source", {
description = S("Dummy light source node"),
inventory_image = "technic_dummy_light_source.png",
wield_image = "technic_dummy_light_source.png",
paramtype = "light",
drawtype = "airlike",
light_source = 14,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
diggable = false,
pointable = false,
--drop = "", -- Intentionally allowed to drop itself
groups = {not_in_creative_inventory = 1}
})
local cid_light = minetest.get_content_id("technic:dummy_light_source")
local cid_air = minetest.CONTENT_AIR
local function illuminate(pos, active)
local pos1 = {x = pos.x - 3, y = pos.y - 3, z = pos.z - 3}
local pos2 = {x = pos.x + 3, y = pos.y - 1, z = pos.z + 3}
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(pos1, pos2)
local va = VoxelArea:new({MinEdge = emin, MaxEdge = emax})
local node_data = vm:get_data()
local find_node = active and cid_air or cid_light
local set_node = active and cid_light or cid_air
local dirty = false
for i in va:iterp(pos1, pos2) do
if node_data[i] == find_node then
node_data[i] = set_node
dirty = true
end
end
if dirty then
vm:set_data(node_data)
vm:write_to_map()
end
end
local function set_random_timer(pos, mint, maxt)
local t = math.random(mint * 10, maxt * 10) * 0.1
minetest.get_node_timer(pos):start(t)
end
local function lamp_run(pos, node)
local meta = minetest.get_meta(pos)
if meta:get_int("LV_EU_demand") == 0 then
return -- Lamp is turned off
end
local eu_input = meta:get_int("LV_EU_input")
if node.name == "technic:lv_lamp_active" then
if eu_input < demand then
technic.swap_node(pos, "technic:lv_lamp")
meta:set_string("infotext", unpowered_desc)
set_random_timer(pos, 0.2, 1)
end
elseif node.name == "technic:lv_lamp" then
if eu_input >= demand then
technic.swap_node(pos, "technic:lv_lamp_active")
meta:set_string("infotext", active_desc)
set_random_timer(pos, 0.2, 2)
end
end
end
local function lamp_toggle(pos, node, player)
if not player or minetest.is_protected(pos, player:get_player_name()) then
return
end
local meta = minetest.get_meta(pos)
if meta:get_int("LV_EU_demand") == 0 then
meta:set_string("infotext", active_desc)
meta:set_int("LV_EU_demand", demand)
else
technic.swap_node(pos, "technic:lv_lamp")
meta:set_string("infotext", off_desc)
meta:set_int("LV_EU_demand", 0)
set_random_timer(pos, 0.2, 1)
end
end
minetest.register_node("technic:lv_lamp", {
description = desc,
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, pickaxey = 2},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
connect_sides = {"front", "back", "left", "right", "top"},
can_dig = technic.machine_can_dig,
technic_run = lamp_run,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", desc)
meta:set_int("LV_EU_demand", demand)
end,
on_destruct = illuminate,
on_rightclick = lamp_toggle,
on_timer = function(pos)
illuminate(pos, false)
-- Don't start the timer again, otherwise lights will fight each other
end,
})
minetest.register_node("technic:lv_lamp_active", {
description = active_desc,
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"
},
paramtype = "light",
light_source = 14,
drop = "technic:lv_lamp",
groups = {cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1, pickaxey = 2},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
connect_sides = {"front", "back", "left", "right", "top"},
can_dig = technic.machine_can_dig,
technic_run = lamp_run,
technic_on_disable = function(pos)
technic.swap_node(pos, "technic:lv_lamp")
set_random_timer(pos, 0.2, 1)
end,
on_destruct = illuminate,
on_rightclick = lamp_toggle,
on_timer = function(pos, elapsed)
if elapsed < 60 then -- Don't check immediately after being unloaded
illuminate(pos, true)
end
set_random_timer(pos, 30, 60) -- Check every 30-60 seconds
end,
})
technic.register_machine("LV", "technic:lv_lamp", technic.receiver)
technic.register_machine("LV", "technic:lv_lamp_active", technic.receiver)
minetest.register_craft({
output = "technic:lv_lamp",
recipe = {
{mat.glass, mat.glass, mat.glass},
{"technic:lv_led", "technic:lv_led", "technic:lv_led"},
{"mesecons_materials:glue", "technic:lv_cable", "mesecons_materials:glue"},
}
})

View file

@ -0,0 +1,102 @@
-- LED - a weak light source.
-- Intended primarily as a core component for LED lamps.
local S = technic.getter
local demand = 5
local desc = S("@1 LED", S("LV"))
local active_desc = S("@1 Active", desc).."\n"..S("Demand: @1", technic.EU_string(demand))
local unpowered_desc = S("@1 Unpowered", desc)
local function led_run(pos, node)
local meta = minetest.get_meta(pos)
local eu_input = meta:get_int("LV_EU_input")
if eu_input < demand and node.name == "technic:lv_led_active" then
technic.swap_node(pos, "technic:lv_led")
meta:set_string("infotext", unpowered_desc)
elseif eu_input >= demand and node.name == "technic:lv_led" then
technic.swap_node(pos, "technic:lv_led_active")
meta:set_string("infotext", active_desc)
end
end
minetest.register_node("technic:lv_led", {
description = desc,
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, pickaxey = 2},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
connect_sides = {"front", "back", "left", "right", "top", "bottom"},
can_dig = technic.machine_can_dig,
technic_run = led_run,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", desc)
meta:set_int("LV_EU_demand", demand)
end,
})
minetest.register_node("technic:lv_led_active", {
description = active_desc,
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",
paramtype = "light",
light_source = 9,
drop = "technic:lv_led",
sunlight_propagates = true,
groups = {cracky = 2, technic_machine = 1, technic_lv = 1, not_in_creative_inventory = 1, pickaxey = 2},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
connect_sides = {"front", "back", "left", "right", "top", "bottom"},
can_dig = technic.machine_can_dig,
technic_run = led_run,
technic_on_disable = function(pos)
technic.swap_node(pos, "technic:lv_led")
end,
})
technic.register_machine("LV", "technic:lv_led", technic.receiver)
technic.register_machine("LV", "technic:lv_led_active", technic.receiver)
minetest.register_craft({
output = "technic:lv_led 2",
recipe = {
{"", "basic_materials:plastic_sheet", ""},
{"basic_materials:plastic_sheet", "technic:doped_silicon_wafer", "basic_materials:plastic_sheet"},
{"", "basic_materials:silver_wire", ""},
},
replacements = {{"basic_materials:silver_wire", "basic_materials:empty_spool"}},
})

View file

@ -0,0 +1,134 @@
-- LV Music player.
-- The player can play music. But it is high ampage!
local S = technic.getter
local mat = technic.materials
minetest.register_alias("music_player", "technic:music_player")
minetest.register_craft({
output = 'technic:music_player',
recipe = {
{'technic:chromium_ingot', mat.diamond, 'technic:chromium_ingot'},
{mat.diamond, 'technic:machine_casing', mat.diamond},
{mat.mossycobble, 'technic:lv_cable', mat.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("@1 Music Player", S("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("@1 Idle", machine_name))
meta:set_int("LV_EU_demand", 0)
return
end
if eu_input < demand then
meta:set_string("infotext", S("@1 Unpowered", 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("@1 Active", machine_name) .. "\n" ..
S("Demand: @1", technic.EU_string(demand)))
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("@1 Music Player", S("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;"..S("Stop").."]"..
"label[0,4;"..(meta:get_int("active") == 0 and S("Stopped") or
S("Current track: @1", meta:get_int("current_track"))).."]")
end
minetest.register_node("technic:music_player", {
description = S("@1 Music Player", S("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, axey = 2, handy=1},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
connect_sides = {"bottom"},
sounds = technic.sounds.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("@1 Music Player", S("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)

View file

@ -0,0 +1,22 @@
-- 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:lv_solar_array 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("technic:lv_solar_array", {
tier="LV",
power=10
})
minetest.register_alias("technic:solar_array_lv", "technic:lv_solar_array")

View file

@ -0,0 +1,74 @@
-- 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 @1 Generator", S("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("@1 Idle", 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, axey=2, handy=1},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
connect_sides = {"bottom"},
sounds = technic.sounds.node_sound_wood_defaults(),
description = S("Small Solar @1 Generator", S("LV")),
active = false,
drawtype = "nodebox",
paramtype = "light",
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 @1 Generator", S("LV")))
end,
technic_run = run,
})
technic.register_machine("LV", "technic:solar_panel", technic.producer)

View file

@ -0,0 +1,115 @@
-- 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 mat = technic.materials
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', mat.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 == mat.water_flowing or node.name == mat.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("@1 (@2% Efficiency)",
S("Hydro @1 Generator", S("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 @1 Generator", S("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, axey=2, handy=1},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
legacy_facedir_simple = true,
sounds = technic.sounds.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Hydro @1 Generator", S("LV")))
meta:set_int("LV_EU_supply", 0)
end,
technic_run = run,
})
minetest.register_node("technic:water_mill_active", {
description = S("Hydro @1 Generator", S("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, axey=2, handy=1},
is_ground_content = false,
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
legacy_facedir_simple = true,
sounds = technic.sounds.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)