spaces->tab, equipper improvements, supertreefarm rewrite, follow improvements, sensor cleanup, milo multiple items allowed in recipes, remote canvas access
This commit is contained in:
@@ -3,28 +3,28 @@ local GPS = require('gps')
|
||||
local device = _G.device
|
||||
|
||||
if device.neuralInterface and device.wireless_modem then
|
||||
local ni = require('neural.interface')
|
||||
device.neuralInterface.goTo = function(x, y, z)
|
||||
local pt = GPS.locate(2)
|
||||
if pt then
|
||||
return pcall(function()
|
||||
if device.neuralInterface.walk then
|
||||
local gpt = {
|
||||
x = x - pt.x,
|
||||
y = 0,
|
||||
z = z - pt.z,
|
||||
}
|
||||
gpt.x = math.min(math.max(gpt.x, -15), 15)
|
||||
gpt.z = math.min(math.max(gpt.z, -15), 15)
|
||||
return device.neuralInterface.walk(gpt.x, gpt.y, gpt.z, 2)
|
||||
elseif ni.launch then
|
||||
local y, p = ni.yap(pt, { x = x, y = y + 3, z = z })
|
||||
ni.look(y, 0)
|
||||
return ni.launch(y, p, 1.5)
|
||||
end
|
||||
end)
|
||||
end
|
||||
return false, 'No GPS'
|
||||
end
|
||||
local ni = require('neural.interface')
|
||||
device.neuralInterface.goTo = function(x, y, z)
|
||||
local pt = GPS.locate(2)
|
||||
if pt then
|
||||
return pcall(function()
|
||||
if device.neuralInterface.walk then
|
||||
local gpt = {
|
||||
x = x - pt.x,
|
||||
y = 0,
|
||||
z = z - pt.z,
|
||||
}
|
||||
gpt.x = math.min(math.max(gpt.x, -15), 15)
|
||||
gpt.z = math.min(math.max(gpt.z, -15), 15)
|
||||
return device.neuralInterface.walk(gpt.x, gpt.y, gpt.z, 2)
|
||||
elseif ni.launch then
|
||||
local y, p = ni.yap(pt, { x = x, y = y + 3, z = z })
|
||||
ni.look(y, 0)
|
||||
return ni.launch(y, p, 1.5)
|
||||
end
|
||||
end)
|
||||
end
|
||||
return false, 'No GPS'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,70 +1,70 @@
|
||||
local opus = {
|
||||
'fffff00',
|
||||
'ffff07000',
|
||||
'ff00770b00 4444',
|
||||
'ff077777444444444',
|
||||
'f07777744444444444',
|
||||
'f0000777444444444',
|
||||
'070000111744444',
|
||||
'777770000',
|
||||
'7777000000',
|
||||
'70700000000',
|
||||
'077000000000',
|
||||
'fffff00',
|
||||
'ffff07000',
|
||||
'ff00770b00 4444',
|
||||
'ff077777444444444',
|
||||
'f07777744444444444',
|
||||
'f0000777444444444',
|
||||
'070000111744444',
|
||||
'777770000',
|
||||
'7777000000',
|
||||
'70700000000',
|
||||
'077000000000',
|
||||
}
|
||||
|
||||
local hex = {
|
||||
['0'] = 0xF0F0F04F,
|
||||
['1'] = 0xF2B2334F,
|
||||
['2'] = 0xE57FD84F,
|
||||
['3'] = 0x99B2F24F,
|
||||
['4'] = 0xDEDE6C4F,
|
||||
['5'] = 0x7FCC194F,
|
||||
['6'] = 0xF2B2CC4F,
|
||||
['7'] = 0x4C4C4C4F,
|
||||
['8'] = 0x9999994F,
|
||||
['9'] = 0x4C99B24F,
|
||||
['a'] = 0xB266E54F,
|
||||
['b'] = 0x3366CC4F,
|
||||
['c'] = 0x7F664C4F,
|
||||
['d'] = 0x57A64E4F,
|
||||
['e'] = 0xCC4C4C4F,
|
||||
['0'] = 0xF0F0F04F,
|
||||
['1'] = 0xF2B2334F,
|
||||
['2'] = 0xE57FD84F,
|
||||
['3'] = 0x99B2F24F,
|
||||
['4'] = 0xDEDE6C4F,
|
||||
['5'] = 0x7FCC194F,
|
||||
['6'] = 0xF2B2CC4F,
|
||||
['7'] = 0x4C4C4C4F,
|
||||
['8'] = 0x9999994F,
|
||||
['9'] = 0x4C99B24F,
|
||||
['a'] = 0xB266E54F,
|
||||
['b'] = 0x3366CC4F,
|
||||
['c'] = 0x7F664C4F,
|
||||
['d'] = 0x57A64E4F,
|
||||
['e'] = 0xCC4C4C4F,
|
||||
-- ['f'] = 0x191919FF, -- transparent
|
||||
}
|
||||
|
||||
local function update()
|
||||
local canvas = device['plethora:glasses'] and device['plethora:glasses'].canvas()
|
||||
if canvas then
|
||||
local Tween = require('ui.tween')
|
||||
local canvas = device['plethora:glasses'] and device['plethora:glasses'].canvas()
|
||||
if canvas then
|
||||
local Tween = require('ui.tween')
|
||||
|
||||
canvas.clear()
|
||||
local w, h = canvas.getSize()
|
||||
local pos = { x = w / 2, y = h / 2 - 30 }
|
||||
local group = canvas.addGroup(pos)
|
||||
local function drawLine(k, line)
|
||||
for i = 1, #line do
|
||||
local pix = hex[line:sub(i, i)]
|
||||
if pix then
|
||||
group.addRectangle(i*1.5, k*2.25, 1.5, 2.25, pix)
|
||||
end
|
||||
end
|
||||
end
|
||||
canvas.clear()
|
||||
local w, h = canvas.getSize()
|
||||
local pos = { x = w / 2, y = h / 2 - 30 }
|
||||
local group = canvas.addGroup(pos)
|
||||
local function drawLine(k, line)
|
||||
for i = 1, #line do
|
||||
local pix = hex[line:sub(i, i)]
|
||||
if pix then
|
||||
group.addRectangle(i*1.5, k*2.25, 1.5, 2.25, pix)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for k,line in ipairs(opus) do
|
||||
drawLine(k, line)
|
||||
end
|
||||
os.sleep(.5)
|
||||
local tween = Tween.new(40, pos, { x = w - 60, y = h - 30 }, 'outBounce')
|
||||
repeat
|
||||
local finished = tween:update(1)
|
||||
os.sleep(0)
|
||||
group.setPosition(pos.x, pos.y)
|
||||
until finished
|
||||
end
|
||||
for k,line in ipairs(opus) do
|
||||
drawLine(k, line)
|
||||
end
|
||||
os.sleep(.5)
|
||||
local tween = Tween.new(40, pos, { x = w - 60, y = h - 30 }, 'outBounce')
|
||||
repeat
|
||||
local finished = tween:update(1)
|
||||
os.sleep(0)
|
||||
group.setPosition(pos.x, pos.y)
|
||||
until finished
|
||||
end
|
||||
end
|
||||
|
||||
kernel.run({
|
||||
title = 'opus',
|
||||
env = _ENV,
|
||||
hidden = true,
|
||||
fn = update,
|
||||
title = 'opus',
|
||||
env = _ENV,
|
||||
hidden = true,
|
||||
fn = update,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user