milo wip
This commit is contained in:
@@ -2,6 +2,7 @@ local Milo = require('milo')
|
||||
local Util = require('util')
|
||||
|
||||
local Autocraft = {
|
||||
name = 'autocraft',
|
||||
priority = 100,
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,8 @@ function craftPage:eventHandler(event)
|
||||
end
|
||||
|
||||
local demandCraftingTask = {
|
||||
priority = 20,
|
||||
name = 'demand crafting',
|
||||
priority = 60,
|
||||
}
|
||||
|
||||
function demandCraftingTask:cycle(context)
|
||||
|
||||
@@ -4,7 +4,8 @@ local Milo = require('milo')
|
||||
local device = _G.device
|
||||
|
||||
local ExportTask = {
|
||||
priority = 5,
|
||||
name = 'exporter',
|
||||
priority = 40,
|
||||
}
|
||||
|
||||
function ExportTask:cycle(context)
|
||||
|
||||
@@ -3,7 +3,8 @@ local Milo = require('milo')
|
||||
local device = _G.device
|
||||
|
||||
local ImportTask = {
|
||||
priority = 3,
|
||||
name = 'importer',
|
||||
priority = 20,
|
||||
}
|
||||
|
||||
function ImportTask:cycle(context)
|
||||
|
||||
@@ -3,7 +3,8 @@ local Milo = require('milo')
|
||||
local device = _G.device
|
||||
|
||||
local InputChest = {
|
||||
priority = 1,
|
||||
name = 'input',
|
||||
priority = 10,
|
||||
}
|
||||
|
||||
function InputChest:cycle(context)
|
||||
|
||||
@@ -56,6 +56,7 @@ jobList:draw()
|
||||
jobList:sync()
|
||||
|
||||
local JobListTask = {
|
||||
name = 'job status',
|
||||
priority = 80,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
local Milo = require('milo')
|
||||
|
||||
local LimitTask = {
|
||||
priority = 10,
|
||||
name = 'limiter',
|
||||
priority = 50,
|
||||
}
|
||||
|
||||
function LimitTask:cycle(context)
|
||||
|
||||
@@ -3,7 +3,8 @@ local Milo = require('milo')
|
||||
local device = _G.device
|
||||
|
||||
local PotionImportTask = {
|
||||
priority = 3,
|
||||
name = 'potions',
|
||||
priority = 30,
|
||||
}
|
||||
|
||||
function PotionImportTask:cycle(context)
|
||||
|
||||
@@ -2,15 +2,32 @@ local Event = require('event')
|
||||
local Milo = require('milo')
|
||||
local Socket = require('socket')
|
||||
|
||||
local device = _G.device
|
||||
local manipulator = device.manipulator_1
|
||||
local turtle = _G.turtle
|
||||
local device = _G.device
|
||||
local turtle = _G.turtle
|
||||
|
||||
local context = Milo:getContext()
|
||||
|
||||
local function getManipulatorForUser(user)
|
||||
for _,v in pairs(device) do
|
||||
if v.type == 'manipulator' and v.getName and v.getName() == user then
|
||||
return v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function client(socket)
|
||||
debug('connection from ' .. socket.dhost)
|
||||
|
||||
local user = socket:read(2)
|
||||
if not user then
|
||||
return
|
||||
end
|
||||
|
||||
local manipulator = getManipulatorForUser(user)
|
||||
if not manipulator then
|
||||
return
|
||||
end
|
||||
|
||||
repeat
|
||||
local data = socket:read()
|
||||
if not data then
|
||||
@@ -51,6 +68,7 @@ if device.wireless_modem then
|
||||
local socket = Socket.server(4242)
|
||||
Event.addRoutine(function()
|
||||
client(socket)
|
||||
socket:close()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -2,7 +2,8 @@ local itemDB = require('itemDB')
|
||||
local Milo = require('milo')
|
||||
|
||||
local ReplenishTask = {
|
||||
priority = 30,
|
||||
name = 'replenish',
|
||||
priority = 70,
|
||||
}
|
||||
|
||||
function ReplenishTask:cycle(context)
|
||||
|
||||
Reference in New Issue
Block a user