bugfix #2 (oil explorer), lua controller manuall and terminal node added

This commit is contained in:
Joachim Stolberg 2020-03-08 22:36:23 +01:00
parent 96a6cd4c56
commit 7ed4e5fd32
14 changed files with 835 additions and 412 deletions

View File

@ -678,7 +678,7 @@ techage.manual_DE.aText = {
"\n"..
"\n"..
"\n",
"Mit dem Ölexplorer kannst du nach Öl suchen. Dazu den Block auf den Boden setzen und mit Rechtsklick die Suche starten.\n"..
"Mit dem Ölexplorer kannst du nach Öl suchen. Dazu den Block auf den Boden setzen und mit Rechtsklick die Suche starten. Der Ölexplorer kann oberirdisch und unterirdisch in Tiefen bis zu -50 Meter eingesetzt werden.\n"..
"Über die Chat-Ausgabe wird dir angezeigt\\, in welcher Tiefe nach Öl gesucht wurde und wie viel Öl (oil) gefunden wurde.\n"..
"Du kannst bis zu 4 mal auf den Block klicken\\, um auch in tieferen Bereichen nach Öl zu suchen. Ölfelder haben eine Größe von 2000 bis zu 20000 Items.\n"..
"\n"..

View File

@ -228,6 +228,7 @@ else
-- dofile(MP.."/lua_controller/commands.lua")
-- dofile(MP.."/lua_controller/server.lua")
-- dofile(MP.."/lua_controller/sensorchest.lua")
-- dofile(MP.."/lua_controller/terminal.lua")
-- Items
dofile(MP.."/items/barrel.lua")

View File

@ -23,6 +23,7 @@ Basalt Gravel=Basaltkies
Basalt Stone=Basaltgestein
Basalt Stone Block=Basaltsteinblock
Basalt Stone Brick=Basaltsteinziegel
Battery=Batterie
Bauxite Cobblestone=Bauxit Kopfsteinpflaster
Bauxite Gravel=Bauxit Kies
Bauxite Powder=Bauxit Pulver
@ -95,6 +96,7 @@ Meridium Pickaxe=Meridium Pickel
Meridium Shovel=Meridium Schaufel
Meridium Sword=Meridium Schwert
More water expected (2 m deep)!=Mehr Wasser erwartet (2 m tief)
Nacelle is missing=Die Gondel fehlt
Needle Powder=Nadel Pulver
Network Data=Netzwerkdaten
No network or active generator available!=Kein Stromnetz oder aktiver Generator verfügbar
@ -102,6 +104,7 @@ No plan available=Kein Plan verfügar
No wind at this altitude!=Kein Wind auf dieser Höhe
Node owner=Blockbesitzer
Number of all nodes=Anzahl aller Blöcke
Oil=Öl
Oil Drill Box=Ölbohrkiste
Oil Pumpjack=Ölpumpe
Oil Source=Erdöl
@ -127,6 +130,9 @@ Recipe=Rezept
Red Mud=Rotschlamm
Red Mud Barrel=Rotschlamm Fass
Red Mud Canister=Rotschlamm Kanister
Red Stone=Rotstein
Red Stone Block=Rotsteinblock
Red Stone Brick=Rotsteinziegel
Remove derrick=Entferne Ölturm
Rinsing=Waschen
River Water Barrel=Flusswasserfass
@ -263,23 +269,25 @@ TA4 Pillar=TA4 Säule
TA4 Pipe Inlet=TA4 Rohrzulauf
TA4 Protected Chest=TA4 Gesicherte Kiste
TA4 Pump=TA4 Pumpe
TA4 RAM Chip=RAM Chip
TA4 Reactor=TA4 Reaktor
TA4 Reactor Base=TA4 Reaktor Sockel
TA4 Reactor Filler Pipe=TA4 Reaktor Einfüllstutzen
TA4 Reactor Stand=TA4 Reaktor Ständer
TA4 Rotor Blade=TA4 Rotorblatt
TA4 Sensor Chest=Sensorkiste
TA4 Silicon Wafer=TA4 Silizium-Wafer
TA4 Silo=Silo
TA4 Solar Carrier Module=TA4 Solar Trägermodul
TA4 Solar Carrier Module B=TA4 Solar Trägermodul U
TA4 Solar Carrier Module T=TA4 Solar Trägermodul O
TA4 Solar Inverter=TA4 Solar Wechselrichter
TA4 Solar Inverter DC=TA4 Solar Wechselrichter DC
TA4 Solar Module=TA4 Solarmodul
TA4 Streetlamp Solar Cell=TA4 Straßenlampen-Solarzelle
TA4 Tank=TA4 Tank
TA4 Turbine=TA4 Turbine
TA4 WLAN Chip=TA4 WLAN Chip
TA4 Wall Pipe=TA4 Wandröhre
TA4 Water Pump=Wasserpumpe
TA4 Wind Turbine=TA4 Windkraftanlage
TA4 Wind Turbine Nacelle=TA4 Windkraftanlagengondel
@ -297,6 +305,7 @@ TechAge Signal Lamp (can be colored)=TechAge Signallampe (kann gefärbt werden)
TechAge Steel Mat=TechAge Stahlmatte
TechAge Trowel=TechAge Kelle
Techage Forceload Block=Techage Forceload Block
Techage Forceload Tile=Techage Forceload Kachel
The network is overloaded!=Das Stromnetz ist überlastet!
The network load is almost at the limit!=Das Stromnetz ist ziemlich am Limit!
The wind turbines are too close together!=Die Windkraftanlagen stehen zu eng beisammen!
@ -316,6 +325,7 @@ Water Barrel=Wasserfass
Water Boiler=Wasserboiler
Water Pump=Wasserpumpe
[Bucket] Lava can only be placed below sea level!=Lava kann nur unterhalb der Meerehöhe platziert werden!
[TA Oil] No oil exploration possible at this depth! = [TA Oil] Keine Ölsuche in dieser Tiefe möglich!
[TA4 Wind Turbine]=[TA4 Windkraftanlage]
[TA] Area is protected!=[TA] Bereich ist geschützt
[TA] Derrick is being built!=[TA] Bohrturm wird errichtet
@ -334,6 +344,7 @@ added or removed=hinzugefügt oder entfernt wird
block can't be dug=Block kann nicht abgebaut werden
commands like: help=Kommandos wie: help
connected with=verbunden mit
depth=Tiefe
did you check the plan?=hast du den Plan geprüft?
empty=leer
full=voll
@ -357,11 +368,13 @@ reactor has no power=Reaktor hat keinen Strom
removed=entfernt
repaired=repariert
stopped=gestoppt
storage empty?=Speicher leer?
water temperature=Wassertemperatur
wrong storage diameter=Falscher Wärmespeicher-Durchmesser
##### not used anymore #####
Number of nodes=Anzahl Blöcke
Secondary needed=Sekundär benötigt
Number of nodes=Anzahl Blöcke
TA4 Solar Inverter DC=TA4 Solar Wechselrichter DC
Secondary available=Sekundär verfügbar
Primary available=Primär verfügbar
Primary needed=Primär benötigt

View File

@ -1,366 +0,0 @@
# textdomain: techage
#### TA3 Terminal ####@n@nSend commands to your machines@nand output text messages from your@nmachines to the Terminal.@n@nCommand syntax:@n cmd <num> <cmnd>@n@nexample: cmd 181 on@n<num> is the number of the node to which the command is sent@n'on' is the command to turn machines/nodes on@nFurther commands can be retrieved by clicking on@nmachines/nodes with the Techage Info Tool.@n@nLocal commands:@n- clear @= clear screen@n- help @= this message@n- pub @= switch to public use@n- priv @= switch to private use@nTo program a user button with a command:@n set <button-num> <button-text> <command>@ne.g. 'set 1 ON cmd 123 on'@n=
Active:=Aktiv:
All nodes:=Alle Blöcke:
Allow to dig/place Techage power lines nearby power poles=Erlaubt TODO
Aluminum=Aluminium
Area already loaded or max. number of Forceload Blocks reached!=Bereich bereits geladen oder maximale Anzahl von Forceload Blöcken erreicht!
Ash=Asche
Autocrafter=Autocrafter
Axle Power Source=Achsenkraftquelle
Baborium Ingot=Baboriumbarren
Baborium Lump=Baboriumklumpen
Baborium Ore=Baboriumerz
Basalt Cobble=Basaltpflaster
Basalt Glass=Basaltglas
Basalt Glass 2=Basaltglas 2
Basalt Glass Thin=Basaltglas dünn
Basalt Glass Thin 2=Basaltglas dünn 2
Basalt Glass Thin XL=Basaltglas dünn XL
Basalt Glass Thin XL 2=Basaltglas dünn XL 2
Basalt Gravel=Basaltkies
Basalt Stone=Basaltgestein
Basalt Stone Block=Basaltsteinblock
Basalt Stone Brick=Basaltsteinziegel
Bauxite Cobblestone=Bauxit Kopfsteinpflaster
Bauxite Gravel=Bauxit Kies
Bauxite Powder=Bauxit Pulver
Bauxite Stone=Bauxit
Biome=Biom
Block configured items for open ports=Blockiere konfigurierte Gegenstände für offene Ausgänge
Build derrick=Errichte Ölturm
Compressed Gravel=Komprimiertes Kies
Consum. 1=Konsum. 1
Consum. 2=Konsum. 2
Depth=Tiefe
Digging depth=Grabungstiefe
Dirt with Ash=Erde mit Asche
Distributor=Verteiler
Doser=Dosierer
Drill Bit=Bohrstange
Drill area is protected=Bohrbereich ist geschützt
Drill bits missing=Bohrgestänge fehlt
Ele Power Source=Ele Kraftquelle
Electricity=Strom
Electrolyzer=Eletrolyseur
Electronic Fab=Elektronikfabrik
Enter=Eingeben
Epoxide Resin=Epoxidharz
Epoxide Resin Barrel=Epoxidharz Fass
Epoxide Resin Canister=Epoxidharz Kanister
Error=Fehler
Firebox=Feuerkasten
Flint and Iron=Flint and Iron
Flowing Oil=Fließendes Öl
Flywheel=Schwungrad
Force order of filter items=Erzwinge Reihenfolge
Fuel Cell=Brennstoffzelle
Fuel Menu=Brennstoff Menü
Furnace Top=Ofenoberteil
Gas Cylinder Large=Gasflasche groß
Gas Cylinder Small=Gasflasche klein
Genera. 1=Genera. 1
Genera. 2=Genera. 2
Generator=Generator
Gibbsite Powder=Gibbsit Pulver
Gravel Rinser=Kiesspüler
Gravel Sieve=Kiessieb
Grinder=Mühle
Grinding=Mahlen
Heat=Hitze
Heat Exchanger=Wärmetauscher
Hydrogen Cylinder Large=Wasserstoffflasche groß
Hydrogen Cylinder Small=Wasserstoffflasche klein
In use:=In Benutzung:
Insert destination node number(s)=Gebe Zielnummer(n) ein
Inverter=Wechselrichter
Leave Powder=Laub Pulver
Liquid Filler=Einfülltrichter
Liquid Sampler=Flüssigkeitensammler
Liquid Tank=Flüssigkeitstank
List of your Forceload Blocks:=Liste der Forceload Blöcke
Load=Ladung
Lye=Lauge
Lye Barrel=Lauge Fass
Lye Canister=Lauge Kanister
Melting Guide=Schmelzführer
Melting Pot active (heat@==Schmelztiegel aktiv (Hitze@=
Melting Pot inactive (heat@==Schmelztiegel inaktiv (Hitze@=
Melting Pot inactive (heat@=0)=Schmelztiegel inaktiv (Hitze@=0)
Menu=Menü
Menu,Recipes=Menü,Rezepte
Meridium Axe=Meridium Axt
Meridium Pickaxe=Meridium Pickel
Meridium Shovel=Meridium Schaufel
Meridium Sword=Meridium Schwert
More water expected (2 m deep)!=Mehr Wasser erwartet (2 m tief)
Needle Powder=Nadel Pulver
Network Data=Netzwerkdaten
No network or active generator available!=Kein Stromnetz oder aktiver Generator verfügbar
No plan available=Kein Plan verfügar
No wind at this altitude!=Kein Wind auf dieser Höhe
Node owner=Blockbesitzer
Number of all nodes=Anzahl aller Blöcke
Number of nodes=Anzahl Blöcke
Oil Drill Box=Ölbohrkiste
Oil Pumpjack=Ölpumpe
Oil Source=Erdöl
Oil Tank=Öltank
Oil amount=Ölmenge
Outp=Ergeb.
Plan=Plan
Plastic Granules=Plastikgranulat
Position=Position
Position temperature=Positionstemperatur
Power AC=Wechselstrom
Power DC=Gleichstrom
Power Source=Stromquelle
Primary available=Primär verfügbar
Primary needed=Primär benötigt
Priv missing=Rechte fehlen
Propane Cylinder Large=Propangasflasche groß
Propane Cylinder Small=Propangasflasche klein
Pumpjack=Ölpumpe
Punch the block to make the area visible.=Schlage auf den Bock um den Bereich anzuzeigen.
Pusher=Schieber
Quarry=Steinbrecher
Quarry area is protected=Bereich ist geschützt
Recipe=Rezept
Red Mud=Rotschlamm
Red Mud Barrel=Rotschlamm Fass
Red Mud Canister=Rotschlamm Kanister
Remove derrick=Entferne Ölturm
Rinsing=Waschen
River Water Barrel=Flusswasserfass
Save=Speichern
Secondary available=Sekundär verfügbar
Secondary needed=Sekundär benötigt
Send signal if nodes have been:=Sende ein Signal falls Blöcke:
Show all forceload blocks in a 64x64x64 range=Zeige alle Forceload Blöcke im Umkreis von 64x64x64 Blöcken
Sieved Basalt Gravel=Basaltkies gesiebt
Sieved Gravel=Gesiebtes Kies
Start level=Startebene
Start level @= 0@nmeans the same Y-level@nas the quarry is placed=Startebene @= 0@nbedeutet gleiche Y-Ebene@nwie der Steinbrecher
Steam Power Source=Dampfenergiequelle
Store=Speichern
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 Construction Board=TA Konstruktionsplan
TA Electric Cable=TA Stromkabel
TA Electric Junction Box=TA Verteilerdose
TA Empty Barrel=TA leeres Fass
TA Industrial Lamp 1=TA Industrielampe 1
TA Industrial Lamp 2=TA Industrielampe 2
TA Industrial Lamp 3=TA Industrielampe 3
TA Junction Pipe=TA Leitungskupplung
TA Lamp=TA Lampe
TA Liquid Filler=TA Einfülltrichter
TA Pipe=TA Leitung (Flüssigkeiten)
TA Power Line=TA Stromleitung
TA Power Pole=TA Strommast
TA Power Pole Top (for up to 6 connections)=TA Strommastkopf (für bis zu 6 Verbindungen)
TA Power Pole Top 2 (for landlines)=TA Strommastkopf 2 (für Überlandleitungen)
TA Power Switch=TA Stromschalter
TA Power Switch Box=TA Stromschalterbox
TA Power Switch Small=TA Stromschalter klein
TA Street Lamp=TA Straßenlampe
TA1 Bronze Hammer (smash stone to gravel)=TA1 Bronzehammer (zerschlage Stein zu Kies)
TA1 Burning=TA1 Brennen
TA1 Charcoal=TA1 Holzkohle
TA1 Diamond Hammer (smash stone to gravel)=TA1 Diamanthammer (zerschlage Stein zu Kies)
TA1 Gravel Sieve=TA1 Kiessieb
TA1 Iron Ingot=TA1 Eisenbarren
TA1 Lighter=TA1 Anzünder
TA1 Melting=TA1 Schmelzen
TA1 Melting Pot=TA1 Schmelztiegel
TA1 Meridium Hammer (smash stone to gravel)=TA1 Meridiumhammer (zerschlage Stein zu Kies)
TA1 Mese Hammer (smash stone to gravel)=TA1 Mesehammer (zerschlage Stein zu Kies)
TA1 Steel Hammer (smash stone to gravel)=TA1 Stahlhammer (zerschlage Stein zu Kies)
TA2 Boiler Base=TA2 Boiler unten
TA2 Boiler Top=TA2 Boiler oben
TA2 Cylinder=TA2 Zylinder
TA2 Drive Axle=TA2 Antriebsachse
TA2 Ele Fab=TA2 E-Fabrik
TA2 Firebox=TA2 Feuerkiste
TA2 Flywheel=TA2 Schwungrad
TA2 Gearbox=TA2 Getriebeblock
TA2 Gravel Sieve=TA2 Kiessieb
TA2 Protected Chest=TA2 Gesicherte Kiste
TA2 Steam Pipe=TA2 Dampfleitung
TA3 Accu Box=Akkublock
TA3 Akku Box=TA3 Akku Block
TA3 Bitumen=TA3 Bitumen
TA3 Bitumen Barrel=TA3 Bitumenfass
TA3 Bitumen Canister=TA3 Bitumenkanister
TA3 Boiler Base=TA3 Boiler unten
TA3 Boiler Top=TA3 Boiler oben
TA3 Booster=TA3 Gebläse
TA3 Button/Switch=TA3 Taster/Schalter
TA3 Canister=TA3 Kanister
TA3 Cart Detector=TA3 Wagen Detektor
TA3 Coal Power Station Firebox=TA3 Kohlekraftwerks-Feuerbox
TA3 Cooler=TA3 Kühler
TA3 Derrick=TA3 Bohrturm
TA3 Detector=TA3 Detektor
TA3 Distillation Tower 1=TA3 Destillationsturm 1
TA3 Distillation Tower 2=TA3 Destillationsturm 2
TA3 Distillation Tower 3=TA3 Destillationsturm 3
TA3 Distillation Tower 4=TA3 Destillationsturm 4
TA3 Distillation Tower Base=TA3 Destillationsturm Basis
TA3 Drill Bit=TA3 Bohrgestänge
TA3 Ele Fab=TA3 E-Fabrik
TA3 Fuel Oil=TA3 Schweröl
TA3 Fuel Oil Barrel=TA3 Schwerölfass
TA3 Fuel Oil Canister=TA3 Schwerölkanister
TA3 Furnace Oil Burner=TA3 Ofen-Ölbrenner
TA3 Gasoline=TA3 Benzin
TA3 Gasoline Barrel=TA3 Benzinfass
TA3 Gasoline Canister=TA3 Benzinkanister
TA3 Generator=TA3 Generator
TA3 Gravel Sieve=TA3 Kiessieb
TA3 Logic Block=TA3 Logikblock
TA3 Melting=TA3 Schmelzen
TA3 Naphtha=TA3 Naphtha
TA3 Naphtha Barrel=TA3 Naphtha-Fass
TA3 Naphtha Canister=TA3 Naphtha-Kanister
TA3 Node Detector=TA3 Block Detektor
TA3 Oil Barrel=TA3 Ölfass
TA3 Oil Canister=TA3 Erdölkanister
TA3 Oil Explorer=TA3 Ölexplorer
TA3 Oil Reboiler=TA3 Aufkocher
TA3 Oil Reboiler: blocked=TA3 Aufkocher: blockiert
TA3 Oil Storage=TA3 Öl Speicher
TA3 Player Detector=TA3 Spieler Detektor
TA3 Power Station Firebox=TA3 Kraftwerks-Feuerbox
TA3 Power Station Oil Burner=TA3 Kraftwerks-Ölbrenner
TA3 Power Terminal=TA3 Strom Terminal
TA3 Propane=TA3 Propan
TA3 Protected Chest=TA3 Gesicherte Kiste
TA3 Pump=TA3 Pumpe
TA3 Repeater=TA3 Wiederholer
TA3 Sequencer=TA3 Sequenzer
TA3 Silo=TA3 Silo
TA3 Tank=TA3 Tank
TA3 Terminal=TA3 Terminal
TA3 Timer=TA3 Timer
TA3 Tiny Power Generator=TA3 Kleiner Stromgenerator
TA3 Turbine=TA3 Turbine
TA3 Vacuum Tube=TA3 Vakuumröhre
TA4 Carbon Fiber=TA4 Kohlefaser
TA4 Derrick=TA4 Bohrturm
TA4 Doser=TA4 Dosierer
TA4 Electrolyzer=TA4 Elektrolyseur
TA4 Fuel Cell=TA4 Brennstoffzelle
TA4 Fuel Cell Stack=Brennstoffzellenstapel
TA4 Furnace Heater=TA4 Ofenheizung
TA4 Generator=TA4 Generator
TA4 Heat Exchanger=TA4 Wärmetauscher
TA4 Heat Exchanger 1=TA4 Wärmetauscher 1
TA4 Heat Exchanger 2=TA4 Wärmetauscher 2
TA4 Heat Exchanger 3=TA4 Wärmetauscher 3
TA4 Hydrogen=TA4 Wasserstoff
TA4 Low Power Box=TA4 Niederspannungsverteilerbox
TA4 Low Power Cable=TA4 Niederspannungskabel
TA4 Pillar=TA4 Säule
TA4 Pipe Inlet=TA4 Rohrzulauf
TA4 Protected Chest=TA4 Gesicherte Kiste
TA4 Pump=TA4 Pumpe
TA4 Reactor=TA4 Reaktor
TA4 Reactor Base=TA4 Reaktor Sockel
TA4 Reactor Filler Pipe=TA4 Reaktor Einfüllstutzen
TA4 Reactor Stand=TA4 Reaktor Ständer
TA4 Rotor Blade=TA4 Rotorblatt
TA4 Silicon Wafer=TA4 Silizium-Wafer
TA4 Silo=Silo
TA4 Solar Carrier Module=TA4 Solar Trägermodul
TA4 Solar Carrier Module B=TA4 Solar Trägermodul U
TA4 Solar Carrier Module T=TA4 Solar Trägermodul O
TA4 Solar Inverter=TA4 Solar Wechselrichter
TA4 Solar Inverter DC=TA4 Solar Wechselrichter DC
TA4 Solar Module=TA4 Solarmodul
TA4 Streetlamp Solar Cell=TA4 Straßenlampen-Solarzelle
TA4 Tank=TA4 Tank
TA4 Turbine=TA4 Turbine
TA4 WLAN Chip=TA4 WLAN Chip
TA4 Water Pump=Wasserpumpe
TA4 Wind Turbine=TA4 Windkraftanlage
TA4 Wind Turbine Nacelle=TA4 Windkraftanlagengondel
TA4 Wind Turbine Signal Lamp=TA4 Windkraftanlagenlampe
TechAge Black Hole=TechAge Schwarzes Loch
TechAge Black Hole (let items disappear)=TechAge Schwarzes Loch (Gegenstände verschwinden)
TechAge Door Block=TechAge Türblock
TechAge Gate Block=TechAge Torblock
TechAge Gravel=TechAge Kies
TechAge Info Tool (use @= read status info)=TechAge Info Werkzeug
TechAge Programmer (right @= read number, left @= write numbers)=TechAge Programmer (rechts @= lese Nummer, links @= schreibe Nummern)
TechAge Repair Kit=TechAge Reparaturset
TechAge Signal Lamp=TechAge Signallampe
TechAge Signal Lamp (can be colored)=TechAge Signallampe (kann gefärbt werden)
TechAge Steel Mat=TechAge Stahlmatte
TechAge Trowel=TechAge Kelle
Techage Forceload Block=Techage Forceload Block
The network is overloaded!=Das Stromnetz ist überlastet!
The network load is almost at the limit!=Das Stromnetz ist ziemlich am Limit!
The wind turbines are too close together!=Die Windkraftanlagen stehen zu eng beisammen!
Thermal=Wärme
Time=Zeit
Tiny Generator=Kleingenerator
To add fuel punch@nthis block@nwith a fuel container=Um Brennstoff nachzufüllen,@nschlage mit einem Kraftstoffbehälter@nauf den Block
To add liquids punch@nthe tank@nwith a liquid container=Um Flüssigkeit nachzufüllen,@nschlage mit einem Flüssigkeitsbehälter@nauf den Block
To add water punch@nthe boiler@nwith a water bucket=Um Wasser nachzufüllen,@nschlage mit einem Wassereimer@nauf den Block
Turned on:=Eingeschaltet:
Update=Update
Usmium Nuggets=Usmium Nuggets
Usmium Powder=Usmium Pulver
WLAN Chip=WLAN Chip
Water=Wasser
Water Barrel=Wasserfass
Water Boiler=Wasserboiler
Water Pump=Wasserpumpe
[Bucket] Lava can only be placed below sea level!=Lava kann nur unterhalb der Meerehöhe platziert werden!
[TA4 Wind Turbine]=[TA4 Windkraftanlage]
[TA] Area is protected!=[TA] Bereich ist geschützt
[TA] Derrick is being built!=[TA] Bohrturm wird errichtet
[TA] Derrick is being removed!=[TA] Bohrturm wird abgebaut
[TA] Not enough space!=[TA] Nicht ausreichend Platz!
[TechAge Programmer] Error: invalid numbers!=[TechAge Programmer] Fehler: ungültige Nummern!
[TechAge Programmer] Error: programmer not supported!=[TechAge Programmer] Fehler: Programmer wird nicht unterstützt!
[TechAge Programmer] Unknown node on=[TechAge Programmer] Unbekannter Block bei
[TechAge Programmer] foreign or unknown node!=[TechAge Programmer] Fremder oder unbekannter Block!
[TechAge Programmer] node programmed!=[TechAge Programmer] Nummer(n) programmiert!
[TechAge Programmer] number=[TechAge Programmer] Nummer
[TechAge Programmer] programmer reset=[TechAge Programmer] Programmer zurück gesetzt
accept=akzeptieren
added=hinzugefügt wird
added or removed=hinzugefügt oder entfernt wird
block can't be dug=Block kann nicht abgebaut werden
commands like: help=Kommandos wie: help
connected with=verbunden mit
did you check the plan?=hast du den Plan geprüft?
empty=leer
full=voll
inlet/pipe error=Einlass/Röhrenfehler
level@==Ebene
light=Licht
loaded=geladen
needs power=benötigt Strom
no fuel=kein Kraftstoff
no fuel or no power=kein Strom oder Brennstoff
no oil=Kein Öl
no power=kein Strom
no usable water=Kein brauchbares Wasser
off=aus
on=an
pos@==pos@=
power=Energie
reactor defect=Reaktor defekt
reactor defect or no power=Reaktor defekt oder kein Strom
reactor has no power=Reaktor hat keinen Strom
removed=entfernt
stopped=gestoppt
water temperature=Wassertemperatur
wrong storage diameter=Falscher Wärmespeicher-Durchmesser
##### not used anymore #####

View File

@ -21,6 +21,7 @@ Basalt Gravel=
Basalt Stone=
Basalt Stone Block=
Basalt Stone Brick=
Battery=
Bauxite Cobblestone=
Bauxite Gravel=
Bauxite Powder=
@ -93,6 +94,7 @@ Meridium Pickaxe=
Meridium Shovel=
Meridium Sword=
More water expected (2 m deep)!=
Nacelle is missing=
Needle Powder=
Network Data=
No network or active generator available!=
@ -100,6 +102,7 @@ No plan available=
No wind at this altitude!=
Node owner=
Number of all nodes=
Oil=
Oil Drill Box=
Oil Pumpjack=
Oil Source=
@ -125,6 +128,9 @@ Recipe=
Red Mud=
Red Mud Barrel=
Red Mud Canister=
Red Stone=
Red Stone Block=
Red Stone Brick=
Remove derrick=
Rinsing=
River Water Barrel=
@ -261,23 +267,25 @@ TA4 Pillar=
TA4 Pipe Inlet=
TA4 Protected Chest=
TA4 Pump=
TA4 RAM Chip=
TA4 Reactor=
TA4 Reactor Base=
TA4 Reactor Filler Pipe=
TA4 Reactor Stand=
TA4 Rotor Blade=
TA4 Sensor Chest=
TA4 Silicon Wafer=
TA4 Silo=
TA4 Solar Carrier Module=
TA4 Solar Carrier Module B=
TA4 Solar Carrier Module T=
TA4 Solar Inverter=
TA4 Solar Inverter DC=
TA4 Solar Module=
TA4 Streetlamp Solar Cell=
TA4 Tank=
TA4 Turbine=
TA4 WLAN Chip=
TA4 Wall Pipe=
TA4 Water Pump=
TA4 Wind Turbine=
TA4 Wind Turbine Nacelle=
@ -295,6 +303,7 @@ TechAge Signal Lamp (can be colored)=
TechAge Steel Mat=
TechAge Trowel=
Techage Forceload Block=
Techage Forceload Tile=
The network is overloaded!=
The network load is almost at the limit!=
The wind turbines are too close together!=
@ -314,6 +323,7 @@ Water Barrel=
Water Boiler=
Water Pump=
[Bucket] Lava can only be placed below sea level!=
[TA Oil] No oil exploration possible at this depth! =
[TA4 Wind Turbine]=
[TA] Area is protected!=
[TA] Derrick is being built!=
@ -332,6 +342,7 @@ added or removed=
block can't be dug=
commands like: help=
connected with=
depth=
did you check the plan?=
empty=
full=
@ -355,5 +366,6 @@ reactor has no power=
removed=
repaired=
stopped=
storage empty?=
water temperature=
wrong storage diameter=

View File

@ -1,11 +1,11 @@
--[[
sl_controller
=============
Techage
=======
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2020 Joachim Stolberg
LGPLv2.1+
GPL v3
See LICENSE.txt for more information
commands.lua:
@ -55,40 +55,37 @@ techage.lua_ctlr.register_function("get_player_action", {
' example: player, action, item = $get_player_action("1234")'
})
--techage.lua_ctlr.register_function("get_counter", {
-- cmnd = function(self, num)
-- num = tostring(num or "")
-- return techage.send_single(self.meta.number, num, "counter", nil)
-- end,
-- help = " $get_counter(num)\n"..
-- " Read number of pushed items from a\n"..
-- " Pusher/Distributor node.\n"..
-- " The Pusher returns a single value (number)\n"..
-- " The Distributor returns a list with 4 values\n"..
-- " like: {red=1, green=0, blue=8, yellow=0}\n"..
-- ' example: cnt = $get_counter("1234")\n'
--})
--techage.lua_ctlr.register_function("clear_counter", {
-- cmnd = function(self, num)
-- num = tostring(num or "")
-- return techage.send_single(self.meta.number, num, "clear_counter", nil)
-- end,
-- help = " $clear_counter(num)\n"..
-- " Set counter(s) from Pusher/Distributor to zero.\n"..
-- ' example: $clear_counter("1234")'
--})
techage.lua_ctlr.register_function("get_fuel_value", {
cmnd = function(self, num)
num = tostring(num or "")
return techage.send_single(self.meta.number, num, "fuel", nil)
end,
help = " $get_fuel_value(num)\n"..
" Read fuel value from fuel consuming blocks.\n"..
" Read the fuel value from fuel consuming blocks.\n"..
' example: val = $get_fuel_value("1234")'
})
techage.lua_ctlr.register_function("get_load_value", {
cmnd = function(self, num)
num = tostring(num or "")
return techage.send_single(self.meta.number, num, "load", nil)
end,
help = " $get_load_value(num)\n"..
" Read the load value (0..100) from a tank/storage block.\n"..
' example: val = $get_load_value("1234")'
})
techage.lua_ctlr.register_function("get_delivered_value", {
cmnd = function(self, num)
num = tostring(num or "")
return techage.send_single(self.meta.number, num, "delivered", nil)
end,
help = " $get_delivered_value(num)\n"..
" Read the delivered power value from a generator block.\n"..
" Power consuming blocks like accus\nalso provide a negative value.\n"..
' example: val = $get_delivered_value("1234")'
})
--techage.lua_ctlr.register_function("get_num_items", {
-- cmnd = function(self, num, idx)
-- num = tostring(num or "")
@ -179,7 +176,7 @@ techage.lua_ctlr.register_action("display", {
' Send a text line to the display with number "num".\n'..
" 'row' is a value from 1..5\n"..
" The function accepts up to 3 text parameters\n"..
' example: $display("0123", 1, "Hello ", name, " !")'
' example: $display("123", 1, "Hello ", name, " !")'
})
techage.lua_ctlr.register_action("clear_screen", {
@ -233,3 +230,6 @@ techage.lua_ctlr.register_action("door", {
' example: $door("123,7,-1200", "close")\n'..
" Hint: Use the Techage Programmer to\ndetermine the door position."
})
-- function not_protected(owner, number(s))
techage.lua_ctlr.not_protected = not_protected

View File

@ -539,7 +539,7 @@ minetest.register_node("techage:ta4_lua_controller", {
minetest.register_craft({
output = "techage:ta4_lua_controller",
recipe = {
{"basic_materials:plastic_sheet", "dye:blue", "basic_materials:plastic_sheet"},
{"basic_materials:plastic_sheet", "dye:blue", "techage:aluminum"},
{"", "default:copper_ingot", ""},
{"techage:ta4_ramchip", "techage:ta4_wlanchip", "techage:ta4_ramchip"},
},

View File

@ -44,7 +44,7 @@ local function send_command(pos)
if numbers ~= "" then
local own_num = meta:get_string("node_number")
techage.send_multi(own_num, numbers, "on")
minetest.after(1, send_off_command, pos)
minetest.after(0.2, send_off_command, pos)
end
end
@ -86,7 +86,7 @@ local function formspec(pos)
default.gui_slots..
"list[context;main;0,0;2,2;]"..
"button[2,0;1,1;f1;F1]"..
"button[2,1;1,1;ok;OK]"..
"button[2,1;1,1;f2;F2]"..
"label[3,0;"..text.."]"..
"list[current_player;main;0,2.3;8,4;]"..
"listring[context;main]"..
@ -128,8 +128,8 @@ minetest.register_node("techage:ta4_sensor_chest", {
store_action(pos, player, "f1")
send_command(pos)
end
if fields.ok then
store_action(pos, player, "ok")
if fields.f2 then
store_action(pos, player, "f2")
send_command(pos)
end
meta:set_string("formspec", formspec(pos, meta))

View File

@ -1,11 +1,11 @@
--[[
sl_controller
=============
Techage
=======
Copyright (C) 2018 Joachim Stolberg
Copyright (C) 2020 Joachim Stolberg
LGPLv2.1+
GPL v3
See LICENSE.txt for more information
server.lua:

248
lua_controller/terminal.lua Normal file
View File

@ -0,0 +1,248 @@
--[[
Techage
=======
Copyright (C) 2020 Joachim Stolberg
GPL v3
See LICENSE.txt for more information
terminal.lua:
]]--
local HELP = [[#### TA4 Lua Controller Terminal ####
Send commands to your Controller
and output text messages from your
Controller to the Terminal.
Commands can have up to 80 characters.
Local commands:
- clear = clear screen
- help = this message
- pub = switch to public use
- priv = switch to private use
Global commands:
- send <num> on/off = send on/off event
- msg <num> <text> = send a text message
]]
local function formspec1()
return "size[6,4]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"field[0.5,1;5,1;number;TA4 Lua Controller number:;]" ..
"button_exit[1.5,2.5;2,1;exit;Save]"
end
local function formspec2(meta)
local output = meta:get_string("output")
output = minetest.formspec_escape(output)
output = output:gsub("\n", ",")
return "size[9,8]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
"table[0.1,0.1;8.6,6.6;output;"..output..";200]"..
"field[0.5,7.6;6,1;cmnd;Enter command;]" ..
"field_close_on_enter[cmnd;false]"..
"button[6.7,7.3;2,1;ok;Enter]"
end
local function output(pos, text)
local meta = minetest.get_meta(pos)
text = meta:get_string("output") .. "\n" .. (text or "")
text = text:sub(-500,-1)
meta:set_string("output", text)
meta:set_string("formspec", formspec2(meta))
end
local function command(pos, cmnd, player)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
if cmnd then
cmnd = cmnd:sub(1,80)
if cmnd == "clear" then
meta:set_string("output", "")
meta:set_string("formspec", formspec2(meta))
elseif cmnd == "help" then
local meta = minetest.get_meta(pos)
meta:set_string("output", HELP)
meta:set_string("formspec", formspec2(meta))
elseif cmnd == "pub" and owner == player then
meta:set_int("public", 1)
output(pos, player..":$ "..cmnd)
output(pos, "Switched to public use!")
elseif cmnd == "priv" and owner == player then
meta:set_int("public", 0)
output(pos, player..":$ "..cmnd)
output(pos, "Switched to private use!")
elseif meta:get_int("public") == 1 or owner == player then
-- send <num> on/off
local num, topic = cmnd:match('^send%s+([0-9]+)%s+([onff]+)$')
if num and topic then
local own_number = meta:get_string("own_number")
if techage.lua_ctlr.not_protected(owner, num) then
output(pos, player..":$ send "..num.." "..topic)
techage.send_single(own_number, num, topic, nil)
return
end
end
-- msg <num> <text>
local num, text = cmnd:match('^msg%s+([0-9]+)%s+(.+)$')
if num and text then
local own_number = meta:get_string("own_number")
if techage.lua_ctlr.not_protected(owner, num) then
output(pos, player..":$ msg "..num.." "..text)
techage.send_single(own_number, num, "msg", {src=own_number, text=text})
return
end
end
local number = meta:get_string("number")
local own_number = meta:get_string("own_number")
if techage.lua_ctlr.not_protected(owner, num) then
output(pos, player..":$ "..cmnd)
techage.send_single(own_number, number, "term", cmnd)
end
end
end
end
minetest.register_node("techage:ta4_terminal", {
description = "TA4 Lua Controller Terminal",
tiles = {
-- up, down, right, left, back, front
'techage_terminal1_top.png',
'techage_terminal1_bottom.png',
'techage_terminal1_side.png',
'techage_terminal1_side.png',
'techage_terminal1_bottom.png',
"techage_terminal1_front.png",
},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-12/32, -16/32, -8/32, 12/32, -14/32, 12/32},
{-12/32, -14/32, 12/32, 12/32, 6/32, 14/32},
},
},
selection_box = {
type = "fixed",
fixed = {
{-12/32, -16/32, -8/32, 12/32, -14/32, 12/32},
{-12/32, -14/32, 12/32, 12/32, 6/32, 14/32},
},
},
after_place_node = function(pos, placer)
local number = techage.add_node(pos, minetest.get_node(pos).name)
local meta = minetest.get_meta(pos)
meta:set_string("own_number", number)
meta:set_string("formspec", formspec1())
meta:set_string("owner", placer:get_player_name())
meta:set_string("infotext", "TA4 Lua Controller Terminal "..number..": not connected")
end,
on_receive_fields = function(pos, formname, fields, player)
local meta = minetest.get_meta(pos)
if fields.number and fields.number ~= "" then
local owner = meta:get_string("owner")
print(fields.number, owner)
if techage.check_numbers(fields.number, owner) then
print(1)
meta:set_string("number", fields.number)
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "TA4 Lua Controller Terminal "..own_number..": connected with "..fields.number)
meta:set_string("formspec", formspec2(meta))
end
elseif (fields.key_enter == "true" or fields.ok == "Enter") and fields.cmnd ~= "" then
command(pos, fields.cmnd, player:get_player_name())
end
end,
after_dig_node = function(pos)
techage.remove_node(pos)
end,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
minetest.register_craft({
output = "techage:ta4_terminal",
recipe = {
{"", "techage:ta4_display", ""},
{"dye:black", "techage:ta4_wlanchip", "default:copper_ingot"},
{"", "techage:aluminum", ""},
},
})
techage.register_node({"techage:ta4_terminal"}, {
on_recv_message = function(pos, topic, payload)
if topic == "term" then
output(pos, payload)
return true
elseif topic == "msg" then
output(pos, payload.src..": "..payload.text)
return true
end
end,
})
techage.lua_ctlr.register_function("get_term", {
cmnd = function(self)
return techage.lua_ctlr.get_command(self.meta.number)
end,
help = ' $get_term() --> text string or nil\n'..
' Read an entered string (command) from the Terminal.\n'..
' example: s = $get_term()\n'..
" The Terminal has to be connected to the controller."
})
techage.lua_ctlr.register_action("put_term", {
cmnd = function(self, num, text)
text = tostring(text or "")
if techage.lua_ctlr.not_protected(self.meta.owner, num) then
techage.send_single(self.meta.number, num, "term", text)
end
end,
help = " $put_term(num, text)\n"..
' Send a text line to the terminal with number "num".\n'..
' example: $put_term("0123", "Hello "..name)'
})
techage.lua_ctlr.register_function("get_msg", {
cmnd = function(self)
local msg = techage.lua_ctlr.get_msg(self.meta.number)
if msg then
return msg.src, msg.text
end
end,
help = ' $get_msg() --> number and text string or nil\n'..
' Read a received messages. Number is the node\n'..
' number of the sender.\n'..
' example: num,msg = $get_msg().'
})
techage.lua_ctlr.register_action("send_msg", {
cmnd = function(self, num, text)
local msg = {src = self.meta.number, text = tostring(text or "")}
if techage.lua_ctlr.not_protected(self.meta.owner, num) then
techage.send_single(self.meta.number, num, "msg", msg)
end
end,
help = " $send_msg(num, text)\n"..
' Send a message to the controller with number "num".\n'..
' example: $send_msg("0123", "test")'
})

View File

@ -294,7 +294,7 @@ Dazu dienen dir TA3 Ölexplorer, TA3 Ölbohrkiste und TA3 Ölpumpe.
### TA3 Ölexplorer / Oil Explorer
Mit dem Ölexplorer kannst du nach Öl suchen. Dazu den Block auf den Boden setzen und mit Rechtsklick die Suche starten.
Mit dem Ölexplorer kannst du nach Öl suchen. Dazu den Block auf den Boden setzen und mit Rechtsklick die Suche starten. Der Ölexplorer kann oberirdisch und unterirdisch in Tiefen bis zu -50 Meter eingesetzt werden.
Über die Chat-Ausgabe wird dir angezeigt, in welcher Tiefe nach Öl gesucht wurde und wie viel Öl (oil) gefunden wurde.
Du kannst bis zu 4 mal auf den Block klicken, um auch in tieferen Bereichen nach Öl zu suchen. Ölfelder haben eine Größe von 2000 bis zu 20000 Items.

View File

@ -0,0 +1,512 @@
# TA4 Lua Controller
![Lua Controller](https://github.com/joe7575/techage/blob/master/textures/techage_lua_controller_inventory.png)
The TA4 Lua Controller is a small computer, programmable in Lua to control your machinery.
In contrast to the ICTA Controller this controller allows to implement larger and smarter control and monitoring tasks.
But to write Lua scripts, some knowledge with the programming language Lua is required.
Minetest uses Lua 5.1. The reference document for Lua 5.1 is [here](https://www.lua.org/manual/5.1/). The book [Programming in Lua (first edition)](https://www.lua.org/pil/contents.html) is also a perfect source for learning Lua.
## Table of Contents
- [TA4 Lua Controller Blocks](#TA4-Lua-Controller-Blocks)
- [TA4 Lua Controller](#TA4-Lua-Controller)
- [Battery](#Battery)
- [Central Server](#Central-Server)
- [ TA4 Lua Controller Terminal](#TA4-Lua-Controller-Terminal)
- [TA4 Sensor Chest ](#TA4-Sensor-Chest )
- [Lua Functions and Environment](#Lua-Functions-and-Environment)
- [Lua Functions and Limitations](#Lua-Functions-and-Limitations)
- [Arrays, Stores, and Sets](#Arrays,-Stores,-and-Sets)
- [Initialization, Loops, and Events](#Initialization,-Loops,-and-Events)
- [Techage Commands](#Techage-Commands)
- [Controller local commands](#Controller-local-commands)
- [Techage commands](#Techage-commands)
- [Server and Terminal commands](#Server-and-Terminal-commands)
- [Further commands](#Further-commands)
- [Example Scripts](#Example-Scripts)
## TA4 Lua Controller Blocks
### TA4 Lua Controller
The controller block has a menu form with the following tabs:
- the `init` tab for the initialization code block (see "Initialization, Loops, and Events")
- the `func` tab for the Lua functions (see "Initialization, Loops, and Events")
- the `loop` tab for the main code block (see "Initialization, Loops, and Events")
- the `outp` tab for debugging outputs via `$print()`
- the `notes` tab for your code snippets or other notes (like a clipboard)
- the `help` tab with information to the available commands (see "Techage Commands")
The controller needs power to work. A battery pack has to be placed neadby.
### Battery
The battery pack has to be placed near the controller (1 block distance).
The needed battery power is directly dependent on the CPU time the controller consumes.
Because of that, it is important to optimize the execution time of the code (which helps the admin to keep server lags down :))
The controller will be restarted (init() is called) every time the Minetest server starts again.
To store data non-volatile (to pass a server restart), the Central Server has to be used.
### Central Server
The Server block is used to store data from the controllers nonvolatile. It can also be used for communication purposes between several Controllers.
The Server has a form to enter valid usernames for server access.
For special Server commands, see "Server and Terminal commands"
### TA4 Lua Controller Terminal
The Terminal is used to send command strings to the controller.
In turn, the controller can send text strings to the terminal.
The Terminal has a help system for internal commands. Its supports the following commands:
- `clear` = clear the screen
- `help` = output this message
- `pub` = switch terminal to public use (everybody can enter commands)
- `priv` = switch terminal to private use (only the owner can enter commands)
- `send <num> on/off` = send on/off event to e. g. lamps (for testing purposes)
- `msg <num> <text>` = send a text message to another Controller (for testing purposes)
For special Terminal commands for the TA4 Lua Controller, see "Terminal Commands"
### TA4 Sensor Chest
tbd.
## Lua Functions and Environment
### Lua Functions and Limitations
The controller uses a subset of the language Lua, called SaferLua. It allows the safe and secure execution of Lua scripts, but has the following limitations:
- limited code length
- limited execution time
- limited memory use
- limited possibilities to call functions
SaferLua follows the standard Lua syntax with the following restrictions:
- no `while` or `repeat` loops (to prevent endless loops)
- no table constructor {..}, see "Arrays, Stores, and Sets" for comfortable alternatives
- limited runtime environment
SaferLua directly supports the following standard functions:
- math.floor
- math.abs
- math.max
- math.min
- math.random
- tonumber
- tostring
- unpack
- type
- string.byte
- string.char
- string.find
- string.format
- string.gmatch
- string.gsub
- string.len
- string.lower
- string.match
- string.rep
- string.sub
- string.upper
- string.split
- string.trim
For own function definitions, the menu tab 'func' can be used. Here you write your functions like:
```lua
function foo(a, b)
return a + b
end
```
Each SaferLua program has access to the following system variables:
- ticks - a counter which increments by one each call of `loop()`
- elapsed - the amount of seconds since the last call of `loop()`
- event - a boolean flag (true/false) to signal the execution of `loop()` based on an occurred event
### Arrays, Stores, and Sets
It is not possible to easily control the memory usage of a Lua table at runtime. Therefore, Lua tables can't be used for SaferLua programs. Because of this, there are the following alternatives, which are secure shells over the Lua table type:
#### Arrays
_Arrays_ are lists of elements, which can be addressed by means of an index. An index must be an integer number. The first element in an _array_ has the index value 1. _Arrays_ have the following methods:
- add(value) - add a new element at the end of the array
- set(idx, value) - overwrite an existing array element on index `idx`
- get(idx) - return the value of the array element on index `idx`
- remove(idx) - remove the array element on index `idx`
- insert(idx, val) - insert a new element at index `idx` (the array becomes one element longer)
- size() - return the number of _array_ elements
- memsize() - return the needed _array_ memory space
- next() - `for` loop iterator function, returning `idx,val`
- sort(reverse) - sort the _array_ elements in place. If _reverse_ is `true`, sort in descending order.
Example:
```lua
a = Array(1,2,3,4) --> {1,2,3,4}
a.add(6) --> {1,2,3,4,6}
a.set(2, 8) --> {1,8,3,4,6}
a.get(2) --> function returns 8
a.insert(5,7) --> {1,8,3,4,7,6}
a.remove(3) --> {1,8,4,7,6}
a.insert(1, "hello") --> {"hello",1,8,4,7,6}
a.size() --> function returns 6
a.memsize() --> function returns 10
for idx,val in a.next() do
...
end
```
#### Stores
Unlike _arrays_, which are indexed by a range of numbers, _stores_ are indexed by keys, which can be a string or a number. The main operations on a _store_ are storing a value with some key and extracting the value given the key.
The _store_ has the following methods:
- set(key, val) - store/overwrite the value `val` behind the keyword `key`
- get(key) - read the value behind `key`
- del(key) - delete a value
- size() - return the number of _store_ elements
- memsize() - return the needed _store_ memory space
- next() - `for` loop iterator function, returning `key,val`
- keys(order) - return an _array_ with the keys. If _order_ is `"up"` or `"down"`, return the keys as sorted _array_, in order of the _store_ values.
Example:
```lua
s = Store("a", 4, "b", 5) --> {a = 4, b = 5}
s.set("val", 12) --> {a = 4, b = 5, val = 12}
s.get("val") --> returns 12
s.set(0, "hello") --> {a = 4, b = 5, val = 12, [0] = "hello"}
s.del("val") --> {a = 4, b = 5, [0] = "hello"}
s.size() --> function returns 3
s.memsize() --> function returns 9
for key,val in s.next() do
...
end
```
Keys sort example:
```lua
s = Store() --> {}
s.set("Joe", 800) --> {Joe=800}
s.set("Susi", 1000) --> {Joe=800, Susi=1000}
s.set("Tom", 60) --> {Joe=800, Susi=1000, Tom=60}
s.keys() --> {Joe, Susi, Tom}
s.keys("down") --> {Susi, Joe, Tom}
s.keys("up") --> {Tom, Joe, Susi}
```
#### Sets
A _set_ is an unordered collection with no duplicate elements. The basic use of a _set_ is to test if an element is in the _set_, e.g. if a player name is stored in the _set_.
The _set_ has the following methods:
- add(val) - add a value to the _set_
- del(val) - delete a value from the _set_
- has(val) - test if value is stored in the _set_
- size() - return the number of _set_ elements
- memsize() - return the needed _set_ memory space
- next() - `for` loop iterator function, returning `idx,val`
Example:
```lua
s = Set("Tom", "Lucy") --> {Tom = true, Lucy = true}
s.add("Susi") --> {Tom = true, Lucy = true, Susi = true}
s.del("Tom") --> {Lucy = true, Susi = true}
s.has("Susi") --> function returns `true`
s.has("Mike") --> function returns `false`
s.size() --> function returns 2
s.memsize() --> function returns 8
for idx,val in s.next() do
...
end
```
All three types of data structures allow nested elements, e.g. you can store a _set_ in a _store_ or an _array_ and so on. But note that the overall size over all data structures can't exceed the predefined limit. This value is configurable for the server admin. The default value is 1000.
The configured limit can be determined via `memsize()`:
```lua
memsize() --> function returns 1000 (example)
```
### Initialization, Loops, and Events
The TA4 Lua Controller distinguishes between the initialization phase (just after the controller was started) and the continuous operational phase, in which the normal code is executed.
#### Initialization
During the initialization phase the function `init()` is executed once. The `init()` function is typically used to initialize variables, e.g. clean the display, or reset other blocks:
```lua
-- initialize variables
counter = 1
table = Store()
player_name = "unknown"
# reset blocks
$clear_screen("0123") -- "0123" is the number of the display
$send_cmnd("2345", "off") -- turn off the blocks with the number "2345"
```
#### Loops
During the continuous operational phase the `loop()` function is typically called every second.
Code witch should be executed cyclically has to be placed here.
The cycle frequency is per default once per second, but can be changed via:
```lua
$loopcycle(0) -- no loop cyle any more
$loopcycle(1) -- call the loop function every second
$loopcycle(10) -- call the loop function only every 10 seconds
```
The provided number must be an integer value.
The cycle frequency can be changed in the `init()` function, but also in the `loop()` function.
#### Events
To be able to react directly on received commands, the TA4 Lua Controller supports events.
Events are usually turned off, but can be activated with the command `events()`:
```lua
$events(true) -- enable events
$events(false) -- disable events
```
If an event occurs (a command was received from another block), the `loop()` is executed (in addition to the
normal loop cycle). In this case the system variable 'event' is set:
```lua
if event then
-- event has occurred
if $input("3456") == "on" then -- check input from block with the number "3456"
-- do some action...
end
end
```
The first occurred event will directly processed, further events may be delayed. The TA4 Lua Controller
allows a maximum of one event every 100 ms.
## Techage Commands
For the communication with other blocks the controller supports the following commands:
### Controller local commands
- `$print(text, text, text)` - Output a text string on the 'outp' tab of the controller menu. The function accepts up to three text arguments. E.g.: `$print("Hello ", name, " !")`
- `$loopcycle(seconds)` - This function allows to change the call frequency of the controllers loop() function, witch is per default one second. For more info, see "Loops and Events".
- `$events(bool)` - Enable/disable event handling. For more info, see "Loops and Events"
- `$get_ms_time()` - Returns time with millisecond precision.
- `$time_as_str()` - Read the time of day (ingame) als text string in 24h format, like "18:45".
- `$time_as_num()` - Read the time of day (ingame) als integer number in 24h format, like 1845.
- `$get_input(num)` - Read one input value provided by an external block with the given number _num_. The block has to be configured with the number of the controller to be able to send status messages (on/off commands) to the controller. _num_ is the number of the remote block, like "1234".
#### Input Example
- a Player Detector with number "0001" is configured to send on/off commands to a block with number "0002".
- The TA4 Lua Controller with number "0002" will receive these commands as input messages.
- The program on the SaferLua Controller can always read the last input message from block with number "0001" by means of:
`sts = $get_input("0001")`
### Techage commands
* `$get_status(num)` - Read the status from an external block with the given number _num_. Standard blocks return a status string like: 'running', 'stopped', 'blocked', 'standby', 'fault', or "unloaded".
* `$get_player_action(num)` - Read the player action status from a TA4 Sensor Chest with the given number _num_. The function returns three values: player-name, action, item-name.
* `$get_fuel_value(num)` - Read fuel value from fuel consuming blocks. The block returns a number value. _num_ is the number of the remote block, like "1234".
* `$get_load_value(num)` - Read the load value from a tank/storage block. The block returns a number (0..100). _num_ is the number of the remote block, like "1234".
* `$get_delivered_value(num)` - Read the delivered power value from a generator block. The block returns a positive or negative number. Blocks like accus provide a negative value while charging. _num_ is the number of the remote block, like "1234".
* `$playerdetector(num)` - Read the name status from a Player Detector with the number _num_. If no player is nearby, the detector returns an empty string `""`.
* `$send_cmnd(num, text)` - Send a command to another block. _num_ is the number of the remote block, like "1234". _text_ is the command string like "on".
* `set_filter(num, slot, val)` - Enable/disable a Distributor filter slot. _num_ is the number of the Distributor block. _slot_ is a color and is used to select one of the Distributor sides: "red", "green", "blue", and "yellow". _val_ is either "on" (enable filter) or "off" (disable filter).
* `$display(num, row, text,...)` Send a text string to the display with number _num_. _row_ is the display row, a value from 1 to 5. _text_ is the string to be displayed. This function allows up to 3 text strings.
* `$clear_screen(num)` Clear the screen of the display with number _num_.
* `$position(num)` Returns the position '(x,y,z)' of the device with the given _num_.
### Server and Terminal commands
The Server is used to store data permanently/non-volatile. It can also be used to share data between several Controllers.
- `$server_write(num, key, value)` - Store a value on the server under the key _key_. _key_ must be a string. _value_ can be either a number, string, boolean, nil or data structure. **But this command does not allow nested data structures**. _num_ is the number of the Server, like "1234". Example: `$server_write("0123", "state", state)`
- `$server_read(num, key)` - Read a value from the server. _key_ must be a string. _num_ is the number of the Server, like "1234".
The Terminal can send text strings as events to the Controller.
In contrast the Controller can send text strings to the terminal.
- `$get_term()` - Read a text command received from the Terminal
- `$put_term(num, text)` - Send a text string to the Terminal. _num_ is the number of the Terminal.
### Further commands
Messages are used to transport data between Controllers. Messages are text strings or any other data plus the sender number.
Incoming messages are stored in a message queue (up to 10) and can be read one after the other.
* `$get_msg()` - Read a received message. The function returns the sender number and the message.
* `$send_msg(num, msg)` - Send a message to another Controller. _num_ is the destination number.
* `$chat(text,...)` - Send yourself a chat message. This function allows up to 3 text strings.
* `$door(pos, text)` - Open/Close a door at position "pos".
Example: `$door("123,7,-1200", "close")`.
Hint: Use the Techage Programmer or Info Tool to easily determine the door position.
## Example Scripts
### Simple Counter
Very simple example with output on the Controller menu.
init() code:
```lua
a = 1
```
loop() code:
```lua
a = a + 1
$print("a = ", a)
```
### Hello World
"Hello world" example with output on the Display.
init() code:
```lua
a = Array("Hello", "world", "of", "Minetest")
$clear_screen("0669")
for i,text in a.next() do
$display("0669", i+2, text)
end
```
### For Loop with range(from, to)
Second "Hello world" example with output on the Display,
implemented by means of a for/range loop.
init() code:
```lua
a = Array("Hello", "world", "of", "Minetest")
$clear_screen("0669")
for i in range(1, 4) do
text = a.get(i)
$display("0669", i+2, text)
end
```
### Monitoring Chest & Furnace
More realistic example to output Pusher states on the Display
init() code:
```lua
DISPLAY = "1234"
min = 0
```
loop() code:
```lua
-- call code every 60 sec
if ticks % 60 == 0 then
-- output time in minutes
min = min + 1
$display(DISPLAY, 1, min, " min")
-- Cactus chest overrun
sts = $get_status("1034") -- read pusher status
if sts == "blocked" then $display(DISPLAY, 2, "Cactus full") end
-- Tree chest overrun
sts = $get_status("1089") -- read pusher status
if sts == "blocked" then $display(DISPLAY, 3, "Tree full") end
-- Furnace fuel empty
sts = $get_status("2895") -- read pusher status
if sts == "standby" then $display(DISPLAY, 4, "Furnace fuel") end
end
```
### Emails
For an email system you need a Central Server and a TA4 Lua Controller with Terminal per player.
The Central Server serves as database for player name/block number resolution.
* Each Player needs its own Terminal and Controller. The Terminal has to be connected with the Controller
* Each Controller runs the same Lua Script, only the numbers and the owner names are different
* To send a message, enter the receiver name and the text message like `Tom: hello` into the Terminal
* The Lua script will determine the destination number and send the message to the destination Controller
* All players who should be able to take part in the email system have to be entered into the Server form
init() code:
```lua
$loopcycle(0)
$events(true)
-- Start: update to your conditions
TERM = "27309"
CONTROLLER = "27310"
NAME = "Tom"
SERVER = "27312"
-- End: update to your conditions
$server_write(SERVER, NAME, CONTROLLER)
$server_write(SERVER, CONTROLLER, NAME)
```
loop() code:
```lua
-- read from Terminal and send the message
s = $get_term()
if s then
name,text = unpack(string.split(s, ":", false, 1))
num = $server_read(SERVER, name)
if num then
$send_msg(num, text)
$put_term(TERM, "message sent")
end
end
-- read message and output to terminal
num,text = $get_msg()
if num then
name = $server_read(SERVER, num)
if name then
$put_term(TERM, name..": "..text)
end
end
```

Binary file not shown.

View File

@ -112,7 +112,7 @@ local function status(pos, player_name, depth, amount)
depth = depth + pos.y
local posC = {x = center(pos.x), y = pos.y, z = center(pos.z)}
minetest.chat_send_player(player_name,
"[TA Oil] "..P2S(posC).." depth: "..depth..", Oil: "..amount.." ")
"[TA Oil] "..P2S(posC).." "..S("depth")..": "..depth..", "..S("Oil")..": "..amount.." ")
end
local function marker(player_name, pos)
@ -142,7 +142,10 @@ local function explore_area(pos, pos1, pos2, posC, depth, amount, player_name)
end
local function emerge_area(pos, node, player_name)
if get_oil_amount(pos) == 0 then -- nothing found so far?
if pos.y < -50 then
minetest.chat_send_player(player_name,
S("[TA Oil] No oil exploration possible at this depth! "))
elseif get_oil_amount(pos) == 0 then -- nothing found so far?
local depth = get_next_depth(pos)
local posC = {x = center(pos.x), y = center(-depth), z = center(pos.z)}
local radius = 7