new icon set + scanning miner

This commit is contained in:
kepler155c@gmail.com 2018-10-15 16:05:43 -04:00
parent ecb3af4672
commit 8b50127f21
5 changed files with 49 additions and 14 deletions

View File

@ -136,6 +136,18 @@ function Event.waitForEvent(event, timeout)
until e[1] == 'timer' and e[2] == timerId until e[1] == 'timer' and e[2] == timerId
end end
-- Set a handler for the terminate event. Within the function, return
-- true or false to indicate whether the event should be propagated to
-- all sub-threads
function Event.onTerminate(fn)
Event.termFn = fn
end
function Event.termFn()
Event.terminate = true
return true -- propagate
end
function Event.addRoutine(fn) function Event.addRoutine(fn)
local r = setmetatable({ local r = setmetatable({
co = coroutine.create(fn), co = coroutine.create(fn),
@ -204,11 +216,16 @@ end
function Event.pullEvent(eventType) function Event.pullEvent(eventType)
while true do while true do
local e = { os.pullEventRaw() } local e = { os.pullEventRaw() }
local propagate = true -- don't like this...
Event.terminate = Event.terminate or e[1] == 'terminate' if e[1] == 'terminate' then
propagate = Event.termFn()
end
processHandlers(e[1]) if propagate then
processRoutines(table.unpack(e)) processHandlers(e[1])
processRoutines(table.unpack(e))
end
if Event.terminate then if Event.terminate then
return { 'terminate' } return { 'terminate' }

View File

@ -653,7 +653,6 @@ function Util.getOptions(options, args, ignoreInvalid)
end end
end end
return true, Util.size(rawOptions) return true, Util.size(rawOptions)
end end
return Util return Util

View File

@ -10,7 +10,7 @@ local os = _G.os
local read = _G.read local read = _G.read
local term = _G.term local term = _G.term
local options, args = Util.args({ ... }) local args = { ... }
local remoteId = tonumber(table.remove(args, 1) or '') local remoteId = tonumber(table.remove(args, 1) or '')
if not remoteId then if not remoteId then
@ -19,11 +19,11 @@ if not remoteId then
end end
if not remoteId then if not remoteId then
error('Syntax: telnet [-title TITLE] ID [PROGRAM]') error('Syntax: telnet ID [PROGRAM] [ARGS]')
end end
if options.title and multishell then if multishell then
multishell.setTitle(multishell.getCurrent(), options.title) multishell.setTitle(multishell.getCurrent(), 'Telnet ' .. remoteId)
end end
local socket, msg = Socket.connect(remoteId, 23) local socket, msg = Socket.connect(remoteId, 23)

View File

@ -16,6 +16,9 @@
icon = "\0304\031f \030f\0310o..\0304\031f \ icon = "\0304\031f \030f\0310o..\0304\031f \
\0304\031f \030f\0310.o.\0304\031f \ \0304\031f \030f\0310.o.\0304\031f \
\0304\031f - ", \0304\031f - ",
iconExt = "\0307\031f\135\0300\0317\159\0307\0310\144\031f\139\
\0300\0317\131\0307\0310\147\0300\0317\156\131\
\130\143\143\129",
run = "rom/programs/reboot", run = "rom/programs/reboot",
}, },
fb91e24fa52d8d2b32937bf04d843f730319a902 = { fb91e24fa52d8d2b32937bf04d843f730319a902 = {
@ -24,9 +27,9 @@
icon = "\0301\03171\03180\030 \031 \ icon = "\0301\03171\03180\030 \031 \
\0301\03181\030 \031 \ \0301\03181\030 \031 \
\0301\03170\03180\03171\0307\031f>", \0301\03170\03180\03171\0307\031f>",
iconExt = "\031f\128\0315\152\131\131\132\031f\128\ iconExt = "\031f\128\0313\152\131\131\132\031f\128\
\0315\139\159\129\0305\031f\159\129\139\ \0313\139\159\129\0303\031f\159\129\139\
\031f\128\0315\136\0305\031f\143\143\030f\0315\134\031f\128", \031f\128\0313\136\0303\031f\143\143\030f\0313\134\031f\128",
run = "http://pastebin.com/raw/UzGHLbNC", run = "http://pastebin.com/raw/UzGHLbNC",
}, },
c47ae15370cfe1ed2781eedc1dc2547d12d9e972 = { c47ae15370cfe1ed2781eedc1dc2547d12d9e972 = {
@ -46,6 +49,9 @@
icon = "\030f \ icon = "\030f \
\030f\0310lua>\031 \ \030f\0310lua>\031 \
\030f ", \030f ",
iconExt = "\0300\031f\151\030f\128\0300\159\159\159\030f\0310\144\0304\031f\159\030f\128\
\0300\031f\149\030f\128\0300\149\149\151\145\030f\128\0314\153\
\130\131\130\131\130\131\0314\130\031f\128",
run = "sys/apps/Lua.lua", run = "sys/apps/Lua.lua",
}, },
df485c871329671f46570634d63216761441bcd6 = { df485c871329671f46570634d63216761441bcd6 = {
@ -54,6 +60,9 @@
icon = "\0304 \030 \ icon = "\0304 \030 \
\030f \0304 \0307 \030 \031 \031f_\ \030f \0304 \0307 \030 \031 \031f_\
\030f \0304 \0307 \030 \031f/", \030f \0304 \0307 \030 \031f/",
iconExt = "\031f\128\128\128\0308\159\143\0300\0317\151\0307\0310\140\148\
\0314\151\131\0304\031f\148\030f\0318\138\148\0307\0310\138\131\129\
\0304\031f\138\143\133\030f\0318\131\129\031f\128\128\128",
run = "Devices.lua", run = "Devices.lua",
}, },
bc0792d8dc81e8aa30b987246a5ce97c40cd6833 = { bc0792d8dc81e8aa30b987246a5ce97c40cd6833 = {
@ -73,6 +82,9 @@
icon = "\0304\031f \030 \0311e\ icon = "\0304\031f \030 \0311e\
\030f\031f \0304 \030 \0311ee\031f \ \030f\031f \0304 \030 \0311ee\031f \
\030f\031f \0304 \030 \0311e\031f ", \030f\031f \0304 \030 \0311e\031f ",
iconExt = "\0300\031f\159\135\030f\0310\156\0301\031f\159\030f\0311\144\0300\031f\147\139\030f\0310\144\
\0300\128\128\030f\149\0311\157\142\0300\031f\149\0310\128\128\
\130\139\141\0311\130\131\0310\142\135\129",
run = "Events.lua", run = "Events.lua",
}, },
[ "2a4d562b1d9a9c90bdede6fac8ce4f7402462b86" ] = { [ "2a4d562b1d9a9c90bdede6fac8ce4f7402462b86" ] = {
@ -82,8 +94,8 @@
\030f\031f \0315/\\/ \ \030f\031f \0315/\\/ \
\030f\0315/\031f ", \030f\0315/\031f ",
iconExt = "\031f\128\128\0305\159\030f\128\0305\159\030f\0315\134\031f\128\ iconExt = "\031f\128\128\0305\159\030f\128\0305\159\030f\0315\134\031f\128\
\031f\128\0315\152\129\137\0305\031f\158\139\030f\0315\144\ \031f\128\0315\152\129\137\0305\031f\158\139\030f\0317 \
\0315\134\031f\128\128\128\128\0305\154\030f\0315\144", \0315\134\031f\128\128\128\128\0305\154\030f\0317 ",
run = "Tasks.lua", run = "Tasks.lua",
}, },
[ "6ce6c512ea433a7fc5c8841628e7696cd0ff7f2b" ] = { [ "6ce6c512ea433a7fc5c8841628e7696cd0ff7f2b" ] = {
@ -103,12 +115,18 @@
icon = "\0304\031f \ icon = "\0304\031f \
\0304\031f \030f\0310zz\031 \ \0304\031f \030f\0310zz\031 \
\0304\031f \030f ", \0304\031f \030f ",
iconExt = "\030e\031f\135\030f\031e\148\030e\128\031f\151\139\
\030e\031e\128\030f\031f\128\031e\143\031f\128\030e\031e\128\
\031e\139\030e\031f\130\131\129\030f\031e\135",
run = "/rom/programs/shutdown", run = "/rom/programs/shutdown",
}, },
bdc1fd5d3c0f3dcfd55d010426e61bf9451e680d = { bdc1fd5d3c0f3dcfd55d010426e61bf9451e680d = {
title = "Shell", title = "Shell",
category = "Apps", category = "Apps",
icon = "\030f\0314\151\131\131\131\131\ icon = "\0304 \030 \
\0304 \030f\0314> \0310_\031 \
\0304 \030f \030 ",
iconExt = "\030f\0314\151\131\131\131\131\
\030f\0314\149\030f\0314> \0310_ \ \030f\0314\149\030f\0314> \0310_ \
\030f\0314\149\030f ", \030f\0314\149\030f ",
run = "shell", run = "shell",

View File

@ -458,6 +458,7 @@ function turtle.back()
end end
local function moveTowardsX(dx) local function moveTowardsX(dx)
if not tonumber(dx) then error('moveTowardsX: Invalid arguments') end
local direction = dx - turtle.point.x local direction = dx - turtle.point.x
local move local move