This commit is contained in:
Julian Brammer 2024-06-23 19:04:14 +02:00
parent a8d47e6c53
commit 5cc1bb9a44
30 changed files with 106 additions and 75 deletions

0
.idea/.gitignore vendored Normal file → Executable file
View File

0
.idea/Computercraft.iml Normal file → Executable file
View File

0
.idea/misc.xml Normal file → Executable file
View File

0
.idea/modules.xml Normal file → Executable file
View File

0
.idea/vcs.xml Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
src/brulijam/drucker.lua Normal file → Executable file
View File

0
src/brulijam/files/oreTable.txt Normal file → Executable file
View File

0
src/brulijam/files/shape-hex-64-20.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

0
src/brulijam/files/shape-hex-64.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

0
src/brulijam/files/shape-test-12.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

0
src/brulijam/gps-door.lua Normal file → Executable file
View File

0
src/brulijam/gps-tower.lua Normal file → Executable file
View File

0
src/brulijam/lib/createNetworkingKey.lua Normal file → Executable file
View File

51
src/brulijam/lib/tutel.lua Normal file → Executable file
View File

@ -57,7 +57,7 @@ end
local function forward()
if turtle.forward() then
local pos = getPos()
pos = getPos()
sleep(1)
if pos["r"] == 0 then
pos["z"] = pos["z"] + 1
@ -122,6 +122,54 @@ end
local function goToPosition(toR, toX, toY, toZ) end
-- go to lastValidY
while pos["y"] < toY do
secureDigUp()
up()
end
while pos["y"] > toY do
secureDigDown()
down()
end
--go to lastValidX
while pos["x"] < toX do
while not pos["r"] == 3 do
right()
end
secureDig()
forward()
end
while pos["x"] > toX do
while not pos["r"] == 1 do
right()
end
secureDig()
forward()
end
--go to lastValidZ
while pos["z"] < toZ do
while not pos["r"] == 0 do
right()
end
secureDig()
forward()
end
while pos["z"] > toZ do
while not pos["r"] == 2 do
right()
end
secureDig()
forward()
end
return
{
secureDig=secureDig,
@ -134,4 +182,5 @@ return
left=left,
right=right,
getPos=getPos,
goToPosition=goToPosition,
}

0
src/brulijam/log-receiver.lua Normal file → Executable file
View File

0
src/brulijam/setLabel.lua Normal file → Executable file
View File

0
src/brulijam/shapeBuilder.lua Normal file → Executable file
View File

0
src/brulijam/sync-client.lua Normal file → Executable file
View File

0
src/brulijam/systemlock.lua Normal file → Executable file
View File

0
src/brulijam/t-farmer.lua Normal file → Executable file
View File

128
src/brulijam/t-fiboMiner.lua Normal file → Executable file
View File

@ -62,14 +62,10 @@ local function getState()
state["dataGoalPathProgress"] = 0
state["dataCurrentRow"] = 0
state["dataCurrentPathProgress"] = 0
state["x"] = 0
state["y"] = 0
state["z"] = 0
state["r"] = 0 --towards south (pos Z)
state["startX"] = 0
state["startY"] = 0
state["startZ"] = 0
state["lastValidR"] = 0
state["lastValidX"] = 0
state["lastValidY"] = 0
state["lastValidZ"] = 0
basic.writeToFile("brulijam/files/state-t-fiboMiner.txt", textutils.serialize(state))
else
@ -121,12 +117,10 @@ local function inventoryRework()
--store items away
if not spaceAvailable and chestAvailable then
--turtle.up()
state["y"] = tutel.up(state["y"])
setState(state)
tutel.up()
basic.secureDigUp()
--turtle.up()
state["y"] = tutel.up(state["y"])
setState(state)
tutel.up()
basic.secureDigUp()
turtle.select(chestSlot)
turtle.placeUp()
@ -142,11 +136,9 @@ local function inventoryRework()
end
end
--turtle.down()
state["y"] = tutel.down(state["y"])
setState(state)
tutel.down()
--turtle.down()
state["y"] = tutel.down(state["y"])
setState(state)
tutel.down()
end
if not spaceAvailable and not chestAvailable then
@ -170,18 +162,15 @@ end
local function recursiveOreMining()
for i=0, 3 do
--turtle.turnLeft()
state["r"] = tutel.left(state["r"])
setState(state)
tutel.left()
blockFound, blockData = turtle.inspect()
if isOre(blockData) then
tutel.secureDig()
--turtle.forward()
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
setState(state)
tutel.forward()
recursiveOreMining()
--turtle.back()
state["x"], state["y"], state["z"], state["r"] = tutel.back(state["x"],state["y"],state["z"],state["r"])
setState(state)
tutel.back()
end
end
@ -189,24 +178,20 @@ local function recursiveOreMining()
if isOre(blockData) then
tutel.secureDigUp()
--turtle.up()
state["y"] = tutel.up(state["y"])
setState(state)
tutel.up()
recursiveOreMining()
--turtle.down()
state["y"] = tutel.down(state["y"])
setState(state)
tutel.down()
end
blockFound, blockData = turtle.inspectDown()
if isOre(blockData) then
tutel.secureDigDown()
--turtle.down()
state["y"] = tutel.down(state["y"])
setState(state)
tutel.down()
recursiveOreMining()
--turtle.up()
state["y"] = tutel.up(state["y"])
setState(state)
tutel.up()
end
end
@ -217,8 +202,7 @@ local function mineRow()
tutel.secureDig()
--turtle.forward()
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
setState(state)
tutel.forward()
tutel.secureDigUp()
tutel.secureDigDown()
@ -227,20 +211,16 @@ local function mineRow()
--check current mining step for ore
--turtle.up()
state["y"] = tutel.up(state["y"])
setState(state)
tutel.up()
recursiveOreMining()
--turtle.down()
state["y"] = tutel.down(state["y"])
setState(state)
tutel.down()
recursiveOreMining()
--turtle.down()
state["y"] = tutel.down(state["y"])
setState(state)
tutel.down()
recursiveOreMining()
--turtle.up()
state["y"] = tutel.up(state["y"])
setState(state)
tutel.up()
inventoryRework()
--clearInventory()
@ -248,9 +228,16 @@ local function mineRow()
--save path progress
state["dataCurrentPathProgress"] = i+1
setState(state)
end
print("row: " .. state["dataCurrentRow"]+1 .. "/" .. state["dataGoalRows"] .. ", pathProgress: " .. state["dataCurrentPathProgress"]+1 .. "/" .. state["dataGoalPathProgress"])
local pos = tutel.getPos()
--TODO SAVE LAST VALID POSITION HERE
state["lastValidR"] = pos["r"]
state["lastValidX"] = pos["x"]
state["lastValidY"] = pos["y"]
state["lastValidZ"] = pos["z"]
setState(state)
end
local function mineChunk()
@ -267,33 +254,27 @@ local function mineChunk()
--turn back and return to start of row if not last row
if i<state["dataGoalRows"]-1 then
--turtle.turnLeft()
state["r"] = tutel.left(state["r"])
setState(state)
tutel.left()
--turtle.turnLeft()
state["r"] = tutel.left(state["r"])
setState(state)
tutel.left()
for j=1, state["dataGoalPathProgress"]-1 do
--turtle.forward()
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
setState(state)
tutel.forward()
end
--go to next row
--turtle.turnLeft()
state["r"] = tutel.left(state["r"])
setState(state)
tutel.left()
for j=0, 2 do
tutel.secureDig()
--turtle.forward()
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
setState(state)
tutel.forward()
tutel.secureDigUp()
tutel.secureDigDown()
end
--turtle.turnLeft()
state["r"] = tutel.left(state["r"])
setState(state)
tutel.left()
end
state["dataCurrentRow"] = i+1
@ -312,46 +293,47 @@ local function mineFibo()
--go to next chunk
--turtle.turnRight()
state["r"] = tutel.right(state["r"])
setState(state)
tutel.right()
for j=1, 2 do
tutel.secureDig()
--turtle.forward()
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
setState(state)
tutel.forward()
tutel.secureDigUp()
tutel.secureDigDown()
end
--get next fibo number
state["dataCurrentFibo"] = math.floor((state["dataCurrentFibo"] * (1+math.sqrt(5))/2) + 0.5)
setState(state)
end
end
local function checkPosition()
pos = tutel.getPos()
state = getState()
if not (pos["r"] == state["lastValidR"] and pos["x"] == state["lastValidX"] and pos["y"] == state["lastValidY"] and pos["z"] == state["lastValidZ"]) then
--TODO go to last valid pos
print("Tutel moving to where it should be")
tutel.goToPosition(state["lastValidR"], state["lastValidX"], state["lastValidY"], state["lastValidZ"])
end
end
if fs.exists "brulijam/files/state-t-fiboMiner.txt" then
--setup()
checkPosition()
mineFibo()
else
state = getState()
write("x: ")
startX = read()
write("y: ")
startY = read()
write("z: ")
startZ = read()
write("r (S=0,W=1,N=2,E=3):")
startR = read()
local pos = tutel.getPos()
state["x"] = startX
state["y"] = startY
state["z"] = startZ
state["r"] = startR
state["lastValidR"] = pos["r"]
state["lastValidX"] = pos["x"]
state["lastValidY"] = pos["y"]
state["lastValidZ"] = pos["z"]
state["startX"] = startX
state["startY"] = startY
state["startZ"] = startZ
setState(state)
end

0
src/brulijam/t-path-miner.lua Normal file → Executable file
View File

0
src/brulijam/turtle-chaosMine.lua Normal file → Executable file
View File

0
src/brulijam/turtle-miner-fibo.lua Normal file → Executable file
View File

0
src/brulijam/turtle-miner-stupidExcavate.lua Normal file → Executable file
View File

0
src/brulijam/turtle-roomCreator.lua Normal file → Executable file
View File

0
src/brulijam/turtle-treeFarmer.lua Normal file → Executable file
View File

0
src/brulijam/tutelMoveTest.lua Normal file → Executable file
View File

0
src/startup.lua Normal file → Executable file
View File