spaces->tab, equipper improvements, supertreefarm rewrite, follow improvements, sensor cleanup, milo multiple items allowed in recipes, remote canvas access
This commit is contained in:
@@ -7,89 +7,89 @@ local device = _G.device
|
||||
|
||||
--[[ Configuration Screen ]]
|
||||
local wizardPage = UI.WizardPage {
|
||||
title = 'Trashcan',
|
||||
index = 2,
|
||||
backgroundColor = colors.cyan,
|
||||
info = UI.TextArea {
|
||||
x = 1, ex = -1, y = 2, ey = 4,
|
||||
textColor = colors.yellow,
|
||||
marginLeft = 1,
|
||||
marginRight = 1,
|
||||
value = [[ Items can be automatically dropped from this storage.]],
|
||||
},
|
||||
form = UI.Form {
|
||||
x = 2, ex = -2, y = 4, ey = -2,
|
||||
manualControls = true,
|
||||
[1] = UI.Checkbox {
|
||||
formLabel = 'Drop', formKey = 'drop',
|
||||
help = 'Drop the items out of this inventory',
|
||||
},
|
||||
[2] = UI.Chooser {
|
||||
width = 9,
|
||||
formLabel = 'Direction', formKey = 'dropDirection',
|
||||
nochoice = 'Down',
|
||||
choices = {
|
||||
{ name = 'Down', value = 'down' },
|
||||
{ name = 'Up', value = 'up' },
|
||||
{ name = 'North', value = 'north' },
|
||||
{ name = 'South', value = 'south' },
|
||||
{ name = 'East', value = 'east' },
|
||||
{ name = 'West', value = 'west' },
|
||||
},
|
||||
help = 'Drop in a specified direction'
|
||||
},
|
||||
},
|
||||
title = 'Trashcan',
|
||||
index = 2,
|
||||
backgroundColor = colors.cyan,
|
||||
info = UI.TextArea {
|
||||
x = 1, ex = -1, y = 2, ey = 4,
|
||||
textColor = colors.yellow,
|
||||
marginLeft = 1,
|
||||
marginRight = 1,
|
||||
value = [[ Items can be automatically dropped from this storage.]],
|
||||
},
|
||||
form = UI.Form {
|
||||
x = 2, ex = -2, y = 4, ey = -2,
|
||||
manualControls = true,
|
||||
[1] = UI.Checkbox {
|
||||
formLabel = 'Drop', formKey = 'drop',
|
||||
help = 'Drop the items out of this inventory',
|
||||
},
|
||||
[2] = UI.Chooser {
|
||||
width = 9,
|
||||
formLabel = 'Direction', formKey = 'dropDirection',
|
||||
nochoice = 'Down',
|
||||
choices = {
|
||||
{ name = 'Down', value = 'down' },
|
||||
{ name = 'Up', value = 'up' },
|
||||
{ name = 'North', value = 'north' },
|
||||
{ name = 'South', value = 'south' },
|
||||
{ name = 'East', value = 'east' },
|
||||
{ name = 'West', value = 'west' },
|
||||
},
|
||||
help = 'Drop in a specified direction'
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
function wizardPage:validate()
|
||||
return self.form:save()
|
||||
return self.form:save()
|
||||
end
|
||||
|
||||
function wizardPage:setNode(node)
|
||||
self.form:setValues(node)
|
||||
self.form:setValues(node)
|
||||
end
|
||||
|
||||
function wizardPage:isValidType(node)
|
||||
local m = device[node.name]
|
||||
return m and m.pullItems and {
|
||||
name = 'Trashcan',
|
||||
value = 'trashcan',
|
||||
category = 'custom',
|
||||
help = 'An inventory to send unwanted items',
|
||||
}
|
||||
local m = device[node.name]
|
||||
return m and m.pullItems and {
|
||||
name = 'Trashcan',
|
||||
value = 'trashcan',
|
||||
category = 'custom',
|
||||
help = 'An inventory to send unwanted items',
|
||||
}
|
||||
end
|
||||
|
||||
function wizardPage:isValidFor(node)
|
||||
return node.mtype == 'trashcan'
|
||||
return node.mtype == 'trashcan'
|
||||
end
|
||||
|
||||
UI:getPage('nodeWizard').wizard:add({ trashcan = wizardPage })
|
||||
|
||||
--[[ TASK ]]--
|
||||
local task = {
|
||||
name = 'trashcan',
|
||||
priority = 90,
|
||||
name = 'trashcan',
|
||||
priority = 90,
|
||||
}
|
||||
|
||||
local function filter(a)
|
||||
return a.drop
|
||||
return a.drop
|
||||
end
|
||||
|
||||
function task:cycle(context)
|
||||
local tasks = Tasks()
|
||||
local tasks = Tasks()
|
||||
|
||||
for node in context.storage:filterActive('trashcan', filter) do
|
||||
pcall(function()
|
||||
for k in pairs(node.adapter.list()) do
|
||||
local direction = node.dropDirection or 'down'
|
||||
tasks:add(function()
|
||||
node.adapter.drop(k, 64, direction)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
for node in context.storage:filterActive('trashcan', filter) do
|
||||
pcall(function()
|
||||
for k in pairs(node.adapter.list()) do
|
||||
local direction = node.dropDirection or 'down'
|
||||
tasks:add(function()
|
||||
node.adapter.drop(k, 64, direction)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
tasks:run()
|
||||
tasks:run()
|
||||
end
|
||||
|
||||
Milo:registerTask(task)
|
||||
|
||||
Reference in New Issue
Block a user