.
This commit is contained in:
parent
1ecffb0823
commit
193ce1da41
@ -49,10 +49,10 @@ function ntfy(msg)
|
||||
http.post("https://ntfy.brammer.cc/8DI2nmDPVG6l7A0x", msg)
|
||||
end
|
||||
|
||||
function splitStringToArray(input_str)
|
||||
function splitStringToArray(inputStr)
|
||||
table = {}
|
||||
i = 0
|
||||
for str in string.gmatch(input_str, "([^"..",".."]+)") do
|
||||
for str in string.gmatch(inputStr, "([^"..",".."]+)") do
|
||||
table[i] = str
|
||||
i = i + 1
|
||||
end
|
||||
|
@ -150,96 +150,6 @@ local function inventoryRework()
|
||||
end
|
||||
|
||||
|
||||
local function clearInventory()
|
||||
for i=1, 16 do
|
||||
turtle.select(i)
|
||||
itemDetail = turtle.getItemDetail()
|
||||
local keepItem = false
|
||||
|
||||
for j=0, #keepList do
|
||||
itemDetail = turtle.getItemDetail()
|
||||
if itemDetail ~= nil then
|
||||
if itemDetail.name == keepList[j] then
|
||||
--turtle.dropDown()
|
||||
keepItem = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not keepItem then
|
||||
turtle.dropDown()
|
||||
end
|
||||
end
|
||||
turtle.select(1)
|
||||
end
|
||||
|
||||
local function storeItems()
|
||||
--refuel all
|
||||
-- shell.run("refuel all") doesnt work because nomnom chests
|
||||
for i=1, 16 do
|
||||
turtle.select(i)
|
||||
itemDetail = turtle.getItemDetail()
|
||||
if itemDetail ~= nil then
|
||||
if itemDetail.name == "minecraft:coal" then
|
||||
turtle.refuel()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--check inv for chest and place it
|
||||
chestAvailable = false
|
||||
for i=1, 16 do
|
||||
turtle.select(i)
|
||||
itemDetail = turtle.getItemDetail()
|
||||
if itemDetail ~= nil then
|
||||
if itemDetail.name == "minecraft:chest" then
|
||||
turtle.up()
|
||||
basic.secureDigUp()
|
||||
turtle.up()
|
||||
basic.secureDigUp()
|
||||
turtle.placeUp()
|
||||
savePos()
|
||||
chestAvailable = true
|
||||
break
|
||||
elseif i == 16 then
|
||||
--TODO save in state that no chests are available
|
||||
shell.run("delete /brulijam/task.lua")
|
||||
shell.run("reboot")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--drop items in chest
|
||||
if chestAvailable then
|
||||
for i=1, 16 do
|
||||
turtle.select(i)
|
||||
itemDetail = turtle.getItemDetail()
|
||||
if itemDetail ~= nil then
|
||||
if itemDetail.name ~= "minecraft:chest" and itemDetail.name ~= "computercraft:wireless_modem_advanced" then
|
||||
turtle.dropUp()
|
||||
end
|
||||
end
|
||||
end
|
||||
turtle.down()
|
||||
turtle.down()
|
||||
end
|
||||
end
|
||||
|
||||
local function checkInventory()
|
||||
for i=1, 16 do
|
||||
turtle.select(i)
|
||||
itemCount = turtle.getItemCount()
|
||||
if itemCount == 0 then
|
||||
turtle.select(1)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
storeItems()
|
||||
turtle.select(1)
|
||||
end
|
||||
|
||||
|
||||
local function isOre(blockData)
|
||||
for i=0, #oreList do
|
||||
if blockData["name"] == oreList[i] then
|
||||
@ -378,4 +288,6 @@ local function mineFibo()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
setup()
|
||||
mineFibo()
|
@ -1,6 +1,11 @@
|
||||
--you may change these values
|
||||
local repo = "https://git.brulijam.com/brulijam/Computercraft/raw/branch/main/src"
|
||||
local labelPrefix = "SPHEAL"
|
||||
|
||||
|
||||
|
||||
|
||||
--fetch sync script
|
||||
local repo = "https://git.brulijam.com/brulijam/Computercraft/raw/branch/main/src"
|
||||
getRequest = http.get(repo .. "/brulijam/sync.lua")
|
||||
file = fs.open("/brulijam/sync.lua", "w")
|
||||
file.write(getRequest.readAll())
|
||||
@ -19,6 +24,13 @@ shell.run("brulijam/task.lua")
|
||||
--execute sync script
|
||||
shell.run("/brulijam/sync.lua")
|
||||
|
||||
|
||||
--set label if not set
|
||||
if os.getComputerLabel == nil then
|
||||
local labelMainPart = string.sub(hash.digestStr(os.getComputerID()), 1, 6)
|
||||
os.setComputerLabel(labelPrefix .. "-" .. labelMainPart)
|
||||
end
|
||||
|
||||
--shell.run("/brulijam/systemlock.lua")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user