peripheral updates
This commit is contained in:
@@ -18,34 +18,23 @@ Use this turtle for machine crafting.
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
local Event = require('event')
|
||||
local Peripheral = require('peripheral')
|
||||
local Util = require('util')
|
||||
|
||||
local device = _G.device
|
||||
local fs = _G.fs
|
||||
local os = _G.os
|
||||
local peripheral = _G.peripheral
|
||||
local turtle = _G.turtle
|
||||
|
||||
local STARTUP_FILE = 'usr/autorun/miloFurni.lua'
|
||||
|
||||
local function equip(side, item, rawName)
|
||||
local equipped = Peripheral.lookup('side/' .. side)
|
||||
|
||||
if equipped and equipped.type == item then
|
||||
return true
|
||||
end
|
||||
|
||||
if not turtle.equip(side, rawName or item) then
|
||||
if not turtle.selectSlotWithQuantity(0) then
|
||||
error('No slots available')
|
||||
end
|
||||
turtle.equip(side)
|
||||
if not turtle.equip(side, item) then
|
||||
if peripheral.getType(side) ~= item then
|
||||
if not turtle.equip(side, rawName or item) then
|
||||
error('Unable to equip ' .. item)
|
||||
end
|
||||
turtle.select(1)
|
||||
end
|
||||
|
||||
turtle.select(1)
|
||||
end
|
||||
|
||||
equip('left', 'plethora:introspection', 'plethora:module:0')
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local Craft = require('craft2')
|
||||
local Milo = require('milo')
|
||||
local Sound = require('sound')
|
||||
local Util = require('util')
|
||||
|
||||
local context = Milo:getContext()
|
||||
@@ -61,6 +62,7 @@ function craftTask:cycle()
|
||||
if item.requested - item.crafted > 0 then
|
||||
local recipe = Craft.findRecipe(key)
|
||||
if recipe then
|
||||
Sound.play('entity.experience_orb.pickup')
|
||||
self:craft(recipe, item)
|
||||
if item.callback and item.crafted >= item.requested then
|
||||
item.callback(item) -- invoke callback
|
||||
|
||||
Reference in New Issue
Block a user