diff --git a/basis/mark2.lua b/basis/mark2.lua index 19cda66..6902c14 100644 --- a/basis/mark2.lua +++ b/basis/mark2.lua @@ -50,8 +50,8 @@ minetest.register_entity(":techage:position_cube", { }, --use_texture_alpha = true, physical = false, - visual_size = {x = 1.2, y = 1.2}, - collisionbox = {-0.6,-0.6,-0.6, 0.6,0.6,0.6}, + visual_size = {x = 1.1, y = 1.1}, + collisionbox = {-0.55,-0.55,-0.55, 0.55,0.55,0.55}, glow = 8, }, on_step = function(self, dtime) diff --git a/basis/networks.lua b/basis/networks.lua index 492fa80..2de2939 100644 --- a/basis/networks.lua +++ b/basis/networks.lua @@ -64,6 +64,16 @@ local function net_def2(node_name, net_name) return ndef and ndef.networks and ndef.networks[net_name] or {} end +local function connected(tlib2, pos, dir) + local param2, npos = tlib2:get_primary_node_param2(pos, dir) + if param2 then + local d1, d2, num = tlib2:decode_param2(npos, param2) + if not num then return end + return Flip[dir] == d1 or Flip[dir] == d2 + end + return false +end + -- Calculate the node outdir based on node.param2 and nominal dir (according to side) local function dir_to_outdir(dir, param2) if dir < 5 then @@ -115,7 +125,7 @@ local function node_connections(pos, tlib2) val = val * 2 local side = DirToSide[outdir_to_dir(dir, node.param2)] if sides[side] then - if tlib2:connected(pos, dir) then + if connected(tlib2, pos, dir) then val = val + 1 end end @@ -139,7 +149,7 @@ end -- check if the given pipe dir into the node is valid local function valid_indir(indir, node, net_name) local ndef = net_def2(node.name, net_name) - if not ndef or not ndef.sides or ndef.blocker then return false end + if not ndef or not ndef.sides then return false end local side = DirToSide[indir_to_dir(indir, node.param2)] if not ndef.sides[side] then return false end return true @@ -148,14 +158,17 @@ end -- do the walk through the tubelib2 network -- indir is the direction which should not be covered by the walk -- (coming from there or is a different network) -local function connection_walk(pos, indir, node, tlib2, clbk) +local function connection_walk(pos, indir, node, tlib2, lvl, clbk) if clbk then clbk(pos, indir, node) end - for _,outdir in pairs(get_node_connections(pos, tlib2.tube_type)) do - if outdir ~= Flip[indir] then - local pos2, indir2 = tlib2:get_connected_node_pos(pos, outdir) - local node = techage.get_node_lvm(pos2) - if pos2 and not pos_already_reached(pos2) and valid_indir(indir2, node, tlib2.tube_type) then - connection_walk(pos2, indir2, node, tlib2, clbk) + --techage.mark_position("singleplayer", pos, "walk", "", 1) + if lvl == 1 or net_def2(node.name, tlib2.tube_type).ntype == "junc" then + for _,outdir in pairs(get_node_connections(pos, tlib2.tube_type)) do + if outdir ~= Flip[indir] then + local pos2, indir2 = tlib2:get_connected_node_pos(pos, outdir) + local node = techage.get_node_lvm(pos2) + if pos2 and not pos_already_reached(pos2) and valid_indir(indir2, node, tlib2.tube_type) then + connection_walk(pos2, indir2, node, tlib2, lvl + 1, clbk) + end end end end @@ -170,7 +183,7 @@ local function collect_network_nodes(pos, outdir, tlib2) local node = techage.get_node_lvm(pos) local net_name = tlib2.tube_type -- outdir corresponds to the indir coming from - connection_walk(pos, outdir, node, tlib2, function(pos, indir, node) + connection_walk(pos, outdir, node, tlib2, 1, function(pos, indir, node) local ntype = net_def2(node.name, net_name).ntype if ntype then if not netw[ntype] then netw[ntype] = {} end @@ -233,7 +246,7 @@ function techage.networks.connection_walk(pos, outdir, tlib2, clbk) NumNodes = 0 pos_already_reached(pos) -- don't consider the start pos local node = techage.get_node_lvm(pos) - connection_walk(pos, outdir, node, tlib2, clbk) + connection_walk(pos, outdir, node, tlib2, 1, clbk) return NumNodes end diff --git a/chemistry/ta4_reactor.lua b/chemistry/ta4_reactor.lua index af11433..4c15f2c 100644 --- a/chemistry/ta4_reactor.lua +++ b/chemistry/ta4_reactor.lua @@ -30,7 +30,7 @@ minetest.register_node("techage:ta4_reactor", { description = S("TA4 Reactor"), tiles = {"techage_reactor_side.png"}, drawtype = "mesh", - mesh = "techage_boiler_huge.obj", + mesh = "techage_cylinder_12h.obj", selection_box = { type = "fixed", fixed = {-1/2, -23/32, -1/2, 1/2, 32/32, 1/2}, diff --git a/coal_power_station/boiler_base.lua b/coal_power_station/boiler_base.lua index ec68701..fc4d9cc 100644 --- a/coal_power_station/boiler_base.lua +++ b/coal_power_station/boiler_base.lua @@ -22,7 +22,7 @@ minetest.register_node("techage:coalboiler_base", { description = S("TA3 Boiler Base"), tiles = {"techage_coal_boiler_mesh_base.png"}, drawtype = "mesh", - mesh = "techage_boiler_large.obj", + mesh = "techage_cylinder_12.obj", selection_box = { type = "fixed", fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32}, diff --git a/coal_power_station/boiler_top.lua b/coal_power_station/boiler_top.lua index a044ac4..6a3c1e5 100644 --- a/coal_power_station/boiler_top.lua +++ b/coal_power_station/boiler_top.lua @@ -223,7 +223,7 @@ minetest.register_node("techage:coalboiler_top", { description = S("TA3 Boiler Top"), tiles = {"techage_coal_boiler_mesh_top.png"}, drawtype = "mesh", - mesh = "techage_boiler_large.obj", + mesh = "techage_cylinder_12.obj", selection_box = { type = "fixed", fixed = {-13/32, -48/32, -13/32, 13/32, 16/32, 13/32}, diff --git a/coal_power_station/firebox.lua b/coal_power_station/firebox.lua index a663efa..b583d4d 100644 --- a/coal_power_station/firebox.lua +++ b/coal_power_station/firebox.lua @@ -81,7 +81,7 @@ minetest.register_node("techage:coalfirebox", { inventory_image = "techage_coal_boiler_inv.png", tiles = {"techage_coal_boiler_mesh_top.png"}, drawtype = "mesh", - mesh = "techage_boiler_large.obj", + mesh = "techage_cylinder_12.obj", selection_box = { type = "fixed", fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32}, @@ -235,7 +235,7 @@ minetest.register_node("techage:oilfirebox", { inventory_image = "techage_oil_boiler_inv.png", tiles = {"techage_coal_boiler_mesh_top.png"}, drawtype = "mesh", - mesh = "techage_boiler_large.obj", + mesh = "techage_cylinder_12.obj", selection_box = { type = "fixed", fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32}, diff --git a/coal_power_station/power_terminal.lua b/coal_power_station/power_terminal.lua index 421fa59..a4df465 100644 --- a/coal_power_station/power_terminal.lua +++ b/coal_power_station/power_terminal.lua @@ -13,7 +13,7 @@ ]]-- -- for lazy programmers -local P2P = minetest.string_to_pos +local S2P = minetest.string_to_pos local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end local M = minetest.get_meta local N = function(pos) return minetest.get_node(pos).name end @@ -62,8 +62,10 @@ local function collect_network_data(pos, mem) add(data.fcel, mem, mem.pwr_available, mem.provided) elseif node.name == "techage:ta4_electrolyzer" or node.name == "techage:ta4_electrolyzer_on" then add(data.elec, mem, -(mem.pwr_could_need or 0), -(mem.consumed or 0)) - elseif mem.pwr_needed and mem.pwr_needed > 0 and (mem.pwr_node_alive_cnt or 0) > 0 then - add(data.other, mem, -(mem.pwr_needed or 0), (-mem.pwr_needed or 0)) + elseif mem.pwr_needed and mem.pwr_needed > 0 then + local nomi = -mem.pwr_needed + local real = (mem.pwr_node_alive_cnt or 0) > 0 and -mem.pwr_needed + add(data.other, mem, nomi, real) end end ) @@ -74,7 +76,7 @@ local function formspec(pos, mem) local data, nnodes = collect_network_data(pos, mem) local get = function(kind) return (data[kind].load or 0).." / "..(data[kind].num or 0).." : ".. - (data[kind].curr or 0).." / "..(data[kind].nomi or 0).. " ku" + (data[kind].real or 0).." / "..(data[kind].nomi or 0).. " ku" end local alarm = "" diff --git a/doc/manual_DE.lua b/doc/manual_DE.lua index 7c8ff24..c4553b5 100644 --- a/doc/manual_DE.lua +++ b/doc/manual_DE.lua @@ -416,6 +416,8 @@ techage.manual_DE.aText = { "Teil des Kraftwerks. \n".. "Der Ölbrenner kann nur mit Öl gefüllt werden. Die Brenndauer ist abhängig von der Leistung\\, die vom Kraftwerk angefordert wird. Unter Volllast brennt Öl 20 s. Unter Teillast entsprechend länger (50% Last = doppelte Zeit).\n".. "\n".. + "Der Ölbrenner kann nur 50 Einheiten Öl aufnehmen. Ein zusätzlicher Öltank und eine Ölpumpe sind daher ratsam.\n".. + "\n".. "\n".. "\n", "Teil des Kraftwerk. Muss mit Wasser gefüllt werden. Wem kein Wasser mehr vorhanden ist oder die Temperatur zu weit absinkt\\, schaltet sich der Boiler ab.\n".. @@ -497,6 +499,8 @@ techage.manual_DE.aText = { "\n", "Der kleine Stromgenerator wird mit Erdöl betrieben und kann für kleine Verbraucher mit bis zu 12 ku genutzt werden. Unter Volllast brennt Erdöl 100 s. Unter Teillast entsprechend länger (50% Last = doppelte Zeit).\n".. "\n".. + "Der Stromgenerator kann nur 50 Einheiten Öl aufnehmen. Ein zusätzlicher Öltank und eine Ölpumpe sind daher ratsam.\n".. + "\n".. "\n".. "\n", "Der Akku Block dient zur Speicherung von überschüssiger Energie und gibt bei Stromausfall automatisch Strom ab (soweit vorhanden).\n".. @@ -524,6 +528,8 @@ techage.manual_DE.aText = { "\n", "Ist Teil des TA3 Industrieofen. Muss mit Öl befeuert werden.\n".. "\n".. + "Der Ölbrenner kann nur 50 Einheiten Öl aufnehmen. Ein zusätzlicher Öltank und eine Ölpumpe sind daher ratsam.\n".. + "\n".. "\n".. "\n", "Ist Teil des TA3 Industrieofen. Siehe TA3 Industrieofen.\n".. @@ -790,6 +796,10 @@ techage.manual_DE.aText = { "\n".. "Die TA3 Pumpe pumpt 4 Einheiten Flüssigkeit alle zwei Sekunden.\n".. "\n".. + "Hinweis 1: Die Pumpe darf nicht direkt neben den Tank platziert werden. Es muss immer mindestens ein Stück gelbe Leitung dazwischen sein.\n".. + "\n".. + "Hinweis 2: Nach dem Starten markiert die Pumpe 10 x die Blöcke\\, von und zu denen gepumpt wird.\n".. + "\n".. "\n".. "\n", "", diff --git a/energy_storage/inlet.lua b/energy_storage/inlet.lua index b0d04c1..f8cbbff 100644 --- a/energy_storage/inlet.lua +++ b/energy_storage/inlet.lua @@ -75,6 +75,7 @@ local function get_radius(pos, in_dir) return radius end end + return 1 end local function check_volume(pos, in_dir, owner) diff --git a/init.lua b/init.lua index eee810f..8c3aef4 100644 --- a/init.lua +++ b/init.lua @@ -164,6 +164,8 @@ else dofile(MP.."/oil/drillbox.lua") dofile(MP.."/oil/pumpjack.lua") dofile(MP.."/oil/generator.lua") + --dofile(MP.."/oil/distiller.lua") + --dofile(MP.."/oil/reboiler.lua") -- Nodes2 if techage.basalt_stone_enabled then @@ -216,7 +218,6 @@ else -- Chemistry --dofile(MP.."/chemistry/ta4_reactor.lua") --dofile(MP.."/chemistry/ta4_doser.lua") - --dofile(MP.."/chemistry/ta4_distiller.lua") -- Hydrogen dofile(MP.."/hydrogen/hydrogen.lua") diff --git a/liquids/liquid.lua b/liquids/liquid.lua index 4c48551..742522a 100644 --- a/liquids/liquid.lua +++ b/liquids/liquid.lua @@ -111,14 +111,17 @@ end -- Add given amount of liquid to the remote inventory. -- return leftover amount -function techage.liquid.put(pos, outdir, name, amount) +function techage.liquid.put(pos, outdir, name, amount, player_name) for _,item in ipairs(get_network_table(pos, outdir, "tank")) do local liquid = LQD(item.pos) if liquid and liquid.put and liquid.peek then -- wrong items? local peek = liquid.peek(item.pos, item.indir) if peek and peek ~= name then return amount or 0 end - --techage.mark_position("singleplayer", item.pos, "put", "", 1) ------------------- debug + if player_name then + local num = techage.get_node_number(pos) + techage.mark_position(player_name, item.pos, "("..num..") put", "", 1) + end amount = liquid.put(item.pos, item.indir, name, amount) if not amount or amount == 0 then break end end @@ -128,13 +131,16 @@ end -- Take given amount of liquid for the remote inventory. -- return taken amount and item name -function techage.liquid.take(pos, outdir, name, amount) +function techage.liquid.take(pos, outdir, name, amount, player_name) local taken = 0 local item_name = nil for _,item in ipairs(get_network_table(pos, outdir, "tank")) do local liquid = LQD(item.pos) if liquid and liquid.take then - --techage.mark_position("singleplayer", item.pos, "take", "", 1) ------------------- debug + if player_name then + local num = techage.get_node_number(pos) + techage.mark_position(player_name, item.pos, "("..num..") take", "", 1) + end local val, name = liquid.take(item.pos, item.indir, name, amount - taken) if val and name then taken = taken + val diff --git a/liquids/liquid_pipe.lua b/liquids/liquid_pipe.lua index d8cc143..3327108 100644 --- a/liquids/liquid_pipe.lua +++ b/liquids/liquid_pipe.lua @@ -25,6 +25,7 @@ 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 = true, tube_type = "pipe", primary_node_names = {"techage:ta3_pipeS", "techage:ta3_pipeA"}, secondary_node_names = {}, diff --git a/liquids/pump.lua b/liquids/pump.lua index d2b2472..911048a 100644 --- a/liquids/pump.lua +++ b/liquids/pump.lua @@ -21,11 +21,31 @@ local networks = techage.networks local liquid = techage.liquid local Flip = techage.networks.Flip -local STANDBY_TICKS = 10 -local COUNTDOWN_TICKS = 10 +local STANDBY_TICKS = 5 +local COUNTDOWN_TICKS = 5 local CYCLE_TIME = 2 local CAPA = 4 +-- to mark the pump source and destinstion node +local DebugCache = {} + +local function set_starter_name(pos, clicker) + local key = minetest.hash_node_position(pos) + DebugCache[key] = {starter = clicker:get_player_name(), count = 10} +end + +local function get_starter_name(pos) + local key = minetest.hash_node_position(pos) + local def = DebugCache[key] + if def then + def.count = (def.count or 0) - 1 + if def.count > 0 then + return def.starter + end + DebugCache[key] = nil + end +end + local State3 = techage.NodeStates:new({ node_name_passive = "techage:t3_pump", node_name_active = "techage:t3_pump_on", @@ -44,9 +64,10 @@ local State4 = techage.NodeStates:new({ local function pumping(pos, mem, state, capa) local outdir = M(pos):get_int("outdir") - local taken, name = liquid.take(pos, Flip[outdir], nil, capa) + local starter = get_starter_name(pos) + local taken, name = liquid.take(pos, Flip[outdir], nil, capa, starter) if taken > 0 then - local leftover = liquid.put(pos, outdir, name, taken) + local leftover = liquid.put(pos, outdir, name, taken, starter) if leftover and leftover > 0 then liquid.put(pos, Flip[outdir], name, leftover) state:blocked(pos, mem) @@ -89,10 +110,12 @@ end local function on_rightclick(pos, node, clicker) local mem = tubelib2.get_mem(pos) if node.name == "techage:t3_pump" then + set_starter_name(pos, clicker) State3:start(pos, mem) elseif node.name == "techage:t3_pump_on" then State3:stop(pos, mem) elseif node.name == "techage:t4_pump" then + set_starter_name(pos, clicker) State4:start(pos, mem) elseif node.name == "techage:t4_pump_on" then State4:stop(pos, mem) @@ -187,7 +210,6 @@ local nworks = { pipe = { sides = {L = 1, R = 1}, -- Pipe connection side ntype = "pump", - blocker = true, -- for the connection_walk }, } diff --git a/liquids/tank.lua b/liquids/tank.lua index e92ff45..6dfc280 100644 --- a/liquids/tank.lua +++ b/liquids/tank.lua @@ -238,15 +238,15 @@ minetest.register_node("techage:oiltank", { paramtype = "light", node_box = { type = "fixed", - fixed = {-6/8, -6/8, -6/8, 6/8, 6/8, 6/8}, + fixed = {-6/8, -4/8, -6/8, 6/8, 6/8, 6/8}, }, selection_box = { type = "fixed", - fixed = {-6/8, -6/8, -6/8, 6/8, 6/8, 6/8}, + fixed = {-6/8, -4/8, -6/8, 6/8, 6/8, 6/8}, }, collision_box = { type = "fixed", - fixed = {-6/8, -6/8, -6/8, 6/8, 6/8, 6/8}, + fixed = {-6/8, -4/8, -6/8, 6/8, 6/8, 6/8}, }, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/manuals/manual_ta3_DE.md b/manuals/manual_ta3_DE.md index 103b61d..2ae0665 100644 --- a/manuals/manual_ta3_DE.md +++ b/manuals/manual_ta3_DE.md @@ -38,6 +38,9 @@ Die Feuerbox muss mit Kohle, Holzkohle oder Erdöl gefüllt werden. Die Brenndau Teil des Kraftwerks. Der Ölbrenner kann nur mit Öl gefüllt werden. Die Brenndauer ist abhängig von der Leistung, die vom Kraftwerk angefordert wird. Unter Volllast brennt Öl 20 s. Unter Teillast entsprechend länger (50% Last = doppelte Zeit). +Der Ölbrenner kann nur 50 Einheiten Öl aufnehmen. Ein zusätzlicher Öltank und eine Ölpumpe sind daher ratsam. + + [ta3_oilbox|image] @@ -162,6 +165,9 @@ siehe TA Stromschalter. Der kleine Stromgenerator wird mit Erdöl betrieben und kann für kleine Verbraucher mit bis zu 12 ku genutzt werden. Unter Volllast brennt Erdöl 100 s. Unter Teillast entsprechend länger (50% Last = doppelte Zeit). +Der Stromgenerator kann nur 50 Einheiten Öl aufnehmen. Ein zusätzlicher Öltank und eine Ölpumpe sind daher ratsam. + + [ta3_tinygenerator|image] @@ -194,6 +200,7 @@ Der Industrieofen benötigt Strom (für das Gebläse) sowie Öl für den Brenner Die Brennzeit für Öl beträgt 80 s. + [ta3_furnace|plan] @@ -201,6 +208,8 @@ Die Brennzeit für Öl beträgt 80 s. Ist Teil des TA3 Industrieofen. Muss mit Öl befeuert werden. +Der Ölbrenner kann nur 50 Einheiten Öl aufnehmen. Ein zusätzlicher Öltank und eine Ölpumpe sind daher ratsam. + [ta3_furnacefirebox|image] @@ -568,6 +577,10 @@ Mit der Pumpe können Flüssigkeiten von Tanks oder Behältern zu anderen Tanks Die TA3 Pumpe pumpt 4 Einheiten Flüssigkeit alle zwei Sekunden. +Hinweis 1: Die Pumpe darf nicht direkt neben den Tank platziert werden. Es muss immer mindestens ein Stück gelbe Leitung dazwischen sein. + +Hinweis 2: Nach dem Starten markiert die Pumpe 10 x die Blöcke, von und zu denen gepumpt wird. + [ta3_pump|image] diff --git a/models/size.py b/models/size.py new file mode 100644 index 0000000..620294c --- /dev/null +++ b/models/size.py @@ -0,0 +1,9 @@ +lOut = [] +for line in file("techage_boiler_large.obj"): + words = line.split(" ") + if words[0] == "v": + words[1] = "%1.6f" % (float(words[1]) * 1.2) + words[3] = "%1.6f" % (float(words[3]) * 1.2) + line = " ".join(words) + lOut.append(line.strip()) +file("techage_boiler_bigger.obj", "wt").write("\n".join(lOut)) diff --git a/models/techage_pillar.obj b/models/techage_cylinder_07.obj similarity index 100% rename from models/techage_pillar.obj rename to models/techage_cylinder_07.obj diff --git a/models/techage_boiler.obj b/models/techage_cylinder_09.obj similarity index 100% rename from models/techage_boiler.obj rename to models/techage_cylinder_09.obj diff --git a/models/techage_boiler_large.obj b/models/techage_cylinder_12.obj similarity index 100% rename from models/techage_boiler_large.obj rename to models/techage_cylinder_12.obj diff --git a/models/techage_boiler_huge.obj b/models/techage_cylinder_12h.obj similarity index 100% rename from models/techage_boiler_huge.obj rename to models/techage_cylinder_12h.obj diff --git a/models/techage_cylinder_14.obj b/models/techage_cylinder_14.obj new file mode 100644 index 0000000..85c47e8 --- /dev/null +++ b/models/techage_cylinder_14.obj @@ -0,0 +1,124 @@ +# Blender v2.78 (sub 0) OBJ File: 'oven.blend' +# www.blender.org +o Cylinder +v 0.000000 -0.500000 -0.720000 +v 0.000000 0.500000 -0.720000 +v 0.275532 -0.500000 -0.665194 +v 0.275532 0.500000 -0.665194 +v 0.509117 -0.500000 -0.509117 +v 0.509117 0.500000 -0.509117 +v 0.665194 -0.500000 -0.275532 +v 0.665194 0.500000 -0.275532 +v 0.720000 -0.500000 0.000000 +v 0.720000 0.500000 0.000000 +v 0.665194 -0.500000 0.275532 +v 0.665194 0.500000 0.275532 +v 0.509117 -0.500000 0.509117 +v 0.509117 0.500000 0.509117 +v 0.275532 -0.500000 0.665194 +v 0.275532 0.500000 0.665194 +v 0.000000 -0.500000 0.720000 +v 0.000000 0.500000 0.720000 +v -0.275532 -0.500000 0.665194 +v -0.275532 0.500000 0.665194 +v -0.509117 -0.500000 0.509117 +v -0.509117 0.500000 0.509117 +v -0.665194 -0.500000 0.275532 +v -0.665194 0.500000 0.275532 +v -0.720000 -0.500000 -0.000000 +v -0.720000 0.500000 -0.000000 +v -0.665194 -0.500000 -0.275532 +v -0.665194 0.500000 -0.275532 +v -0.509117 -0.500000 -0.509117 +v -0.509117 0.500000 -0.509117 +v -0.275532 -0.500000 -0.665194 +v -0.275532 0.500000 -0.665194 +vt 0.5486 0.5000 +vt 0.5486 1.0000 +vt 0.4725 1.0000 +vt 0.4725 0.5000 +vt 0.4142 1.0000 +vt 0.4142 0.5000 +vt 1.0000 0.5000 +vt 1.0000 1.0000 +vt 0.9239 1.0000 +vt 0.9239 0.5000 +vt 0.8415 1.0000 +vt 0.8415 0.5000 +vt 0.7654 1.0000 +vt 0.7654 0.5000 +vt 0.4142 0.5000 +vt 0.4142 0.0000 +vt 0.4725 0.0000 +vt 0.4725 0.5000 +vt 0.5486 0.0000 +vt 0.5486 0.5000 +vt 0.6310 0.0000 +vt 0.6310 0.5000 +vt 0.7071 0.0000 +vt 0.7071 0.5000 +vt 0.7654 0.0000 +vt 0.7654 0.5000 +vt 0.8415 0.0000 +vt 0.8415 0.5000 +vt 0.9239 0.0000 +vt 0.9239 0.5000 +vt 1.0000 0.0000 +vt 1.0000 0.5000 +vt 0.7654 0.5000 +vt 0.7654 1.0000 +vt 0.7071 1.0000 +vt 0.7071 0.5000 +vt 0.3244 0.4749 +vt 0.3827 0.5370 +vt 0.4142 0.6181 +vt 0.4142 0.7059 +vt 0.3827 0.7870 +vt 0.3244 0.8491 +vt 0.2483 0.8827 +vt 0.1659 0.8827 +vt 0.0898 0.8491 +vt 0.0315 0.7870 +vt 0.0000 0.7059 +vt 0.0000 0.6181 +vt 0.0315 0.5370 +vt 0.0898 0.4749 +vt 0.1659 0.4414 +vt 0.2483 0.4414 +vt 0.6310 1.0000 +vt 0.6310 0.5000 +vt 0.0000 0.2646 +vt 0.0000 0.1768 +vt 0.0315 0.0957 +vt 0.0898 0.0336 +vt 0.1659 0.0000 +vt 0.2483 0.0000 +vt 0.3244 0.0336 +vt 0.3827 0.0957 +vt 0.4142 0.1768 +vt 0.4142 0.2646 +vt 0.3827 0.3457 +vt 0.3244 0.4078 +vt 0.2483 0.4414 +vt 0.1659 0.4414 +vt 0.0898 0.4078 +vt 0.0315 0.3457 +s off +f 1/1 2/2 4/3 3/4 +f 3/4 4/3 6/5 5/6 +f 5/7 6/8 8/9 7/10 +f 7/10 8/9 10/11 9/12 +f 9/12 10/11 12/13 11/14 +f 11/15 12/16 14/17 13/18 +f 13/18 14/17 16/19 15/20 +f 15/20 16/19 18/21 17/22 +f 17/22 18/21 20/23 19/24 +f 19/24 20/23 22/25 21/26 +f 21/26 22/25 24/27 23/28 +f 23/28 24/27 26/29 25/30 +f 25/30 26/29 28/31 27/32 +f 27/33 28/34 30/35 29/36 +f 4/37 2/38 32/39 30/40 28/41 26/42 24/43 22/44 20/45 18/46 16/47 14/48 12/49 10/50 8/51 6/52 +f 29/36 30/35 32/53 31/54 +f 31/54 32/53 2/2 1/1 +f 1/55 3/56 5/57 7/58 9/59 11/60 13/61 15/62 17/63 19/64 21/65 23/66 25/67 27/68 29/69 31/70 \ No newline at end of file diff --git a/nodes/pillar.lua b/nodes/pillar.lua index 94c3082..72cca96 100644 --- a/nodes/pillar.lua +++ b/nodes/pillar.lua @@ -18,7 +18,7 @@ minetest.register_node("techage:pillar", { description = S("TA4 Pillar"), tiles = {"techage_concrete.png"}, drawtype = "mesh", - mesh = "techage_pillar.obj", + mesh = "techage_cylinder_07.obj", selection_box = { type = "fixed", fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32}, diff --git a/oil/distiller.lua b/oil/distiller.lua new file mode 100644 index 0000000..cd87753 --- /dev/null +++ b/oil/distiller.lua @@ -0,0 +1,226 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019 Joachim Stolberg + + GPL v3 + See LICENSE.txt for more information + + TA3 Distillation Tower + +]]-- + +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S +local Pipe = techage.LiquidPipe +local networks = techage.networks +local liquid = techage.liquid + + +local function orientation(pos, names) + local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) + for _,name in ipairs(names) do + if node.name == name then + local param2 = node.param2 + node = minetest.get_node(pos) + node.param2 = param2 + minetest.swap_node(pos, node) + return + end + end + minetest.remove_node(pos) + return true +end + +local function after_place_node(pos, placer) + Pipe:after_place_node(pos) +end + +local function tubelib2_on_update2(pos, dir, tlib2, node) + liquid.update_network(pos) +end + +local function after_dig_node(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_node(pos) +end + +minetest.register_node("techage:ta3_distiller_base", { + description = S("TA3 Distillation Tower Base"), + tiles = { + -- up, down, right, left, back, front + "techage_concrete.png^techage_appl_arrowXL.png^techage_appl_hole_pipe.png", + "techage_concrete.png", + "techage_concrete.png", + "techage_concrete.png", + "techage_concrete.png^techage_appl_hole_pipe.png", + "techage_concrete.png", + }, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = {-6/8, -4/8, -6/8, 6/8, 4/8, 6/8}, + }, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + collision_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + + after_place_node = after_place_node, + tubelib2_on_update2 = tubelib2_on_update2, + after_dig_node = after_dig_node, + + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta3_distiller1", { + description = S("TA3 Distillation Tower 1"), + tiles = {"techage_distiller1.png"}, + drawtype = "mesh", + mesh = "techage_cylinder_14.obj", + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + collision_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + + after_place_node = function(pos, placer) + local res = orientation(pos, {"techage:ta3_distiller_base"}) + M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) + after_place_node(pos, placer) + return res + end, + + tubelib2_on_update2 = tubelib2_on_update2, + after_dig_node = after_dig_node, + + paramtype = "light", + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta3_distiller2", { + description = S("TA3 Distillation Tower 2"), + tiles = {"techage_distiller2.png"}, + drawtype = "mesh", + mesh = "techage_cylinder_14.obj", + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + collision_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + + after_place_node = function(pos, placer) + return orientation(pos, {"techage:ta3_distiller1", "techage:ta3_distiller3"}) + end, + + paramtype = "light", + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta3_distiller3", { + description = S("TA3 Distillation Tower 3"), + tiles = {"techage_distiller3.png"}, + drawtype = "mesh", + mesh = "techage_cylinder_14.obj", + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + collision_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + + after_place_node = function(pos, placer) + local res = orientation(pos, {"techage:ta3_distiller2"}) + return res + end, + + tubelib2_on_update2 = tubelib2_on_update2, + after_dig_node = after_dig_node, + + paramtype = "light", + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta3_distiller4", { + description = S("TA3 Distillation Tower 4"), + tiles = {"techage_distiller4.png"}, + drawtype = "mesh", + mesh = "techage_cylinder_14.obj", + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + collision_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2}, + }, + + after_place_node = function(pos, placer) + local res = orientation(pos, {"techage:ta3_distiller3"}) + after_place_node(pos, placer) + return res + end, + + tubelib2_on_update2 = tubelib2_on_update2, + after_dig_node = after_dig_node, + + paramtype = "light", + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + + +Pipe:add_secondary_node_names({ + "techage:ta3_distiller_base", + "techage:ta3_distiller1", "techage:ta3_distiller2", + "techage:ta3_distiller3", "techage:ta3_distiller4", +}) + +techage.register_node({"techage:ta3_distiller1"}, { + on_recv_message = function(pos, src, topic, payload) + if topic == "put" then + local pos2 = {x = pos.x, y = pos.y + payload.height, z = pos.z} + local outdir = 6 + if payload.height ~= 7 then + outdir = M(pos):get_int("outdir") + end + techage.mark_position("singleplayer", pos2, "put", "", 1)------------------------debug + return liquid.put(pos2, outdir, payload.name, payload.amount) + end + end, +}) diff --git a/oil/reboiler.lua b/oil/reboiler.lua new file mode 100644 index 0000000..b254fde --- /dev/null +++ b/oil/reboiler.lua @@ -0,0 +1,190 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019 Joachim Stolberg + + GPL v3 + See LICENSE.txt for more information + + TA3 Oil Reboiler + +]]-- + +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S +local Pipe = techage.LiquidPipe +local networks = techage.networks +local liquid = techage.liquid +local Flip = techage.networks.Flip + +local CYCLE_TIME = 4 +local CAPA = 12 + +local function swap_node(pos) + local node = techage.get_node_lvm(pos) + if node.name == "techage:ta3_reboiler" then + node.name = "techage:ta3_reboiler_on" + else + node.name = "techage:ta3_reboiler" + end + minetest.swap_node(pos, node) +end + +--local function pumping(pos, mem, state, capa) +-- local outdir = M(pos):get_int("outdir") +-- local taken, name = liquid.take(pos, Flip[outdir], nil, capa) +-- if taken > 0 then +-- local leftover = liquid.put(pos, outdir, name, taken) +-- if leftover and leftover > 0 then +-- liquid.put(pos, Flip[outdir], name, leftover) +-- state:blocked(pos, mem) +-- return +-- end +-- state:keep_running(pos, mem, COUNTDOWN_TICKS) +-- return +-- end +-- state:idle(pos, mem) +--end + +local function after_place_node(pos, placer) + M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) + Pipe:after_place_node(pos) +end + +local function node_timer(pos, elapsed) + local mem = tubelib2.get_mem(pos) + pumping(pos, mem, State3, CAPA) + return State3:is_active(mem) +end + +local function tubelib2_on_update2(pos, outdir, tlib2, node) + liquid.update_network(pos, outdir) +end + +local function after_dig_node(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_node(pos) +end + +local _liquid = { + capa = CAPA, + peek = liquid.srv_peek, + put = function(pos, indir, name, amount) + --start timer + return liquid.srv_put(pos, indir, name, amount) + end, + take = liquid.srv_take, +} + +local _networks = { + pipe = { + sides = {L = true, R = true}, -- Pipe connection sides + ntype = "tank", + }, +} + +local function on_rightclick(pos, node, clicker) + swap_node(pos) +end + +minetest.register_node("techage:ta3_reboiler", { + description = S("TA3 Oil Reboiler"), + tiles = { + -- 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_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_reboiler.png^techage_frame_ta3.png^[transformFX", + "techage_filling_ta3.png^techage_appl_reboiler.png^techage_frame_ta3.png", + }, + + after_place_node = function(pos, placer) + local mem = tubelib2.init_mem(pos) + mem.liquid = {} + local meta = M(pos) + meta:set_string("infotext", S("TA3 Oil Reboiler")) + meta:set_int("outdir", networks.side_to_outdir(pos, "R")) + Pipe:after_place_node(pos) + end, + + tubelib2_on_update2 = tubelib2_on_update2, + on_timer = node_timer, + after_dig_node = after_dig_node, + on_rightclick = on_rightclick, + liquid = _liquid, + networks = _networks, + + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:ta3_reboiler_on", { + description = S("TA3 Oil Reboiler"), + tiles = { + -- 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_appl_hole_pipe.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", + { + image = "techage_filling4_ta3.png^techage_appl_reboiler4.png^techage_frame4_ta3.png^[transformFX", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 2.0, + }, + }, + { + image = "techage_filling4_ta3.png^techage_appl_reboiler4.png^techage_frame4_ta3.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 2.0, + }, + }, + }, + + tubelib2_on_update2 = tubelib2_on_update2, + on_timer = node_timer, + after_dig_node = after_dig_node, + on_rightclick = on_rightclick, + liquid = _liquid, + networks = _networks, + + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +Pipe:add_secondary_node_names({"techage:ta3_reboiler", "techage:ta3_reboiler_on"}) + +--minetest.register_craft({ +-- output = "techage:t3_pump 2", +-- recipe = { +-- {"group:wood", "techage:iron_ingot", "group:wood"}, +-- {"techage:ta3_pipeS", "techage:usmium_nuggets", "techage:ta3_pipeS"}, +-- {"group:wood", "techage:iron_ingot", "group:wood"}, +-- }, +--}) + +--minetest.register_craft({ +-- output = "techage:t4_pump", +-- recipe = { +-- {"default:tin_ingot", "dye:blue", "default:steel_ingot"}, +-- {"", "techage:t3_pump", ""}, +-- {"", "", ""}, +-- }, +--}) diff --git a/power/ta4_junction.lua b/power/ta4_junction.lua deleted file mode 100644 index aad3c06..0000000 --- a/power/ta4_junction.lua +++ /dev/null @@ -1,77 +0,0 @@ ---[[ - - TechAge - ======= - - Copyright (C) 2019 Joachim Stolberg - - GPL v3 - See LICENSE.txt for more information - - TA4 Junction Pipes - -]]-- - --- for lazy programmers -local M = minetest.get_meta -local S = techage.S - -local Pipe = techage.BiogasPipe -local power = techage.power - -local size1 = 1/8 -local size2 = 2/8 -local size3 = 13/32 ---local size3 = 1/8 -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+ - } -} - -techage.register_junction("techage:ta4_junctionpipe", 1/8, Boxes, Pipe, { - description = S("TA4 Junction Pipe"), - tiles = {"techage_gaspipe_junction.png"}, - groups = {crumbly = 2, cracky = 2, snappy = 2, techage_trowel = 1}, - sounds = default.node_sound_metal_defaults(), - - on_construct = tubelib2.init_mem, - after_tube_update = function(node, pos, out_dir, peer_pos, peer_in_dir) - local name = "techage:ta4_junctionpipe"..techage.junction_type(pos, Pipe) - minetest.swap_node(pos, {name = name, param2 = 0}) - power.network_changed(pos, tubelib2.get_mem(pos)) - end, - is_power_available = function(pos) - return techage.power.power_accounting(pos, tubelib2.get_mem(pos)) - end, -}, 25) - -minetest.register_craft({ - output = "techage:ta4_junctionpipe25 2", - recipe = { - {"", "techage:ta4_pipeS", ""}, - {"techage:ta4_pipeS", "", "techage:ta4_pipeS"}, - {"", "techage:ta4_pipeS", ""}, - }, -}) \ No newline at end of file diff --git a/steam_engine/boiler.lua b/steam_engine/boiler.lua index 4233a55..172a56e 100644 --- a/steam_engine/boiler.lua +++ b/steam_engine/boiler.lua @@ -214,7 +214,7 @@ minetest.register_node("techage:boiler1", { description = S("TA2 Boiler Base"), tiles = {"techage_boiler.png"}, drawtype = "mesh", - mesh = "techage_boiler.obj", + mesh = "techage_cylinder_09.obj", selection_box = { type = "fixed", fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32}, @@ -232,7 +232,7 @@ minetest.register_node("techage:boiler2", { description = S("TA2 Boiler Top"), tiles = {"techage_boiler2.png"}, drawtype = "mesh", - mesh = "techage_boiler.obj", + mesh = "techage_cylinder_09.obj", selection_box = { type = "fixed", fixed = {-10/32, -48/32, -10/32, 10/32, 16/32, 10/32}, diff --git a/textures/techage_appl_arrowXL.png b/textures/techage_appl_arrowXL.png new file mode 100644 index 0000000..18b1cc0 Binary files /dev/null and b/textures/techage_appl_arrowXL.png differ diff --git a/textures/techage_appl_reboiler.png b/textures/techage_appl_reboiler.png new file mode 100644 index 0000000..f95dd3e Binary files /dev/null and b/textures/techage_appl_reboiler.png differ diff --git a/textures/techage_appl_reboiler4.png b/textures/techage_appl_reboiler4.png new file mode 100644 index 0000000..aedccab Binary files /dev/null and b/textures/techage_appl_reboiler4.png differ diff --git a/textures/techage_distiller1.png b/textures/techage_distiller1.png new file mode 100644 index 0000000..1231490 Binary files /dev/null and b/textures/techage_distiller1.png differ diff --git a/textures/techage_distiller2.png b/textures/techage_distiller2.png new file mode 100644 index 0000000..497510e Binary files /dev/null and b/textures/techage_distiller2.png differ diff --git a/textures/techage_distiller3.png b/textures/techage_distiller3.png new file mode 100644 index 0000000..bfe0987 Binary files /dev/null and b/textures/techage_distiller3.png differ diff --git a/textures/techage_distiller4.png b/textures/techage_distiller4.png new file mode 100644 index 0000000..aa479fa Binary files /dev/null and b/textures/techage_distiller4.png differ