diff --git a/README.md b/README.md index 69914bd..42ee4f0 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ In contrast to TechPack, the resources are more limited and it is much more diff ### License -Copyright (C) 2019-2021 Joachim Stolberg +Copyright (C) 2019-2022 Joachim Stolberg Code: Licensed under the GNU AGPL version 3 or later. See LICENSE.txt Textures: CC BY-SA 3.0 @@ -80,6 +80,9 @@ Available worlds will be converted to 'lsqlite3', but there is no way back, so: ### History +**2022-01-22 V1.07** +- TA5 fusion reactor added + **2022-01-03 V1.06** - TA5 teleport blocks added - Many improvements diff --git a/basis/fly_lib.lua b/basis/fly_lib.lua index a9064b7..4ae48b2 100644 --- a/basis/fly_lib.lua +++ b/basis/fly_lib.lua @@ -242,9 +242,8 @@ local function attach_objects(pos, offs, parent, yoffs) local dir = vector.subtract(obj:get_pos(), pos) local entity = obj:get_luaentity() if entity then - if entity.name == "__builtin:item" then -- dropped items - --obj:set_attach(objref, "", {x=0, y=0, z=0}, {x=0, y=0, z=0}, true) -- hier kracht es - elseif entity.name ~= "techage:move_item" then + local mod = entity.name:gmatch("(.-):")() + if techage.RegisteredMobsMods[mod] then dir.y = dir.y + yoffs attach_single_object(parent, obj, dir) end diff --git a/basis/lib.lua b/basis/lib.lua index edbe7c1..d47f5ac 100644 --- a/basis/lib.lua +++ b/basis/lib.lua @@ -264,25 +264,6 @@ function techage.get_node_lvm(pos) return {name="ignore", param2=0} end --- --- Functions used to hide electric cable and biogas pipes --- --- Overridden method of tubelib2! -function techage.get_primary_node_param2(pos, dir) - local npos = vector.add(pos, tubelib2.Dir6dToVector[dir or 0]) - local param2 = M(npos):get_int("tl2_param2") - if param2 ~= 0 then - return param2, npos - end -end - --- Overridden method of tubelib2! -function techage.is_primary_node(pos, dir) - local npos = vector.add(pos, tubelib2.Dir6dToVector[dir or 0]) - local param2 = M(npos):get_int("tl2_param2") - return param2 ~= 0 -end - function techage.is_air_like(name) local ndef = minetest.registered_nodes[name] if ndef and ndef.buildable_to then @@ -505,6 +486,14 @@ function techage.wrench_tooltip(x, y) "tooltip["..x..","..y..";0.5,0.5;"..tooltip..";#0C3D32;#FFFFFF]" end +techage.RegisteredMobsMods = {} + +-- Register mobs mods for the move/fly controllers +function techage.register_mobs_mods(mod) + techage.RegisteredMobsMods[mod] = true +end + + ------------------------------------------------------------------------------- -- Terminal history buffer ------------------------------------------------------------------------------- @@ -590,3 +579,50 @@ function techage.set_expoints(player, ex_points) end end end + +------------------------------------------------------------------------------- +-- Scheduler for a table-based, cyclic call of functions +------------------------------------------------------------------------------- +local TABLE_SIZE = 256 +techage.scheduler = {} + +local function add_to_table(tbl, i, func) + while i < TABLE_SIZE do + if not tbl[i] then + tbl[i] = func + return i + 1 + end + i = i + 1 + end + return i +end + +function techage.scheduler.init(pos) + local mem = techage.get_mem(pos) + mem.sched_idx = 0 +end + +-- tFunc : (empty) table of functions +-- call_rate : (2,4,8,16,32,64 or 128) +-- offset : 0-128 +-- func : function to be called +function techage.scheduler.register(tFunc, call_rate, offset, func) + local i= 0 + while i < TABLE_SIZE do + if (i % call_rate) == offset then + i = add_to_table(tFunc, i, func) + else + i = i + 1 + end + end + return tFunc +end + +-- tFunc : table of functions +-- default : default function (optional) +-- Returns a function to be called be the callee +function techage.scheduler.get(pos, tFunc, default) + local mem = techage.get_mem(pos) + mem.sched_idx = ((mem.sched_idx or 0) + 1) % TABLE_SIZE + return tFunc[mem.sched_idx] or default or function() end +end diff --git a/basis/liquid_lib.lua b/basis/liquid_lib.lua index 25acfd3..34a7e37 100644 --- a/basis/liquid_lib.lua +++ b/basis/liquid_lib.lua @@ -190,7 +190,7 @@ local function fill_on_punch(nvm, empty_container, item_count, puncher) end local function legacy_items(full_container, item_count) - if full_container == "techage:hydrogen" then + if full_container == "techage:isobutane" then return {container = "", size = item_count, inv_item = full_container} elseif full_container == "techage:oil_source" then return {container = "", size = item_count, inv_item = full_container} diff --git a/basis/submenu.lua b/basis/submenu.lua index 5ee9fb2..4c248dc 100644 --- a/basis/submenu.lua +++ b/basis/submenu.lua @@ -221,7 +221,7 @@ end function techage.menu.generate_formspec(pos, ndef, form_def, player_name) local meta = minetest.get_meta(pos) - local number = techage.get_node_number(pos) + local number = techage.get_node_number(pos) or "-" local mem = techage.get_mem(pos) mem.star = ((mem.star or 0) + 1) % 2 local star = mem.star == 1 and "*" or "" diff --git a/doc/guide.lua b/doc/guide.lua index 61a8445..3f5e1a4 100644 --- a/doc/guide.lua +++ b/doc/guide.lua @@ -15,6 +15,8 @@ local function tooltip(item) return "", name elseif img == "10x10" then -- huge image for the plan? return "10x10", name + elseif img == "5x4" then -- huge image for the plan? + return "5x4", name end local ndef = minetest.registered_nodes[name] if ndef and ndef.description then @@ -40,12 +42,17 @@ local function plan(images) tbl[#tbl+1] = "label["..x_offs..","..y_offs..";"..S("Top view").."]" elseif img == "side_view" then tbl[#tbl+1] = "label["..x_offs..","..y_offs..";"..S("Side view").."]" + elseif img == "sectional_view" then + tbl[#tbl+1] = "label["..x_offs..","..y_offs..";"..S("Sectional view").."]" elseif img == "" then img = tooltip -- use tooltip for bigger image tbl[#tbl+1] = "image["..x_offs..","..y_offs..";2.2,2.2;"..img.."]" elseif img == "10x10" then img = tooltip -- use tooltip for bigger image tbl[#tbl+1] = "image["..x_offs..","..y_offs..";10,10;"..img.."]" + elseif img == "5x4" then + img = tooltip -- use tooltip for bigger image + tbl[#tbl+1] = "image["..x_offs..","..y_offs..";5,4;"..img.."]" elseif string.find(img, ":") then tbl[#tbl+1] = "item_image["..x_offs..","..y_offs..";1,1;"..img.."]" else diff --git a/doc/items.lua b/doc/items.lua index 0ee4745..abad424 100644 --- a/doc/items.lua +++ b/doc/items.lua @@ -204,13 +204,18 @@ techage.Items = { ta4_autocrafter = "techage:ta4_autocrafter_pas", ta4_recipeblock = "techage:ta4_recipeblock", ---------------------------- + techage_ta5 = "techage:ta5_fr_nucleus", ta5_flycontroller = "techage:ta5_flycontroller", ta5_aichip = "techage:ta5_aichip", ta5_tele_pipe = "techage:ta5_tele_pipe", ta5_tele_tube = "techage:ta5_tele_tube", ta5_chest = "techage:ta5_hl_chest", ta5_tank = "techage:ta5_hl_tank", - + ta5_magnet = "techage:ta5_magnet1", + ta5_pump = "techage:ta5_pump", + ta5_fr_shell = "techage:ta5_fr_shell", + ta5_fr_nucleus = "techage:ta5_fr_nucleus", + ta5_fr_controller = "techage:ta5_fr_controller_pas", } function techage.add_manual_items(table_with_items) diff --git a/doc/manual_DE.lua b/doc/manual_DE.lua index 9c8042a..0ea121b 100644 --- a/doc/manual_DE.lua +++ b/doc/manual_DE.lua @@ -230,7 +230,13 @@ techage.manual_DE.aTitel = { "3,TA4 Recycler", "1,TA5: Zukunft", "2,Energiequellen", - "3,TA5 Fusionsreaktor (geplant)", + "3,TA5 Fusionsreaktor", + "4,TA5 Fusionreaktor Magnet", + "4,TA5 Pumpe", + "4,TA5 Wärmetauscher", + "4,TA5 Fusionreaktor Controller", + "4,TA5 Fusionreaktor Hülle", + "4,TA5 Fusionreaktor Kern", "2,Energiespeicher", "3,TA5 Hybrid-Speicher (geplant)", "2,Logik Blöcke", @@ -1995,7 +2001,48 @@ techage.manual_DE.aText = { "\n".. "\n", "", - "", + "Kernfusion bedeutet das Verschmelzen zweier Atomkerne. Dabei können\\, je nach Reaktion\\, große Mengen von Energie freigesetzt werden. Kernfusionen\\, bei denen Energie frei wird\\, laufen in Form von Kettenreaktionen ab. Sie sind die Quelle der Energie der Sterne\\, zum Beispiel auch unserer Sonne. Ein Fusionsreaktor wandelt die Energie\\, die bei einer kontrollierten Kernfusion frei wird\\, in elektrischen Strom um.\n".. + "\n".. + "*Wie funktionieren ein Fusionsreaktor?*\n".. + "\n".. + "Ein Fusionsreaktor funktioniert nach dem klassischen Prinzip eines Wärmekraftwerks: Wasser wird erhitzt und treibt eine Dampfturbine an\\, deren Bewegungsenergie von einem Generator in Strom gewandelt wird.\n".. + "\n".. + "Ein Fusionskraftwerk benötigt zunächst eine hohe Menge an Energie\\, da ein Plasma erzeugt werden muss. „Plasma“ nennt man den vierten Zustand von Stoffen\\, nach fest\\, flüssig und gasförmig. Dafür wird viel Strom benötigt. Erst durch diese extreme Energiekonzentration zündet die Fusionsreaktion und mit der abgegebenen Wärme wird über den Wärmetauscher Strom erzeugt. Der Generator liefert dann 800 ku an Strom.\n".. + "\n".. + "Der Plan rechts zeigt einen Schnitt durch den Fusionsreaktor.\n".. + "\n".. + "Für den Betrieb des Fusionsreaktors werden 60 Erfahrungspunkte benötigt. Der Fusionsreaktur muss komplett in einem Forceload Block Bereich aufgebaut werden.\n".. + "\n".. + "\n".. + "\n", + "Für den Aufbau des Fusionsreaktor werden insgesamt 60 TA5 Fusionreaktor Magnete benötigt. Diese bilden den Ring\\, in dem sich das Plasma bildet. Der TA5 Fusionsreaktor Magnete benötigt Strom und hat zwei Anschlüsse für die Kühlung.\n".. + "\n".. + "Es gibt zwei Typen von Magneten\\, so dass auch alle Seiten des Magnets\\, die zum Plasmaring zeigen\\, mit einem Hitzeschild geschützt werden können.\n".. + "\n".. + "Bei den Eckmagneten auf der Innenseite des Rings ist jeweils eine Anschlussseite verdeckt (Strom oder Kühlung) und kann daher nicht angeschlossen werden. Dies ist technisch nicht machbar und hat daher keinen Einfluß auf die Funktion des Fusionsreaktor. \n".. + "\n".. + "\n".. + "\n", + "Die Pumpe wird benötigt\\, um den Kühlkreislauf mit Isobutan zu füllen. Es werden ca. 350 Einheiten Isobutan benötigt.\n".. + "\n".. + "\n".. + "\n", + "Der TA5 Wärmetauscher wird benötigt\\, um die im Fusionsreaktor erzeugte Hitze zuerst in Dampf und dann in Strom umzuwandeln. Der Wärmetauscher selbst benötigt dazu 5 ku Strom. Der Aufbau gleicht dem Wärmetauscher des Energiespeichers aus TA4.\n".. + "\n".. + "\n".. + "\n", + "Über den TA5 Fusionreaktor Controller wird der Fusionreaktors eingeschaltet. Dabei muss zuerst die Kühlung/Wärmetauscher und dann der Controller eingeschaltet werden. Es dauert ca. 2 min\\, bis der Reaktor in Gang kommt und Strom liefert. Der Fusionreaktor und damit der Controller benötigt 400 ku an Strom\\, um das Plasma aufrecht zu erhalten.\n".. + "\n".. + "\n".. + "\n", + "Der komplette Reaktor muss mit einer Hülle umgeben werden\\, die den enormen Druck\\, den die Magnete auf das Plasma ausüben\\, abfängt und die Umgebung vor Strahlung schützt. Ohne diese Hülle kann der Reaktor nicht gestartet werden. Mit der TechAge Kelle können auch Stromkabel und Kühlleitungen des Fusionreaktors in die Hülle integriert werden.\n".. + "\n".. + "\n".. + "\n", + "Der Kern muss in der Mitte des Reaktors sitzen. Siehe Abbildung unter \"TA5 Fusionsreaktor\". Auch hierfür wird die TechAge Kelle benötigt.\n".. + "\n".. + "\n".. + "\n", "", "", "", @@ -2300,6 +2347,12 @@ techage.manual_DE.aItemName = { "techage_ta5", "", "", + "ta5_magnet", + "ta5_pump", + "", + "ta5_fr_controller", + "ta5_fr_shell", + "ta5_fr_nucleus", "", "", "", @@ -2547,6 +2600,12 @@ techage.manual_DE.aPlanTable = { "", "", "", + "ta5_fusion_reactor", + "", + "", + "ta5_heatexchanger", + "", + "", "", "", "", diff --git a/doc/manual_EN.lua b/doc/manual_EN.lua index 27faf5e..0abb1d6 100644 --- a/doc/manual_EN.lua +++ b/doc/manual_EN.lua @@ -230,7 +230,13 @@ techage.manual_EN.aTitel = { "3,TA4 Recycler", "1,TA5: Future", "2,Energy Sources", - "3,TA5 Fusion Reactor (planned)", + "3,TA5 Fusion Reactor", + "4,TA5 Fusion Reactor Magnet", + "4,TA5 Pump", + "4,TA5 Heat Exchanger", + "4,TA5 Fusion Reactor Controller", + "4,TA5 Fusion Reactor Shell", + "4,TA5 Fusion Reactor Core", "2,Energy Storage", "3,TA5 Hybrid Storage (planned)", "2,Logic blocks", @@ -1992,7 +1998,48 @@ techage.manual_EN.aText = { "\n".. "\n", "", - "", + "Nuclear fusion means the fusing of two atomic nuclei. Depending on the reaction\\, large amounts of energy can be released. Nuclear fusions\\, in which energy is released\\, take place in the form of chain reactions. They are the source of the energy of the stars\\, including our sun\\, for example. A fusion reactor converts the energy released during controlled nuclear fusion into electricity.\n".. + "\n".. + "*How ​​do fusion reactors work?*\n".. + "\n".. + "A fusion reactor works according to the classic principle of a thermal power plant: water is heated and drives a steam turbine\\, whose kinetic energy is converted into electricity by a generator.\n".. + "\n".. + "A fusion power plant initially requires a large amount of energy\\, since a plasma has to be generated. \"Plasma\" is the name given to the fourth state of matter\\, after solid\\, liquid and gaseous. This requires a lot of electricity. Only through this extreme concentration of energy does the fusion reaction ignite and the heat given off is used to generate electricity via the heat exchanger. The generator then delivers 800 ku of electricity.\n".. + "\n".. + "The plan on the right shows a section through the fusion reactor.\n".. + "\n".. + "60 experience points are required to operate the fusion reactor. The fusion reactor must be built entirely in a forceload block area.\n".. + "\n".. + "\n".. + "\n", + "A total of 60 TA5 Fusion Reactor Magnets are required to set up the fusion reactor. These form the ring in which the plasma forms. The TA5 Fusion Reactor Magnets requires power and has two ports for cooling.\n".. + "\n".. + "There are two types of magnets\\, so all sides of the magnet that face the plasma ring can also be protected with a heat shield.\n".. + "\n".. + "With the corner magnets on the inside of the ring\\, one connection side is covered (power or cooling) and can therefore not be connected. This is technically not feasible and therefore has no influence on the function of the fusion reactor. \n".. + "\n".. + "\n".. + "\n", + "The pump is required to fill the cooling circuit with isobutane. About 350 units of isobutane are required.\n".. + "\n".. + "\n".. + "\n", + "The TA5 Heat Exchanger is required to convert the heat generated in the fusion reactor first to steam and then to electricity. The Heat Exchanger itself requires 5 ku electricity. The structure is similar to the Heat Exchanger of the energy store from TA4.\n".. + "\n".. + "\n".. + "\n", + "The fusion reactor is switched on via the TA5 Fusion Reactor Controller. The cooling/Heat Exchanger must be switched on first and then the controller. It takes about 2 minutes for the reactor to start up and supply electricity. The fusion reactor and thus the controller requires 400 ku of electricity to maintain the plasma.\n".. + "\n".. + "\n".. + "\n", + "The entire reactor must be surrounded by a shell that absorbs the enormous pressure that the magnets exert on the plasma and protects the environment from radiation. Without this shell\\, the reactor cannot be started. With the TechAge Trowel\\, power cables and cooling pipes of the fusion reactor can also be integrated into the shell.\n".. + "\n".. + "\n".. + "\n", + "The core must sit in the center of the reactor. See illustration under \"TA5 Fusion Reactor\". The TechAge Trowel is also required for this.\n".. + "\n".. + "\n".. + "\n", "", "", "", @@ -2295,6 +2342,12 @@ techage.manual_EN.aItemName = { "techage_ta5", "", "", + "ta5_magnet", + "ta5_pump", + "", + "ta5_fr_controller", + "ta5_fr_shell", + "ta5_fr_nucleus", "", "", "", @@ -2541,6 +2594,12 @@ techage.manual_EN.aPlanTable = { "", "", "", + "ta5_fusion_reactor", + "", + "", + "ta5_heatexchanger", + "", + "", "", "", "", diff --git a/doc/plans.lua b/doc/plans.lua index 6934d54..3cf0476 100644 --- a/doc/plans.lua +++ b/doc/plans.lua @@ -25,9 +25,11 @@ local IMG42 = {"", "techage_ta4_solar.png"} local IMG43 = {"", "techage_reactor_inv.png"} local IMG44 = {"", "techage_ta4_filter.png"} local IMG45 = {"10x10", "techage_collider_plan.png"} +local IMG46 = {"5x4", "techage_fusion_reactor.png"} local TOP_V = {"top_view", ""} local SIDEV = {"side_view", ""} +local SECTV = {"sectional_view", ""} -- -- TA1: Coal Pile @@ -513,6 +515,52 @@ techage.ConstructionPlans["ta5_teleport"] = { {false, TANK4, PIPEH, TELEP, false, ARROW, false, TELEP, PUMP4, TANK4, false}, } +-- +-- TA5 Fusion Reactor +-- +local SHELL = {"techage_reactor_shell.png", "techage:ta5_fr_shell"} +local NUCLS = {"techage_reactor_shell.png^techage_collider_detector_core.png", "techage:ta5_fr_nucleus"} +local MAGN1 = {"techage_collider_magnet.png^techage_steel_tiles_top3.png", "techage:ta5_magnet1"} +local MAGN2 = {"techage_collider_magnet.png^techage_steel_tiles_top3.png^[transformR90]", "techage:ta5_magnet1"} +local MAGN3 = {"techage_collider_magnet.png^techage_steel_tiles_top3.png^[transformR180]", "techage:ta5_magnet1"} +local MAGN4 = {"techage_collider_magnet.png^techage_steel_tiles_top3.png^[transformR270]", "techage:ta5_magnet1"} + +techage.ConstructionPlans["ta5_fusion_reactor"] = { + {false, false, false, false, false, false, IMG46, false, false, false, false}, + {false, false, false, false, false, false, false, false, false, false, false}, + {false, false, false, false, false, false, false, false, false, false, false}, + {false, false, false, false, false, false, false, false, false, false, false}, + {false, SECTV, false, false, false, false, false, false, false, false, false}, + {false, false, SHELL, SHELL, SHELL, false, SHELL, SHELL, SHELL, false, false}, + {false, SHELL, SHELL, MAGN3, SHELL, SHELL, SHELL, MAGN3, SHELL, SHELL, false}, + {false, SHELL, MAGN4, false, MAGN2, NUCLS, MAGN4, false, MAGN2, SHELL, false}, + {false, SHELL, SHELL, MAGN1, SHELL, SHELL, SHELL, MAGN1, SHELL, SHELL, false}, + {false, false, SHELL, SHELL, SHELL, false, SHELL, SHELL, SHELL, false, false}, +} + +-- +-- TA5 Heat Exchanger +-- +local PIPEG = {"techage_ta5_gaspipe.png", "techage:ta5_pipe1S"} +local PIPEB = {"techage_ta5_gaspipeB.png", "techage:ta5_pipe2S"} +local HEX51 = {"techage_filling_ta4.png^techage_frameT_ta5.png^techage_appl_ribsT.png", "techage:ta5_heatexchanger3"} +local HEX52 = {"techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsB.png", "techage:ta5_heatexchanger2"} +local HEX53 = {"techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png", "techage:ta5_heatexchanger1"} +local TURB5 = {"techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta5.png", "techage:ta5_turbine"} +local GENE5 = {"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_generator.png^[transformFX]", "techage:ta5_generator"} + +techage.ConstructionPlans["ta5_heatexchanger"] = { + {false, false, false, false, SIDEV, false, false, false}, + {false, false, false, false, false, false, false, false}, + {false, false, false, false, false, false, false, false}, + {false, false, PIPEG, PIPEG, HEX51, PIPEH, PN270, false}, + {false, false, false, false, HEX52, false, PIPEV, false}, + {false, false, PIPEB, PIPEB, HEX53, PIPEH, TURB5, GENE5}, + {false, false, false, false, false, false, false, false}, + {false, false, false, false, false, false, false, false}, +} + + function techage.add_manual_plans(table_with_plans) for name, tbl in pairs(table_with_plans) do techage.ConstructionPlans[name] = tbl diff --git a/fusion_reactor/controller.lua b/fusion_reactor/controller.lua new file mode 100644 index 0000000..31f0401 --- /dev/null +++ b/fusion_reactor/controller.lua @@ -0,0 +1,281 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Fusion Reactor Controller + +]]-- + +-- for lazy programmers +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S + +local Cable = techage.ElectricCable +local sched = techage.scheduler +local power = networks.power +local control = networks.control + +local CYCLE_TIME = 2 +local STANDBY_TICKS = 0 +local COUNTDOWN_TICKS = 1 +local PWR_NEEDED = 400 +local EXPECTED_PLASMA_NUM = 56 +local EXPECTED_SHELL_NUM = 56 +local EXPECTED_MAGNET_NUM = 56 +local CALL_RATE1 = 16 -- 2s * 16 = 32s +local CALL_RATE2 = 8 -- 2s * 8 = 16s +local DESCRIPTION = S("TA5 Fusion Reactor Controller") +local EX_POINTS = 60 + +local function count_trues(t) + local cnt = 0 + for _,v in ipairs(t) do + if v then + cnt = cnt + 1 + end + end + return cnt +end + +local function nucleus(t) + if #t == 4 then + if vector.equals(t[1], t[2]) and vector.equals(t[3], t[4]) then + return true + end + end + return S("Nucleus detection error") +end + +local tSched = {} + +sched.register(tSched, CALL_RATE1, 0, function(pos, outdir) + local resp = control.request(pos, Cable, outdir, "con", "connect") + local cnt = count_trues(resp) + if cnt ~= EXPECTED_MAGNET_NUM then + return S("Magnet detection error\n(@1% found / 100% expected)", math.floor(cnt* 100 / EXPECTED_MAGNET_NUM)) + end + return true + end) + +sched.register(tSched, CALL_RATE1, 1, function(pos, outdir) + local resp = control.request(pos, Cable, outdir, "con", "test_plasma") + local cnt = count_trues(resp) + if cnt ~= EXPECTED_PLASMA_NUM then + return S("Tokamak shape error") + end + return true + end) + +sched.register(tSched, CALL_RATE1, 2, function(pos, outdir) + local resp = control.request(pos, Cable, outdir, "con", "test_shell") + local cnt = count_trues(resp) + if cnt ~= EXPECTED_SHELL_NUM then + return S("Shell shape error\n(@1% found / 100% expected)", math.floor(cnt* 100 / EXPECTED_SHELL_NUM)) + end + return true + end) + +sched.register(tSched, CALL_RATE1, 3, function(pos, outdir) + local resp = control.request(pos, Cable, outdir, "con", "test_nucleus") + return nucleus(resp) + end) + +sched.register(tSched, CALL_RATE2, 4, function(pos, outdir) + local resp = control.request(pos, Cable, outdir, "con", "inc_power") + local cnt = count_trues(resp) + --print("inc_power", cnt) + if cnt < 52 then + return S("Cooling failed") + end + return true + end) + +-- function(pos, outdir) +-- local resp = control.request(pos, Cable, outdir, "con", "no_gas") +-- return "no_gas: " .. concentrate(resp) +-- end, + +local function can_start(pos, nvm) + local outdir = networks.side_to_outdir(pos, "L") + if not power.power_available(pos, Cable, outdir) then + return S("No power") + end + outdir = networks.side_to_outdir(pos, "R") + control.request(pos, Cable, outdir, "con", "rst_power") + for i = 0,4 do + local res = tSched[i](pos, outdir) + if res ~= true then return res end + end + return true +end + +local function start_node(pos, nvm) + sched.init(pos) + local outdir = networks.side_to_outdir(pos, "R") + control.send(pos, Cable, outdir, "con", "on") + sched.init(pos) +end + +local function stop_node(pos, nvm) + local outdir = networks.side_to_outdir(pos, "R") + control.send(pos, Cable, outdir, "con", "off") +end + +local function formspec(self, pos, nvm) + return "size[5,3]".. + "box[0,-0.1;4.8,0.5;#c6e8ff]" .. + "label[0.2,-0.1;" .. minetest.colorize( "#000000", DESCRIPTION) .. "]" .. + "image_button[2,1.5;1,1;".. self:get_state_button_image(nvm) ..";state_button;]".. + "tooltip[2,1.5;1,1;"..self:get_state_tooltip(nvm).."]" +end + +local State = techage.NodeStates:new({ + node_name_passive = "techage:ta5_fr_controller_pas", + node_name_active = "techage:ta5_fr_controller_act", + cycle_time = CYCLE_TIME, + infotext_name = DESCRIPTION, + standby_ticks = STANDBY_TICKS, + can_start = can_start, + start_node = start_node, + stop_node = stop_node, + formspec_func = formspec, +}) + +local function after_place_node(pos, placer, itemstack) + local nvm = techage.get_nvm(pos) + local meta = M(pos) + local own_num = techage.add_node(pos, "techage:ta5_fr_controller_pas") + State:node_init(pos, nvm, own_num) + meta:set_string("owner", placer:get_player_name()) + Cable:after_place_node(pos) +end + +local function consume_power(pos, nvm, outdir) + if techage.needs_power(nvm) then + local taken = power.consume_power(pos, Cable, outdir, PWR_NEEDED) + if techage.is_running(nvm) then + if taken < PWR_NEEDED then + State:nopower(pos, nvm, "No power") + stop_node(pos, nvm) + else + return true -- keep running + end + end + end +end + +local function node_timer(pos) + local nvm = techage.get_nvm(pos) + local outdir = networks.side_to_outdir(pos, "L") + if consume_power(pos, nvm, outdir) then + local resp = sched.get(pos, tSched, function() + return true end)(pos, networks.Flip[outdir]) + if resp ~= true then + State:fault(pos, nvm, resp) + stop_node(pos, nvm) + else + State:keep_running(pos, nvm, COUNTDOWN_TICKS) + end + end + return State:is_active(nvm) +end + +local function after_dig_node(pos, oldnode, oldmetadata) + Cable:after_dig_node(pos) + techage.remove_node(pos, oldnode, oldmetadata) + techage.del_mem(pos) +end + +local function on_receive_fields(pos, formname, fields, player) + if minetest.is_protected(pos, player:get_player_name()) then + return + end + + if techage.get_expoints(player) >= EX_POINTS then + local nvm = techage.get_nvm(pos) + State:state_button_event(pos, nvm, fields) + --M(pos):set_string("formspec", formspec(State, pos, nvm)) + end +end + +minetest.register_node("techage:ta5_fr_controller_pas", { + description = S("TA5 Fusion Reactor Controller"), + tiles = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_arrow.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", + "techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_hole_electric.png", + "techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_hole_electric.png", + "techage_filling_ta4.png^techage_appl_plasma.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_appl_plasma.png^techage_frame_ta5.png", + }, + after_place_node = after_place_node, + on_timer = node_timer, + after_dig_node = after_dig_node, + on_receive_fields = on_receive_fields, + drawtype = "nodebox", + paramtype2 = "facedir", + groups = {choppy=2, cracky=2, crumbly=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta5_fr_controller_act", { + description = S("TA5 Fusion Reactor Controller"), + tiles = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_arrow.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", + "techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_hole_electric.png", + "techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_hole_electric.png", + { + image = "techage_filling4_ta4.png^techage_appl_plasma4.png^techage_frame4_ta5.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 64, + aspect_h = 64, + length = 0.5, + }, + }, + { + image = "techage_filling4_ta4.png^techage_appl_plasma4.png^techage_frame4_ta5.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 64, + aspect_h = 64, + length = 0.5, + }, + }, + }, + after_place_node = after_place_node, + on_timer = node_timer, + after_dig_node = after_dig_node, + on_receive_fields = on_receive_fields, + drawtype = "nodebox", + paramtype2 = "facedir", + groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1}, + drop = "", + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +power.register_nodes({"techage:ta5_fr_controller_pas", "techage:ta5_fr_controller_act"}, Cable, "con", {"L", "R"}) + +minetest.register_craft({ + output = "techage:ta5_fr_controller_pas", + recipe = { + {'techage:aluminum', 'basic_materials:gold_wire', 'default:steel_ingot'}, + {'techage:electric_cableS', 'techage:ta5_aichip2', 'techage:electric_cableS'}, + {'default:steel_ingot', 'default:diamond', 'techage:aluminum'}, + }, +}) diff --git a/fusion_reactor/gas_pipe.lua b/fusion_reactor/gas_pipe.lua new file mode 100644 index 0000000..108164d --- /dev/null +++ b/fusion_reactor/gas_pipe.lua @@ -0,0 +1,331 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Gas Pipes + +]]-- + +-- for lazy programmers +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S + +local MAX_PIPE_LENGHT = 100 + +local liquid = networks.liquid + +local Pipe = tubelib2.Tube:new({ + dirs_to_check = {1,2,3,4,5,6}, + max_tube_length = MAX_PIPE_LENGHT, + show_infotext = false, + force_to_use_tubes = false, + tube_type = "pipe3", + primary_node_names = { + "techage:ta5_pipe1S", "techage:ta5_pipe1A", + "techage:ta5_pipe2S", "techage:ta5_pipe2A", + }, + secondary_node_names = {}, + after_place_tube = function(pos, param2, tube_type, num_tubes) + local name = minetest.get_node(pos).name + if not networks.hidden_name(pos) then + local name = minetest.get_node(pos).name + if name == "techage:ta5_pipe1S" or name == "techage:ta5_pipe1A" then + minetest.swap_node(pos, {name = "techage:ta5_pipe1"..tube_type, param2 = param2 % 32}) + else + minetest.swap_node(pos, {name = "techage:ta5_pipe2"..tube_type, param2 = param2 % 32}) + end + end + M(pos):set_int("netw_param2", param2) + end, +}) + +-- Enable hidden cables +networks.use_metadata(Pipe) + +-- Use global callback instead of node related functions +Pipe:register_on_tube_update2(function(pos, outdir, tlib2, node) + liquid.update_network(pos, outdir, tlib2, node) +end) + +minetest.register_node("techage:ta5_pipe1S", { + description = S("TA5 Pipe"), + tiles = { + "techage_ta5_gaspipe.png^[transformR90^[colorize:#000080:160", + "techage_ta5_gaspipe.png^[transformR90^[colorize:#000080:160", + "techage_ta5_gaspipe.png^[colorize:#000080:160", + "techage_ta5_gaspipe.png^[colorize:#000080:160", + "techage_ta5_gaspipe_hole2.png^[colorize:#000080:160", + "techage_ta5_gaspipe_hole2.png^[colorize:#000080:160", + }, + + after_place_node = function(pos, placer, itemstack, pointed_thing) + if not Pipe:after_place_tube(pos, placer, pointed_thing) then + minetest.remove_node(pos) + return true + end + return false + end, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_tube(pos, oldnode, oldmetadata) + end, + + paramtype2 = "facedir", -- important! + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-1/16, -1/16, -8/16, 1/16, 1/16, 8/16}, + }, + }, + on_rotate = screwdriver.disallow, -- important! + paramtype = "light", + use_texture_alpha = techage.CLIP, + sunlight_propagates = true, + is_ground_content = false, + groups = {crumbly = 2, cracky = 2, snappy = 2, techage_trowel = 1}, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta5_pipe1A", { + description = S("TA5 Pipe"), + tiles = { + "techage_ta5_gaspipe_knee2.png^[colorize:#000080:160", + "techage_ta5_gaspipe_hole2.png^[transformR180^[colorize:#000080:160", + "techage_ta5_gaspipe_knee.png^[transformR270^[colorize:#000080:160", + "techage_ta5_gaspipe_knee.png^[colorize:#000080:160", + "techage_ta5_gaspipe_knee2.png^[colorize:#000080:160", + "techage_ta5_gaspipe_hole2.png^[colorize:#000080:160", + }, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_tube(pos, oldnode, oldmetadata) + end, + + paramtype2 = "facedir", -- important! + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-1/16, -8/16, -1/16, 1/16, 1/16, 1/16}, + {-2/16, -0.5, -2/16, 2/16, -13/32, 2/16}, + {-1/16, -1/16, -8/16, 1/16, 1/16, -1/16}, + {-2/16, -2/16, -0.5, 2/16, 2/16, -13/32}, + }, + }, + on_rotate = screwdriver.disallow, -- important! + paramtype = "light", + use_texture_alpha = techage.CLIP, + sunlight_propagates = true, + is_ground_content = false, + groups = {crumbly = 2, cracky = 2, snappy = 2, + not_in_creative_inventory=1, techage_trowel = 1}, + sounds = default.node_sound_metal_defaults(), + drop = "techage:ta5_pipe1S", +}) + +minetest.register_node("techage:ta5_pipe2S", { + description = S("TA5 Pipe"), + tiles = { + "techage_ta5_gaspipe.png^[transformR90^[colorize:#008000:160", + "techage_ta5_gaspipe.png^[transformR90^[colorize:#008000:160", + "techage_ta5_gaspipe.png^[colorize:#008000:160", + "techage_ta5_gaspipe.png^[colorize:#008000:160", + "techage_ta5_gaspipe_hole2.png^[colorize:#008000:160", + "techage_ta5_gaspipe_hole2.png^[colorize:#008000:160", + }, + + after_place_node = function(pos, placer, itemstack, pointed_thing) + if not Pipe:after_place_tube(pos, placer, pointed_thing) then + minetest.remove_node(pos) + return true + end + return false + end, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_tube(pos, oldnode, oldmetadata) + end, + + paramtype2 = "facedir", -- important! + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-1/16, -1/16, -8/16, 1/16, 1/16, 8/16}, + }, + }, + on_rotate = screwdriver.disallow, -- important! + paramtype = "light", + use_texture_alpha = techage.CLIP, + sunlight_propagates = true, + is_ground_content = false, + groups = {crumbly = 2, cracky = 2, snappy = 2, techage_trowel = 1}, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta5_pipe2A", { + description = S("TA5 Pipe"), + tiles = { + "techage_ta5_gaspipe_knee2.png^[colorize:#008000:160", + "techage_ta5_gaspipe_hole2.png^[transformR180^[colorize:#008000:160", + "techage_ta5_gaspipe_knee.png^[transformR270^[colorize:#008000:160", + "techage_ta5_gaspipe_knee.png^[colorize:#008000:160", + "techage_ta5_gaspipe_knee2.png^[colorize:#008000:160", + "techage_ta5_gaspipe_hole2.png^[colorize:#008000:160", + }, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_tube(pos, oldnode, oldmetadata) + end, + + paramtype2 = "facedir", -- important! + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-1/16, -8/16, -1/16, 1/16, 1/16, 1/16}, + {-2/16, -0.5, -2/16, 2/16, -13/32, 2/16}, + {-1/16, -1/16, -8/16, 1/16, 1/16, -1/16}, + {-2/16, -2/16, -0.5, 2/16, 2/16, -13/32}, + }, + }, + on_rotate = screwdriver.disallow, -- important! + paramtype = "light", + use_texture_alpha = techage.CLIP, + sunlight_propagates = true, + is_ground_content = false, + groups = {crumbly = 2, cracky = 2, snappy = 2, + not_in_creative_inventory=1, techage_trowel = 1}, + sounds = default.node_sound_metal_defaults(), + drop = "techage:ta5_pipe2S", +}) + +local size1 = 1/16 +local size2 = 2/16 +local size3 = 13/32 +local Boxes = { + { + {-size1, -size1, size1, size1, size1, 0.5 }, -- z+ + {-size2, -size2, size3, size2, size2, 0.5 }, -- z+ + }, + { + {-size1, -size1, -size1, 0.5, size1, size1}, -- x+ + { size3, -size2, -size2, 0.5, size2, size2}, -- x+ + }, + { + {-size1, -size1, -0.5, size1, size1, size1}, -- z- + {-size2, -size2, -0.5, size2, size2, -size3}, -- z- + }, + { + {-0.5, -size1, -size1, size1, size1, size1}, -- x- + {-0.5, -size2, -size2, -size3, size2, size2}, -- x- + }, + { + {-size1, -0.5, -size1, size1, size1, size1}, -- y- + {-size2, -0.5, -size2, size2, -size3, size2}, -- y- + }, + { + {-size1, -size1, -size1, size1, 0.5, size1}, -- y+ + {-size2, size3, -size2, size2, 0.5, size2}, -- y+ + } +} + +local names1 = networks.register_junction("techage:ta5_junctionpipe1", 1/8, Boxes, Pipe, { + description = S("TA5 Junction Pipe"), + tiles = {"techage_ta5_gaspipe_junction.png^[colorize:#000080:160"}, + use_texture_alpha = techage.CLIP, + is_ground_content = false, + groups = {crumbly = 2, cracky = 2, snappy = 2, techage_trowel = 1}, + sounds = default.node_sound_metal_defaults(), + + after_place_node = function(pos, placer, itemstack, pointed_thing) + local name = "techage:ta5_junctionpipe1" .. networks.junction_type(pos, Pipe) + minetest.swap_node(pos, {name = name, param2 = 0}) + Pipe:after_place_node(pos) + end, + tubelib2_on_update2 = function(pos, dir1, tlib2, node) + if not networks.hidden_name(pos) then + local name = "techage:ta5_junctionpipe1" .. networks.junction_type(pos, Pipe) + minetest.swap_node(pos, {name = name, param2 = 0}) + end + liquid.update_network(pos, 0, tlib2, node) + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_node(pos) + end, +}, 25) + +local names2 = networks.register_junction("techage:ta5_junctionpipe2", 1/8, Boxes, Pipe, { + description = S("TA5 Junction Pipe"), + tiles = {"techage_ta5_gaspipe_junction.png^[colorize:#008000:160"}, + use_texture_alpha = techage.CLIP, + is_ground_content = false, + groups = {crumbly = 2, cracky = 2, snappy = 2, techage_trowel = 1}, + sounds = default.node_sound_metal_defaults(), + + after_place_node = function(pos, placer, itemstack, pointed_thing) + local name = "techage:ta5_junctionpipe2" .. networks.junction_type(pos, Pipe) + minetest.swap_node(pos, {name = name, param2 = 0}) + Pipe:after_place_node(pos) + end, + tubelib2_on_update2 = function(pos, dir1, tlib2, node) + if not networks.hidden_name(pos) then + local name = "techage:ta5_junctionpipe2" .. networks.junction_type(pos, Pipe) + minetest.swap_node(pos, {name = name, param2 = 0}) + end + liquid.update_network(pos, 0, tlib2, node) + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_node(pos) + end, +}, 25) + +liquid.register_nodes(names1, Pipe, "junc") +liquid.register_nodes(names2, Pipe, "junc") + +minetest.register_craft({ + output = "techage:ta5_pipe1S 6", + recipe = { + {'', '', "default:steel_ingot"}, + {'', 'dye:blue', 'techage:ta4_carbon_fiber'}, + {"", '', 'techage:aluminum'}, + }, +}) + +minetest.register_craft({ + output = "techage:ta5_pipe2S 6", + recipe = { + {'', '', "default:steel_ingot"}, + {'', 'dye:green', 'techage:ta4_carbon_fiber'}, + {"", '', 'techage:aluminum'}, + }, +}) + +minetest.register_craft({ + output = "techage:ta5_junctionpipe125 2", + recipe = { + {"", "techage:ta5_pipe1S", ""}, + {"techage:ta5_pipe1S", "", "techage:ta5_pipe1S"}, + {"", "techage:ta5_pipe1S", ""}, + }, +}) + +minetest.register_craft({ + output = "techage:ta5_junctionpipe225 2", + recipe = { + {"", "techage:ta5_pipe2S", ""}, + {"techage:ta5_pipe2S", "", "techage:ta5_pipe2S"}, + {"", "techage:ta5_pipe2S", ""}, + }, +}) + +techage.GasPipe = Pipe diff --git a/fusion_reactor/generator.lua b/fusion_reactor/generator.lua new file mode 100644 index 0000000..cd78b5c --- /dev/null +++ b/fusion_reactor/generator.lua @@ -0,0 +1,204 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Fusion Reactor Generator +]]-- + +-- for lazy programmers +local M = minetest.get_meta +local S = techage.S + +local Cable = techage.ElectricCable +local power = networks.power +local control = networks.control + +local CYCLE_TIME = 2 +local PWR_PERF = 800 + +local function swap_node(pos, name) + local node = techage.get_node_lvm(pos) + if node.name == name then + return + end + node.name = name + minetest.swap_node(pos, node) +end + +local function start_node(pos, nvm) + local meta = M(pos) + nvm.provided = 0 + nvm.alive_cnt = 5 + techage.evaluate_charge_termination(nvm, meta) + local outdir = meta:get_int("outdir") + power.start_storage_calc(pos, Cable, outdir) + swap_node(pos, "techage:ta5_generator_on") + minetest.get_node_timer(pos):start(CYCLE_TIME) +end + +local function stop_node(pos, nvm) + nvm.provided = 0 + nvm.alive_cnt = 0 + local outdir = M(pos):get_int("outdir") + power.start_storage_calc(pos, Cable, outdir) + swap_node(pos, "techage:ta5_generator") +end + +local function get_generator_data(pos, outdir, tlib2) + local nvm = techage.get_nvm(pos) + if (nvm.alive_cnt or 0) > 0 then + return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2} + end +end + +local function node_timer(pos, elapsed) + local nvm = techage.get_nvm(pos) + nvm.alive_cnt = (nvm.alive_cnt or 0) - 1 + if nvm.alive_cnt > 0 then + local meta = M(pos) + local outdir = meta:get_int("outdir") + local tp1 = tonumber(meta:get_string("termpoint1")) + local tp2 = tonumber(meta:get_string("termpoint2")) + nvm.provided = power.provide_power(pos, Cable, outdir, PWR_PERF, tp1, tp2) + local val = power.get_storage_load(pos, Cable, outdir, PWR_PERF) + if val > 0 then + nvm.load = val + end + return true + else + swap_node(pos, "techage:ta5_generator") + stop_node(pos, nvm) + return false + end +end + +minetest.register_node("techage:ta5_generator", { + description = S("TA5 Generator"), + tiles = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta5_top.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", + "techage_filling_ta4.png^techage_appl_hole_electric.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_generator.png", + "techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_generator.png^[transformFX]", + }, + + after_place_node = function(pos, placer) + M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) + Cable:after_place_node(pos) + end, + after_dig_node = function(pos, oldnode) + Cable:after_dig_node(pos) + techage.del_mem(pos) + end, + + get_generator_data = get_generator_data, + ta4_formspec = techage.generator_settings("ta4", PWR_PERF), + paramtype2 = "facedir", + groups = {cracky=2, crumbly=2, choppy=2}, + on_rotate = screwdriver.disallow, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("techage:ta5_generator_on", { + description = S("TA5 Generator"), + tiles = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta5_top.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", + "techage_filling_ta4.png^techage_appl_hole_electric.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta5.png", + { + image = "techage_filling4_ta4.png^techage_appl_generator4.png^techage_frame4_ta5.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 0.3, + }, + }, + { + image = "techage_filling4_ta4.png^techage_appl_generator4.png^[transformFX]^techage_frame4_ta5.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 0.3, + }, + }, + }, + + get_generator_data = get_generator_data, + ta4_formspec = techage.generator_settings("ta4", PWR_PERF), + on_timer = node_timer, + paramtype2 = "facedir", + drop = "", + groups = {not_in_creative_inventory=1}, + diggable = false, + on_rotate = screwdriver.disallow, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), +}) + +power.register_nodes({"techage:ta5_generator", "techage:ta5_generator_on"}, Cable, "gen", {"R"}) + +-- controlled by the turbine +techage.register_node({"techage:ta5_generator", "techage:ta5_generator_on"}, { + on_transfer = function(pos, in_dir, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == "trigger" then + nvm.alive_cnt = 5 + elseif topic == "start" then + start_node(pos, nvm) + elseif topic == "stop" then + stop_node(pos, nvm) + end + end, + on_recv_message = function(pos, src, topic, payload) + return "unsupported" + end, + on_node_load = function(pos) + -- remove legacy formspec + M(pos):set_string("formspec", "") + end, +}) + +control.register_nodes({"techage:ta5_generator", "techage:ta5_generator_on"}, { + on_receive = function(pos, tlib2, topic, payload) + end, + on_request = function(pos, tlib2, topic) + if topic == "info" then + local nvm = techage.get_nvm(pos) + local meta = M(pos) + return { + type = S("TA5 Generator"), + number = "-", + running = (nvm.alive_cnt or 0) > 0, + available = PWR_PERF, + provided = nvm.provided or 0, + termpoint = meta:get_string("termpoint"), + } + end + return false + end, + } +) + +minetest.register_craft({ + output = "techage:ta5_generator", + recipe = { + {"", "dye:red", ""}, + {"", "techage:ta4_generator", ""}, + {"", "techage:baborium_ingot", ""}, + }, +}) diff --git a/fusion_reactor/heatexchanger1.lua b/fusion_reactor/heatexchanger1.lua new file mode 100644 index 0000000..0a2cb8a --- /dev/null +++ b/fusion_reactor/heatexchanger1.lua @@ -0,0 +1,109 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Heat Exchanger1 (bottom part) + - has a connection to storage and turbine (via pipes) + - acts as a cable junction for Exchanger2 +]]-- + +-- for lazy programmers +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S + +local Cable = techage.ElectricCable +local Pipe2 = techage.LiquidPipe +local Pipe3 = techage.GasPipe +local power = networks.power +local liquid = networks.liquid +local control = networks.control + +local function turbine_cmnd(pos, topic, payload) + return techage.transfer(pos, "R", topic, payload, Pipe2, + {"techage:ta5_turbine", "techage:ta5_turbine_on"}) +end + +-- Send to the magnets +local function control_cmnd(pos, topic) + local outdir = networks.side_to_outdir(pos, "L") + return control.request(pos, Pipe3, outdir, "tank", topic) +end + +minetest.register_node("techage:ta5_heatexchanger1", { + description = S("TA5 Heat Exchanger 1"), + tiles = { + -- up, down, right, left, back, front + "techage_hole_ta4.png^techage_appl_arrow_white.png", + "techage_filling_ta4.png^techage_frame_ta4.png", + "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_pipe.png", + "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_ta5_pipe2.png", + "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png", + "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png", + }, + + after_place_node = function(pos, placer, itemstack, pointed_thing) + Cable:after_place_node(pos) + Pipe2:after_place_node(pos) + Pipe3:after_place_node(pos) + end, + tubelib2_on_update2 = function(pos, outdir, tlib2, node) + if tlib2 == Cable then + power.update_network(pos, 0, Cable, node) -- junction!!! + elseif tlib2 == Pipe2 then + power.update_network(pos, outdir, Pipe2, node) + else + power.update_network(pos, outdir, Pipe3, node) + end + end, + can_dig = function(pos, player) + if minetest.is_protected(pos, player:get_player_name()) then + return false + end + pos.y = pos.y + 1 + return minetest.get_node(pos).name ~= "techage:ta5_heatexchanger2" + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + Cable:after_dig_node(pos) + Pipe2:after_dig_node(pos) + Pipe3:after_dig_node(pos) + end, + paramtype2 = "facedir", + groups = {crumbly = 2, cracky = 2, snappy = 2}, + on_rotate = screwdriver.disallow, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +liquid.register_nodes({"techage:ta5_heatexchanger1"}, Pipe2, "tank", {"R"}, {}) +liquid.register_nodes({"techage:ta5_heatexchanger1"}, Pipe3, "tank", {"L"}, {}) +power.register_nodes({"techage:ta5_heatexchanger1"}, Cable, "junc", {"F", "B", "U"}) + +-- command interface +techage.register_node({"techage:ta5_heatexchanger1"}, { + on_transfer = function(pos, indir, topic, payload) + local nvm = techage.get_nvm(pos) + -- used by heatexchanger2 + if topic == "test_gas_blue" then + return control_cmnd(pos, topic) + else + return turbine_cmnd(pos, topic, payload) + end + end, +}) + +minetest.register_craft({ + output = "techage:ta5_heatexchanger1", + recipe = { + {"default:tin_ingot", "techage:electric_cableS", "default:steel_ingot"}, + {"techage:ta5_pipe1S", "basic_materials:gear_steel", "techage:ta4_pipeS"}, + {"", "techage:baborium_ingot", ""}, + }, +}) diff --git a/fusion_reactor/heatexchanger2.lua b/fusion_reactor/heatexchanger2.lua new file mode 100644 index 0000000..7ea1df2 --- /dev/null +++ b/fusion_reactor/heatexchanger2.lua @@ -0,0 +1,378 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Heat Exchanger2 (middle part) + +]]-- + +-- for lazy programmers +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S + +local Cable = techage.ElectricCable +local power = networks.power +local control = networks.control +local sched = techage.scheduler + +local CYCLE_TIME = 2 +local PWR_NEEDED = 5 +local COUNTDOWN_TICKS = 1 +local DOWN = 5 -- dir +local DESCRIPTION = S("TA5 Heat Exchanger 2") +local EXPECT_BLUE = 56 +local EXPECT_GREEN = 52 +local CALL_RATE1 = 16 -- 2s * 16 = 32s +local CALL_RATE2 = 8 -- 2s * 8 = 16s +local EX_POINTS = 60 + +local function heatexchanger1_cmnd(pos, topic, payload) + return techage.transfer({x = pos.x, y = pos.y - 1, z = pos.z}, + nil, topic, payload, nil, + {"techage:ta5_heatexchanger1"}) +end + +local function heatexchanger3_cmnd(pos, topic, payload) + return techage.transfer({x = pos.x, y = pos.y + 1, z = pos.z}, + nil, topic, payload, nil, + {"techage:ta5_heatexchanger3"}) +end + +local function play_sound(pos) + local mem = techage.get_mem(pos) + if not mem.handle or mem.handle == -1 then + mem.handle = minetest.sound_play("techage_booster", { + pos = pos, + gain = 0.3, + max_hear_distance = 10, + loop = true}) + if mem.handle == -1 then + minetest.after(1, play_sound, pos) + end + end +end + +local function stop_sound(pos) + local mem = techage.get_mem(pos) + if mem.handle then + minetest.sound_stop(mem.handle) + mem.handle = nil + end +end + +local function count_trues(t) + local cnt = 0 + for _,v in ipairs(t) do + if v then + cnt = cnt + 1 + end + end + return cnt +end + +local tSched = {} + +sched.register(tSched, CALL_RATE1, 0, function(pos) + if not heatexchanger1_cmnd(pos, "turbine") then + return S("Turbine error") + end + return true + end) +sched.register(tSched, CALL_RATE1, 1, function(pos) + if not heatexchanger3_cmnd(pos, "turbine") then + return S("Cooler error") + end + return true + end) +sched.register(tSched, CALL_RATE1, 2, function(pos) + local resp = heatexchanger1_cmnd(pos, "test_gas_blue") + local cnt = count_trues(resp) + if cnt ~= EXPECT_BLUE then + return S("Blue pipe connection error\n(@1 found / @2 expected)", cnt, EXPECT_BLUE) + end + return true + end) +sched.register(tSched, CALL_RATE1, 3, function(pos) + local resp = heatexchanger3_cmnd(pos, "test_gas_green") + local cnt = count_trues(resp) + if cnt ~= EXPECT_GREEN then + return S("Green pipe connection error\n(@1 found / @2 expected)", cnt, EXPECT_GREEN) + end + return true + end) +sched.register(tSched, CALL_RATE2, 4, function(pos) + local resp = heatexchanger3_cmnd(pos, "dec_power") + local cnt = count_trues(resp) + --print("dec_power", cnt) + if cnt < 52 then + return 0 + end + return 1 + end) + +local function can_start(pos, nvm) + if not power.power_available(pos, Cable, DOWN) then + return S("No power") + end + heatexchanger3_cmnd(pos, "rst_power") + for i = 0,4 do + local res = tSched[i](pos) + if res ~= true and res ~= 1 then return res end + end + return true +end + +local function start_node(pos, nvm) + play_sound(pos) + sched.init(pos) + nvm.temperature = nvm.temperature or 0 + local mem = techage.get_mem(pos) + local t = minetest.get_gametime() - (mem.stopped_at or 0) + nvm.temperature = math.max(nvm.temperature - math.floor(t/2), 0) + nvm.temperature = math.min(nvm.temperature, 70) +end + +local function stop_node(pos, nvm) + stop_sound(pos) + heatexchanger1_cmnd(pos, "stop") + local mem = techage.get_mem(pos) + mem.stopped_at = minetest.get_gametime() +end + +local function temp_indicator (nvm, x, y) + local temp = techage.is_running(nvm) and nvm.temperature or 0 + return "image[" .. x .. "," .. y .. ";1,2;techage_form_temp_bg.png^[lowpart:" .. + temp .. ":techage_form_temp_fg.png]" .. + "tooltip[" .. x .. "," .. y .. ";1,2;" .. S("water temperature") .. ";#0C3D32;#FFFFFF]" +end + +local function formspec(self, pos, nvm) + return "size[5,3]".. + "box[0,-0.1;4.8,0.5;#c6e8ff]" .. + "label[0.2,-0.1;" .. minetest.colorize( "#000000", DESCRIPTION) .. "]" .. + temp_indicator (nvm, 1, 1) .. + "image_button[3.2,1.5;1,1;".. self:get_state_button_image(nvm) ..";state_button;]".. + "tooltip[3.2,1.5;1,1;"..self:get_state_tooltip(nvm).."]" +end + +local State = techage.NodeStates:new({ + node_name_passive = "techage:ta5_heatexchanger2", + cycle_time = CYCLE_TIME, + infotext_name = DESCRIPTION, + standby_ticks = 0, + can_start = can_start, + start_node = start_node, + stop_node = stop_node, + formspec_func = formspec, +}) + +local function steam_management(pos, nvm) + local resp = sched.get(pos, tSched, function() return true end)(pos) + + if resp == 0 then -- has no power + nvm.temperature = math.max(nvm.temperature - 10, 0) + elseif resp == 1 then -- has power + nvm.temperature = math.min(nvm.temperature + 10, 100) + elseif resp ~= true then + State:fault(pos, nvm, resp) + stop_node(pos, nvm) + return false + end + + if resp == 0 and nvm.temperature == 70 then + heatexchanger1_cmnd(pos, "stop") + elseif nvm.temperature == 80 then + if resp == 1 then + heatexchanger1_cmnd(pos, "start") + local owner = M(pos):get_string("owner") + minetest.log("action", "[techage] " .. owner .. " starts the TA5 Fusion Reactor at " .. P2S(pos)) + else + heatexchanger1_cmnd(pos, "trigger") + end + elseif nvm.temperature > 80 then + heatexchanger1_cmnd(pos, "trigger") + end + return true +end + +local function consume_power(pos, nvm) + if techage.needs_power(nvm) then + local taken = power.consume_power(pos, Cable, DOWN, PWR_NEEDED) + if techage.is_running(nvm) then + if taken < PWR_NEEDED then + State:nopower(pos, nvm, S("No power")) + stop_sound(pos) + heatexchanger1_cmnd(pos, "stop") + else + return true -- keep running + end + end + end +end + +local function node_timer(pos, elapsed) + local nvm = techage.get_nvm(pos) + nvm.temperature = nvm.temperature or 0 + --print("node_timer", nvm.temperature) + if consume_power(pos, nvm) then + if steam_management(pos, nvm) then + State:keep_running(pos, nvm, COUNTDOWN_TICKS) + end + end + if techage.is_activeformspec(pos) then + M(pos):set_string("formspec", formspec(State, pos, nvm)) + end + return State:is_active(nvm) or nvm.temperature > 0 +end + +local function can_dig(pos, player) + if minetest.is_protected(pos, player:get_player_name()) then + return false + end + local nvm = techage.get_nvm(pos) + return not techage.is_running(nvm) +end + +local function on_rightclick(pos, node, clicker) + techage.set_activeformspec(pos, clicker) + local nvm = techage.get_nvm(pos) + M(pos):set_string("formspec", formspec(State, pos, nvm)) +end + +local function after_place_node(pos, placer) + if techage.orientate_node(pos, "techage:ta5_heatexchanger1") then + return true + end + local meta = M(pos) + local nvm = techage.get_nvm(pos) + local own_num = techage.add_node(pos, "techage:ta5_heatexchanger2") + meta:set_string("owner", placer:get_player_name()) + meta:set_string("infotext", DESCRIPTION..": "..own_num) + meta:set_string("formspec", formspec(State, pos, nvm)) + Cable:after_place_node(pos, {DOWN}) + State:node_init(pos, nvm, own_num) +end + +local function after_dig_node(pos, oldnode, oldmetadata, digger) + Cable:after_dig_node(pos) + techage.del_mem(pos) +end + +local function on_receive_fields(pos, formname, fields, player) + if minetest.is_protected(pos, player:get_player_name()) then + return + end + + if techage.get_expoints(player) >= EX_POINTS then + local nvm = techage.get_nvm(pos) + State:state_button_event(pos, nvm, fields) + --M(pos):set_string("formspec", formspec(State, pos, nvm)) + end +end + +-- Middle node with the formspec from the bottom node +minetest.register_node("techage:ta5_heatexchanger2", { + description = DESCRIPTION, + tiles = { + -- up, down, right, left, back, front + "techage_hole_ta4.png", + "techage_hole_ta4.png", + "techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_tes_turb.png", + "techage_filling_ta4.png^techage_frameM_ta4.png", + "techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsB.png", + "techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsB.png", + }, + + selection_box = { + type = "fixed", + fixed = {-1/2, -1.5/2, -1/2, 1/2, 1/2, 1/2}, + }, + + on_receive_fields = on_receive_fields, + on_rightclick = on_rightclick, + on_timer = node_timer, + after_place_node = after_place_node, + can_dig = can_dig, + after_dig_node = after_dig_node, + + paramtype2 = "facedir", + groups = {crumbly = 2, cracky = 2, snappy = 2}, + on_rotate = screwdriver.disallow, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +power.register_nodes({"techage:ta5_heatexchanger2"}, Cable, "con", {"D"}) + +techage.register_node({"techage:ta5_heatexchanger2"}, { + on_recv_message = function(pos, src, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == "state" then + if techage.is_running(nvm) then + return "running" + else + return "stopped" + end + elseif topic == "delivered" then + local data = power.get_network_data(pos, Cable, DOWN) + return data.consumed - data.provided + elseif topic == "on" then + start_node(pos, techage.get_nvm(pos)) + return true + elseif topic == "off" then + stop_node(pos, techage.get_nvm(pos)) + return true + else + return "unsupported" + end + end, + on_node_load = function(pos, node) + local nvm = techage.get_nvm(pos) + if techage.is_running(nvm) then + play_sound(pos) + else + stop_sound(pos) + end + -- Attempt to restart the system as the heat exchanger goes into error state + -- when parts of the storage block are unloaded. + if nvm.techage_state == techage.FAULT then + start_node(pos, nvm) + end + end, +}) + +control.register_nodes({"techage:ta5_heatexchanger2"}, { + on_receive = function(pos, tlib2, topic, payload) + end, + on_request = function(pos, tlib2, topic) + if topic == "info" then + local nvm = techage.get_nvm(pos) + return { + type = DESCRIPTION, + number = M(pos):get_string("node_number") or "", + running = techage.is_running(nvm) or false, + capa = nvm.capa_max or 1, + load = nvm.capa or 0, + } + end + return false + end, + } +) + +minetest.register_craft({ + output = "techage:ta5_heatexchanger2", + recipe = { + {"default:tin_ingot", "", "default:steel_ingot"}, + {"", "techage:ta5_aichip2", ""}, + {"", "techage:baborium_ingot", ""}, + }, +}) diff --git a/fusion_reactor/heatexchanger3.lua b/fusion_reactor/heatexchanger3.lua new file mode 100644 index 0000000..dd8ee47 --- /dev/null +++ b/fusion_reactor/heatexchanger3.lua @@ -0,0 +1,106 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Heat Exchanger3 (top part) + +]]-- + +-- for lazy programmers +local M = minetest.get_meta +local S = techage.S + +local Pipe2 = techage.LiquidPipe +local Pipe3 = techage.GasPipe +local liquid = networks.liquid +local control = networks.control + +local function orientate_node(pos, name) + local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) + if node.name == name then + local param2 = node.param2 + node = minetest.get_node(pos) + node.param2 = param2 + minetest.swap_node(pos, node) + else + minetest.remove_node(pos) + return true + end +end + +local function after_place_node(pos) + if orientate_node(pos, "techage:ta5_heatexchanger2") then + return true + end + Pipe2:after_place_node(pos) + Pipe3:after_place_node(pos) +end + +local function after_dig_node(pos, oldnode) + Pipe2:after_dig_node(pos) + Pipe3:after_dig_node(pos) +end + +local function turbine_cmnd(pos, topic, payload) + return techage.transfer(pos, "R", topic, payload, Pipe2, + {"techage:ta5_turbine", "techage:ta5_turbine_on"}) +end + +-- Send to the magnets +local function control_cmnd(pos, topic) + local outdir = networks.side_to_outdir(pos, "L") + return control.request(pos, Pipe3, outdir, "tank", topic) +end + +minetest.register_node("techage:ta5_heatexchanger3", { + description = S("TA5 Heat Exchanger 3"), + tiles = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta5_top.png", + "techage_hole_ta4.png", + "techage_filling_ta4.png^techage_frameT_ta5.png^techage_appl_hole_pipe.png", + "techage_filling_ta4.png^techage_frameT_ta5.png^techage_appl_hole_ta5_pipe1.png", + "techage_filling_ta4.png^techage_frameT_ta5.png^techage_appl_ribsT.png", + "techage_filling_ta4.png^techage_frameT_ta5.png^techage_appl_ribsT.png", + }, + + after_place_node = after_place_node, + after_dig_node = after_dig_node, + + paramtype2 = "facedir", + groups = {crumbly = 2, cracky = 2, snappy = 2}, + on_rotate = screwdriver.disallow, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +liquid.register_nodes({"techage:ta5_heatexchanger3"}, Pipe2, "tank", {"R"}, {}) +liquid.register_nodes({"techage:ta5_heatexchanger3"}, Pipe3, "tank", {"L"}, {}) + +-- command interface, used by heatexchanger2 +techage.register_node({"techage:ta5_heatexchanger3"}, { + on_transfer = function(pos, indir, topic, payload) + if topic == "turbine" then + return turbine_cmnd(pos, topic, payload) + else + return control_cmnd(pos, topic) + end + end, +}) + +minetest.register_craft({ + output = "techage:ta5_heatexchanger3", + recipe = { + {"default:tin_ingot", "dye:red", "default:steel_ingot"}, + {"techage:ta5_pipe2S", "basic_materials:gear_steel", "techage:ta4_pipeS"}, + {"", "techage:baborium_ingot", ""}, + }, +}) + +techage.orientate_node = orientate_node diff --git a/fusion_reactor/magnet.lua b/fusion_reactor/magnet.lua new file mode 100644 index 0000000..66889cf --- /dev/null +++ b/fusion_reactor/magnet.lua @@ -0,0 +1,266 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Fusion Reactor Magnet + +]]-- + +-- for lazy programmers +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S + +local Cable = techage.ElectricCable +local Pipe = techage.GasPipe +local power = networks.power +local liquid = networks.liquid +local control = networks.control + +local CAPACITY = 6 +local SHELLBLOCKS = {"techage:ta5_fr_shell", "techage:ta5_fr_nucleus", "techage:ta5_magnet1", "techage:ta5_magnet2"} + +minetest.register_node("techage:ta5_magnet1", { + description = S("TA5 Fusion Reactor Magnet 1"), + tiles = { + -- up, down, right, left, back, front + "techage_collider_magnet.png^techage_appl_hole_ta5_pipe1.png^techage_steel_tiles_top.png^[transformR180]", + "techage_collider_magnet.png^techage_appl_hole_ta5_pipe2.png^techage_steel_tiles_top.png", + "techage_collider_magnet.png^techage_steel_tiles_side.png", + "techage_collider_magnet.png^techage_steel_tiles_side.png^[transformR180]", + "techage_collider_magnet.png^techage_appl_hole_electric.png", + "techage_steel_tiles.png", + }, + after_place_node = function(pos, placer, itemstack) + Pipe:after_place_node(pos) + Cable:after_place_node(pos) + end, + ta_rotate_node = function(pos, node, new_param2) + Pipe:after_dig_node(pos) + Cable:after_dig_node(pos) + minetest.swap_node(pos, {name = node.name, param2 = new_param2}) + Pipe:after_place_node(pos) + Cable:after_place_node(pos) + end, + after_dig_node = function(pos, oldnode) + Pipe:after_dig_node(pos) + Cable:after_dig_node(pos) + techage.del_mem(pos) + end, + drawtype = "nodebox", + paramtype2 = "facedir", + groups = {choppy=2, cracky=2, crumbly=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta5_magnet2", { + description = S("TA5 Fusion Reactor Magnet 2"), + tiles = { + -- up, down, right, left, back, front + "techage_collider_magnet.png^techage_appl_hole_ta5_pipe1.png^techage_steel_tiles_top2.png^[transformR180]", + "techage_collider_magnet.png^techage_appl_hole_ta5_pipe2.png^techage_steel_tiles_top2.png^[transformR270]", + "techage_steel_tiles.png", + "techage_collider_magnet.png^techage_steel_tiles_side.png^[transformR180]", + "techage_collider_magnet.png^techage_steel_tiles_side.png", + "techage_steel_tiles.png", + }, + after_place_node = function(pos, placer, itemstack) + Pipe:after_place_node(pos) + Cable:after_place_node(pos) + end, + ta_rotate_node = function(pos, node, new_param2) + Pipe:after_dig_node(pos) + Cable:after_dig_node(pos) + minetest.swap_node(pos, {name = node.name, param2 = new_param2}) + Pipe:after_place_node(pos) + Cable:after_place_node(pos) + end, + after_dig_node = function(pos, oldnode) + Pipe:after_dig_node(pos) + Cable:after_dig_node(pos) + techage.del_mem(pos) + end, + drawtype = "nodebox", + paramtype2 = "facedir", + groups = {choppy=2, cracky=2, crumbly=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +power.register_nodes({"techage:ta5_magnet1"}, Cable, "con", {"B"}) +liquid.register_nodes({"techage:ta5_magnet1", "techage:ta5_magnet2"}, Pipe, "tank", {"U", "D"}, { + capa = CAPACITY, + peek = function(pos, indir) + local nvm = techage.get_nvm(pos) + return liquid.srv_peek(nvm) + end, + put = function(pos, indir, name, amount) + local nvm = techage.get_nvm(pos) + return liquid.srv_put(nvm, name, amount, CAPACITY) + end, + take = function(pos, indir, name, amount) + local nvm = techage.get_nvm(pos) + return liquid.srv_take(nvm, name, amount) + end, + untake = function(pos, indir, name, amount) + local nvm = techage.get_nvm(pos) + liquid.srv_put(nvm, name, amount, CAPACITY) + end, +}) + +local function check_plasma(pos, param2) + local pos1 = networks.get_relpos(pos, "F", param2) + local node = minetest.get_node(pos1) or {} + return node.name == "air" +end + +local function swap_plasma(pos, name, param2) + local pos1 = networks.get_relpos(pos, "F", param2) + minetest.swap_node(pos1, {name = name, param2 = param2}) +end + +local function check_shell(pos, param2) + local pos1 = networks.get_relpos(pos, "D", param2) + local pos2 = networks.get_relpos(pos, "BU", param2) + local _,t = minetest.find_nodes_in_area(pos1, pos2, SHELLBLOCKS) + local cnt = 0 + for k,v in pairs(t) do + cnt = cnt + v + end + return cnt == 6 +end + +local function check_nucleus(pos, param2) + local pos1 = networks.get_relpos(pos, "B", param2) + local node = minetest.get_node(pos1) or {} + if node.name == "techage:ta5_fr_nucleus" then + return pos1 + end +end + +local function on_receive(pos, tlib2, topic, payload) + --print("on_receive", topic) + local nvm = techage.get_nvm(pos) + if topic == "on" then + nvm.running = true + elseif topic == "off" then + nvm.running = false + end +end + +local function rst_power(nvm) + nvm.power = 0 + return true +end + +local function inc_power(nvm) + nvm.power = nvm.power or 0 + if nvm.power < 0 then nvm.power = 0 end + nvm.power = nvm.power + 1 + return nvm.power <= 2 +end + +local function dec_power(nvm) + nvm.power = nvm.power or 0 + if nvm.power > 0 then nvm.power = 0 end + nvm.power = nvm.power - 1 + return nvm.power >= -2 +end + +local function on_request(pos, tlib2, topic) + local nvm = techage.get_nvm(pos) + nvm.liquid = nvm.liquid or {} + nvm.liquid.amount = nvm.liquid.amount or 0 + if tlib2 == Cable then + if topic == "connect" then + return true + elseif topic == "inc_power" then + return inc_power(nvm) + elseif topic == "test_plasma" then + local node = minetest.get_node(pos) or {} + return check_plasma(pos, node.param2) + elseif topic == "test_shell" then + local node = minetest.get_node(pos) or {} + return check_shell(pos, node.param2) + elseif topic == "test_nucleus" then + local node = minetest.get_node(pos) or {} + return check_nucleus(pos, node.param2) + elseif topic == "no_gas" then + nvm.liquid.amount = 0 + return true + end + else -- Pipe + if topic == "dec_power" then + return dec_power(nvm) + elseif topic == "test_gas_blue" then + nvm.has_gas = true + return nvm.liquid.amount == CAPACITY + elseif topic == "test_gas_green" then + local res = nvm.has_gas + nvm.has_gas = false + return res + end + end + if topic == "rst_power" then + return rst_power(nvm) + end + return false +end + +control.register_nodes({"techage:ta5_magnet1", "techage:ta5_magnet2"}, { + on_receive = on_receive, + on_request = on_request, + } +) + +minetest.register_craftitem("techage:ta5_magnet_blank", { + description = S("TA5 Fusion Reactor Magnet Blank"), + inventory_image = "techage_collider_magnet.png^techage_appl_hole_electric.png", +}) + +minetest.register_craftitem("techage:ta5_magnet_shield", { + description = S("TA5 Fusion Reactor Magnet Shield"), + inventory_image = "techage_steel_tiles.png", +}) + +techage.furnace.register_recipe({ + output = "techage:ta5_magnet_shield 2", + recipe = {"default:steel_ingot", "techage:usmium_powder", "techage:graphite_powder"}, + time = 2, + +}) + +minetest.register_craft({ + output = "techage:ta5_magnet_blank 2", + recipe = { + {'default:steel_ingot', 'techage:electric_cableS', 'techage:aluminum'}, + {'techage:ta5_pipe1S', 'basic_materials:gold_wire', 'techage:ta5_pipe2S'}, + {'techage:aluminum', 'dye:brown', 'default:steel_ingot'}, + }, +}) + +minetest.register_craft({ + output = "techage:ta5_magnet1", + recipe = { + {'', 'techage:ta5_magnet_shield', 'techage:ta5_magnet_blank'}, + {'', '', ''}, + {'', '', ''}, + }, +}) + +minetest.register_craft({ + output = "techage:ta5_magnet2", + recipe = { + {'', 'techage:ta5_magnet_shield', 'techage:ta5_magnet_blank'}, + {'', '', 'techage:ta5_magnet_shield'}, + {'', '', ''}, + }, +}) diff --git a/fusion_reactor/shell.lua b/fusion_reactor/shell.lua new file mode 100644 index 0000000..b2f1fcc --- /dev/null +++ b/fusion_reactor/shell.lua @@ -0,0 +1,63 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Fusion Reactor Shell + +]]-- + +-- for lazy programmers +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S + +minetest.register_node("techage:ta5_fr_shell", { + description = S("TA5 Fusion Reactor Shell"), + tiles = { + "techage_reactor_shell.png", + }, + drawtype = "nodebox", + paramtype2 = "facedir", + paramtype = "light", + use_texture_alpha = "blend", + groups = {choppy=2, cracky=2, crumbly=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta5_fr_nucleus", { + description = S("TA5 Fusion Reactor Nucleus"), + tiles = { + "techage_reactor_shell.png^techage_collider_detector_core.png", + }, + drawtype = "nodebox", + paramtype2 = "facedir", + paramtype = "light", + use_texture_alpha = "blend", + groups = {choppy=2, cracky=2, crumbly=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +techage.furnace.register_recipe({ + output = "techage:ta5_fr_shell 3", + recipe = {'techage:ta4_colliderblock', 'techage:ta4_colliderblock', "techage:graphite_powder"}, + time = 24, +}) + +minetest.register_craft({ + output = "techage:ta5_fr_nucleus", + recipe = { + {"", "techage:ta5_aichip2", ""}, + {"techage:electric_cableS", "techage:cylinder_large_hydrogen", "techage:ta3_valve_open"}, + {"", "techage:ta5_fr_shell", ""}, + }, +}) + diff --git a/fusion_reactor/ta5_pump.lua b/fusion_reactor/ta5_pump.lua new file mode 100644 index 0000000..fab96a0 --- /dev/null +++ b/fusion_reactor/ta5_pump.lua @@ -0,0 +1,191 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Pump + +]]-- + +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S +local Pipe2 = techage.LiquidPipe +local Pipe3 = techage.GasPipe +local liquid = networks.liquid +local Flip = networks.Flip + +local STANDBY_TICKS = 16 +local COUNTDOWN_TICKS = 4 +local CYCLE_TIME = 2 +local CAPA = 4 + +local WRENCH_MENU = {{ + type = "output", + name = "flowrate", + label = S("Total flow rate"), + tooltip = S("Total flow rate in liquid units"), +}} + +local State = techage.NodeStates:new({ + node_name_passive = "techage:ta5_pump", + node_name_active = "techage:ta5_pump_on", + infotext_name = S("TA5 Pump"), + cycle_time = CYCLE_TIME, + standby_ticks = STANDBY_TICKS, +}) + +local function pumping(pos, nvm) + local outdir = M(pos):get_int("outdir") + local taken, name = liquid.take(pos, Pipe2, Flip[outdir], nil, CAPA) + if taken > 0 then + local leftover = liquid.put(pos, Pipe3, outdir, name, taken) + if leftover and leftover > 0 then + liquid.untake(pos, Pipe2, Flip[outdir], name, leftover) + if leftover == taken then + State:blocked(pos, nvm) + return 0 + end + State:keep_running(pos, nvm, COUNTDOWN_TICKS) + return taken - leftover + end + State:keep_running(pos, nvm, COUNTDOWN_TICKS) + return taken + end + State:idle(pos, nvm) + return 0 +end + +local function after_place_node(pos, placer) + local nvm = techage.get_nvm(pos) + local number = techage.add_node(pos, "techage:ta5_pump") + State:node_init(pos, nvm, number) + M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) + Pipe2:after_place_node(pos) + Pipe3:after_place_node(pos) +end + +local function node_timer(pos, elapsed) + local nvm = techage.get_nvm(pos) + nvm.flowrate = (nvm.flowrate or 0) + pumping(pos, nvm) + return State:is_active(nvm) +end + +local function on_rightclick(pos, node, clicker) + if minetest.is_protected(pos, clicker:get_player_name()) then + return + end + + local nvm = techage.get_nvm(pos) + if node.name == "techage:ta5_pump" then + State:start(pos, nvm) + elseif node.name == "techage:ta5_pump_on" then + State:stop(pos, nvm) + end +end + +local function after_dig_node(pos, oldnode, oldmetadata, digger) + Pipe2:after_dig_node(pos) + Pipe3:after_dig_node(pos) + techage.del_mem(pos) +end + +local tiles_pas = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_arrow.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", + "techage_filling_ta4.png^techage_appl_hole_ta5_pipe2.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta5.png^[transformFX", + "techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta5.png", +} + +local tiles_act = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_arrow.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", + "techage_filling_ta4.png^techage_appl_hole_ta5_pipe2.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta5.png", + { + image = "techage_filling8_ta4.png^techage_appl_pump8.png^techage_frame8_ta5.png^[transformFX", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 2.0, + }, + }, + { + image = "techage_filling8_ta4.png^techage_appl_pump8.png^techage_frame8_ta5.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 2.0, + }, + }, +} + +minetest.register_node("techage:ta5_pump", { + description = S("TA5 Pump"), + tiles = tiles_pas, + after_place_node = after_place_node, + on_rightclick = on_rightclick, + on_timer = node_timer, + after_dig_node = after_dig_node, + on_rotate = screwdriver.disallow, + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), + ta4_formspec = WRENCH_MENU, +}) + +minetest.register_node("techage:ta5_pump_on", { + description = S("TA5 Pump"), + tiles = tiles_act, + --after_place_node = after_place_node4, + on_rightclick = on_rightclick, + on_timer = node_timer, + after_dig_node = after_dig_node, + on_rotate = screwdriver.disallow, + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + diggable = false, + groups = {not_in_creative_inventory=1}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +techage.register_node({"techage:ta5_pump", "techage:ta5_pump_on"}, { + on_recv_message = function(pos, src, topic, payload) + return State:on_receive_message(pos, topic, payload) + end, +}) + +-- Pumps have to provide one output and one input side +liquid.register_nodes({ + "techage:ta5_pump", "techage:ta5_pump_on", +}, Pipe2, "pump", {"L"}, {}) + +liquid.register_nodes({ + "techage:ta5_pump", "techage:ta5_pump_on", +}, Pipe3, "pump", {"R"}, {}) + +minetest.register_craft({ + output = "techage:ta5_pump", + recipe = { + {"techage:aluminum", "dye:red", "default:steel_ingot"}, + {"techage:ta4_pipeS", "techage:ta5_ceramic_turbine", "techage:ta5_pipe1S"}, + {"default:steel_ingot", "basic_materials:motor", "techage:aluminum"}, + }, +}) diff --git a/fusion_reactor/turbine.lua b/fusion_reactor/turbine.lua new file mode 100644 index 0000000..4703304 --- /dev/null +++ b/fusion_reactor/turbine.lua @@ -0,0 +1,170 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2022 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + TA5 Gas Turbine + +]]-- + +-- for lazy programmers +local M = minetest.get_meta +local S = techage.S + +local Pipe = techage.LiquidPipe + +local function generator_cmnd(pos, topic, payload) + return techage.transfer(pos, "R", topic, payload, nil, + {"techage:ta5_generator", "techage:ta5_generator_on"}) +end + +local function swap_node(pos, name) + local node = techage.get_node_lvm(pos) + if node.name == name then + return + end + node.name = name + minetest.swap_node(pos, node) +end + +local function play_sound(pos) + local mem = techage.get_mem(pos) + if not mem.handle or mem.handle == -1 then + mem.handle = minetest.sound_play("techage_turbine", { + pos = pos, + gain = 0.4, + max_hear_distance = 10, + loop = true}) + if mem.handle == -1 then + minetest.after(1, play_sound, pos) + end + end +end + +local function stop_sound(pos) + local mem = techage.get_mem(pos) + if mem.handle then + minetest.sound_stop(mem.handle) + mem.handle = nil + end +end + +minetest.register_node("techage:ta5_turbine", { + description = S("TA5 Turbine"), + tiles = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_hole_pipe.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", + "techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_hole_pipe.png", + "techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta5.png", + }, + + after_place_node = function(pos) + Pipe:after_place_node(pos) + end, + after_dig_node = function(pos, oldnode) + stop_sound(pos) + Pipe:after_dig_node(pos) + techage.del_mem(pos) + end, + networks = { + pipe2 = {}, + }, + paramtype2 = "facedir", + groups = {cracky=2, crumbly=2, choppy=2}, + on_rotate = screwdriver.disallow, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("techage:ta5_turbine_on", { + tiles = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_hole_pipe.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", + "techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta5.png", + "techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_hole_pipe.png", + { + image = "techage_filling4_ta4.png^techage_appl_turbine4.png^techage_frame4_ta5.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 0.4, + }, + }, + { + image = "techage_filling4_ta4.png^techage_appl_turbine4.png^techage_frame4_ta5.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 0.4, + }, + }, + }, + + tubelib2_on_update2 = function(pos, outdir, tlib2, node) + swap_node(pos, "techage:ta5_turbine") + stop_sound(pos) + generator_cmnd(pos, "stop") + end, + networks = { + pipe2 = {}, + }, + paramtype2 = "facedir", + groups = {not_in_creative_inventory=1}, + diggable = false, + on_rotate = screwdriver.disallow, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), +}) + +Pipe:add_secondary_node_names({"techage:ta5_turbine", "techage:ta5_turbine_on"}) +Pipe:set_valid_sides("techage:ta5_turbine", {"L", "U"}) +Pipe:set_valid_sides("techage:ta5_turbine_on", {"L", "U"}) + +techage.register_node({"techage:ta5_turbine", "techage:ta5_turbine_on"}, { + -- used by heatexchanger1 + on_transfer = function(pos, in_dir, topic, payload) + local nvm = techage.get_nvm(pos) + if topic == "trigger" then + return generator_cmnd(pos, topic, payload) + elseif topic == "start" then + swap_node(pos, "techage:ta5_turbine_on") + play_sound(pos) + return generator_cmnd(pos, topic, payload) + elseif topic == "stop" then + swap_node(pos, "techage:ta5_turbine") + stop_sound(pos) + return generator_cmnd(pos, topic, payload) + elseif topic == "turbine" then + return true + else + return generator_cmnd(pos, topic, payload) + end + end, + on_node_load = function(pos, node) + if node.name == "techage:ta5_turbine_on" then + play_sound(pos) + end + end, +}) + +minetest.register_craft({ + output = "techage:ta5_turbine", + recipe = { + {"", "dye:red", ""}, + {"", "techage:turbine", ""}, + {"", "techage:ta5_ceramic_turbine", ""}, + }, +}) diff --git a/images/chemical_reactor.png b/images/chemical_reactor.png index 78c56c5..6fbc83e 100644 Binary files a/images/chemical_reactor.png and b/images/chemical_reactor.png differ diff --git a/images/distillation_tower.png b/images/distillation_tower.png index 7e3826b..aa8e1db 100644 Binary files a/images/distillation_tower.png and b/images/distillation_tower.png differ diff --git a/images/drilling_tower.png b/images/drilling_tower.png index 6e098d1..06945dc 100644 Binary files a/images/drilling_tower.png and b/images/drilling_tower.png differ diff --git a/images/fusion_reactor.png b/images/fusion_reactor.png new file mode 100644 index 0000000..5b0f353 Binary files /dev/null and b/images/fusion_reactor.png differ diff --git a/images/melting_furnace.png b/images/melting_furnace.png index 5341921..2c5f614 100644 Binary files a/images/melting_furnace.png and b/images/melting_furnace.png differ diff --git a/images/solar_plant.png b/images/solar_plant.png index 53dc02f..e17ef73 100644 Binary files a/images/solar_plant.png and b/images/solar_plant.png differ diff --git a/images/steam_engine.png b/images/steam_engine.png index f6b5637..8faaa33 100644 Binary files a/images/steam_engine.png and b/images/steam_engine.png differ diff --git a/images/tank_cart.png b/images/tank_cart.png index d641589..c1273a9 100644 Binary files a/images/tank_cart.png and b/images/tank_cart.png differ diff --git a/images/thermal_energy_storage.png b/images/thermal_energy_storage.png index 4fe067f..23527fb 100644 Binary files a/images/thermal_energy_storage.png and b/images/thermal_energy_storage.png differ diff --git a/images/watermill.png b/images/watermill.png index 8c3a8e2..69ac560 100644 Binary files a/images/watermill.png and b/images/watermill.png differ diff --git a/images/wind_plant.png b/images/wind_plant.png index 55210b0..1507582 100644 Binary files a/images/wind_plant.png and b/images/wind_plant.png differ diff --git a/init.lua b/init.lua index fe7b60c..7674ca0 100644 --- a/init.lua +++ b/init.lua @@ -13,7 +13,7 @@ techage = {} -- Version for compatibility checks, see readme.md/history -techage.version = 1.06 +techage.version = 1.07 if minetest.global_exists("tubelib") then minetest.log("error", "[techage] Techage can't be used together with the mod tubelib!") @@ -172,6 +172,8 @@ dofile(MP.."/ta2_energy_storage/ta2_weight_chest.lua") dofile(MP.."/liquids/liquid_pipe.lua") dofile(MP.."/liquids/valve.lua") dofile(MP.."/liquids/pipe_wall_entry.lua") +dofile(MP.."/fusion_reactor/gas_pipe.lua") + -- Basic Machines dofile(MP.."/basic_machines/consumer.lua") -- consumer base model @@ -387,7 +389,7 @@ dofile(MP.."/items/moreblocks.lua") dofile(MP.."/carts/tank_cart.lua") dofile(MP.."/carts/chest_cart.lua") --- Collider +-- TA4 Collider dofile(MP.."/collider/vacuumtube.lua") dofile(MP.."/collider/magnet.lua") dofile(MP.."/collider/inlets.lua") @@ -395,9 +397,20 @@ dofile(MP.."/collider/cooler.lua") dofile(MP.."/collider/detector.lua") dofile(MP.."/collider/worker.lua") +-- TA5 Teleport dofile(MP.."/teleport/teleport_tube.lua") dofile(MP.."/teleport/teleport_pipe.lua") +-- TA5 Fusion Reactor +dofile(MP.."/fusion_reactor/shell.lua") +dofile(MP.."/fusion_reactor/magnet.lua") +dofile(MP.."/fusion_reactor/controller.lua") +dofile(MP.."/fusion_reactor/heatexchanger3.lua") +dofile(MP.."/fusion_reactor/heatexchanger2.lua") +dofile(MP.."/fusion_reactor/heatexchanger1.lua") +dofile(MP.."/fusion_reactor/generator.lua") +dofile(MP.."/fusion_reactor/turbine.lua") +dofile(MP.."/fusion_reactor/ta5_pump.lua") -- Prevent other mods from using IE techage.IE = nil diff --git a/items/ceramic.lua b/items/ceramic.lua index f2d1dcf..5bdcad6 100644 --- a/items/ceramic.lua +++ b/items/ceramic.lua @@ -59,6 +59,11 @@ minetest.register_craftitem("techage:ta4_round_ceramic", { inventory_image = "techage_round_ceramic.png", }) +minetest.register_craftitem("techage:ta5_ceramic_turbine", { + description = S("TA5 Ceramic Turbine"), + inventory_image = "techage_ceramic_turbine.png", +}) + techage.furnace.register_recipe({ output = "techage:ta4_round_ceramic 2", recipe = { @@ -67,3 +72,13 @@ techage.furnace.register_recipe({ }, time = 16, }) + +techage.furnace.register_recipe({ + output = "techage:ta5_ceramic_turbine", + recipe = { + "techage:ta4_ceramic_material", + "techage:ta4_ceramic_material", + "techage:graphite_powder", + }, + time = 16, +}) diff --git a/items/electronic.lua b/items/electronic.lua index ad180ce..1f54551 100644 --- a/items/electronic.lua +++ b/items/electronic.lua @@ -41,7 +41,12 @@ minetest.register_craftitem("techage:ta4_leds", { minetest.register_craftitem("techage:ta5_aichip", { description = S("TA5 AI Chip"), - inventory_image = "techage_aichip.png", + inventory_image = "techage_aichip.png^[colorize:#48b9de:40", +}) + +minetest.register_craftitem("techage:ta5_aichip2", { + description = S("TA5 AI Chip II"), + inventory_image = "techage_aichip.png^[colorize:#de486c:40", }) techage.recipes.add("ta2_electronic_fab", { @@ -84,3 +89,9 @@ techage.recipes.add("ta4_electronic_fab", { input = {"techage:ta4_leds 8", "basic_materials:copper_wire 1", "basic_materials:gold_wire 1", "techage:ta4_silicon_wafer 1"}, ex_points = 10, }) + +techage.recipes.add("ta4_electronic_fab", { + output = "techage:ta5_aichip2 2", + input = {"techage:ta4_leds 8", "basic_materials:copper_wire 1", "basic_materials:gold_wire 1", "techage:ta4_silicon_wafer 1"}, + ex_points = 50, +}) diff --git a/items/powder.lua b/items/powder.lua index 1ca6484..a75ab61 100644 --- a/items/powder.lua +++ b/items/powder.lua @@ -50,6 +50,12 @@ minetest.register_craftitem("techage:silver_sandstone_powder", { groups = {powder = 1}, }) +minetest.register_craftitem("techage:graphite_powder", { + description = S("Graphite Powder"), + inventory_image = "techage_powder_inv.png^[colorize:#000000:160", + groups = {powder = 1}, +}) + techage.add_grinder_recipe({input="default:acacia_bush_leaves", output="techage:leave_powder"}) techage.add_grinder_recipe({input="default:acacia_leaves", output="techage:leave_powder"}) techage.add_grinder_recipe({input="default:aspen_leaves", output="techage:leave_powder"}) @@ -62,4 +68,5 @@ techage.add_grinder_recipe({input="default:iron_lump", output="techage:iron_powd techage.add_grinder_recipe({input="default:clay", output="techage:clay_powder"}) techage.add_grinder_recipe({input="techage:aluminum", output="techage:aluminum_powder"}) techage.add_grinder_recipe({input="default:silver_sandstone", output="techage:silver_sandstone_powder"}) +techage.add_grinder_recipe({input="default:coal_lump", output="techage:graphite_powder"}) diff --git a/items/registered_nodes.lua b/items/registered_nodes.lua index 36cf710..a6a6bae 100644 --- a/items/registered_nodes.lua +++ b/items/registered_nodes.lua @@ -38,3 +38,30 @@ minetest.register_on_mods_loaded(function() end) minetest.override_item("default:gravel", {groups = {crumbly = 2, gravel = 1, falling_node = 1}}) + +-- Register all known mobs mods for the move/fly controllers +techage.register_mobs_mods("ts_skins_dummies") +techage.register_mobs_mods("mobs") +techage.register_mobs_mods("draconis") +techage.register_mobs_mods("mobkit") +techage.register_mobs_mods("animalia") +techage.register_mobs_mods("mobs_animal") +techage.register_mobs_mods("mobs_monster") +techage.register_mobs_mods("dmobs") +techage.register_mobs_mods("mob_horse") +techage.register_mobs_mods("petz") +techage.register_mobs_mods("mobs_npc") +techage.register_mobs_mods("livingnether") +techage.register_mobs_mods("extra_mobs") +techage.register_mobs_mods("nssm") +techage.register_mobs_mods("goblins") +techage.register_mobs_mods("animalworld") +techage.register_mobs_mods("aliveai") +techage.register_mobs_mods("people") +techage.register_mobs_mods("paleotest") +techage.register_mobs_mods("mobs_balrog") +techage.register_mobs_mods("wildlife") +techage.register_mobs_mods("mobs_skeletons") +techage.register_mobs_mods("mobs_dwarves") +techage.register_mobs_mods("mobf_trader") +techage.register_mobs_mods("ts_vehicles") diff --git a/liquids/liquid_pipe.lua b/liquids/liquid_pipe.lua index 40a366f..2e94efa 100644 --- a/liquids/liquid_pipe.lua +++ b/liquids/liquid_pipe.lua @@ -20,7 +20,7 @@ local S = techage.S local MAX_PIPE_LENGHT = 100 -local power = networks.power +local liquid = networks.liquid local Pipe = tubelib2.Tube:new({ dirs_to_check = {1,2,3,4,5,6}, @@ -47,7 +47,7 @@ local Pipe = tubelib2.Tube:new({ -- Use global callback instead of node related functions Pipe:register_on_tube_update2(function(pos, outdir, tlib2, node) - power.update_network(pos, outdir, tlib2, node) + liquid.update_network(pos, outdir, tlib2, node) end) minetest.register_node("techage:ta3_pipeS", { @@ -172,14 +172,14 @@ local names = networks.register_junction("techage:ta3_junctionpipe", 1/8, Boxes, tubelib2_on_update2 = function(pos, dir1, tlib2, node) local name = "techage:ta3_junctionpipe" .. networks.junction_type(pos, Pipe) minetest.swap_node(pos, {name = name, param2 = 0}) - power.update_network(pos, 0, tlib2, node) + liquid.update_network(pos, 0, tlib2, node) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) end, }, 25) -power.register_nodes(names, Pipe, "junc") +liquid.register_nodes(names, Pipe, "junc") minetest.register_craft({ output = "techage:ta3_junctionpipe25 2", diff --git a/liquids/pump.lua b/liquids/pump.lua index 0a49247..868d81a 100644 --- a/liquids/pump.lua +++ b/liquids/pump.lua @@ -3,7 +3,7 @@ TechAge ======= - Copyright (C) 2019-2021 Joachim Stolberg + Copyright (C) 2019-2022 Joachim Stolberg AGPL v3 See LICENSE.txt for more information @@ -66,7 +66,7 @@ local function pumping(pos, nvm, state, capa) state:blocked(pos, nvm) return 0 end - state:keep_running(pos, nvm, COUNTDOWN_TICKS) + state:keep_running(pos, nvm, COUNTDOWN_TICKS) return taken - leftover end state:keep_running(pos, nvm, COUNTDOWN_TICKS) @@ -133,7 +133,7 @@ end local ta3_tiles_pas = { -- up, down, right, left, back, front "techage_filling_ta3.png^techage_frame_ta3_top.png^techage_appl_arrow.png", - "techage_filling_ta3.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_frame_ta3_bottom.png", "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_pump.png^techage_frame_ta3.png^[transformFX", @@ -143,7 +143,7 @@ local ta3_tiles_pas = { local ta4_tiles_pas = { -- up, down, right, left, back, front "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png", - "techage_filling_ta4.png^techage_frame_ta4.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta4.png", "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta4.png", "techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta4.png^[transformFX", @@ -153,7 +153,7 @@ local ta4_tiles_pas = { local ta3_tiles_act = { -- up, down, right, left, back, front "techage_filling_ta3.png^techage_frame_ta3_top.png^techage_appl_arrow.png", - "techage_filling_ta3.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_frame_ta3_bottom.png", "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", { @@ -181,7 +181,7 @@ local ta3_tiles_act = { local ta4_tiles_act = { -- up, down, right, left, back, front "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png", - "techage_filling_ta4.png^techage_frame_ta4.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta4.png", "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta4.png", { diff --git a/liquids/tank.lua b/liquids/tank.lua index b970c50..9b87f51 100644 --- a/liquids/tank.lua +++ b/liquids/tank.lua @@ -91,7 +91,7 @@ minetest.register_node("techage:ta3_tank", { tiles = { -- up, down, right, left, back, front "techage_filling_ta3.png^techage_frame_ta3_top.png", - "techage_filling_ta3.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_frame_ta3_bottom.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_tank.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_tank.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_tank.png", @@ -197,7 +197,7 @@ minetest.register_node("techage:ta4_tank", { tiles = { -- up, down, right, left, back, front "techage_filling_ta4.png^techage_frame_ta4_top.png", - "techage_filling_ta4.png^techage_frame_ta4.png", + "techage_filling_ta4.png^techage_frame_ta4_bottom.png", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_tank.png", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_tank.png", "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_tank.png", diff --git a/locale/techage.de.tr b/locale/techage.de.tr index 58208ef..d9cd4d5 100644 --- a/locale/techage.de.tr +++ b/locale/techage.de.tr @@ -97,6 +97,10 @@ TA3 Boiler Base=TA3 Boiler unten To add water punch@nthe boiler@nwith a water bucket=Um Wasser nachzufüllen,@nschlage mit einem Wassereimer@nauf den Block Water Boiler=Wasserboiler + +### boiler_lib.lua ### +### heatexchanger2.lua ### + water temperature=Wassertemperatur ### boiler_top.lua ### @@ -197,6 +201,7 @@ Cement Powder=Zement Pulver TA4 Ceramic Material=TA4 Keramik Material TA4 Furnace Ceramic=TA4 Ofen Keramik TA4 Round Ceramic=TA4 Rund-Keramik +TA5 Ceramic Turbine=TA5 Keramikturbine ### charcoalpile.lua ### @@ -232,6 +237,20 @@ TA4 State Collector=TA4 Zuständesammler TA4 Tube Concentrator=TA4 Röhren Konzentrator Tube Concentrator=Röhren Konzentrator +### controller.lua ### + +Cooling failed=Kühlung ausgefallen +Magnet detection error@n(@1% found / 100% expected)=Magneterkennungsfehler@n(@1% erkannt / 100% erwartet) +Nucleus detection error=Kern nicht erkannt +Shell shape error@n(@1% found / 100% expected)=Hüllenformfehler@n(@1% erkannt / 100% erwartet) +TA5 Fusion Reactor Controller=TA5 Fusionsreaktor Controller +Tokamak shape error=Tokamakformfehler + +### controller.lua ### +### heatexchanger2.lua ### + +No power=Kein Strom + ### cooking.lua ### TA3 Melting=TA3 Schmelzen @@ -383,6 +402,7 @@ TA4 LEDs=TA4 LEDs TA4 RAM Chip=RAM Chip TA4 WLAN Chip=TA4 WLAN Chip TA5 AI Chip=TA5 KI Chip +TA5 AI Chip II=TA5 KI Chip II WLAN Chip=WLAN Chip ### electronic_fab.lua ### @@ -523,6 +543,11 @@ Furnace Top=Ofenoberteil Outp=Ergeb. no fuel or no power=kein Strom oder Brennstoff +### gas_pipe.lua ### + +TA5 Junction Pipe=TA5 Leitungskupplung +TA5 Pipe=TA5 Leitung + ### gateblock.lua ### TechAge Gate Block=TechAge Torblock @@ -535,6 +560,7 @@ TA2 Gearbox=TA2 Getriebeblock TA3 Generator=TA3 Generator TA4 Generator=TA4 Generator +TA5 Generator=TA5 Generator ### generator.lua ### ### power_terminal2.lua ### @@ -571,6 +597,7 @@ TA4 LED Grow Light=TA4 LED Pflanzenlampe No plan available=Kein Plan verfügar Plan=Plan +Sectional view=Schnittbild Side view=Seitenansicht Top view=Draufsicht @@ -590,13 +617,18 @@ TA4 Furnace Heater=TA4 Ofenheizung ### heatexchanger1.lua ### TA4 Heat Exchanger 1=TA4 Wärmetauscher 1 +TA5 Heat Exchanger 1=TA5 Wärmetauscher 1 ### heatexchanger2.lua ### -No power=Kein Strom +Blue pipe connection error@n(@1 found / @2 expected)=Verbindungsfehler blaue Leitung@n(@1 erkannt / @2 erwartet) +Cooler error=Kühlungsfehler +Green pipe connection error@n(@1 found / @2 expected)=Verbindungsfehler grüne Leitung@n(@1 erkannt / @2 erwartet) Power network connection error=Stromnetz Verbindungsfehler TA4 Heat Exchanger=TA4 Wärmetauscher TA4 Heat Exchanger 2=TA4 Wärmetauscher 2 +TA5 Heat Exchanger 2=TA5 Wärmetauscher 2 +Turbine error= did you check the plan?=hast du den Plan geprüft? inlet/pipe error=Einlass/Leitungsfehler wrong storage diameter=Falscher Wärmespeicher-Durchmesser @@ -604,6 +636,7 @@ wrong storage diameter=Falscher Wärmespeicher-Durchmesser ### heatexchanger3.lua ### TA4 Heat Exchanger 3=TA4 Wärmetauscher 3 +TA5 Heat Exchanger 3=TA5 Wärmetauscher 3 ### hydrogen.lua ### @@ -770,6 +803,10 @@ TA4 Collider Detector Magnet=TA4 Collider Detektormagnet TA4 Collider Magnet=TA4 Collider Magnet TA4 Collider Magnet Base=TA4 Collider Magnetfuß TA4 Collider Steel Block=TA4 Collider Stahlblock +TA5 Fusion Reactor Magnet 1=TA5 Fusionsreaktor Magnet 1 +TA5 Fusion Reactor Magnet 2=TA5 Fusionsreaktor Magnet 2 +TA5 Fusion Reactor Magnet Blank=TA5 Fusionsreaktor Magnetrohling +TA5 Fusion Reactor Magnet Shield=TA5 Fusionsreaktor Magnetschild ### mba_detector.lua ### @@ -906,6 +943,7 @@ TA4 Player Detector=TA4 Spieler Detektor Aluminum Powder=Aluminium Pulver Clay Powder=Ton Pulver +Graphite Powder=Graphitpulver Iron Powder=Eisen Pulver Leave Powder=Laub Pulver Needle Powder=Nadel Pulver @@ -967,6 +1005,10 @@ Allow to dig/place Techage power lines nearby power poles=Erlaubt TODO TA3 Pump=TA3 Pumpe TA4 Pump=TA4 Pumpe + +### pump.lua ### +### ta5_pump.lua ### + Total flow rate=Gesamtdurchfluss Total flow rate in liquid units=Gesamtdurchfluss in Flüssigkeitseinheiten @@ -1094,6 +1136,11 @@ the timeslot when the command is executed.@n=der Zeitpunkt, wenn der Befehl ausg Cancel=Abbruch +### shell.lua ### + +TA5 Fusion Reactor Nucleus=TA5 Fusionsreaktor Kern +TA5 Fusion Reactor Shell=TA5 Fusionsreaktor Hülle + ### signallamp.lua ### TA4 Wind Turbine Signal Lamp=TA4 Windkraftanlagenlampe @@ -1262,6 +1309,10 @@ no power=kein Strom TA5 Hyperloop Chest=TA5 Hyperloop Kiste +### ta5_pump.lua ### + +TA5 Pump=TA5 Pumpe + ### ta5_tank.lua ### TA5 Hyperloop Tank=TA5 Hyperloop Tank @@ -1348,6 +1399,7 @@ TA4 Tube=TA4 Röhre TA3 Turbine=TA3 Turbine TA4 Turbine=TA4 Turbine +TA5 Turbine=TA5 Turbine ### turncontroller.lua ### diff --git a/locale/template.txt b/locale/template.txt index 6d1ce2d..bb17203 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -97,6 +97,10 @@ TA3 Boiler Base= To add water punch@nthe boiler@nwith a water bucket= Water Boiler= + +### boiler_lib.lua ### +### heatexchanger2.lua ### + water temperature= ### boiler_top.lua ### @@ -197,6 +201,7 @@ Cement Powder= TA4 Ceramic Material= TA4 Furnace Ceramic= TA4 Round Ceramic= +TA5 Ceramic Turbine= ### charcoalpile.lua ### @@ -232,6 +237,20 @@ TA4 State Collector= TA4 Tube Concentrator= Tube Concentrator= +### controller.lua ### + +Cooling failed= +Magnet detection error@n(@1% found / 100% expected)= +Nucleus detection error= +Shell shape error@n(@1% found / 100% expected)= +TA5 Fusion Reactor Controller= +Tokamak shape error= + +### controller.lua ### +### heatexchanger2.lua ### + +No power= + ### cooking.lua ### TA3 Melting= @@ -383,6 +402,7 @@ TA4 LEDs= TA4 RAM Chip= TA4 WLAN Chip= TA5 AI Chip= +TA5 AI Chip II= WLAN Chip= ### electronic_fab.lua ### @@ -523,6 +543,11 @@ Furnace Top= Outp= no fuel or no power= +### gas_pipe.lua ### + +TA5 Junction Pipe= +TA5 Pipe= + ### gateblock.lua ### TechAge Gate Block= @@ -535,6 +560,7 @@ TA2 Gearbox= TA3 Generator= TA4 Generator= +TA5 Generator= ### generator.lua ### ### power_terminal2.lua ### @@ -571,6 +597,7 @@ TA4 LED Grow Light= No plan available= Plan= +Sectional view= Side view= Top view= @@ -590,13 +617,18 @@ TA4 Furnace Heater= ### heatexchanger1.lua ### TA4 Heat Exchanger 1= +TA5 Heat Exchanger 1= ### heatexchanger2.lua ### -No power= +Blue pipe connection error@n(@1 found / @2 expected)= +Cooler error= +Green pipe connection error@n(@1 found / @2 expected)= Power network connection error= TA4 Heat Exchanger= TA4 Heat Exchanger 2= +TA5 Heat Exchanger 2= +Turbine error= did you check the plan?= inlet/pipe error= wrong storage diameter= @@ -604,6 +636,7 @@ wrong storage diameter= ### heatexchanger3.lua ### TA4 Heat Exchanger 3= +TA5 Heat Exchanger 3= ### hydrogen.lua ### @@ -770,6 +803,10 @@ TA4 Collider Detector Magnet= TA4 Collider Magnet= TA4 Collider Magnet Base= TA4 Collider Steel Block= +TA5 Fusion Reactor Magnet 1= +TA5 Fusion Reactor Magnet 2= +TA5 Fusion Reactor Magnet Blank= +TA5 Fusion Reactor Magnet Shield= ### mba_detector.lua ### @@ -906,6 +943,7 @@ TA4 Player Detector= Aluminum Powder= Clay Powder= +Graphite Powder= Iron Powder= Leave Powder= Needle Powder= @@ -967,6 +1005,10 @@ Allow to dig/place Techage power lines nearby power poles= TA3 Pump= TA4 Pump= + +### pump.lua ### +### ta5_pump.lua ### + Total flow rate= Total flow rate in liquid units= @@ -1094,6 +1136,11 @@ the timeslot when the command is executed.@n= Cancel= +### shell.lua ### + +TA5 Fusion Reactor Nucleus= +TA5 Fusion Reactor Shell= + ### signallamp.lua ### TA4 Wind Turbine Signal Lamp= @@ -1262,6 +1309,10 @@ no power= TA5 Hyperloop Chest= +### ta5_pump.lua ### + +TA5 Pump= + ### ta5_tank.lua ### TA5 Hyperloop Tank= @@ -1348,6 +1399,7 @@ TA4 Tube= TA3 Turbine= TA4 Turbine= +TA5 Turbine= ### turncontroller.lua ### diff --git a/manuals/manual_ta5_DE.md b/manuals/manual_ta5_DE.md index 599594b..29f1124 100644 --- a/manuals/manual_ta5_DE.md +++ b/manuals/manual_ta5_DE.md @@ -8,7 +8,61 @@ Für die Herstellung und Nutzung von TA5 Maschinen und Blöcken sind Erfahrungsp ## Energiequellen -### TA5 Fusionsreaktor (geplant) +### TA5 Fusionsreaktor + +Kernfusion bedeutet das Verschmelzen zweier Atomkerne. Dabei können, je nach Reaktion, große Mengen von Energie freigesetzt werden. Kernfusionen, bei denen Energie frei wird, laufen in Form von Kettenreaktionen ab. Sie sind die Quelle der Energie der Sterne, zum Beispiel auch unserer Sonne. Ein Fusionsreaktor wandelt die Energie, die bei einer kontrollierten Kernfusion frei wird, in elektrischen Strom um. + +**Wie funktionieren ein Fusionsreaktor?** + +Ein Fusionsreaktor funktioniert nach dem klassischen Prinzip eines Wärmekraftwerks: Wasser wird erhitzt und treibt eine Dampfturbine an, deren Bewegungsenergie von einem Generator in Strom gewandelt wird. + +Ein Fusionskraftwerk benötigt zunächst eine hohe Menge an Energie, da ein Plasma erzeugt werden muss. „Plasma“ nennt man den vierten Zustand von Stoffen, nach fest, flüssig und gasförmig. Dafür wird viel Strom benötigt. Erst durch diese extreme Energiekonzentration zündet die Fusionsreaktion und mit der abgegebenen Wärme wird über den Wärmetauscher Strom erzeugt. Der Generator liefert dann 800 ku an Strom. + +Der Plan rechts zeigt einen Schnitt durch den Fusionsreaktor. + +Für den Betrieb des Fusionsreaktors werden 60 Erfahrungspunkte benötigt. Der Fusionsreaktur muss komplett in einem Forceload Block Bereich aufgebaut werden. + +[ta5_fusion_reactor|plan] + +#### TA5 Fusionreaktor Magnet + +Für den Aufbau des Fusionsreaktor werden insgesamt 60 TA5 Fusionreaktor Magnete benötigt. Diese bilden den Ring, in dem sich das Plasma bildet. Der TA5 Fusionsreaktor Magnete benötigt Strom und hat zwei Anschlüsse für die Kühlung. + +Es gibt zwei Typen von Magneten, so dass auch alle Seiten des Magnets, die zum Plasmaring zeigen, mit einem Hitzeschild geschützt werden können. + +Bei den Eckmagneten auf der Innenseite des Rings ist jeweils eine Anschlussseite verdeckt (Strom oder Kühlung) und kann daher nicht angeschlossen werden. Dies ist technisch nicht machbar und hat daher keinen Einfluß auf die Funktion des Fusionsreaktor. + +[ta5_magnet|image] + +#### TA5 Pumpe + +Die Pumpe wird benötigt, um den Kühlkreislauf mit Isobutan zu füllen. Es werden ca. 350 Einheiten Isobutan benötigt. + +[ta5_pump|image] + +#### TA5 Wärmetauscher + +Der TA5 Wärmetauscher wird benötigt, um die im Fusionsreaktor erzeugte Hitze zuerst in Dampf und dann in Strom umzuwandeln. Der Wärmetauscher selbst benötigt dazu 5 ku Strom. Der Aufbau gleicht dem Wärmetauscher des Energiespeichers aus TA4. + +[ta5_heatexchanger|plan] + +#### TA5 Fusionreaktor Controller + +Über den TA5 Fusionreaktor Controller wird der Fusionreaktors eingeschaltet. Dabei muss zuerst die Kühlung/Wärmetauscher und dann der Controller eingeschaltet werden. Es dauert ca. 2 min, bis der Reaktor in Gang kommt und Strom liefert. Der Fusionreaktor und damit der Controller benötigt 400 ku an Strom, um das Plasma aufrecht zu erhalten. + +[ta5_fr_controller|image] + +#### TA5 Fusionreaktor Hülle + +Der komplette Reaktor muss mit einer Hülle umgeben werden, die den enormen Druck, den die Magnete auf das Plasma ausüben, abfängt und die Umgebung vor Strahlung schützt. Ohne diese Hülle kann der Reaktor nicht gestartet werden. Mit der TechAge Kelle können auch Stromkabel und Kühlleitungen des Fusionreaktors in die Hülle integriert werden. + +[ta5_fr_shell|image] + +#### TA5 Fusionreaktor Kern + +Der Kern muss in der Mitte des Reaktors sitzen. Siehe Abbildung unter "TA5 Fusionsreaktor". Auch hierfür wird die TechAge Kelle benötigt. + +[ta5_fr_nucleus|image] ## Energiespeicher diff --git a/manuals/manual_ta5_EN.md b/manuals/manual_ta5_EN.md index f61e370..fea4a84 100644 --- a/manuals/manual_ta5_EN.md +++ b/manuals/manual_ta5_EN.md @@ -8,7 +8,61 @@ Experience points are required for the manufacture and use of TA5 machines and b ## Energy Sources -### TA5 Fusion Reactor (planned) +### TA5 Fusion Reactor + +Nuclear fusion means the fusing of two atomic nuclei. Depending on the reaction, large amounts of energy can be released. Nuclear fusions, in which energy is released, take place in the form of chain reactions. They are the source of the energy of the stars, including our sun, for example. A fusion reactor converts the energy released during controlled nuclear fusion into electricity. + +**How ​​do fusion reactors work?** + +A fusion reactor works according to the classic principle of a thermal power plant: water is heated and drives a steam turbine, whose kinetic energy is converted into electricity by a generator. + +A fusion power plant initially requires a large amount of energy, since a plasma has to be generated. "Plasma" is the name given to the fourth state of matter, after solid, liquid and gaseous. This requires a lot of electricity. Only through this extreme concentration of energy does the fusion reaction ignite and the heat given off is used to generate electricity via the heat exchanger. The generator then delivers 800 ku of electricity. + +The plan on the right shows a section through the fusion reactor. + +60 experience points are required to operate the fusion reactor. The fusion reactor must be built entirely in a forceload block area. + +[ta5_fusion_reactor|plan] + +#### TA5 Fusion Reactor Magnet + +A total of 60 TA5 Fusion Reactor Magnets are required to set up the fusion reactor. These form the ring in which the plasma forms. The TA5 Fusion Reactor Magnets requires power and has two ports for cooling. + +There are two types of magnets, so all sides of the magnet that face the plasma ring can also be protected with a heat shield. + +With the corner magnets on the inside of the ring, one connection side is covered (power or cooling) and can therefore not be connected. This is technically not feasible and therefore has no influence on the function of the fusion reactor. + +[ta5_magnet|image] + +#### TA5 Pump + +The pump is required to fill the cooling circuit with isobutane. About 350 units of isobutane are required. + +[ta5_pump|image] + +#### TA5 Heat Exchanger + +The TA5 Heat Exchanger is required to convert the heat generated in the fusion reactor first to steam and then to electricity. The Heat Exchanger itself requires 5 ku electricity. The structure is similar to the Heat Exchanger of the energy store from TA4. + +[ta5_heatexchanger|plan] + +#### TA5 Fusion Reactor Controller + +The fusion reactor is switched on via the TA5 Fusion Reactor Controller. The cooling/Heat Exchanger must be switched on first and then the controller. It takes about 2 minutes for the reactor to start up and supply electricity. The fusion reactor and thus the controller requires 400 ku of electricity to maintain the plasma. + +[ta5_fr_controller|image] + +#### TA5 Fusion Reactor Shell + +The entire reactor must be surrounded by a shell that absorbs the enormous pressure that the magnets exert on the plasma and protects the environment from radiation. Without this shell, the reactor cannot be started. With the TechAge Trowel, power cables and cooling pipes of the fusion reactor can also be integrated into the shell. + +[ta5_fr_shell|image] + +#### TA5 Fusion Reactor Core + +The core must sit in the center of the reactor. See illustration under "TA5 Fusion Reactor". The TechAge Trowel is also required for this. + +[ta5_fr_nucleus|image] ## Energy Storage diff --git a/manuals/toc_DE.md b/manuals/toc_DE.md index 593d91b..36fc807 100644 --- a/manuals/toc_DE.md +++ b/manuals/toc_DE.md @@ -229,7 +229,13 @@ - [TA4 Recycler](./manual_ta4_DE.md#ta4-recycler) - [TA5: Zukunft](./manual_ta5_DE.md#ta5:-zukunft) - [Energiequellen](./manual_ta5_DE.md#energiequellen) - - [TA5 Fusionsreaktor (geplant)](./manual_ta5_DE.md#ta5-fusionsreaktor-(geplant)) + - [TA5 Fusionsreaktor](./manual_ta5_DE.md#ta5-fusionsreaktor) + - [TA5 Fusionreaktor Magnet](./manual_ta5_DE.md#ta5-fusionreaktor-magnet) + - [TA5 Pumpe](./manual_ta5_DE.md#ta5-pumpe) + - [TA5 Wärmetauscher](./manual_ta5_DE.md#ta5-wärmetauscher) + - [TA5 Fusionreaktor Controller](./manual_ta5_DE.md#ta5-fusionreaktor-controller) + - [TA5 Fusionreaktor Hülle](./manual_ta5_DE.md#ta5-fusionreaktor-hülle) + - [TA5 Fusionreaktor Kern](./manual_ta5_DE.md#ta5-fusionreaktor-kern) - [Energiespeicher](./manual_ta5_DE.md#energiespeicher) - [TA5 Hybrid-Speicher (geplant)](./manual_ta5_DE.md#ta5-hybrid-speicher-(geplant)) - [Logik Blöcke](./manual_ta5_DE.md#logik-blöcke) diff --git a/manuals/toc_EN.md b/manuals/toc_EN.md index 7847f76..705a0a2 100644 --- a/manuals/toc_EN.md +++ b/manuals/toc_EN.md @@ -229,7 +229,13 @@ - [TA4 Recycler](./manual_ta4_EN.md#ta4-recycler) - [TA5: Future](./manual_ta5_EN.md#ta5:-future) - [Energy Sources](./manual_ta5_EN.md#energy-sources) - - [TA5 Fusion Reactor (planned)](./manual_ta5_EN.md#ta5-fusion-reactor-(planned)) + - [TA5 Fusion Reactor](./manual_ta5_EN.md#ta5-fusion-reactor) + - [TA5 Fusion Reactor Magnet](./manual_ta5_EN.md#ta5-fusion-reactor-magnet) + - [TA5 Pump](./manual_ta5_EN.md#ta5-pump) + - [TA5 Heat Exchanger](./manual_ta5_EN.md#ta5-heat-exchanger) + - [TA5 Fusion Reactor Controller](./manual_ta5_EN.md#ta5-fusion-reactor-controller) + - [TA5 Fusion Reactor Shell](./manual_ta5_EN.md#ta5-fusion-reactor-shell) + - [TA5 Fusion Reactor Core](./manual_ta5_EN.md#ta5-fusion-reactor-core) - [Energy Storage](./manual_ta5_EN.md#energy-storage) - [TA5 Hybrid Storage (planned)](./manual_ta5_EN.md#ta5-hybrid-storage-(planned)) - [Logic blocks](./manual_ta5_EN.md#logic-blocks) diff --git a/move_controller/flycontroller.lua b/move_controller/flycontroller.lua index b7790aa..7bdf96c 100644 --- a/move_controller/flycontroller.lua +++ b/move_controller/flycontroller.lua @@ -96,7 +96,7 @@ minetest.register_node("techage:ta5_flycontroller", { nvm.lpos1 = {} nvm.lpos2 = {} nvm.moveBA = false - nvm.running = true + nvm.running = nil meta:set_string("status", S("Recording...")) local name = player:get_player_name() minetest.chat_send_player(name, S("Click on all blocks that shall be moved")) @@ -109,7 +109,7 @@ minetest.register_node("techage:ta5_flycontroller", { if not err then meta:set_string("path", fields.path) end - nvm.running = false + nvm.running = nil local text = #pos_list.." "..S("block positions are stored.") meta:set_string("status", text) nvm.lpos1 = pos_list @@ -128,7 +128,7 @@ minetest.register_node("techage:ta5_flycontroller", { local name = player:get_player_name() mark.stop(name) nvm.moveBA = false - nvm.running = true + nvm.running = nil elseif fields.test then local path, err = fly.to_path(fields.path, MAX_DIST) if err then diff --git a/move_controller/movecontroller.lua b/move_controller/movecontroller.lua index 92e2348..ab000ec 100644 --- a/move_controller/movecontroller.lua +++ b/move_controller/movecontroller.lua @@ -112,7 +112,7 @@ minetest.register_node("techage:ta4_movecontroller", { nvm.lpos1 = {} nvm.lpos2 = {} nvm.moveBA = false - nvm.running = true + nvm.running = nil meta:set_string("status", S("Recording...")) local name = player:get_player_name() minetest.chat_send_player(name, S("Click on all blocks that shall be moved")) @@ -125,7 +125,7 @@ minetest.register_node("techage:ta4_movecontroller", { meta:set_string("path", fields.path) end local text = #pos_list.." "..S("block positions are stored.") - nvm.running = false + nvm.running = nil meta:set_string("status", text) nvm.lpos1 = pos_list mark.unmark_all(name) @@ -142,7 +142,7 @@ minetest.register_node("techage:ta4_movecontroller", { local name = player:get_player_name() mark.stop(name) nvm.moveBA = false - nvm.running = true + nvm.running = nil elseif fields.moveAB then meta:set_string("status", "") if fly.move_to_other_pos(pos, false) then diff --git a/ta3_power/tiny_generator.lua b/ta3_power/tiny_generator.lua index 3b172bd..db82c46 100644 --- a/ta3_power/tiny_generator.lua +++ b/ta3_power/tiny_generator.lua @@ -127,10 +127,10 @@ local function node_timer(pos, elapsed) local fuel = has_fuel(pos, nvm) if running and not fuel then State:standby(pos, nvm, S("no fuel")) - stop_node(pos, nvm, State) + stop_node(pos, nvm, State) elseif not running and fuel then State:start(pos, nvm) - -- start_node() is called implicit + -- start_node() is called implicit elseif running then local meta = M(pos) local outdir = meta:get_int("outdir") @@ -166,7 +166,7 @@ end local function get_generator_data(pos, outdir, tlib2) local nvm = techage.get_nvm(pos) - if nvm.running and techage.is_running(nvm) then + if techage.is_running(nvm) then return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2} end end @@ -190,7 +190,6 @@ minetest.register_node("techage:tiny_generator", { after_place_node = function(pos, placer, itemstack) local nvm = techage.get_nvm(pos) local number = techage.add_node(pos, "techage:tiny_generator") - nvm.running = false nvm.burn_cycles = 0 if itemstack then local stack_meta = itemstack:get_meta() diff --git a/teleport/teleport_tube.lua b/teleport/teleport_tube.lua index 747a018..11517d3 100644 --- a/teleport/teleport_tube.lua +++ b/teleport/teleport_tube.lua @@ -154,16 +154,18 @@ techage.register_node({"techage:ta5_tele_tube"}, { local nvm = techage.get_nvm(pos) if techage.is_operational(nvm) then local rmt_pos = teleport.get_remote_pos(pos) - local rmt_nvm = techage.get_nvm(rmt_pos) - if techage.is_operational(rmt_nvm) then - local tube_dir = M(rmt_pos):get_int("tube_dir") - if techage.push_items(rmt_pos, tube_dir, stack) then - State:keep_running(pos, nvm, COUNTDOWN_TICKS) - State:keep_running(rmt_pos, rmt_nvm, COUNTDOWN_TICKS) - return true + if rmt_pos then + local rmt_nvm = techage.get_nvm(rmt_pos) + if techage.is_operational(rmt_nvm) then + local tube_dir = M(rmt_pos):get_int("tube_dir") + if techage.push_items(rmt_pos, tube_dir, stack) then + State:keep_running(pos, nvm, COUNTDOWN_TICKS) + State:keep_running(rmt_pos, rmt_nvm, COUNTDOWN_TICKS) + return true + end + else + State:blocked(pos, nvm, S("Remote block error")) end - else - State:blocked(pos, nvm, S("Remote block error")) end end return false diff --git a/textures/shrink.sh b/textures/shrink.sh deleted file mode 100755 index 36036c5..0000000 --- a/textures/shrink.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -pngquant --skip-if-larger --quality=80 --strip *.png --ext .png --force \ No newline at end of file diff --git a/textures/techage_aichip.png b/textures/techage_aichip.png index 58dfd32..85403ae 100644 Binary files a/textures/techage_aichip.png and b/textures/techage_aichip.png differ diff --git a/textures/techage_appl_hole_ta5_pipe1.png b/textures/techage_appl_hole_ta5_pipe1.png new file mode 100644 index 0000000..fa8de79 Binary files /dev/null and b/textures/techage_appl_hole_ta5_pipe1.png differ diff --git a/textures/techage_appl_hole_ta5_pipe2.png b/textures/techage_appl_hole_ta5_pipe2.png new file mode 100644 index 0000000..ab2e41e Binary files /dev/null and b/textures/techage_appl_hole_ta5_pipe2.png differ diff --git a/textures/techage_appl_plasma.png b/textures/techage_appl_plasma.png new file mode 100644 index 0000000..2cea306 Binary files /dev/null and b/textures/techage_appl_plasma.png differ diff --git a/textures/techage_appl_plasma4.png b/textures/techage_appl_plasma4.png new file mode 100644 index 0000000..eb3cd70 Binary files /dev/null and b/textures/techage_appl_plasma4.png differ diff --git a/textures/techage_ceramic_turbine.png b/textures/techage_ceramic_turbine.png new file mode 100644 index 0000000..d2f55e5 Binary files /dev/null and b/textures/techage_ceramic_turbine.png differ diff --git a/textures/techage_filling4_ta3.png b/textures/techage_filling4_ta3.png index 74c33a6..4576f68 100644 Binary files a/textures/techage_filling4_ta3.png and b/textures/techage_filling4_ta3.png differ diff --git a/textures/techage_filling8_ta3.png b/textures/techage_filling8_ta3.png index 3802a64..74739a3 100644 Binary files a/textures/techage_filling8_ta3.png and b/textures/techage_filling8_ta3.png differ diff --git a/textures/techage_filling_ta3.png b/textures/techage_filling_ta3.png index 0cd5219..fe5a214 100644 Binary files a/textures/techage_filling_ta3.png and b/textures/techage_filling_ta3.png differ diff --git a/textures/techage_filling_ta4.png b/textures/techage_filling_ta4.png index 8612391..8d0a03d 100644 Binary files a/textures/techage_filling_ta4.png and b/textures/techage_filling_ta4.png differ diff --git a/textures/techage_frame4_ta5.png b/textures/techage_frame4_ta5.png new file mode 100644 index 0000000..15c168d Binary files /dev/null and b/textures/techage_frame4_ta5.png differ diff --git a/textures/techage_frame8_ta5.png b/textures/techage_frame8_ta5.png new file mode 100644 index 0000000..bd643e1 Binary files /dev/null and b/textures/techage_frame8_ta5.png differ diff --git a/textures/techage_frameT_ta5.png b/textures/techage_frameT_ta5.png new file mode 100644 index 0000000..d6af881 Binary files /dev/null and b/textures/techage_frameT_ta5.png differ diff --git a/textures/techage_fusion_reactor.png b/textures/techage_fusion_reactor.png new file mode 100644 index 0000000..2516d4e Binary files /dev/null and b/textures/techage_fusion_reactor.png differ diff --git a/textures/techage_gas_inv.png b/textures/techage_gas_inv.png index 7565178..ea6868d 100644 Binary files a/textures/techage_gas_inv.png and b/textures/techage_gas_inv.png differ diff --git a/textures/techage_isobutane_inv.png b/textures/techage_isobutane_inv.png index 2189b67..432c96d 100644 Binary files a/textures/techage_isobutane_inv.png and b/textures/techage_isobutane_inv.png differ diff --git a/textures/techage_magnet_hole.png b/textures/techage_magnet_hole.png new file mode 100644 index 0000000..5e00e1e Binary files /dev/null and b/textures/techage_magnet_hole.png differ diff --git a/textures/techage_plasma.png b/textures/techage_plasma.png new file mode 100644 index 0000000..1e7cf86 Binary files /dev/null and b/textures/techage_plasma.png differ diff --git a/textures/techage_reactor_shell.png b/textures/techage_reactor_shell.png new file mode 100644 index 0000000..52165c9 Binary files /dev/null and b/textures/techage_reactor_shell.png differ diff --git a/textures/techage_steel_tiles.png b/textures/techage_steel_tiles.png new file mode 100644 index 0000000..21a25cd Binary files /dev/null and b/textures/techage_steel_tiles.png differ diff --git a/textures/techage_steel_tiles_side.png b/textures/techage_steel_tiles_side.png new file mode 100644 index 0000000..59fb186 Binary files /dev/null and b/textures/techage_steel_tiles_side.png differ diff --git a/textures/techage_steel_tiles_top.png b/textures/techage_steel_tiles_top.png new file mode 100644 index 0000000..95f1cf5 Binary files /dev/null and b/textures/techage_steel_tiles_top.png differ diff --git a/textures/techage_steel_tiles_top2.png b/textures/techage_steel_tiles_top2.png new file mode 100644 index 0000000..f5e2e7e Binary files /dev/null and b/textures/techage_steel_tiles_top2.png differ diff --git a/textures/techage_steel_tiles_top3.png b/textures/techage_steel_tiles_top3.png new file mode 100644 index 0000000..3eb4c8a Binary files /dev/null and b/textures/techage_steel_tiles_top3.png differ diff --git a/textures/techage_ta5_gaspipe.png b/textures/techage_ta5_gaspipe.png new file mode 100644 index 0000000..7f9106d Binary files /dev/null and b/textures/techage_ta5_gaspipe.png differ diff --git a/textures/techage_ta5_gaspipeB.png b/textures/techage_ta5_gaspipeB.png new file mode 100644 index 0000000..17659c4 Binary files /dev/null and b/textures/techage_ta5_gaspipeB.png differ diff --git a/textures/techage_ta5_gaspipe_hole.png b/textures/techage_ta5_gaspipe_hole.png new file mode 100644 index 0000000..821059d Binary files /dev/null and b/textures/techage_ta5_gaspipe_hole.png differ diff --git a/textures/techage_ta5_gaspipe_hole2.png b/textures/techage_ta5_gaspipe_hole2.png new file mode 100644 index 0000000..9097b83 Binary files /dev/null and b/textures/techage_ta5_gaspipe_hole2.png differ diff --git a/textures/techage_ta5_gaspipe_junction.png b/textures/techage_ta5_gaspipe_junction.png new file mode 100644 index 0000000..f5c44ad Binary files /dev/null and b/textures/techage_ta5_gaspipe_junction.png differ diff --git a/textures/techage_ta5_gaspipe_knee.png b/textures/techage_ta5_gaspipe_knee.png new file mode 100644 index 0000000..bafe337 Binary files /dev/null and b/textures/techage_ta5_gaspipe_knee.png differ diff --git a/textures/techage_ta5_gaspipe_knee2.png b/textures/techage_ta5_gaspipe_knee2.png new file mode 100644 index 0000000..d0ea469 Binary files /dev/null and b/textures/techage_ta5_gaspipe_knee2.png differ diff --git a/tools/repairkit.lua b/tools/repairkit.lua index eef67cd..2622a47 100644 --- a/tools/repairkit.lua +++ b/tools/repairkit.lua @@ -19,6 +19,9 @@ local Cable2 = techage.TA4_Cable local Pipe2 = techage.LiquidPipe local menu = techage.menu +local N = techage.get_node_lvm +local CTL = function(pos) return (minetest.registered_nodes[N(pos).name] or {}).control end + local function network_check(start_pos, Cable, player_name) -- local ndef = techage.networks.net_def(start_pos, Cable.tube_type) -- local outdir = nil @@ -61,17 +64,6 @@ local function read_state(itemstack, user, pointed_thing) minetest.chat_send_player(user:get_player_name(), S("Biome")..": "..name..", "..S("Position temperature")..": "..math.floor(data.heat).." ") end - if ndef and ndef.networks then - local player_name = user:get_player_name() - if ndef.networks.ele1 then - network_check(pos, Cable1, player_name) - elseif ndef.networks.ele2 then - network_check(pos, Cable2, player_name) - elseif ndef.networks.pipe2 then - network_check(pos, Pipe2, player_name) - end - end - if number then if ndef and ndef.description then local info = techage.send_single("0", number, "info", nil)