spaces->tab, equipper improvements, supertreefarm rewrite, follow improvements, sensor cleanup, milo multiple items allowed in recipes, remote canvas access

This commit is contained in:
kepler155c@gmail.com
2019-06-18 15:23:20 -04:00
parent 3b9b509429
commit 045b32884f
162 changed files with 20448 additions and 20286 deletions

View File

@@ -8,11 +8,11 @@ local peripheral = _G.peripheral
local t = { }
local ni =
peripheral.find('neuralInterface') or
error('Neural Interface not found')
peripheral.find('neuralInterface') or
error('Neural Interface not found')
if not ni.getID then
error('Missing Introspection Module')
error('Missing Introspection Module')
end
local uid = ni.getID()
@@ -23,66 +23,66 @@ local lpt
local me = Util.find(ni.sense(), 'id', uid)
local function gps()
while true do
me = Util.find(ni.sense(), 'id', uid)
pt = GPS.locate(3) or error('GPS failed')
os.sleep(.3)
print('got gps')
end
while true do
me = Util.find(ni.sense(), 'id', uid)
pt = GPS.locate(3) or error('GPS failed')
os.sleep(.3)
print('got gps')
end
end
local function record()
local timerId = os.startTimer(.1)
repeat
local event, ch = os.pullEvent()
local v
local delay = os.clock() - c
c = os.clock()
--print(event .. ' ' .. tostring(ch))
if event == 'char' then
print('char ' .. ch)
if ch == ' ' then
v = {
action = 'walk',
x = pt.x,
y = pt.y,
z = pt.z,
pitch = me.pitch,
yaw = me.yaw,
delay = delay,
}
elseif ch == 'u' then
v = {
action = 'use',
x = pt.x,
y = pt.y,
z = pt.z,
pitch = me.pitch,
yaw = me.yaw,
delay = delay,
}
end
elseif event == 'timer' and ch == timerId then
if not lpt or not Point.same(pt, lpt) then
v = {
action = 'walk',
x = pt.x,
y = pt.y,
z = pt.z,
pitch = me.pitch,
yaw = me.yaw,
delay = delay,
}
lpt = pt
end
timerId = os.startTimer(.2)
end
local timerId = os.startTimer(.1)
repeat
local event, ch = os.pullEvent()
local v
local delay = os.clock() - c
c = os.clock()
--print(event .. ' ' .. tostring(ch))
if event == 'char' then
print('char ' .. ch)
if ch == ' ' then
v = {
action = 'walk',
x = pt.x,
y = pt.y,
z = pt.z,
pitch = me.pitch,
yaw = me.yaw,
delay = delay,
}
elseif ch == 'u' then
v = {
action = 'use',
x = pt.x,
y = pt.y,
z = pt.z,
pitch = me.pitch,
yaw = me.yaw,
delay = delay,
}
end
elseif event == 'timer' and ch == timerId then
if not lpt or not Point.same(pt, lpt) then
v = {
action = 'walk',
x = pt.x,
y = pt.y,
z = pt.z,
pitch = me.pitch,
yaw = me.yaw,
delay = delay,
}
lpt = pt
end
timerId = os.startTimer(.2)
end
if v then
Util.print(v)
table.insert(t, v)
end
until event == 'char' and ch == 'q'
if v then
Util.print(v)
table.insert(t, v)
end
until event == 'char' and ch == 'q'
end
parallel.waitForAny(gps, record)