cleanup
This commit is contained in:
@@ -236,10 +236,7 @@ function substitutionPage.info:draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self:clear()
|
self:clear()
|
||||||
self:setCursorPos(1, 1)
|
self:print(' Replace ' .. inName .. '\n' .. ' With ' .. outName)
|
||||||
self:print(' Replace ' .. inName .. '\n')
|
|
||||||
--self:print(' ' .. sub.id .. ':' .. sub.dmg .. '\n', nil, colors.yellow)
|
|
||||||
self:print(' With ' .. outName)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function substitutionPage:enable()
|
function substitutionPage:enable()
|
||||||
@@ -536,7 +533,7 @@ local startPage = UI.Page {
|
|||||||
event = 'setStartLevel',
|
event = 'setStartLevel',
|
||||||
cancelEvent = 'slide_hide',
|
cancelEvent = 'slide_hide',
|
||||||
text = UI.Text {
|
text = UI.Text {
|
||||||
x = 5, y = 1, width = 20,
|
x = 5, y = 1, width = 10,
|
||||||
textColor = colors.gray,
|
textColor = colors.gray,
|
||||||
},
|
},
|
||||||
textEntry = UI.TextEntry {
|
textEntry = UI.TextEntry {
|
||||||
@@ -554,7 +551,7 @@ local startPage = UI.Page {
|
|||||||
event = 'setStartBlock',
|
event = 'setStartBlock',
|
||||||
cancelEvent = 'slide_hide',
|
cancelEvent = 'slide_hide',
|
||||||
text = UI.Text {
|
text = UI.Text {
|
||||||
x = 2, y = 1, width = 20,
|
x = 2, y = 1, width = 13,
|
||||||
textColor = colors.gray,
|
textColor = colors.gray,
|
||||||
},
|
},
|
||||||
textEntry = UI.TextEntry {
|
textEntry = UI.TextEntry {
|
||||||
|
|||||||
@@ -211,9 +211,7 @@ function appPage.container.viewport:draw()
|
|||||||
Ansi.yellow .. app.description .. Ansi.reset)
|
Ansi.yellow .. app.description .. Ansi.reset)
|
||||||
|
|
||||||
self:clear()
|
self:clear()
|
||||||
self:setCursorPos(1, 1)
|
|
||||||
self:print(str)
|
self:print(str)
|
||||||
self.ymax = self.cursorY
|
|
||||||
|
|
||||||
if appPage.notification.enabled then
|
if appPage.notification.enabled then
|
||||||
appPage.notification:draw()
|
appPage.notification:draw()
|
||||||
@@ -369,4 +367,3 @@ categoryPage:setCategory(source.name, source.index)
|
|||||||
|
|
||||||
UI:setPage(categoryPage)
|
UI:setPage(categoryPage)
|
||||||
UI:pullEvents()
|
UI:pullEvents()
|
||||||
UI.term:reset()
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ local methodsPage = UI.Page {
|
|||||||
grid = UI.ScrollingGrid {
|
grid = UI.ScrollingGrid {
|
||||||
y = -6, ey = -2,
|
y = -6, ey = -2,
|
||||||
columns = {
|
columns = {
|
||||||
{ heading = 'Name', key = 'name', width = UI.term.width }
|
{ heading = 'Name', key = 'name' }
|
||||||
},
|
},
|
||||||
sortColumn = 'name',
|
sortColumn = 'name',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ function page:drawInfo(drive, textArea)
|
|||||||
return isValid(drive) and fs.getFreeSpace(drive.getMountPath()) or 0
|
return isValid(drive) and fs.getFreeSpace(drive.getMountPath()) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
textArea:setCursorPos(1, 1)
|
|
||||||
textArea:print(string.format('Drive: %s%s%s\nLabel: %s%s%s\nUsed: %s%s%s\nFree: %s%s%s',
|
textArea:print(string.format('Drive: %s%s%s\nLabel: %s%s%s\nUsed: %s%s%s\nFree: %s%s%s',
|
||||||
Ansi.yellow, drive.name, Ansi.reset,
|
Ansi.yellow, drive.name, Ansi.reset,
|
||||||
isValid(drive) and Ansi.yellow or Ansi.orange, getLabel():sub(1, 10), Ansi.reset,
|
isValid(drive) and Ansi.yellow or Ansi.orange, getLabel():sub(1, 10), Ansi.reset,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ local Config = require('opus.config')
|
|||||||
local Event = require('opus.event')
|
local Event = require('opus.event')
|
||||||
local itemDB = require('core.itemDB')
|
local itemDB = require('core.itemDB')
|
||||||
local Socket = require('opus.socket')
|
local Socket = require('opus.socket')
|
||||||
local Terminal = require('opus.terminal')
|
|
||||||
local UI = require('opus.ui')
|
local UI = require('opus.ui')
|
||||||
local Util = require('opus.util')
|
local Util = require('opus.util')
|
||||||
|
|
||||||
@@ -11,10 +10,7 @@ local fs = _G.fs
|
|||||||
local multishell = _ENV.multishell
|
local multishell = _ENV.multishell
|
||||||
local network = _G.network
|
local network = _G.network
|
||||||
local os = _G.os
|
local os = _G.os
|
||||||
local shell = _ENV.shell
|
|
||||||
local term = _G.term
|
|
||||||
|
|
||||||
--UI.Button.defaults.focusIndicator = ' '
|
|
||||||
UI:configure('Turtles', ...)
|
UI:configure('Turtles', ...)
|
||||||
|
|
||||||
local config = { }
|
local config = { }
|
||||||
@@ -31,13 +27,26 @@ local options = {
|
|||||||
|
|
||||||
local SCRIPTS_PATH = 'packages/common/etc/scripts'
|
local SCRIPTS_PATH = 'packages/common/etc/scripts'
|
||||||
|
|
||||||
local nullTerm = Terminal.getNullTerm(term.current())
|
local socket, turtle, page
|
||||||
local socket
|
|
||||||
|
|
||||||
local page = UI.Page {
|
page = UI.Page {
|
||||||
coords = UI.Window {
|
coords = UI.Window {
|
||||||
backgroundColor = colors.black,
|
backgroundColor = colors.black,
|
||||||
height = 3,
|
height = 3,
|
||||||
|
marginTop = 1, marginLeft = 1,
|
||||||
|
draw = function(self)
|
||||||
|
local t = turtle
|
||||||
|
self:clear()
|
||||||
|
if t then
|
||||||
|
self:setCursorPos(2, 2)
|
||||||
|
local ind = 'GPS'
|
||||||
|
if not t.point.gps then
|
||||||
|
ind = 'REL'
|
||||||
|
end
|
||||||
|
self:print(string.format('%s : %d,%d,%d',
|
||||||
|
ind, t.point.x, t.point.y, t.point.z))
|
||||||
|
end
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
tabs = UI.Tabs {
|
tabs = UI.Tabs {
|
||||||
x = 1, y = 4, ey = -2,
|
x = 1, y = 4, ey = -2,
|
||||||
@@ -50,6 +59,23 @@ local page = UI.Page {
|
|||||||
disableHeader = true,
|
disableHeader = true,
|
||||||
sortColumn = 'label',
|
sortColumn = 'label',
|
||||||
autospace = true,
|
autospace = true,
|
||||||
|
draw = function(self)
|
||||||
|
Util.clear(self.values)
|
||||||
|
local files = fs.list(SCRIPTS_PATH)
|
||||||
|
for _,path in pairs(files) do
|
||||||
|
table.insert(self.values, { label = path, path = fs.combine(SCRIPTS_PATH, path) })
|
||||||
|
end
|
||||||
|
self:update()
|
||||||
|
UI.ScrollingGrid.draw(self)
|
||||||
|
end,
|
||||||
|
eventHandler = function(self, event)
|
||||||
|
if event.type == 'grid_select' then
|
||||||
|
page:runScript(event.selected.label)
|
||||||
|
else
|
||||||
|
return UI.ScrollingGrid.eventHandler(self, event)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
turtles = UI.ScrollingGrid {
|
turtles = UI.ScrollingGrid {
|
||||||
tabTitle = 'Select',
|
tabTitle = 'Select',
|
||||||
@@ -63,6 +89,41 @@ local page = UI.Page {
|
|||||||
disableHeader = true,
|
disableHeader = true,
|
||||||
sortColumn = 'label',
|
sortColumn = 'label',
|
||||||
autospace = true,
|
autospace = true,
|
||||||
|
getDisplayValues = function(_, row)
|
||||||
|
row = Util.shallowCopy(row)
|
||||||
|
if row.fuel then
|
||||||
|
row.fuel = Util.toBytes(row.fuel)
|
||||||
|
end
|
||||||
|
if row.distance then
|
||||||
|
row.distance = Util.round(row.distance, 1)
|
||||||
|
end
|
||||||
|
return row
|
||||||
|
end,
|
||||||
|
draw = function(self)
|
||||||
|
Util.clear(self.values)
|
||||||
|
for _,v in pairs(network) do
|
||||||
|
if v.fuel then
|
||||||
|
table.insert(self.values, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:update()
|
||||||
|
UI.ScrollingGrid.draw(self)
|
||||||
|
end,
|
||||||
|
eventHandler = function(self, event)
|
||||||
|
if event.type == 'grid_select' then
|
||||||
|
turtle = event.selected
|
||||||
|
config.id = event.selected.id
|
||||||
|
Config.update('Turtles', config)
|
||||||
|
multishell.setTitle(multishell.getCurrent(), turtle.label)
|
||||||
|
if socket then
|
||||||
|
socket:close()
|
||||||
|
socket = nil
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return UI.ScrollingGrid.eventHandler(self, event)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
inventory = UI.ScrollingGrid {
|
inventory = UI.ScrollingGrid {
|
||||||
backgroundColor = colors.cyan,
|
backgroundColor = colors.cyan,
|
||||||
@@ -74,6 +135,54 @@ local page = UI.Page {
|
|||||||
},
|
},
|
||||||
disableHeader = true,
|
disableHeader = true,
|
||||||
sortColumn = 'index',
|
sortColumn = 'index',
|
||||||
|
getRowTextColor = function(self, row, selected)
|
||||||
|
if turtle and row.selected then
|
||||||
|
return colors.yellow
|
||||||
|
end
|
||||||
|
return UI.ScrollingGrid.getRowTextColor(self, row, selected)
|
||||||
|
end,
|
||||||
|
draw = function(self)
|
||||||
|
local t = turtle
|
||||||
|
Util.clear(self.values)
|
||||||
|
if t then
|
||||||
|
for k,v in pairs(t.inv or { }) do -- new method (less data)
|
||||||
|
local index, count = k:match('(%d+),(%d+)')
|
||||||
|
v = {
|
||||||
|
index = tonumber(index),
|
||||||
|
key = v,
|
||||||
|
count = tonumber(count),
|
||||||
|
}
|
||||||
|
table.insert(self.values, v)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,v in pairs(t.inventory or { }) do
|
||||||
|
if v.count > 0 then
|
||||||
|
table.insert(self.values, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,v in pairs(self.values) do
|
||||||
|
if v.index == t.slotIndex then
|
||||||
|
v.selected = true
|
||||||
|
end
|
||||||
|
if v.key then
|
||||||
|
v.key = itemDB:getName(v.key)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:adjustWidth()
|
||||||
|
self:update()
|
||||||
|
UI.ScrollingGrid.draw(self)
|
||||||
|
end,
|
||||||
|
eventHandler = function(self, event)
|
||||||
|
if event.type == 'grid_select' then
|
||||||
|
local fn = string.format('turtle.select(%d)', event.selected.index)
|
||||||
|
page:runFunction(fn)
|
||||||
|
else
|
||||||
|
return UI.ScrollingGrid.eventHandler(self, event)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
--[[
|
--[[
|
||||||
policy = UI.ScrollingGrid {
|
policy = UI.ScrollingGrid {
|
||||||
@@ -134,6 +243,15 @@ local page = UI.Page {
|
|||||||
{ key = 'distance', width = 6 },
|
{ key = 'distance', width = 6 },
|
||||||
{ key = 'fuel', width = 6 },
|
{ key = 'fuel', width = 6 },
|
||||||
},
|
},
|
||||||
|
draw = function(self)
|
||||||
|
local t = turtle
|
||||||
|
if t then
|
||||||
|
self.values.status = t.status
|
||||||
|
self.values.distance = t.distance and Util.round(t.distance, 2)
|
||||||
|
self.values.fuel = Util.toBytes(t.fuel)
|
||||||
|
end
|
||||||
|
UI.StatusBar.draw(self)
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
notification = UI.Notification(),
|
notification = UI.Notification(),
|
||||||
accelerators = {
|
accelerators = {
|
||||||
@@ -141,15 +259,10 @@ local page = UI.Page {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function page:enable(turtle)
|
|
||||||
self.turtle = turtle
|
|
||||||
UI.Page.enable(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
function page:runFunction(script, nowrap)
|
function page:runFunction(script, nowrap)
|
||||||
for _ = 1, 2 do
|
for _ = 1, 2 do
|
||||||
if not socket then
|
if not socket then
|
||||||
socket = Socket.connect(self.turtle.id, 161)
|
socket = Socket.connect(turtle.id, 161)
|
||||||
end
|
end
|
||||||
|
|
||||||
if socket then
|
if socket then
|
||||||
@@ -170,151 +283,42 @@ function page:runFunction(script, nowrap)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function page:runScript(scriptName)
|
function page:runScript(scriptName)
|
||||||
if self.turtle then
|
if turtle then
|
||||||
self.notification:info('Connecting')
|
self.notification:info('Connecting')
|
||||||
self:sync()
|
self:sync()
|
||||||
|
|
||||||
local cmd = string.format('Script %d %s', self.turtle.id, scriptName)
|
local script = Util.readFile(fs.combine(SCRIPTS_PATH, scriptName))
|
||||||
local ot = term.redirect(nullTerm)
|
if not script then
|
||||||
pcall(function() shell.run(cmd) end)
|
print('Unable to read script file')
|
||||||
term.redirect(ot)
|
end
|
||||||
|
|
||||||
|
local socket = Socket.connect(turtle.id, 161)
|
||||||
|
if not socket then
|
||||||
|
print('Unable to connect to ' .. turtle.id)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local function processVariables(script)
|
||||||
|
local variables = {
|
||||||
|
COMPUTER_ID = os.getComputerID(),
|
||||||
|
}
|
||||||
|
for k,v in pairs(variables) do
|
||||||
|
local token = string.format('{%s}', k)
|
||||||
|
script = script:gsub(token, v)
|
||||||
|
end
|
||||||
|
|
||||||
|
return script
|
||||||
|
end
|
||||||
|
|
||||||
|
script = processVariables(script)
|
||||||
|
|
||||||
|
socket:write({ type = 'script', args = script })
|
||||||
|
socket:close()
|
||||||
|
|
||||||
self.notification:success('Sent')
|
self.notification:success('Sent')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function page.coords:draw()
|
|
||||||
local t = self.parent.turtle
|
|
||||||
self:clear()
|
|
||||||
if t then
|
|
||||||
self:setCursorPos(2, 2)
|
|
||||||
local ind = 'GPS'
|
|
||||||
if not t.point.gps then
|
|
||||||
ind = 'REL'
|
|
||||||
end
|
|
||||||
self:print(string.format('%s : %d,%d,%d',
|
|
||||||
ind, t.point.x, t.point.y, t.point.z))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[ Inventory Tab ]]--
|
|
||||||
function page.tabs.inventory:getRowTextColor(row, selected)
|
|
||||||
if page.turtle and row.selected then
|
|
||||||
return colors.yellow
|
|
||||||
end
|
|
||||||
return UI.ScrollingGrid.getRowTextColor(self, row, selected)
|
|
||||||
end
|
|
||||||
|
|
||||||
function page.tabs.inventory:draw()
|
|
||||||
local t = page.turtle
|
|
||||||
Util.clear(self.values)
|
|
||||||
if t then
|
|
||||||
for k,v in pairs(t.inv or { }) do -- new method (less data)
|
|
||||||
local index, count = k:match('(%d+),(%d+)')
|
|
||||||
v = {
|
|
||||||
index = tonumber(index),
|
|
||||||
key = v,
|
|
||||||
count = tonumber(count),
|
|
||||||
}
|
|
||||||
table.insert(self.values, v)
|
|
||||||
end
|
|
||||||
|
|
||||||
for _,v in pairs(t.inventory or { }) do
|
|
||||||
if v.count > 0 then
|
|
||||||
table.insert(self.values, v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for _,v in pairs(self.values) do
|
|
||||||
if v.index == t.slotIndex then
|
|
||||||
v.selected = true
|
|
||||||
end
|
|
||||||
if v.key then
|
|
||||||
v.key = itemDB:getName(v.key)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self:adjustWidth()
|
|
||||||
self:update()
|
|
||||||
UI.ScrollingGrid.draw(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
function page.tabs.inventory:eventHandler(event)
|
|
||||||
if event.type == 'grid_select' then
|
|
||||||
local fn = string.format('turtle.select(%d)', event.selected.index)
|
|
||||||
page:runFunction(fn)
|
|
||||||
else
|
|
||||||
return UI.ScrollingGrid.eventHandler(self, event)
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function page.tabs.scripts:draw()
|
|
||||||
Util.clear(self.values)
|
|
||||||
local files = fs.list(SCRIPTS_PATH)
|
|
||||||
for _,path in pairs(files) do
|
|
||||||
table.insert(self.values, { label = path, path = fs.combine(SCRIPTS_PATH, path) })
|
|
||||||
end
|
|
||||||
self:update()
|
|
||||||
UI.ScrollingGrid.draw(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
function page.tabs.scripts:eventHandler(event)
|
|
||||||
if event.type == 'grid_select' then
|
|
||||||
page:runScript(event.selected.label)
|
|
||||||
else
|
|
||||||
return UI.ScrollingGrid.eventHandler(self, event)
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function page.tabs.turtles:getDisplayValues(row)
|
|
||||||
row = Util.shallowCopy(row)
|
|
||||||
if row.fuel then
|
|
||||||
row.fuel = Util.toBytes(row.fuel)
|
|
||||||
end
|
|
||||||
if row.distance then
|
|
||||||
row.distance = Util.round(row.distance, 1)
|
|
||||||
end
|
|
||||||
return row
|
|
||||||
end
|
|
||||||
|
|
||||||
function page.tabs.turtles:draw()
|
|
||||||
Util.clear(self.values)
|
|
||||||
for _,v in pairs(network) do
|
|
||||||
if v.fuel then
|
|
||||||
table.insert(self.values, v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
self:update()
|
|
||||||
UI.ScrollingGrid.draw(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
function page.tabs.turtles:eventHandler(event)
|
|
||||||
if event.type == 'grid_select' then
|
|
||||||
page.turtle = event.selected
|
|
||||||
config.id = event.selected.id
|
|
||||||
Config.update('Turtles', config)
|
|
||||||
multishell.setTitle(multishell.getCurrent(), page.turtle.label)
|
|
||||||
if socket then
|
|
||||||
socket:close()
|
|
||||||
socket = nil
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return UI.ScrollingGrid.eventHandler(self, event)
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
function page.statusBar:draw()
|
|
||||||
local t = self.parent.turtle
|
|
||||||
if t then
|
|
||||||
self.values.status = t.status
|
|
||||||
self.values.distance = t.distance and Util.round(t.distance, 2)
|
|
||||||
self.values.fuel = Util.toBytes(t.fuel)
|
|
||||||
end
|
|
||||||
UI.StatusBar.draw(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
function page:showBlocks()
|
function page:showBlocks()
|
||||||
local script = [[
|
local script = [[
|
||||||
local function inspect(direction)
|
local function inspect(direction)
|
||||||
@@ -354,19 +358,14 @@ function page:eventHandler(event)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function page:enable()
|
|
||||||
UI.Page.enable(self)
|
|
||||||
-- self.tabs:activateTab(page.tabs.turtles)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not Util.getOptions(options, { ... }, true) then
|
if not Util.getOptions(options, { ... }, true) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if options.turtle.value >= 0 then
|
if options.turtle.value >= 0 then
|
||||||
for _ = 1, 10 do
|
for _ = 1, 10 do
|
||||||
page.turtle = _G.network[options.turtle.value]
|
turtle = _G.network[options.turtle.value]
|
||||||
if page.turtle then
|
if turtle then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
os.sleep(1)
|
os.sleep(1)
|
||||||
@@ -374,9 +373,9 @@ if options.turtle.value >= 0 then
|
|||||||
end
|
end
|
||||||
|
|
||||||
Event.onInterval(1, function()
|
Event.onInterval(1, function()
|
||||||
if page.turtle then
|
if turtle then
|
||||||
local t = _G.network[page.turtle.id]
|
--local t = _G.network[turtle.id]
|
||||||
page.turtle = t
|
--turtle = t
|
||||||
page:draw()
|
page:draw()
|
||||||
page:sync()
|
page:sync()
|
||||||
end
|
end
|
||||||
@@ -387,5 +386,4 @@ if config.tab then
|
|||||||
end
|
end
|
||||||
|
|
||||||
UI:setPage(page)
|
UI:setPage(page)
|
||||||
|
UI:start()
|
||||||
UI:pullEvents()
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
_G.requireInjector(_ENV)
|
_G.requireInjector(_ENV)
|
||||||
local config = require('config').load('gps')
|
local config = require('opus.config').load('gps')
|
||||||
if config.home then
|
if config.home then
|
||||||
if turtle.enableGPS() then
|
if turtle.enableGPS() then
|
||||||
return turtle.pathfind(config.home)
|
return turtle.pathfind(config.home)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ turtle.run(function()
|
|||||||
|
|
||||||
_G.requireInjector(_ENV)
|
_G.requireInjector(_ENV)
|
||||||
|
|
||||||
local GPS = require('gps')
|
local GPS = require('opus.gps')
|
||||||
local Socket = require('socket')
|
local Socket = require('opus.socket')
|
||||||
|
|
||||||
local id = {COMPUTER_ID}
|
local id = {COMPUTER_ID}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
_G.requireInjector(_ENV)
|
_G.requireInjector(_ENV)
|
||||||
local Config = require('config')
|
local Config = require('opus.config')
|
||||||
local pt = turtle.enableGPS()
|
local pt = turtle.enableGPS()
|
||||||
if pt then
|
if pt then
|
||||||
local config = Config.load('gps', { })
|
local config = Config.load('gps', { })
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ local function summon(id)
|
|||||||
|
|
||||||
_G.requireInjector(_ENV)
|
_G.requireInjector(_ENV)
|
||||||
|
|
||||||
local GPS = require('gps')
|
local GPS = require('opus.gps')
|
||||||
local Point = require('point')
|
local Point = require('opus.point')
|
||||||
local Socket = require('socket')
|
local Socket = require('opus.socket')
|
||||||
|
|
||||||
turtle.setStatus('GPSing')
|
turtle.setStatus('GPSing')
|
||||||
turtle.setPoint({ x = 0, y = 0, z = 0, heading = 0 })
|
turtle.setPoint({ x = 0, y = 0, z = 0, heading = 0 })
|
||||||
|
|||||||
@@ -250,5 +250,3 @@ turtle.setStatus('Jamming')
|
|||||||
UI:pullEvents()
|
UI:pullEvents()
|
||||||
turtle.setStatus('idle')
|
turtle.setStatus('idle')
|
||||||
page:play(false)
|
page:play(false)
|
||||||
|
|
||||||
UI.term:reset()
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ local context = Milo:getContext()
|
|||||||
local resetTab = UI.Tab {
|
local resetTab = UI.Tab {
|
||||||
tabTitle = 'Reset',
|
tabTitle = 'Reset',
|
||||||
index = 5,
|
index = 5,
|
||||||
backgroundColor = colors.cyan,
|
noFill = true,
|
||||||
textArea = UI.TextArea {
|
textArea = UI.TextArea {
|
||||||
y = 2, ey = 6,
|
y = 2, ey = 6,
|
||||||
textColor = colors.yellow,
|
textColor = colors.yellow,
|
||||||
|
|||||||
@@ -637,8 +637,7 @@ Event.addRoutine(function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
UI:setPage(page)
|
UI:setPage(page)
|
||||||
UI:pullEvents()
|
UI:start()
|
||||||
UI.term:reset()
|
|
||||||
|
|
||||||
turtle.reset()
|
turtle.reset()
|
||||||
|
|
||||||
|
|||||||
@@ -100,11 +100,10 @@ function page.info:draw()
|
|||||||
|
|
||||||
self:clear()
|
self:clear()
|
||||||
if book then
|
if book then
|
||||||
self:setCursorPos(1, 1)
|
|
||||||
self:print(
|
self:print(
|
||||||
string.format('Name: %s%s%s\n', Ansi.yellow, book.name, Ansi.reset))
|
string.format('Name: %s%s%s\nVersion: %s%s%s\n',
|
||||||
self:print(
|
Ansi.yellow, book.name, Ansi.reset,
|
||||||
string.format('Version: %s%s%s\n', Ansi.yellow, book.version, Ansi.reset))
|
Ansi.yellow, book.version, Ansi.reset))
|
||||||
|
|
||||||
self.button.text = book.enabled and 'Disable' or 'Enable'
|
self.button.text = book.enabled and 'Disable' or 'Enable'
|
||||||
self.button:draw()
|
self.button:draw()
|
||||||
|
|||||||
Reference in New Issue
Block a user