Add ta5 teleport pipes

This commit is contained in:
Joachim Stolberg 2022-01-02 23:00:21 +01:00
parent 577a4e8bd3
commit 4f41c338ff
15 changed files with 377 additions and 151 deletions

View File

@ -70,6 +70,13 @@ local TELE_MENU = {
label = S("Remote name"),
tooltip = S("Connection name of the remote block"),
},
{
type = "output",
label = S("Status"),
tooltip = S("Connection status"),
name = "status",
default = "",
},
}
function techage.teleport.formspec(pos)
@ -127,23 +134,34 @@ function techage.teleport.get_remote_pos(pos)
end
end
function techage.teleport.after_formspec(pos, fields)
if techage.menu.eval_input(pos, TELE_MENU, fields) then
if not techage.teleport.is_connected(pos) then
local meta = M(pos)
if fields.remote_name ~= "" then -- Client
local tbl = get_pairing_table1(meta)
local peer_pos = tbl[fields.remote_name]
if peer_pos then
tbl[fields.remote_name] = nil
store_connection(pos, peer_pos)
store_connection(peer_pos, pos)
function techage.teleport.after_formspec(pos, player, fields, max_dist, ex_points)
if techage.get_expoints(player) >= ex_points then
if techage.menu.eval_input(pos, TELE_MENU, fields) then
if not techage.teleport.is_connected(pos) then
local meta = M(pos)
if fields.remote_name ~= "" then -- Client
local tbl = get_pairing_table1(meta)
local peer_pos = tbl[fields.remote_name]
if peer_pos then
if vector.distance(pos, peer_pos) <= max_dist then
tbl[fields.remote_name] = nil
store_connection(pos, peer_pos)
store_connection(peer_pos, pos)
M(pos):set_string("status", S("Connected"))
else
M(pos):set_string("status", S("Distance > @1 blocks", max_dist))
meta:set_string("formspec", techage.teleport.formspec(pos))
end
end
elseif fields.conn_name ~= "" then -- Server
local tbl = get_pairing_table1(meta)
tbl[fields.conn_name] = pos
techage.teleport.prepare_pairing(pos, nil, S("server not connected"))
end
elseif fields.conn_name ~= "" then -- Server
local tbl = get_pairing_table1(meta)
tbl[fields.conn_name] = pos
techage.teleport.prepare_pairing(pos, nil, S("server not connected"))
end
end
else
M(pos):set_string("status", S("Ex-points missing (@1 < @2)", techage.get_expoints(player), ex_points))
M(pos):set_string("formspec", techage.teleport.formspec(pos))
end
end

View File

@ -239,8 +239,8 @@ techage.manual_DE.aTitel = {
"3,TA5 Hyperloop Tank / TA5 Hyperloop Tank",
"3,Hyperloop Teleport Blöcke (geplant)",
"3,TA5 Container (geplant)",
"3,TA5-Teleport-Tubes (geplant)",
"3,TA5-Teleport-Pipes (geplant)",
"3,TA5-Teleportröhren / TA5-Teleport-Tubes",
"3,TA5-Teleportleitungen / TA5-Teleport-Pipes",
"3,TA5-Raumgleiter (geplant)",
"2,Weitere TA5 Blöcke/Items",
"3,TA5 KI Chip / TA5 AI Chip",
@ -2027,17 +2027,19 @@ techage.manual_DE.aText = {
"\n"..
"Für die Nutzung des TA5 Containers werden 80 Erfahrungspunkte benötigt.\n"..
"\n",
"Teleport Tubes erlauben den Item-Transport ohne Tubes bis zu einer Entfernung von 200 Blöcken.\n"..
"Teleportröhren erlauben den Item-Transport ohne Röhren bis zu einer Entfernung von 200 Blöcken.\n"..
"Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.\n"..
"\n"..
"Die Teleport-Tubes benötigen jeweils 5 ku Strom.\n"..
"Die Teleportröhren benötigen jeweils 12 ku Strom.\n"..
"\n"..
"Für die Nutzung der TA5 Teleport Tubes werden 60 Erfahrungspunkte benötigt.\n"..
"Für die Nutzung der Teleportröhren werden 60 Erfahrungspunkte benötigt.\n"..
"\n",
"Teleport Pipes erlauben den Flüssigkeiten-Transport ohne Pipes bis zu einer Entfernung von 200 Blöcken.\n"..
"Teleportleitungen erlauben den Flüssigkeiten-Transport ohne Leitungen bis zu einer Entfernung von 200 Blöcken.\n"..
"Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.\n"..
"\n"..
"Die Teleport-Pipes benötigen jeweils 5 ku Strom.\n"..
"Die Teleportleitungen benötigen jeweils 12 ku Strom.\n"..
"\n"..
"Für die Nutzung der TA5 Teleport Pipes werden 60 Erfahrungspunkte benötigt.\n"..
"Für die Nutzung der Teleportleitungen werden 60 Erfahrungspunkte benötigt.\n"..
"\n",
"Dank einem Spezialantrieb für Lichtgeschwindigkeit können mit dem Raumgleiter auch große Entfernungen sehr schnell überwunden werden.\n"..
"\n",

View File

@ -239,8 +239,8 @@ techage.manual_EN.aTitel = {
"3,TA5 Hyperloop Tank",
"3,Hyperloop Teleport Blocks (planned)",
"3,TA5 Container (planned)",
"3,TA5 Teleport Tubes (planned)",
"3,TA5 Teleport Pipes (planned)",
"3,TA5 Teleport Tubes",
"3,TA5 Teleport Pipes",
"2,More TA5 Blocks / Items",
"3,TA5 AI Chip",
}
@ -2025,14 +2025,16 @@ techage.manual_EN.aText = {
"80 experience points are required to use the TA5 container.\n"..
"\n",
"Teleport tubes allow items to be transported without tubes up to a distance of 200 blocks.\n"..
"For pairing you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks.\n"..
"\n"..
"The teleport tubes each require 5 ku of electricity.\n"..
"The teleport tubes each require 12 ku of electricity.\n"..
"\n"..
"60 experience points are required to use the TA5 Teleport Tubes.\n"..
"\n",
"Teleport Pipes allow liquids to be transported without pipes up to a distance of 200 blocks.\n"..
"For pairing you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks.\n"..
"\n"..
"The teleport pipes each require 5 ku of electricity.\n"..
"The teleport pipes each require 12 ku of electricity.\n"..
"\n"..
"60 experience points are required to use the TA5 Teleport Pipes.\n"..
"\n",

View File

@ -395,6 +395,7 @@ dofile(MP.."/collider/detector.lua")
dofile(MP.."/collider/worker.lua")
dofile(MP.."/teleport/teleport_tube.lua")
dofile(MP.."/teleport/teleport_pipe.lua")
-- Prevent other mods from using IE

View File

@ -255,21 +255,26 @@ TA2 Cylinder=TA2 Zylinder
### detector.lua ###
TA4 Collider Detector=TA4 Collider Detektor
TA4 Collider Detector Core=TA4 Collider Detektorkern
TA4 Detector=TA4 Detektor
### detector.lua ###
### logic_block.lua ###
### tele.lua ###
Blocking Time=Sperrzeit
### detector.lua ###
### tele.lua ###
Configured Items=Konfigurierte Gegenstände
Items which generate an 'on' command.@nIf empty, all passed items generate an 'on' command.=Items, die einen 'on'-Kommando generieren.@nWenn leer, generieren alle übergebenen Items einen 'on'-Befehl.
On Time=ON Zeit
TA3 Detector=TA3 Detektor
TA4 Collider Detector=TA4 Collider Detektor
TA4 Collider Detector Core=TA4 Collider Detektorkern
TA4 Detector=TA4 Detektor
The time after the 'off' command@nuntil the next 'on' command is accepted.=Die Zeit nach dem 'off' Kommando,@nbis das nächste 'on' Kommando akzeptiert wird.
The time between the 'on' and 'off' commands.=Die Zeit zwischen den 'on' und 'off' Kommandos.
### detector.lua ###
### logic_block.lua ###
Blocking Time=Sperrzeit
### display.lua ###
Display no: =Display Nr.
@ -593,7 +598,7 @@ Power network connection error=Stromnetz Verbindungsfehler
TA4 Heat Exchanger=TA4 Wärmetauscher
TA4 Heat Exchanger 2=TA4 Wärmetauscher 2
did you check the plan?=hast du den Plan geprüft?
inlet/pipe error=Einlass/Röhrenfehler
inlet/pipe error=Einlass/Leitungsfehler
wrong storage diameter=Falscher Wärmespeicher-Durchmesser
### heatexchanger3.lua ###
@ -607,25 +612,21 @@ Hydrogen Cylinder Small=Wasserstoffflasche klein
TA4 Hydrogen=TA4 Wasserstoff
### hyperloop.lua ###
### sensorchest.lua ###
### teleport.lua ###
### terminal.lua ###
not connected=nicht verbunden
### hyperloop.lua ###
### teleport.lua ###
Block name=Blockname
Connection name for this block=Verbindungsname für diesen Block
Connection name of the remote block=Verbindungsname des entfernten Blocks
Enter a block name or select an existing one=Gebe einen Blocknamen ein oder wähle einen vorhandenen aus
Remote name=Name entfernter Block
### hyperloop.lua ###
### lib.lua ###
### sensorchest.lua ###
### terminal.lua ###
connected with=verbunden mit
### hyperloop.lua ###
### sensorchest.lua ###
### terminal.lua ###
not connected=nicht verbunden
connected to=verbunden mit
### industriallamp1.lua ###
@ -645,7 +646,7 @@ TA4 LED Industrial Lamp=TA4 LED Industrielampe
### inlet.lua ###
TA4 Pipe Inlet=TA4 Rohrzulauf
TA4 Pipe Inlet=TA4 Leitungszulauf
one window maximum=maximal ein Fenster
wrong diameter (should be 5, 7, or 9)=falscher Durchmesser (sollte 5, 7, oder 9 sein)
wrong number of gravel nodes=falsche Anzahl von Kiesblöcken
@ -692,6 +693,12 @@ to=bis
Block has an@nadditional wrench menu=Block besitzt ein@nzusätzliches@nSchraubenschlüssel-Menü
### lib.lua ###
### sensorchest.lua ###
### terminal.lua ###
connected with=verbunden mit
### lighter.lua ###
TA1 Lighter=TA1 Anzünder
@ -881,7 +888,7 @@ TA4 Pillar=TA4 Säule
### pipe_wall_entry.lua ###
TA3 Pipe Wall Entry=TA3 Rohr/Wanddurchbruch
TA3 Pipe Wall Entry=TA3 Leitungs/Wanddurchbruch
### pipe_wrench.lua ###
@ -1264,6 +1271,28 @@ TA4 Tank=TA4 Tank
TA Tank Cart=TA Tankwagen
### teleport.lua ###
Connected=Verbunden
Connection status=Verbindungsstatus
Distance > @1 blocks=Abstand > @1 Blöcke
Ex-points missing (@1 < @2)=Erf.-Punkte fehlen (@1 < @2)
Status=Status
server not connected=Server nicht verbunden
### teleport_pipe.lua ###
TA5 Teleport Pipe=TA5 Teleport Leitung
### teleport_pipe.lua ###
### teleport_tube.lua ###
Remote block error=Fehler entfernter Block
### teleport_tube.lua ###
TA5 Teleport Tube=TA5 Teleport Röhre
### terminal.lua ###
Syntax error, try help=Syntax Fehler, nutze help
@ -1300,7 +1329,7 @@ TechAge Trowel=TechAge Kelle
### tube_wall_entry.lua ###
Tube Wall Entry=Tube Wanddurchbruch
Tube Wall Entry=Röhrenwanddurchbruch
### tubes.lua ###
@ -1373,6 +1402,3 @@ Remove detector=Entferne Detektor
TA4 Collider Detector Worker=TA4 Collider Detektor Worker
[TA4] Detector is being built!=[TA4] Detektor wird gebaut!
[TA4] Detector is being removed!=[TA4] Detektor wird entfernt!

View File

@ -255,21 +255,26 @@ TA2 Cylinder=
### detector.lua ###
TA4 Collider Detector=
TA4 Collider Detector Core=
TA4 Detector=
### detector.lua ###
### logic_block.lua ###
### tele.lua ###
Blocking Time=
### detector.lua ###
### tele.lua ###
Configured Items=
Items which generate an 'on' command.@nIf empty, all passed items generate an 'on' command.=
On Time=
TA3 Detector=
TA4 Collider Detector=
TA4 Collider Detector Core=
TA4 Detector=
The time after the 'off' command@nuntil the next 'on' command is accepted.=
The time between the 'on' and 'off' commands.=
### detector.lua ###
### logic_block.lua ###
Blocking Time=
### display.lua ###
Display no: =
@ -607,25 +612,21 @@ Hydrogen Cylinder Small=
TA4 Hydrogen=
### hyperloop.lua ###
### sensorchest.lua ###
### teleport.lua ###
### terminal.lua ###
not connected=
### hyperloop.lua ###
### teleport.lua ###
Block name=
Connection name for this block=
Connection name of the remote block=
Enter a block name or select an existing one=
Remote name=
### hyperloop.lua ###
### lib.lua ###
### sensorchest.lua ###
### terminal.lua ###
connected with=
### hyperloop.lua ###
### sensorchest.lua ###
### terminal.lua ###
not connected=
connected to=
### industriallamp1.lua ###
@ -692,6 +693,12 @@ to=
Block has an@nadditional wrench menu=
### lib.lua ###
### sensorchest.lua ###
### terminal.lua ###
connected with=
### lighter.lua ###
TA1 Lighter=
@ -1264,6 +1271,28 @@ TA4 Tank=
TA Tank Cart=
### teleport.lua ###
Connected=
Connection status=
Distance > @1 blocks=
Ex-points missing (@1 < @2)=
Status=
server not connected=
### teleport_pipe.lua ###
TA5 Teleport Pipe=
### teleport_pipe.lua ###
### teleport_tube.lua ###
Remote block error=
### teleport_tube.lua ###
TA5 Teleport Tube=
### terminal.lua ###
Syntax error, try help=

View File

@ -66,21 +66,23 @@ Der TA5 Container erlaubt Techage Anlagen ein- und an einer anderen Stelle wiede
Für die Nutzung des TA5 Containers werden 80 Erfahrungspunkte benötigt.
### TA5-Teleport-Tubes (geplant)
### TA5-Teleportröhren / TA5-Teleport-Tubes
Teleport Tubes erlauben den Item-Transport ohne Tubes bis zu einer Entfernung von 200 Blöcken.
Teleportröhren erlauben den Item-Transport ohne Röhren bis zu einer Entfernung von 200 Blöcken.
Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.
Die Teleport-Tubes benötigen jeweils 5 ku Strom.
Die Teleportröhren benötigen jeweils 12 ku Strom.
Für die Nutzung der TA5 Teleport Tubes werden 60 Erfahrungspunkte benötigt.
Für die Nutzung der Teleportröhren werden 60 Erfahrungspunkte benötigt.
### TA5-Teleport-Pipes (geplant)
### TA5-Teleportleitungen / TA5-Teleport-Pipes
Teleport Pipes erlauben den Flüssigkeiten-Transport ohne Pipes bis zu einer Entfernung von 200 Blöcken.
Teleportleitungen erlauben den Flüssigkeiten-Transport ohne Leitungen bis zu einer Entfernung von 200 Blöcken.
Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.
Die Teleport-Pipes benötigen jeweils 5 ku Strom.
Die Teleportleitungen benötigen jeweils 12 ku Strom.
Für die Nutzung der TA5 Teleport Pipes werden 60 Erfahrungspunkte benötigt.
Für die Nutzung der Teleportleitungen werden 60 Erfahrungspunkte benötigt.
### TA5-Raumgleiter (geplant)

View File

@ -66,19 +66,21 @@ The TA5 container allows Techage systems to be packed and unpacked at another lo
80 experience points are required to use the TA5 container.
### TA5 Teleport Tubes (planned)
### TA5 Teleport Tubes
Teleport tubes allow items to be transported without tubes up to a distance of 200 blocks.
For pairing you first have to enter a name for the block on one side, then you can select this name for the other block and thus connect the two blocks.
The teleport tubes each require 5 ku of electricity.
The teleport tubes each require 12 ku of electricity.
60 experience points are required to use the TA5 Teleport Tubes.
### TA5 Teleport Pipes (planned)
### TA5 Teleport Pipes
Teleport Pipes allow liquids to be transported without pipes up to a distance of 200 blocks.
For pairing you first have to enter a name for the block on one side, then you can select this name for the other block and thus connect the two blocks.
The teleport pipes each require 5 ku of electricity.
The teleport pipes each require 12 ku of electricity.
60 experience points are required to use the TA5 Teleport Pipes.

View File

@ -238,8 +238,8 @@
- [TA5 Hyperloop Tank / TA5 Hyperloop Tank](./manual_ta5_DE.md#ta5-hyperloop-tank--ta5-hyperloop-tank)
- [Hyperloop Teleport Blöcke (geplant)](./manual_ta5_DE.md#hyperloop-teleport-blöcke-(geplant))
- [TA5 Container (geplant)](./manual_ta5_DE.md#ta5-container-(geplant))
- [TA5-Teleport-Tubes (geplant)](./manual_ta5_DE.md#ta5-teleport-tubes-(geplant))
- [TA5-Teleport-Pipes (geplant)](./manual_ta5_DE.md#ta5-teleport-pipes-(geplant))
- [TA5-Teleportröhren / TA5-Teleport-Tubes](./manual_ta5_DE.md#ta5-teleportröhren--ta5-teleport-tubes)
- [TA5-Teleportleitungen / TA5-Teleport-Pipes](./manual_ta5_DE.md#ta5-teleportleitungen--ta5-teleport-pipes)
- [TA5-Raumgleiter (geplant)](./manual_ta5_DE.md#ta5-raumgleiter-(geplant))
- [Weitere TA5 Blöcke/Items](./manual_ta5_DE.md#weitere-ta5-blöckeitems)
- [TA5 KI Chip / TA5 AI Chip](./manual_ta5_DE.md#ta5-ki-chip--ta5-ai-chip)

View File

@ -238,7 +238,7 @@
- [TA5 Hyperloop Tank](./manual_ta5_EN.md#ta5-hyperloop-tank)
- [Hyperloop Teleport Blocks (planned)](./manual_ta5_EN.md#hyperloop-teleport-blocks-(planned))
- [TA5 Container (planned)](./manual_ta5_EN.md#ta5-container-(planned))
- [TA5 Teleport Tubes (planned)](./manual_ta5_EN.md#ta5-teleport-tubes-(planned))
- [TA5 Teleport Pipes (planned)](./manual_ta5_EN.md#ta5-teleport-pipes-(planned))
- [TA5 Teleport Tubes](./manual_ta5_EN.md#ta5-teleport-tubes)
- [TA5 Teleport Pipes](./manual_ta5_EN.md#ta5-teleport-pipes)
- [More TA5 Blocks / Items](./manual_ta5_EN.md#more-ta5-blocks--items)
- [TA5 AI Chip](./manual_ta5_EN.md#ta5-ai-chip)

191
teleport/teleport_pipe.lua Normal file
View File

@ -0,0 +1,191 @@
--[[
TechAge
=======
Copyright (C) 2017-2022 Joachim Stolberg
AGPL v3
See LICENSE.txt for more information
TA5 teleport pipe
]]--
-- for lazy programmers
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local S2P = minetest.string_to_pos
local M = minetest.get_meta
local S = techage.S
local Pipe = techage.LiquidPipe
local teleport = techage.teleport
local Cable = techage.ElectricCable
local power = networks.power
local liquid = networks.liquid
local STANDBY_TICKS = 4
local COUNTDOWN_TICKS = 4
local CYCLE_TIME = 2
local PWR_NEEDED = 12
local EX_POINTS = 60
local MAX_DIST = 200
local DESCRIPTION = S("TA5 Teleport Pipe")
local function formspec(self, pos, nvm)
local title = DESCRIPTION .. " " .. M(pos):get_string("tele_status")
return "size[8,2]"..
"box[0,-0.1;7.8,0.5;#c6e8ff]" ..
"label[0.5,-0.1;" .. minetest.colorize( "#000000", title) .. "]" ..
"image_button[3.5,1;1,1;" .. self:get_state_button_image(nvm) .. ";state_button;]" ..
"tooltip[3.5,1;1,1;" .. self:get_state_tooltip(nvm) .. "]"
end
local function can_start(pos, nvm, state)
return teleport.is_connected(pos)
end
local State = techage.NodeStates:new({
node_name_passive = "techage:ta5_tele_pipe",
infotext_name = DESCRIPTION,
cycle_time = CYCLE_TIME,
standby_ticks = STANDBY_TICKS,
countdown_ticks = COUNTDOWN_TICKS,
formspec_func = formspec,
can_start = can_start,
})
local function consume_power(pos, nvm)
if techage.needs_power(nvm) then
local taken = power.consume_power(pos, Cable, nil, PWR_NEEDED)
if techage.is_running(nvm) then
if taken < PWR_NEEDED then
State:nopower(pos, nvm)
else
return true -- keep running
end
elseif taken == PWR_NEEDED then
State:start(pos, nvm)
end
end
end
minetest.register_node("techage:ta5_tele_pipe", {
description = DESCRIPTION,
tiles = {
-- up, down, right, left, back, front
"techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_tele_pipe.png",
"techage_filling_ta4.png^techage_frame_ta5_top.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_hole_pipe.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png",
},
after_place_node = function(pos, placer)
local meta = M(pos)
local nvm = techage.get_nvm(pos)
local node = minetest.get_node(pos)
local pipe_dir = techage.side_to_outdir("L", node.param2)
local number = techage.add_node(pos, "techage:ta5_tele_pipe")
State:node_init(pos, nvm, number)
meta:set_int("pipe_dir", pipe_dir)
meta:set_string("owner", placer:get_player_name())
Pipe:after_place_node(pos, {pipe_dir})
Cable:after_place_node(pos)
teleport.prepare_pairing(pos, "ta5_tele_pipe")
end,
on_receive_fields = function(pos, formname, fields, player)
if minetest.is_protected(pos, player:get_player_name()) then
return
end
if teleport.is_connected(pos) then
local nvm = techage.get_nvm(pos)
State:state_button_event(pos, nvm, fields)
M(pos):set_string("formspec", formspec(State, pos, nvm))
else
teleport.after_formspec(pos, player, fields, MAX_DIST, EX_POINTS)
end
end,
on_rightclick = function(pos, clicker, listname)
if teleport.is_connected(pos) then
local nvm = techage.get_nvm(pos)
M(pos):set_string("formspec", formspec(State, pos, nvm))
else
M(pos):set_string("formspec", teleport.formspec(pos))
end
end,
on_timer = function(pos, elapsed)
local nvm = techage.get_nvm(pos)
consume_power(pos, nvm)
-- the state has to be triggered by on_push_item
State:idle(pos, nvm)
return State:is_active(nvm)
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
techage.remove_node(pos, oldnode, oldmetadata)
teleport.stop_pairing(pos, oldmetadata)
Pipe:after_dig_node(pos)
Cable:after_dig_node(pos)
techage.del_mem(pos)
end,
paramtype2 = "facedir", -- important!
on_rotate = screwdriver.disallow, -- important!
is_ground_content = false,
groups = {choppy=2, cracky=2, crumbly=2},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
output = "techage:ta5_tele_pipe",
recipe = {
{"techage:aluminum", "dye:red", "techage:aluminum"},
{"techage:ta3_pipeS", "techage:usmium_nuggets", "techage:ta5_aichip"},
{"techage:ta4_carbon_fiber", "", "techage:ta4_carbon_fiber"},
},
})
local blocked = false -- flag to prevent stack overruns (not to pump into the own "tank")
liquid.register_nodes({"techage:ta5_tele_pipe"}, Pipe, "tank", {"L"}, {
peek = function(pos)
local nvm = techage.get_nvm(pos)
return liquid.srv_peek(nvm)
end,
put = function(pos, indir, name, amount)
local nvm = techage.get_nvm(pos)
nvm.oil_amount = nvm.oil_amount or 0
if not blocked and 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 pipe_dir = M(rmt_pos):get_int("pipe_dir")
blocked = true
local leftover = liquid.put(rmt_pos, Pipe, pipe_dir, name, amount)
blocked = false
if leftover < amount then
State:keep_running(pos, nvm, COUNTDOWN_TICKS)
State:keep_running(rmt_pos, rmt_nvm, COUNTDOWN_TICKS)
end
return leftover
else
State:blocked(pos, nvm, S("Remote block error"))
end
end
return amount
end
})
techage.register_node({"techage:ta5_tele_pipe"}, {
on_recv_message = function(pos, src, topic, payload)
return State:on_receive_message(pos, topic, payload)
end,
})
power.register_nodes({"techage:ta5_tele_pipe"}, Cable, "con", {"B", "R", "F", "D", "U"})
Pipe:set_valid_sides("techage:ta5_tele_pipe", {"L"})

View File

@ -8,7 +8,7 @@
AGPL v3
See LICENSE.txt for more information
TA5 teleport nodes
TA5 teleport tube
]]--
@ -21,7 +21,6 @@ local S = techage.S
local Tube = techage.Tube
local teleport = techage.teleport
local Cable = techage.ElectricCable
--local Cable = techage.Axle
local power = networks.power
local STANDBY_TICKS = 4
@ -29,43 +28,9 @@ local COUNTDOWN_TICKS = 4
local CYCLE_TIME = 2
local PWR_NEEDED = 12
local EX_POINTS = 60
local MAX_DIST = 200
local DESCRIPTION = S("TA5 Teleport Tube")
-- 2 Blöcke on/off
-- Strom von 7 Seiten
-- Pipe/Tube nur von einer Seite
-- TA5 Design
-- Consumer block mit on/off
-- Inventory mit 4 stacks
-- wrench menü?
-- normales Menü wenn connected
local WRENCH_MENU = {
{
type = "dropdown",
choices = "1,2,4,6,8,12,16",
name = "ontime",
label = S("On Time") .. " [s]",
tooltip = S("The time between the 'on' and 'off' commands."),
default = "1",
},
{
type = "dropdown",
choices = "2,4,6,8,12,16,20",
name = "blockingtime",
label = S("Blocking Time") .. " [s]",
tooltip = S("The time after the 'off' command\nuntil the next 'on' command is accepted."),
default = "8",
},
{
type = "items",
name = "config",
label = S("Configured Items"),
tooltip = S("Items which generate an 'on' command.\nIf empty, all passed items generate an 'on' command."),
size = 4,
}
}
local function formspec(self, pos, nvm)
local title = DESCRIPTION .. " " .. M(pos):get_string("tele_status")
return "size[8,2]"..
@ -108,12 +73,12 @@ minetest.register_node("techage:ta5_tele_tube", {
description = DESCRIPTION,
tiles = {
-- up, down, right, left, back, front
"techage_filling_ta4.png^techage_frame_ta5_top.png^techage_appl_tele_tube.png",
"techage_filling_ta4.png^techage_frame_ta5_top.png",
"techage_filling_ta4.png^techage_frame_ta5_top.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_wifi.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_hole_tube.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_wifi.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_wifi.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png",
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png",
},
after_place_node = function(pos, placer)
@ -122,7 +87,6 @@ minetest.register_node("techage:ta5_tele_tube", {
local node = minetest.get_node(pos)
local tube_dir = techage.side_to_outdir("L", node.param2)
local number = techage.add_node(pos, "techage:ta5_tele_tube")
nvm.running = false
State:node_init(pos, nvm, number)
meta:set_int("tube_dir", tube_dir)
meta:set_string("owner", placer:get_player_name())
@ -140,9 +104,7 @@ minetest.register_node("techage:ta5_tele_tube", {
State:state_button_event(pos, nvm, fields)
M(pos):set_string("formspec", formspec(State, pos, nvm))
else
if techage.get_expoints(player) >= EX_POINTS then
teleport.after_formspec(pos, fields)
end
teleport.after_formspec(pos, player, fields, MAX_DIST, EX_POINTS)
end
end,
@ -181,9 +143,9 @@ minetest.register_node("techage:ta5_tele_tube", {
minetest.register_craft({
output = "techage:ta5_tele_tube",
recipe = {
{"", "dye:red", ""},
{"techage:ta4_tubeS", "techage:ta5_aichip", ""},
{"", "group:wood", ""},
{"techage:aluminum", "dye:red", "techage:aluminum"},
{"techage:ta4_tubeS", "techage:usmium_nuggets", "techage:ta5_aichip"},
{"techage:ta4_carbon_fiber", "", "techage:ta4_carbon_fiber"},
},
})
@ -201,7 +163,7 @@ techage.register_node({"techage:ta5_tele_tube"}, {
return true
end
else
State:blocked(pos, nvm, S("Remote node error"))
State:blocked(pos, nvm, S("Remote block error"))
end
end
return false
@ -209,16 +171,7 @@ techage.register_node({"techage:ta5_tele_tube"}, {
is_pusher = true, -- is a pulling/pushing node
on_recv_message = function(pos, src, topic, payload)
if topic == "count" then
local nvm = techage.get_nvm(pos)
return nvm.counter or 0
elseif topic == "reset" then
local nvm = techage.get_nvm(pos)
nvm.counter = 0
return true
else
return "unsupported"
end
return State:on_receive_message(pos, topic, payload)
end,
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

View File

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 163 B