refactor common apps into its own package

This commit is contained in:
kepler155c@gmail.com
2019-03-12 20:05:04 -04:00
parent d8e0a669af
commit 81a7894037
22 changed files with 26 additions and 13 deletions

16
common/.package Normal file
View File

@@ -0,0 +1,16 @@
{
title = 'Useful applications',
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/common',
description = [[Various applications for Opus.
* App Store
* Peripheral API viewer
* Disk / Computer copier
* A better editor (copy/paste/undo)
* Turtle swarm miner
* Turtle follow
* Screen recorder
* and more...
]],
licence = 'MIT',
}

View File

@@ -0,0 +1,6 @@
_ENV.shell.setCompletionFunction("packages/common/edit.lua",
function(shell, nIndex, sText)
if nIndex == 1 then
return _G.fs.complete(sText, shell.dir(), true, false)
end
end)

View File

@@ -1,6 +1,6 @@
{
title = 'Core apps and apis',
title = 'APIs used by various programs',
repository = 'kepler155c/opus-apps/{{OPUS_BRANCH}}/core',
description = [[Provides common files used by Opus applications. Also includes various useful applications.]],
description = [[Provides APIs used by Opus applications.]],
licence = 'MIT',
}

View File

@@ -1,9 +0,0 @@
if fs.exists('packages/core/lavaRefuel.lua') then fs.delete('packages/core/lavaRefuel.lua') end
if fs.exists('packages/core/t.lua') then fs.delete('packages/core/t.lua') end
_ENV.shell.setCompletionFunction("packages/core/edit.lua",
function(shell, nIndex, sText)
if nIndex == 1 then
return _G.fs.complete(sText, shell.dir(), true, false)
end
end)

View File

@@ -587,12 +587,12 @@ Event.addRoutine(function()
)
local maxDistance = Point.distance(
HOME_PT,
{ x = mining.x + 16, y = 0, z = mining.z + 16 }
{ x = mining.x, y = 0, z = mining.z }
)
_G._debug({ distance = distance, maxDistance = maxDistance })
if distance > maxDistance then
if distance > maxDistance + 16 then
term.clear()
term.setCursorPos(1, 1)
_G.printError('WARNING\n\nTurtle is outside the mining area\n')