.
This commit is contained in:
parent
a8d47e6c53
commit
5cc1bb9a44
0
.idea/.gitignore
vendored
Normal file → Executable file
0
.idea/.gitignore
vendored
Normal file → Executable file
0
.idea/Computercraft.iml
Normal file → Executable file
0
.idea/Computercraft.iml
Normal file → Executable file
0
.idea/misc.xml
Normal file → Executable file
0
.idea/misc.xml
Normal file → Executable file
0
.idea/modules.xml
Normal file → Executable file
0
.idea/modules.xml
Normal file → Executable file
0
.idea/vcs.xml
Normal file → Executable file
0
.idea/vcs.xml
Normal file → Executable file
0
src/brulijam/drucker.lua
Normal file → Executable file
0
src/brulijam/drucker.lua
Normal file → Executable file
0
src/brulijam/files/oreTable.txt
Normal file → Executable file
0
src/brulijam/files/oreTable.txt
Normal file → Executable file
0
src/brulijam/files/shape-hex-64-20.svg
Normal file → Executable file
0
src/brulijam/files/shape-hex-64-20.svg
Normal file → Executable 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
0
src/brulijam/files/shape-hex-64.svg
Normal file → Executable 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
0
src/brulijam/files/shape-test-12.svg
Normal file → Executable file
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
0
src/brulijam/gps-door.lua
Normal file → Executable file
0
src/brulijam/gps-door.lua
Normal file → Executable file
0
src/brulijam/gps-tower.lua
Normal file → Executable file
0
src/brulijam/gps-tower.lua
Normal file → Executable file
0
src/brulijam/lib/createNetworkingKey.lua
Normal file → Executable file
0
src/brulijam/lib/createNetworkingKey.lua
Normal file → Executable file
51
src/brulijam/lib/tutel.lua
Normal file → Executable file
51
src/brulijam/lib/tutel.lua
Normal file → Executable file
@ -57,7 +57,7 @@ end
|
|||||||
|
|
||||||
local function forward()
|
local function forward()
|
||||||
if turtle.forward() then
|
if turtle.forward() then
|
||||||
local pos = getPos()
|
pos = getPos()
|
||||||
sleep(1)
|
sleep(1)
|
||||||
if pos["r"] == 0 then
|
if pos["r"] == 0 then
|
||||||
pos["z"] = pos["z"] + 1
|
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
|
return
|
||||||
{
|
{
|
||||||
secureDig=secureDig,
|
secureDig=secureDig,
|
||||||
@ -134,4 +182,5 @@ return
|
|||||||
left=left,
|
left=left,
|
||||||
right=right,
|
right=right,
|
||||||
getPos=getPos,
|
getPos=getPos,
|
||||||
|
goToPosition=goToPosition,
|
||||||
}
|
}
|
0
src/brulijam/log-receiver.lua
Normal file → Executable file
0
src/brulijam/log-receiver.lua
Normal file → Executable file
0
src/brulijam/setLabel.lua
Normal file → Executable file
0
src/brulijam/setLabel.lua
Normal file → Executable file
0
src/brulijam/shapeBuilder.lua
Normal file → Executable file
0
src/brulijam/shapeBuilder.lua
Normal file → Executable file
0
src/brulijam/sync-client.lua
Normal file → Executable file
0
src/brulijam/sync-client.lua
Normal file → Executable file
0
src/brulijam/systemlock.lua
Normal file → Executable file
0
src/brulijam/systemlock.lua
Normal file → Executable file
0
src/brulijam/t-farmer.lua
Normal file → Executable file
0
src/brulijam/t-farmer.lua
Normal file → Executable file
128
src/brulijam/t-fiboMiner.lua
Normal file → Executable file
128
src/brulijam/t-fiboMiner.lua
Normal file → Executable file
@ -62,14 +62,10 @@ local function getState()
|
|||||||
state["dataGoalPathProgress"] = 0
|
state["dataGoalPathProgress"] = 0
|
||||||
state["dataCurrentRow"] = 0
|
state["dataCurrentRow"] = 0
|
||||||
state["dataCurrentPathProgress"] = 0
|
state["dataCurrentPathProgress"] = 0
|
||||||
state["x"] = 0
|
state["lastValidR"] = 0
|
||||||
state["y"] = 0
|
state["lastValidX"] = 0
|
||||||
state["z"] = 0
|
state["lastValidY"] = 0
|
||||||
state["r"] = 0 --towards south (pos Z)
|
state["lastValidZ"] = 0
|
||||||
state["startX"] = 0
|
|
||||||
state["startY"] = 0
|
|
||||||
state["startZ"] = 0
|
|
||||||
|
|
||||||
|
|
||||||
basic.writeToFile("brulijam/files/state-t-fiboMiner.txt", textutils.serialize(state))
|
basic.writeToFile("brulijam/files/state-t-fiboMiner.txt", textutils.serialize(state))
|
||||||
else
|
else
|
||||||
@ -121,12 +117,10 @@ local function inventoryRework()
|
|||||||
--store items away
|
--store items away
|
||||||
if not spaceAvailable and chestAvailable then
|
if not spaceAvailable and chestAvailable then
|
||||||
--turtle.up()
|
--turtle.up()
|
||||||
state["y"] = tutel.up(state["y"])
|
tutel.up()
|
||||||
setState(state)
|
|
||||||
basic.secureDigUp()
|
basic.secureDigUp()
|
||||||
--turtle.up()
|
--turtle.up()
|
||||||
state["y"] = tutel.up(state["y"])
|
tutel.up()
|
||||||
setState(state)
|
|
||||||
basic.secureDigUp()
|
basic.secureDigUp()
|
||||||
turtle.select(chestSlot)
|
turtle.select(chestSlot)
|
||||||
turtle.placeUp()
|
turtle.placeUp()
|
||||||
@ -142,11 +136,9 @@ local function inventoryRework()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
--turtle.down()
|
--turtle.down()
|
||||||
state["y"] = tutel.down(state["y"])
|
tutel.down()
|
||||||
setState(state)
|
|
||||||
--turtle.down()
|
--turtle.down()
|
||||||
state["y"] = tutel.down(state["y"])
|
tutel.down()
|
||||||
setState(state)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if not spaceAvailable and not chestAvailable then
|
if not spaceAvailable and not chestAvailable then
|
||||||
@ -170,18 +162,15 @@ end
|
|||||||
local function recursiveOreMining()
|
local function recursiveOreMining()
|
||||||
for i=0, 3 do
|
for i=0, 3 do
|
||||||
--turtle.turnLeft()
|
--turtle.turnLeft()
|
||||||
state["r"] = tutel.left(state["r"])
|
tutel.left()
|
||||||
setState(state)
|
|
||||||
blockFound, blockData = turtle.inspect()
|
blockFound, blockData = turtle.inspect()
|
||||||
if isOre(blockData) then
|
if isOre(blockData) then
|
||||||
tutel.secureDig()
|
tutel.secureDig()
|
||||||
--turtle.forward()
|
--turtle.forward()
|
||||||
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
|
tutel.forward()
|
||||||
setState(state)
|
|
||||||
recursiveOreMining()
|
recursiveOreMining()
|
||||||
--turtle.back()
|
--turtle.back()
|
||||||
state["x"], state["y"], state["z"], state["r"] = tutel.back(state["x"],state["y"],state["z"],state["r"])
|
tutel.back()
|
||||||
setState(state)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -189,24 +178,20 @@ local function recursiveOreMining()
|
|||||||
if isOre(blockData) then
|
if isOre(blockData) then
|
||||||
tutel.secureDigUp()
|
tutel.secureDigUp()
|
||||||
--turtle.up()
|
--turtle.up()
|
||||||
state["y"] = tutel.up(state["y"])
|
tutel.up()
|
||||||
setState(state)
|
|
||||||
recursiveOreMining()
|
recursiveOreMining()
|
||||||
--turtle.down()
|
--turtle.down()
|
||||||
state["y"] = tutel.down(state["y"])
|
tutel.down()
|
||||||
setState(state)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
blockFound, blockData = turtle.inspectDown()
|
blockFound, blockData = turtle.inspectDown()
|
||||||
if isOre(blockData) then
|
if isOre(blockData) then
|
||||||
tutel.secureDigDown()
|
tutel.secureDigDown()
|
||||||
--turtle.down()
|
--turtle.down()
|
||||||
state["y"] = tutel.down(state["y"])
|
tutel.down()
|
||||||
setState(state)
|
|
||||||
recursiveOreMining()
|
recursiveOreMining()
|
||||||
--turtle.up()
|
--turtle.up()
|
||||||
state["y"] = tutel.up(state["y"])
|
tutel.up()
|
||||||
setState(state)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -217,8 +202,7 @@ local function mineRow()
|
|||||||
|
|
||||||
tutel.secureDig()
|
tutel.secureDig()
|
||||||
--turtle.forward()
|
--turtle.forward()
|
||||||
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
|
tutel.forward()
|
||||||
setState(state)
|
|
||||||
tutel.secureDigUp()
|
tutel.secureDigUp()
|
||||||
tutel.secureDigDown()
|
tutel.secureDigDown()
|
||||||
|
|
||||||
@ -227,20 +211,16 @@ local function mineRow()
|
|||||||
|
|
||||||
--check current mining step for ore
|
--check current mining step for ore
|
||||||
--turtle.up()
|
--turtle.up()
|
||||||
state["y"] = tutel.up(state["y"])
|
tutel.up()
|
||||||
setState(state)
|
|
||||||
recursiveOreMining()
|
recursiveOreMining()
|
||||||
--turtle.down()
|
--turtle.down()
|
||||||
state["y"] = tutel.down(state["y"])
|
tutel.down()
|
||||||
setState(state)
|
|
||||||
recursiveOreMining()
|
recursiveOreMining()
|
||||||
--turtle.down()
|
--turtle.down()
|
||||||
state["y"] = tutel.down(state["y"])
|
tutel.down()
|
||||||
setState(state)
|
|
||||||
recursiveOreMining()
|
recursiveOreMining()
|
||||||
--turtle.up()
|
--turtle.up()
|
||||||
state["y"] = tutel.up(state["y"])
|
tutel.up()
|
||||||
setState(state)
|
|
||||||
|
|
||||||
inventoryRework()
|
inventoryRework()
|
||||||
--clearInventory()
|
--clearInventory()
|
||||||
@ -248,9 +228,16 @@ local function mineRow()
|
|||||||
|
|
||||||
--save path progress
|
--save path progress
|
||||||
state["dataCurrentPathProgress"] = i+1
|
state["dataCurrentPathProgress"] = i+1
|
||||||
setState(state)
|
|
||||||
end
|
end
|
||||||
print("row: " .. state["dataCurrentRow"]+1 .. "/" .. state["dataGoalRows"] .. ", pathProgress: " .. state["dataCurrentPathProgress"]+1 .. "/" .. state["dataGoalPathProgress"])
|
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
|
end
|
||||||
|
|
||||||
local function mineChunk()
|
local function mineChunk()
|
||||||
@ -267,33 +254,27 @@ local function mineChunk()
|
|||||||
--turn back and return to start of row if not last row
|
--turn back and return to start of row if not last row
|
||||||
if i<state["dataGoalRows"]-1 then
|
if i<state["dataGoalRows"]-1 then
|
||||||
--turtle.turnLeft()
|
--turtle.turnLeft()
|
||||||
state["r"] = tutel.left(state["r"])
|
tutel.left()
|
||||||
setState(state)
|
|
||||||
--turtle.turnLeft()
|
--turtle.turnLeft()
|
||||||
state["r"] = tutel.left(state["r"])
|
tutel.left()
|
||||||
setState(state)
|
|
||||||
|
|
||||||
for j=1, state["dataGoalPathProgress"]-1 do
|
for j=1, state["dataGoalPathProgress"]-1 do
|
||||||
--turtle.forward()
|
--turtle.forward()
|
||||||
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
|
tutel.forward()
|
||||||
setState(state)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--go to next row
|
--go to next row
|
||||||
--turtle.turnLeft()
|
--turtle.turnLeft()
|
||||||
state["r"] = tutel.left(state["r"])
|
tutel.left()
|
||||||
setState(state)
|
|
||||||
for j=0, 2 do
|
for j=0, 2 do
|
||||||
tutel.secureDig()
|
tutel.secureDig()
|
||||||
--turtle.forward()
|
--turtle.forward()
|
||||||
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
|
tutel.forward()
|
||||||
setState(state)
|
|
||||||
tutel.secureDigUp()
|
tutel.secureDigUp()
|
||||||
tutel.secureDigDown()
|
tutel.secureDigDown()
|
||||||
end
|
end
|
||||||
--turtle.turnLeft()
|
--turtle.turnLeft()
|
||||||
state["r"] = tutel.left(state["r"])
|
tutel.left()
|
||||||
setState(state)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
state["dataCurrentRow"] = i+1
|
state["dataCurrentRow"] = i+1
|
||||||
@ -312,46 +293,47 @@ local function mineFibo()
|
|||||||
|
|
||||||
--go to next chunk
|
--go to next chunk
|
||||||
--turtle.turnRight()
|
--turtle.turnRight()
|
||||||
state["r"] = tutel.right(state["r"])
|
tutel.right()
|
||||||
setState(state)
|
|
||||||
for j=1, 2 do
|
for j=1, 2 do
|
||||||
tutel.secureDig()
|
tutel.secureDig()
|
||||||
--turtle.forward()
|
--turtle.forward()
|
||||||
state["x"], state["y"], state["z"], state["r"] = tutel.forward(state["x"],state["y"],state["z"],state["r"])
|
tutel.forward()
|
||||||
setState(state)
|
|
||||||
tutel.secureDigUp()
|
tutel.secureDigUp()
|
||||||
tutel.secureDigDown()
|
tutel.secureDigDown()
|
||||||
end
|
end
|
||||||
|
|
||||||
--get next fibo number
|
--get next fibo number
|
||||||
state["dataCurrentFibo"] = math.floor((state["dataCurrentFibo"] * (1+math.sqrt(5))/2) + 0.5)
|
state["dataCurrentFibo"] = math.floor((state["dataCurrentFibo"] * (1+math.sqrt(5))/2) + 0.5)
|
||||||
setState(state)
|
|
||||||
end
|
end
|
||||||
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
|
if fs.exists "brulijam/files/state-t-fiboMiner.txt" then
|
||||||
--setup()
|
--setup()
|
||||||
|
checkPosition()
|
||||||
mineFibo()
|
mineFibo()
|
||||||
else
|
else
|
||||||
state = getState()
|
state = getState()
|
||||||
|
|
||||||
write("x: ")
|
local pos = tutel.getPos()
|
||||||
startX = read()
|
|
||||||
write("y: ")
|
|
||||||
startY = read()
|
|
||||||
write("z: ")
|
|
||||||
startZ = read()
|
|
||||||
write("r (S=0,W=1,N=2,E=3):")
|
|
||||||
startR = read()
|
|
||||||
|
|
||||||
state["x"] = startX
|
state["lastValidR"] = pos["r"]
|
||||||
state["y"] = startY
|
state["lastValidX"] = pos["x"]
|
||||||
state["z"] = startZ
|
state["lastValidY"] = pos["y"]
|
||||||
state["r"] = startR
|
state["lastValidZ"] = pos["z"]
|
||||||
|
|
||||||
state["startX"] = startX
|
|
||||||
state["startY"] = startY
|
|
||||||
state["startZ"] = startZ
|
|
||||||
setState(state)
|
setState(state)
|
||||||
end
|
end
|
||||||
|
|
0
src/brulijam/t-path-miner.lua
Normal file → Executable file
0
src/brulijam/t-path-miner.lua
Normal file → Executable file
0
src/brulijam/turtle-chaosMine.lua
Normal file → Executable file
0
src/brulijam/turtle-chaosMine.lua
Normal file → Executable file
0
src/brulijam/turtle-miner-fibo.lua
Normal file → Executable file
0
src/brulijam/turtle-miner-fibo.lua
Normal file → Executable file
0
src/brulijam/turtle-miner-stupidExcavate.lua
Normal file → Executable file
0
src/brulijam/turtle-miner-stupidExcavate.lua
Normal file → Executable file
0
src/brulijam/turtle-roomCreator.lua
Normal file → Executable file
0
src/brulijam/turtle-roomCreator.lua
Normal file → Executable file
0
src/brulijam/turtle-treeFarmer.lua
Normal file → Executable file
0
src/brulijam/turtle-treeFarmer.lua
Normal file → Executable file
0
src/brulijam/tutelMoveTest.lua
Normal file → Executable file
0
src/brulijam/tutelMoveTest.lua
Normal file → Executable file
0
src/startup.lua
Normal file → Executable file
0
src/startup.lua
Normal file → Executable file
Loading…
Reference in New Issue
Block a user