Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ==========================
- -- === Parameter einlesen ===
- -- ==========================
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print( "Usage: eis <anzahlIterationen> (Länge = 2 x anzahlIterationen)" )
- print( "Turtle Initialposition: Vorne mitte eins über und eins vor erstem Block" )
- print( "Eine Iteration verbraucht 6 Eisblöcke, 4 Zäune, 2 Fackeln" )
- print( "Slot 1: Eis, Slot 2: Zäune, Slot 3: Fackeln, Slot 4: leer" )
- print( "Darunterliegende Slotreihen analog. Untere Slotreihen ab >10 Iterationen relevant." )
- return
- end
- local anzahlIterationen = 1
- anzahlIterationen = tonumber( tArgs[1] )
- -- =================
- -- === Debugging ===
- -- =================
- print( "Baue Eis-Autobahn mit Länge "..anzahlIterationen.." x 2 " )
- -- ==========================
- -- === Eis-Autobahn bauen ===
- -- ==========================
- local slotMitEisbloecken = 1
- local slotMitZaeunen = 2
- local slotMitFackeln = 3
- local aktuelleIteration = 1
- local aktuelleSlotreiheAbNull = 0
- local maxIterationenProSlotreihe = 10
- for aktuelleIteration=1,anzahlIterationen do
- if aktuelleIteration > (1 * maxIterationenProSlotreihe) then
- aktuelleSlotreiheAbNull = 1
- end
- if aktuelleIteration > (2 * maxIterationenProSlotreihe) then
- aktuelleSlotreiheAbNull = 2
- end
- if aktuelleIteration > (3 * maxIterationenProSlotreihe) then
- aktuelleSlotreiheAbNull = 3
- end
- -- Initialposition nach vorne und eins nach links verlassen um Zielgebiet zu erreichen
- turtle.forward()
- turtle.down()
- turtle.turnLeft()
- -- Links und rechts jeweils Eisblock, darüber Zaun, darüber Fackel
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitEisbloecken)
- turtle.place()
- turtle.up()
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitZaeunen)
- turtle.place()
- turtle.up()
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitFackeln)
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- turtle.down()
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitZaeunen)
- turtle.place()
- turtle.up()
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitFackeln)
- turtle.place()
- turtle.down()
- turtle.down()
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitEisbloecken)
- turtle.place()
- -- In der Mitte am Boden einen Eisblock platzieren
- turtle.turnLeft()
- turtle.up()
- turtle.placeDown()
- -- Links und rechts jeweils einen Eisblock und darüber einen Zaun
- turtle.forward()
- turtle.down()
- turtle.turnLeft()
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitEisbloecken)
- turtle.place()
- turtle.up()
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitZaeunen)
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitZaeunen)
- turtle.place()
- turtle.down()
- turtle.select(aktuelleSlotreiheAbNull * 4 + slotMitEisbloecken)
- turtle.place()
- -- In der Mitte am Boden einen Eisblock
- turtle.turnLeft()
- turtle.up()
- turtle.placeDown()
- end
Advertisement
Add Comment
Please, Sign In to add comment