diff --git a/basis/command.lua b/basis/command.lua index ebc9a4e..cb9c779 100644 --- a/basis/command.lua +++ b/basis/command.lua @@ -17,7 +17,7 @@ local S = function(pos) if pos then return minetest.pos_to_string(pos) end end local P = minetest.string_to_pos local M = minetest.get_meta -local check_cart = minecart.check_cart +local check_cart_for_loading = minecart.check_cart_for_loading local function deserialize(s) local tbl = {} @@ -410,7 +410,7 @@ function techage.push_items(pos, out_dir, stack, idx) local npos, in_dir, name = get_dest_node(pos, out_dir) if npos and NodeDef[name] and NodeDef[name].on_push_item then return NodeDef[name].on_push_item(npos, in_dir, stack, idx) - elseif is_air_like(name) or check_cart(npos) then + elseif is_air_like(name) or check_cart_for_loading(npos) then minetest.add_item(npos, stack) return true end diff --git a/carts/chest_cart.lua b/carts/chest_cart.lua new file mode 100644 index 0000000..20e8a6c --- /dev/null +++ b/carts/chest_cart.lua @@ -0,0 +1,174 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2020 Joachim Stolberg + + GPL v3 + See LICENSE.txt for more information + + TA3 Chest Cart + +]]-- + +-- for lazy programmers +local M = minetest.get_meta +local S = techage.S +local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end +local S2P = minetest.string_to_pos + +local function formspec() + return "size[8,6]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[context;main;3,0;2,2;]".. + "list[current_player;main;0,2.3;8,4;]".. + "listring[context;main]".. + "listring[current_player;main]" +end + +local function can_dig(pos, player) + local owner = M(pos):get_string("owner") + if owner ~= "" and owner ~= player:get_player_name() then + return false + end + local inv = minetest.get_meta(pos):get_inventory() + return inv:is_empty("main") +end + +local function allow_metadata_inventory_put(pos, listname, index, stack, player) + local owner = M(pos):get_string("owner") + if owner ~= "" and owner ~= player:get_player_name() then + return 0 + end + return stack:get_count() +end + +local function allow_metadata_inventory_take(pos, listname, index, stack, player) + local owner = M(pos):get_string("owner") + if owner ~= "" and owner ~= player:get_player_name() then + return 0 + end + return stack:get_count() +end + +minetest.register_node("techage:chest_cart", { + description = S("TA Chest Cart"), + tiles = { + -- up, down, right, left, back, front + "techage_chest_cart_top.png", + "techage_chest_cart_bottom.png", + "techage_chest_cart_side.png", + "techage_chest_cart_side.png", + "techage_chest_cart_front.png", + "techage_chest_cart_front.png", + }, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-7/16, 3/16, -7/16, 7/16, 8/16, 7/16}, + {-8/16, -8/16, -8/16, 8/16, 3/16, 8/16}, + }, + }, + paramtype2 = "facedir", + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 2, crumbly = 2, choppy = 2}, + node_placement_prediction = "", + + can_dig = can_dig, + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_take = allow_metadata_inventory_take, + + after_place_node = function(pos) + local inv = M(pos):get_inventory() + inv:set_size('main', 4) + M(pos):set_string("formspec", formspec()) + end, + + on_place = function(itemstack, placer, pointed_thing) + return minecart.node_on_place(itemstack, placer, pointed_thing, + "techage:chest_cart") + end, + + on_punch = function(pos, node, puncher, pointed_thing) + minecart.node_on_punch(pos, node, puncher, pointed_thing, "techage:chest_cart_entity") + end, + + set_cargo = function(pos, data) + --print("set_cargo", P2S(pos), #data) + local inv = M(pos):get_inventory() + for idx, stack in ipairs(data) do + inv:set_stack("main", idx, stack) + end + end, + + get_cargo = function(pos) + local inv = M(pos):get_inventory() + local data = {} + for idx = 1, 4 do + local stack = inv:get_stack("main", idx) + data[idx] = {name = stack:get_name(), count = stack:get_count()} + end + --print("get_cargo", P2S(pos), #data) + return data + end, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local name = oldmetadata.fields.removed_rail or "carts:rail" + minetest.add_node(pos, {name = name}) + end, +}) + +minecart.register_cart_entity("techage:chest_cart_entity", "techage:chest_cart", { + initial_properties = { + physical = false, + collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + visual = "wielditem", + textures = {"techage:chest_cart"}, + visual_size = {x=0.66, y=0.66, z=0.66}, + static_save = false, + }, + on_activate = minecart.on_activate, + on_punch = minecart.on_punch, + on_step = minecart.on_step, +}) + +techage.register_node({"techage:chest_cart"}, { + on_pull_item = function(pos, in_dir, num, item_name) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return techage.get_items(pos, inv, "main", num) + end, + on_push_item = function(pos, in_dir, stack) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return techage.put_items(inv, "main", stack) + end, + on_unpull_item = function(pos, in_dir, stack) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return techage.put_items(inv, "main", stack) + end, + on_recv_message = function(pos, src, topic, payload) + if topic == "state" then + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return techage.get_inv_state(inv, "main") + else + return "unsupported" + end + end, +}) + +minetest.register_craft({ + output = "techage:chest_cart", + recipe = { + {"default:junglewood", "default:chest_locked", "default:junglewood"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + }, +}) diff --git a/carts/tank_cart.lua b/carts/tank_cart.lua new file mode 100644 index 0000000..4cc4a14 --- /dev/null +++ b/carts/tank_cart.lua @@ -0,0 +1,184 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2020 Joachim Stolberg + + GPL v3 + See LICENSE.txt for more information + + TA3 Tank Cart + +]]-- + +-- for lazy programmers +local M = minetest.get_meta +local S = techage.S +local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end +local S2P = minetest.string_to_pos +local Pipe = techage.LiquidPipe +local liquid = techage.liquid + +local CAPACITY = 100 + +local function on_rightclick(pos, node, clicker) + local nvm = techage.get_nvm(pos) + techage.set_activeformspec(pos, clicker) + M(pos):set_string("formspec", liquid.formspec(pos, nvm)) + minetest.get_node_timer(pos):start(2) +end + +local function node_timer(pos, elapsed) + if techage.is_activeformspec(pos) then + local nvm = techage.get_nvm(pos) + M(pos):set_string("formspec", liquid.formspec(pos, nvm)) + return true + end + return false +end + +local function can_dig(pos, player) + local owner = M(pos):get_string("owner") + if owner ~= "" and owner ~= player:get_player_name() then + return false + end + return liquid.is_empty(pos) +end + +local function take_liquid(pos, indir, name, amount) + amount, name = liquid.srv_take(pos, indir, name, amount) + if techage.is_activeformspec(pos) then + local nvm = techage.get_nvm(pos) + M(pos):set_string("formspec", liquid.formspec(pos, nvm)) + end + return amount, name +end + +local function put_liquid(pos, indir, name, amount) + -- check if it is not powder + local ndef = minetest.registered_craftitems[name] or {} + if not ndef.groups or ndef.groups.powder ~= 1 then + local leftover = liquid.srv_put(pos, indir, name, amount) + if techage.is_activeformspec(pos) then + local nvm = techage.get_nvm(pos) + M(pos):set_string("formspec", liquid.formspec(pos, nvm)) + end + return leftover + end + return amount +end + +local networks_def = { + pipe2 = { + sides = {U = 1}, -- Pipe connection side + ntype = "tank", + }, +} + +minetest.register_node("techage:tank_cart", { + description = S("TA Tank Cart"), + tiles = { + -- up, down, right, left, back, front + "techage_tank_cart_top.png", + "techage_tank_cart_bottom.png", + "techage_tank_cart_side.png", + "techage_tank_cart_side.png", + "techage_tank_cart_front.png", + "techage_tank_cart_front.png", + }, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-3/16, 7/16, -3/16, 3/16, 8/16, 3/16}, + {-7/16, 3/16, -7/16, 7/16, 7/16, 7/16}, + {-8/16, -8/16, -8/16, 8/16, 3/16, 8/16}, + }, + }, + paramtype2 = "facedir", + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 2, crumbly = 2, choppy = 2}, + node_placement_prediction = "", + + after_place_node = function(pos) + local nvm = techage.get_nvm(pos) + nvm.liquid = {} + M(pos):set_string("formspec", liquid.formspec(pos, nvm)) + end, + + on_place = function(itemstack, placer, pointed_thing) + return minecart.node_on_place(itemstack, placer, pointed_thing, + "techage:tank_cart") + end, + + on_punch = function(pos, node, puncher, pointed_thing) + --print("on_punch") + local wielded_item = puncher:get_wielded_item():get_name() + + if techage.liquid.is_container_empty(wielded_item) then + liquid.on_punch(pos, node, puncher, pointed_thing) + else + minecart.node_on_punch(pos, node, puncher, pointed_thing, "techage:tank_cart_entity") + end + end, + + set_cargo = function(pos, data) + --print("set_cargo", P2S(pos), #data) + local nvm = techage.get_nvm(pos) + nvm.liquid = data + end, + + get_cargo = function(pos) + local nvm = techage.get_nvm(pos) + local data = nvm.liquid + nvm.liquid = {} + --print("get_cargo", P2S(pos), #data) + return data + end, + on_timer = node_timer, + + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local name = oldmetadata.fields.removed_rail or "carts:rail" + minetest.add_node(pos, {name = name}) + end, + + liquid = { + capa = CAPACITY, + peek = liquid.srv_peek, + put = put_liquid, + take = take_liquid, + }, + networks = networks_def, + on_rightclick = on_rightclick, + can_dig = can_dig, +}) + +techage.register_node({"techage:tank_cart"}, liquid.recv_message) + +Pipe:add_secondary_node_names({"techage:tank_cart"}) + + +minecart.register_cart_entity("techage:tank_cart_entity", "techage:tank_cart", { + initial_properties = { + physical = false, + collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + visual = "wielditem", + textures = {"techage:tank_cart"}, + visual_size = {x=0.66, y=0.66, z=0.66}, + static_save = false, + }, + on_activate = minecart.on_activate, + on_punch = minecart.on_punch, + on_step = minecart.on_step, +}) + +minetest.register_craft({ + output = "techage:tank_cart", + recipe = { + {"default:junglewood", "techage:ta3_tank", "default:junglewood"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + }, +}) diff --git a/doc/items.lua b/doc/items.lua index b3e4ca0..b5b98cc 100644 --- a/doc/items.lua +++ b/doc/items.lua @@ -90,6 +90,8 @@ techage.Items = { oiltank = "techage:oiltank", reboiler = "techage:ta3_reboiler", ta3_filler = "techage:filler", + tank_cart = "techage:tank_cart", + chest_cart = "techage:chest_cart", ---------------------------- ta3_button = "techage:ta3_button_off", ta3_cartdetector = "techage:ta3_cartdetector_off", diff --git a/doc/manual_DE.lua b/doc/manual_DE.lua index f006afa..7d42ca3 100644 --- a/doc/manual_DE.lua +++ b/doc/manual_DE.lua @@ -81,6 +81,10 @@ techage.manual_DE.aTitel = { "3,TA3 Bohrgestänge / Drill Pipe", "3,Öltank / Oil Tank", "2,Öl-Transport", + "3,Öl-Transport mit dem Tankwagen", + "3,Öl-Transport mit Fässern über Minecarts", + "3,Tankwagen / Tank Cart", + "3,Kistenwagen / Chest Cart", "2,Öl-Verarbeitung", "3,Destillationsturm / distiller tower", "4,Aufkocher / reboiler)", @@ -739,7 +743,21 @@ techage.manual_DE.aText = { "\n".. "\n".. "\n", - "Um Öl von der Ölquelle zur Ölverarbeitungsanlage zu befördern\\, können Minecarts genutzt werden. In die Minecarts können aber nur Kanister oder Fässer geladen werden. Deshalb muss das Öl zuvor in Fässer umgeladen werden. Die Ölfässer können direkt mit einem Schieber und Röhren in das Minecart geschoben werden (siehe Plan). Die leeren Fässer\\, welche per Minecart von der Entladestation zurück kommen\\, können über einen Hopper entladen werden\\, der unter der Schiene an der Haltestelle platziert wird.\n".. + "", + "Um Öl von der Ölquelle zur Ölverarbeitungsanlage zu befördern\\, können Tankwagen (tank carts) genutzt werden. Ein Tankwagen kann direkt über Pumpen gefüllt bzw. geleert werden. In beiden Fällen muss die gelbe Röhre von oben mit dem Tankwagen verbunden werden.\n".. + "\n".. + "Dazu sind folgende Schritte notwendig:\n".. + "\n".. + " - Den Tankwagen vor den Prellbock setzen. Der Prellbock darf noch nicht mit einer Zeit programmiert sein\\, so dass der Tankwagen nicht automatisch losfährt\n".. + " - Den Tankwagen über gelbe Röhren mit der Pumpe verbinden\n".. + " - Pumpe einschalten\n".. + " - Prellbock mit einer Zeit (10 - 20 s) programmieren\n".. + "\n".. + "Diese Reihenfolge muss auf beiden Seiten /Füllen/Leeren) eingehalten werden.\n".. + "\n".. + "\n".. + "\n", + "In die Minecarts können Kanister und Fässer geladen werden. Das Öl muss dazu zuvor in Fässer umgeladen werden. Die Ölfässer können direkt mit einem Schieber und Röhren in das Minecart geschoben werden (siehe Plan). Die leeren Fässer\\, welche per Minecart von der Entladestation zurück kommen\\, können über einen Hopper entladen werden\\, der unter der Schiene an der Haltestelle platziert wird.\n".. "\n".. "Es ist mit dem Hopper nicht möglich\\, an *einer* Haltestelle sowohl die leeren Fässer zu entladen\\, als auch die vollen Fässer zu beladen. Der Hopper lädt die vollen Fässer sofort wieder aus. Daher ist es ratsam\\, jeweils 2 Stationen auf der Be- und Entladeseite einzurichten und den Minecart dann über eine Aufzeichnungsfahrt entsprechend zu programmieren.\n".. "\n".. @@ -749,6 +767,18 @@ techage.manual_DE.aText = { "\n".. "\n".. "\n", + "Der Tankwagen dient zum Transport von Flüssigkeiten. Es kann wie Tanks mit Pumpen gefüllt bzw. geleert werden. In beiden Fällen muss die gelbe Röhre von oben mit dem Tankwagen verbunden werden.\n".. + "\n".. + "In den Tankwagen passen 100 Einheiten.\n".. + "\n".. + "\n".. + "\n", + "Der Kistenwagen dient zum Transport von Items. Es kann wie Kisten über Schieber gefüllt bzw. geleert werden.\n".. + "\n".. + "In den Kistenwagen passen 4 Stacks.\n".. + "\n".. + "\n".. + "\n", "Öl ist ein Stoffgemisch und besteht aus sehr vielen Komponenten. Über einen Destillationsturm kann das Öl in seine Hauptbestandteile wie Bitumen\\, Schweröl\\, Naphtha\\, Benzin und Gas zerlegt werden.\n".. "Die weitere Verarbeitung zu Endprodukten erfolgt im Chemischen Reaktor.\n".. "\n".. @@ -908,6 +938,8 @@ techage.manual_DE.aText = { "\n", "Der Wagen Detektor sendet ein 'on'-Kommando\\, wenn er einen Wagen/Cart (Minecart) direkt vor sich erkannt hat. Zusätzlich kann der Detektor auch den Wagen wieder starten\\, wenn ein 'on'-Kommando empfangen wird.\n".. "\n".. + "Der Detektor kann auch mit seiner eigenen Nummer programmiert werden. In diesem Falle schiebt er alle Wagen an\\, die in seiner Nähe (ein Block in alle Richtungen) zum Halten kommen.\n".. + "\n".. "\n".. "\n", "Der Block Detektor sendet ein 'on'-Kommando\\, wenn er erkennt\\, dass Blöcke vor ihm erscheinen oder verschwinden\\, muss jedoch entsprechend konfiguriert werden. Nach dem Zurückschalten des Detektors in den Standardzustand (grauer Block) wird ein 'off'-Kommando gesendet. Gültige Blöcke sind alle Arten von Blöcken und Pflanzen\\, aber keine Tiere oder Spieler. Die Sensorreichweite beträgt 3 Blöcke/Meter in Pfeilrichtung.\n".. @@ -1507,6 +1539,10 @@ techage.manual_DE.aItemName = { "ta3_drillbit", "oiltank", "", + "tank_cart", + "", + "tank_cart", + "chest_cart", "techage_ta31", "", "reboiler", @@ -1685,8 +1721,12 @@ techage.manual_DE.aPlanTable = { "", "", "", + "", + "", "ta3_loading", "", + "", + "", "ta3_distiller", "", "", diff --git a/doc/manual_EN.lua b/doc/manual_EN.lua index e480cbd..908c816 100644 --- a/doc/manual_EN.lua +++ b/doc/manual_EN.lua @@ -81,6 +81,10 @@ techage.manual_EN.aTitel = { "3,TA3 Drill Pipe", "3,Oil tank", "2,Oil Transportation", + "3,Oil transportation by Tank Carts", + "3,Oil transportation with barrels over Minecarts", + "3,Tank Cart", + "3,Chest Cart", "2,Oil Processing", "3,Distillation Tower", "4,Reboiler", @@ -737,7 +741,21 @@ techage.manual_EN.aText = { "\n".. "\n".. "\n", - "Minecarts can be used to transport oil from the oil well to the oil processing plant. Only canisters or barrels can be loaded into the Minecarts. Therefore\\, the oil must first be transferred to barrels. The oil barrels can be pushed directly into the Minecart with a pusher and tubes (see map). The empty barrels\\, which come back from the unloading station by Minecart\\, can be unloaded using a hopper\\, which is placed under the rail at the stop.\n".. + "", + "Tank carts can be used to transport oil from the oil well to the oil processing plant. A tank cart can be filled or emptied directly using pumps. In both cases\\, the yellow pipes must be connected to the tank cart from above.\n".. + "\n".. + "The following steps are necessary:\n".. + "\n".. + " - Place the tank cart in front of the rail bumper block. The bumper block must not yet be programmed with a time so that the tank cart does not start automatically\n".. + " - Connect the tank cart to the pump using yellow pipes\n".. + " - Switch on the pump\n".. + " - Program the bumper with a time (10 - 20 s)\n".. + "\n".. + "This sequence must be observed on both sides (fill / empty).\n".. + "\n".. + "\n".. + "\n", + "Canisters and barrels can be loaded into the Minecarts. To do this\\, the oil must first be transferred to barrels. The oil barrels can be pushed directly into the Minecart with a pusher and tubes (see map). The empty barrels\\, which come back from the unloading station by Minecart\\, can be unloaded using a hopper\\, which is placed under the rail at the stop.\n".. "\n".. "It is not possible with the hopper to both *unload the empty barrels and load the full barrels at a stop*. The hopper immediately unloads the full barrels. It is therefore advisable to set up 2 stations on the loading and unloading side and then program the Minecart accordingly using a recording run.\n".. "\n".. @@ -747,6 +765,18 @@ techage.manual_EN.aText = { "\n".. "\n".. "\n", + "The tank truck is used to transport liquids. Like tanks\\, it can be filled with pumps or emptied. In both cases\\, the yellow tube must be connected to the tank truck from above.\n".. + "\n".. + "100 units fit in the tank truck.\n".. + "\n".. + "\n".. + "\n", + "The chest cart is used to transport items. Like chests\\, it can be filled or emptied using a pusher.\n".. + "\n".. + "4 stacks fit in the chest cart.\n".. + "\n".. + "\n".. + "\n", "Oil is a mixture of substances and consists of many components. The oil can be broken down into its main components such as bitumen\\, heavy oil\\, naphtha\\, gasoline and gas via a distillation tower.\n".. "Further processing to end products takes place in the chemical reactor.\n".. "\n".. @@ -906,6 +936,8 @@ techage.manual_EN.aText = { "\n", "The cart detector sends an 'on' command if it has recognized a cart (Minecart) directly in front of it. In addition\\, the detector can also restart the cart when an 'on' command is received.\n".. "\n".. + "The detector can also be programmed with its own number. In this case\\, he pushes all the wagons that stop near him (one block in all directions).\n".. + "\n".. "\n".. "\n", "The block detector sends an 'on' command if it detects that blocks appear or disappear in front of it\\, but must be configured accordingly. After switching the detector back to the standard state (gray block)\\, an 'off' command is sent. Valid blocks are all types of blocks and plants\\, but not animals or players. The sensor range is 3 blocks / meter in the direction of the arrow.\n".. @@ -1497,6 +1529,10 @@ techage.manual_EN.aItemName = { "ta3_drillbit", "oiltank", "", + "", + "", + "", + "", "techage_ta31", "", "reboiler", @@ -1675,8 +1711,12 @@ techage.manual_EN.aPlanTable = { "", "", "", + "", + "", "ta3_loading", "", + "", + "", "ta3_distiller", "", "", diff --git a/init.lua b/init.lua index fb69f23..b3c167c 100644 --- a/init.lua +++ b/init.lua @@ -27,8 +27,8 @@ elseif minetest.global_exists("techpack") then elseif minetest.global_exists("tubelib2") and tubelib2.version < 1.8 then minetest.log("error", "[techage] Techage requires tubelib2 version 1.8 or newer!") return -elseif minetest.global_exists("minecart") and minecart.version < 1.03 then - minetest.log("error", "[techage] Techage requires minecart version 1.03 or newer!") +elseif minetest.global_exists("minecart") and minecart.version < 1.05 then + minetest.log("error", "[techage] Techage requires minecart version 1.05 or newer!") return elseif minetest.global_exists("lcdlib") and lcdlib.version < 1.0 then minetest.log("error", "[techage] Techage requires lcdlib version 1.0 or newer!") @@ -292,3 +292,7 @@ dofile(MP.."/items/redstone.lua") if techage.basalt_stone_enabled then dofile(MP.."/items/basalt.lua") end + +-- Carts +dofile(MP.."/carts/tank_cart.lua") +dofile(MP.."/carts/chest_cart.lua") diff --git a/liquids/node_api.lua b/liquids/node_api.lua index e897391..1c4eb1c 100644 --- a/liquids/node_api.lua +++ b/liquids/node_api.lua @@ -92,7 +92,12 @@ local function get_network_table(pos, outdir, ntype) netw = networks.collect_network_nodes(pos, outdir, Pipe) networks.set_network("pipe2", netID, netw) end - --print("netw", string.format("%012X", netID), dump(netw)) + if not netw[ntype] then -- connection lost (e.g. tank cart)? + -- reactivate network + networks.node_connections(pos, Pipe) + delete_netID(pos, outdir) + end + --print("netw", string.format("%012X", netID), dump(netw[ntype])) return netw[ntype] or {} end return {} diff --git a/locale/techage.de.tr b/locale/techage.de.tr index 6a563c0..6187681 100644 --- a/locale/techage.de.tr +++ b/locale/techage.de.tr @@ -40,7 +40,7 @@ Current power:=Strom aktuell: Depth=Tiefe Digging depth=Grabungstiefe Dirt with Ash=Erde mit Asche -Display no: = Display Nr. +Display no: = Display Nr. Distributor=Verteiler Doser=Dosierer Drill Bit=Bohrstange @@ -177,6 +177,7 @@ Switched to private use!=Zur privaten Nutzung umgeschaltet Switched to public use!=Zur öffentlichen Nutzung umgeschaltet Syntax error, try help=Syntax Fehler, nutze help TA Ceiling Lamp=TA Deckenlampe +TA Chest Cart=TA Kistenwagen TA Electric Cable=TA Stromkabel TA Electric Junction Box=TA Verteilerdose TA Empty Barrel=TA leeres Fass @@ -201,6 +202,7 @@ TA Power Switch=TA Stromschalter TA Power Switch Box=TA Stromschalterbox TA Power Switch Small=TA Stromschalter klein TA Street Lamp=TA Straßenlampe +TA Tank Cart=TA Tankwagen TA1 Bronze Hammer (smash stone to gravel)=TA1 Bronzehammer (zerschlage Stein zu Kies) TA1 Burning=TA1 Brennen TA1 Charcoal=TA1 Holzkohle @@ -434,4 +436,3 @@ storage empty?=Speicher leer? water temperature=Wassertemperatur wrong storage diameter=Falscher Wärmespeicher-Durchmesser ##### not used anymore ##### - diff --git a/locale/template.txt b/locale/template.txt index 0326c0e..c56c864 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -175,6 +175,7 @@ Switched to private use!= Switched to public use!= Syntax error, try help= TA Ceiling Lamp= +TA Chest Cart= TA Electric Cable= TA Electric Junction Box= TA Empty Barrel= @@ -199,6 +200,7 @@ TA Power Switch= TA Power Switch Box= TA Power Switch Small= TA Street Lamp= +TA Tank Cart= TA1 Bronze Hammer (smash stone to gravel)= TA1 Burning= TA1 Charcoal= diff --git a/logic/cart_detector.lua b/logic/cart_detector.lua index c21b5f9..fbc49ff 100644 --- a/logic/cart_detector.lua +++ b/logic/cart_detector.lua @@ -15,45 +15,24 @@ -- for lazy programmers local M = minetest.get_meta local S = techage.S +local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end local logic = techage.logic local CYCLE_TIME = 2 -local function switch_on(pos) - if logic.swap_node(pos, "techage:ta3_cartdetector_on") then - logic.send_on(pos, M(pos)) - end -end - local function switch_off(pos) - if logic.swap_node(pos, "techage:ta3_cartdetector_off") then - logic.send_off(pos, M(pos)) - end + logic.swap_node(pos, "techage:ta3_cartdetector_off") + logic.send_off(pos, M(pos)) end -local function check_cart(pos) - for _, object in pairs(minetest.get_objects_inside_radius(pos, 1)) do - if object:get_entity_name() == "minecart:cart" then - return true - end - end - return false +local function switch_on(pos) + logic.swap_node(pos, "techage:ta3_cartdetector_on") + logic.send_on(pos, M(pos)) + minetest.after(1, switch_off, pos) end -local function punch_cart(pos) - for _, object in pairs(minetest.get_objects_inside_radius(pos, 1)) do - if object:get_entity_name() == "minecart:cart" then - object:punch(object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 1}, - }, minetest.facedir_to_dir(0)) - break -- start only one cart - end - end -end - local function node_timer(pos) - if check_cart(pos)then + if minecart.check_cart_for_pushing(pos, nil, 1.5) then switch_on(pos) else switch_off(pos) @@ -101,7 +80,7 @@ minetest.register_node("techage:ta3_cartdetector_off", { description = S("TA3 Cart Detector"), tiles = { -- up, down, right, left, back, front - "techage_filling_ta3.png^techage_frame_ta3_top.png", + "techage_filling_ta3.png^techage_frame_ta3_top.png^techage_appl_arrow.png^[transformR90", "techage_filling_ta3.png^techage_frame_ta3_top.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_cartdetector.png", }, @@ -127,7 +106,7 @@ minetest.register_node("techage:ta3_cartdetector_on", { description = "TA3 Cart Detector", tiles = { -- up, down, right, left, back, front - "techage_filling_ta3.png^techage_frame_ta3_top.png", + "techage_filling_ta3.png^techage_frame_ta3_top.png^techage_appl_arrow.png^[transformR90", "techage_filling_ta3.png^techage_frame_ta3_top.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_cartdetector_on.png", }, @@ -154,7 +133,9 @@ minetest.register_craft({ techage.register_node({"techage:ta3_cartdetector_off", "techage:ta3_cartdetector_on"}, { on_recv_message = function(pos, src, topic, payload) if topic == "on" then - punch_cart(pos) + local node = minetest.get_node(pos) + local dir = minetest.facedir_to_dir(node.param2) + minecart.punch_cart(pos, nil, 1.5, dir) else return "unsupported" end diff --git a/logic/sequencer.lua b/logic/sequencer.lua index 6082a23..494cafc 100644 --- a/logic/sequencer.lua +++ b/logic/sequencer.lua @@ -127,13 +127,15 @@ end local function start_the_sequencer(pos) local nvm = techage.get_nvm(pos) - local meta = M(pos) - nvm.running = true - nvm.endless = nvm.endless or false - nvm.rules = nvm.rules or new_rules() - logic.infotext(meta, S("TA3 Sequencer"), "running") - meta:set_string("formspec", formspec(techage.RUNNING, nvm.rules, nvm.endless)) - minetest.get_node_timer(pos):start(0.1) + if not nvm.running then + local meta = M(pos) + nvm.running = true + nvm.endless = nvm.endless or false + nvm.rules = nvm.rules or new_rules() + logic.infotext(meta, S("TA3 Sequencer"), "running") + meta:set_string("formspec", formspec(techage.RUNNING, nvm.rules, nvm.endless)) + minetest.get_node_timer(pos):start(0.1) + end return false end diff --git a/manuals/manual_ta3_DE.md b/manuals/manual_ta3_DE.md index 7895b57..7eccbc5 100644 --- a/manuals/manual_ta3_DE.md +++ b/manuals/manual_ta3_DE.md @@ -365,7 +365,22 @@ Der große Tank kann 4000 Einheiten Öl, aber auch jede andere Art von Flüssigk ## Öl-Transport -Um Öl von der Ölquelle zur Ölverarbeitungsanlage zu befördern, können Minecarts genutzt werden. In die Minecarts können aber nur Kanister oder Fässer geladen werden. Deshalb muss das Öl zuvor in Fässer umgeladen werden. Die Ölfässer können direkt mit einem Schieber und Röhren in das Minecart geschoben werden (siehe Plan). Die leeren Fässer, welche per Minecart von der Entladestation zurück kommen, können über einen Hopper entladen werden, der unter der Schiene an der Haltestelle platziert wird. +### Öl-Transport mit dem Tankwagen +Um Öl von der Ölquelle zur Ölverarbeitungsanlage zu befördern, können Tankwagen (tank carts) genutzt werden. Ein Tankwagen kann direkt über Pumpen gefüllt bzw. geleert werden. In beiden Fällen muss die gelbe Röhre von oben mit dem Tankwagen verbunden werden. + +Dazu sind folgende Schritte notwendig: + +- Den Tankwagen vor den Prellbock setzen. Der Prellbock darf noch nicht mit einer Zeit programmiert sein, so dass der Tankwagen nicht automatisch losfährt +- Den Tankwagen über gelbe Röhren mit der Pumpe verbinden +- Pumpe einschalten +- Prellbock mit einer Zeit (10 - 20 s) programmieren + +Diese Reihenfolge muss auf beiden Seiten /Füllen/Leeren) eingehalten werden. + +[tank_cart|image] + +### Öl-Transport mit Fässern über Minecarts +In die Minecarts können Kanister und Fässer geladen werden. Das Öl muss dazu zuvor in Fässer umgeladen werden. Die Ölfässer können direkt mit einem Schieber und Röhren in das Minecart geschoben werden (siehe Plan). Die leeren Fässer, welche per Minecart von der Entladestation zurück kommen, können über einen Hopper entladen werden, der unter der Schiene an der Haltestelle platziert wird. Es ist mit dem Hopper nicht möglich, an **einer** Haltestelle sowohl die leeren Fässer zu entladen, als auch die vollen Fässer zu beladen. Der Hopper lädt die vollen Fässer sofort wieder aus. Daher ist es ratsam, jeweils 2 Stationen auf der Be- und Entladeseite einzurichten und den Minecart dann über eine Aufzeichnungsfahrt entsprechend zu programmieren. @@ -376,6 +391,22 @@ Damit die Minecarts automatisch wieder starten, müssen die Prellböcke mit Stat [ta3_loading|plan] +### Tankwagen / Tank Cart + +Der Tankwagen dient zum Transport von Flüssigkeiten. Es kann wie Tanks mit Pumpen gefüllt bzw. geleert werden. In beiden Fällen muss die gelbe Röhre von oben mit dem Tankwagen verbunden werden. + +In den Tankwagen passen 100 Einheiten. + +[tank_cart|image] + +### Kistenwagen / Chest Cart + +Der Kistenwagen dient zum Transport von Items. Es kann wie Kisten über Schieber gefüllt bzw. geleert werden. + +In den Kistenwagen passen 4 Stacks. + +[chest_cart|image] + ## Öl-Verarbeitung @@ -584,6 +615,8 @@ Danach werden weitere Kommando für 8 Sekunden blockiert. Der Wagen Detektor sendet ein `on`-Kommando, wenn er einen Wagen/Cart (Minecart) direkt vor sich erkannt hat. Zusätzlich kann der Detektor auch den Wagen wieder starten, wenn ein `on`-Kommando empfangen wird. +Der Detektor kann auch mit seiner eigenen Nummer programmiert werden. In diesem Falle schiebt er alle Wagen an, die in seiner Nähe (ein Block in alle Richtungen) zum Halten kommen. + [ta3_cartdetector|image] diff --git a/manuals/manual_ta3_EN.md b/manuals/manual_ta3_EN.md index 054cfec..f9bc118 100644 --- a/manuals/manual_ta3_EN.md +++ b/manuals/manual_ta3_EN.md @@ -363,7 +363,24 @@ The large tank can hold 4000 units of oil, but also any other type of liquid. ## Oil Transportation -Minecarts can be used to transport oil from the oil well to the oil processing plant. Only canisters or barrels can be loaded into the Minecarts. Therefore, the oil must first be transferred to barrels. The oil barrels can be pushed directly into the Minecart with a pusher and tubes (see map). The empty barrels, which come back from the unloading station by Minecart, can be unloaded using a hopper, which is placed under the rail at the stop. +### Oil transportation by Tank Carts + +Tank carts can be used to transport oil from the oil well to the oil processing plant. A tank cart can be filled or emptied directly using pumps. In both cases, the yellow pipes must be connected to the tank cart from above. + +The following steps are necessary: + +- Place the tank cart in front of the rail bumper block. The bumper block must not yet be programmed with a time so that the tank cart does not start automatically +- Connect the tank cart to the pump using yellow pipes +- Switch on the pump +- Program the bumper with a time (10 - 20 s) + +This sequence must be observed on both sides (fill / empty). + +[tank_cart | image] + +### Oil transportation with barrels over Minecarts + +Canisters and barrels can be loaded into the Minecarts. To do this, the oil must first be transferred to barrels. The oil barrels can be pushed directly into the Minecart with a pusher and tubes (see map). The empty barrels, which come back from the unloading station by Minecart, can be unloaded using a hopper, which is placed under the rail at the stop. It is not possible with the hopper to both **unload the empty barrels and load the full barrels at a stop**. The hopper immediately unloads the full barrels. It is therefore advisable to set up 2 stations on the loading and unloading side and then program the Minecart accordingly using a recording run. @@ -373,7 +390,21 @@ For the Minecarts to start again automatically, the bumper blocks must be config [ta3_loading|plan] +### Tank Cart +The tank truck is used to transport liquids. Like tanks, it can be filled with pumps or emptied. In both cases, the yellow tube must be connected to the tank truck from above. + +100 units fit in the tank truck. + +[tank_cart | image] + +### Chest Cart + +The chest cart is used to transport items. Like chests, it can be filled or emptied using a pusher. + +4 stacks fit in the chest cart. + +[chest_cart | image] ## Oil Processing @@ -581,6 +612,8 @@ Then further commands are blocked for 8 seconds. The cart detector sends an `on` command if it has recognized a cart (Minecart) directly in front of it. In addition, the detector can also restart the cart when an `on` command is received. +The detector can also be programmed with its own number. In this case, he pushes all the wagons that stop near him (one block in all directions). + [ta3_cartdetector|image] diff --git a/manuals/toc_DE.md b/manuals/toc_DE.md index e50c6fe..077913b 100644 --- a/manuals/toc_DE.md +++ b/manuals/toc_DE.md @@ -80,6 +80,10 @@ - [TA3 Bohrgestänge / Drill Pipe](./manual_ta3_DE.md#ta3-bohrgestänge--drill-pipe) - [Öltank / Oil Tank](./manual_ta3_DE.md#Öltank--oil-tank) - [Öl-Transport](./manual_ta3_DE.md#Öl-transport) + - [Öl-Transport mit dem Tankwagen](./manual_ta3_DE.md#Öl-transport-mit-dem-tankwagen) + - [Öl-Transport mit Fässern über Minecarts](./manual_ta3_DE.md#Öl-transport-mit-fässern-über-minecarts) + - [Tankwagen / Tank Cart](./manual_ta3_DE.md#tankwagen--tank-cart) + - [Kistenwagen / Chest Cart](./manual_ta3_DE.md#kistenwagen--chest-cart) - [Öl-Verarbeitung](./manual_ta3_DE.md#Öl-verarbeitung) - [Destillationsturm / distiller tower](./manual_ta3_DE.md#destillationsturm--distiller-tower) - [Aufkocher / reboiler)](./manual_ta3_DE.md#aufkocher--reboiler)) diff --git a/manuals/toc_EN.md b/manuals/toc_EN.md index 6b9e1bd..2f7e56b 100644 --- a/manuals/toc_EN.md +++ b/manuals/toc_EN.md @@ -80,6 +80,10 @@ - [TA3 Drill Pipe](./manual_ta3_EN.md#ta3-drill-pipe) - [Oil tank](./manual_ta3_EN.md#oil-tank) - [Oil Transportation](./manual_ta3_EN.md#oil-transportation) + - [Oil transportation by Tank Carts](./manual_ta3_EN.md#oil-transportation-by-tank-carts) + - [Oil transportation with barrels over Minecarts](./manual_ta3_EN.md#oil-transportation-with-barrels-over-minecarts) + - [Tank Cart](./manual_ta3_EN.md#tank-cart) + - [Chest Cart](./manual_ta3_EN.md#chest-cart) - [Oil Processing](./manual_ta3_EN.md#oil-processing) - [Distillation Tower](./manual_ta3_EN.md#distillation-tower) - [Reboiler](./manual_ta3_EN.md#reboiler) diff --git a/textures/techage_chest_cart_bottom.png b/textures/techage_chest_cart_bottom.png new file mode 100644 index 0000000..6bd69ba Binary files /dev/null and b/textures/techage_chest_cart_bottom.png differ diff --git a/textures/techage_chest_cart_front.png b/textures/techage_chest_cart_front.png new file mode 100644 index 0000000..44ef504 Binary files /dev/null and b/textures/techage_chest_cart_front.png differ diff --git a/textures/techage_chest_cart_side.png b/textures/techage_chest_cart_side.png new file mode 100644 index 0000000..2a72a6c Binary files /dev/null and b/textures/techage_chest_cart_side.png differ diff --git a/textures/techage_chest_cart_top.png b/textures/techage_chest_cart_top.png new file mode 100644 index 0000000..35dac11 Binary files /dev/null and b/textures/techage_chest_cart_top.png differ diff --git a/textures/techage_tank_cart_bottom.png b/textures/techage_tank_cart_bottom.png new file mode 100644 index 0000000..e4b5987 Binary files /dev/null and b/textures/techage_tank_cart_bottom.png differ diff --git a/textures/techage_tank_cart_front.png b/textures/techage_tank_cart_front.png new file mode 100644 index 0000000..c1a1731 Binary files /dev/null and b/textures/techage_tank_cart_front.png differ diff --git a/textures/techage_tank_cart_side.png b/textures/techage_tank_cart_side.png new file mode 100644 index 0000000..f20e75b Binary files /dev/null and b/textures/techage_tank_cart_side.png differ diff --git a/textures/techage_tank_cart_top.png b/textures/techage_tank_cart_top.png new file mode 100644 index 0000000..fcdc59c Binary files /dev/null and b/textures/techage_tank_cart_top.png differ