Added ms-installer.
This commit is contained in:
parent
f7fd8790f7
commit
3560cca7ca
|
@ -259,7 +259,7 @@ function itemscript.totalCount(filterExpr)
|
||||||
local filter = itemscript.filterize(filterExpr)
|
local filter = itemscript.filterize(filterExpr)
|
||||||
local count = 0
|
local count = 0
|
||||||
for i = 1, 16 do
|
for i = 1, 16 do
|
||||||
local item = t.getItemDetail(i)
|
local item = turtle.getItemDetail(i)
|
||||||
if filter(item) then
|
if filter(item) then
|
||||||
count = count + item.count
|
count = count + item.count
|
||||||
end
|
end
|
||||||
|
|
|
@ -291,7 +291,7 @@ function movescript.executeInstruction(instruction, settings)
|
||||||
if action then
|
if action then
|
||||||
debug("Executing action \"" .. instruction.action .. "\" " .. instruction.count .. " times.", settings)
|
debug("Executing action \"" .. instruction.action .. "\" " .. instruction.count .. " times.", settings)
|
||||||
local shouldRefuel = (
|
local shouldRefuel = (
|
||||||
(settings.safe or true) and
|
((settings ~= nil and settings.safe) or true) and
|
||||||
(action.needsFuel) and
|
(action.needsFuel) and
|
||||||
(instruction.count > t.getFuelLevel())
|
(instruction.count > t.getFuelLevel())
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
--[[
|
||||||
|
An installation script that manages installing all movescript libraries easily.
|
||||||
|
]]--
|
||||||
|
|
||||||
|
local libs = {
|
||||||
|
"movescript.lua",
|
||||||
|
"itemscript.lua",
|
||||||
|
"buildscript.lua"
|
||||||
|
}
|
||||||
|
|
||||||
|
local BASE_URL = "https://andrewlalis.github.io/movescript/scripts/"
|
||||||
|
|
||||||
|
for _, lib in pairs(libs) do
|
||||||
|
if fs.exists(lib) then
|
||||||
|
fs.delete(lib)
|
||||||
|
print("Deleted " .. lib)
|
||||||
|
end
|
||||||
|
local success = shell.run("wget", BASE_URL .. lib)
|
||||||
|
if not success then
|
||||||
|
error("Failed to install " .. lib)
|
||||||
|
end
|
||||||
|
print("Downloaded " .. lib)
|
||||||
|
end
|
||||||
|
print("Done!")
|
Loading…
Reference in New Issue