revert peripheral change

This commit is contained in:
kepler155c@gmail.com
2018-12-26 14:21:28 -05:00
parent 03b7e9602b
commit 0679147a22
4 changed files with 19 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
local GPS = require('gps') local GPS = require('gps')
local Peripheral = require('peripheral')
local Point = require('point') local Point = require('point')
local Util = require('util') local Util = require('util')
@@ -67,13 +68,24 @@ local state = Util.readTable('usr/config/superTreefarm') or {
local clock = os.clock() local clock = os.clock()
local function equip(side, item, rawName) local function equip(side, item, rawName)
if peripheral.getType(side) == item or turtle.equip(side, rawName or item) then local equipped = Peripheral.lookup('side/' .. side)
turtle.select(1)
if equipped and equipped.type == item then
return true return true
end 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
error('Unable to equip ' .. (rawName or item)) error('Unable to equip ' .. (rawName or item))
end end
end
turtle.select(1)
end
local function inspect(fn) local function inspect(fn)
local s, item = fn() local s, item = fn()
@@ -668,7 +680,7 @@ local function updateClock()
end end
local function startupCheck() local function startupCheck()
equip('right', MODEM, 'modem') equip('right', 'modem', MODEM)
equip('left', PICKAXE) equip('left', PICKAXE)
local slots = turtle.getSummedInventory() local slots = turtle.getSummedInventory()

View File

@@ -55,6 +55,7 @@ local dictionary = {
[ 'minecraft:chest' ] = 'suck', [ 'minecraft:chest' ] = 'suck',
[ 'minecraft:lava' ] = 'liquid_fuel', [ 'minecraft:lava' ] = 'liquid_fuel',
[ 'minecraft:flowing_lava' ] = 'liquid_fuel', [ 'minecraft:flowing_lava' ] = 'liquid_fuel',
[ 'minecraft:mob_spawner' ] = 'ignore',
[ 'minecraft:bedrock' ] = 'ignore', [ 'minecraft:bedrock' ] = 'ignore',
[ 'minecraft:flowing_water' ] = 'ignore', [ 'minecraft:flowing_water' ] = 'ignore',
[ 'minecraft:water' ] = 'ignore', [ 'minecraft:water' ] = 'ignore',

View File

@@ -22,8 +22,6 @@ if not sensor or not sensor.sense then
error('Plethora sensor must be equipped') error('Plethora sensor must be equipped')
end end
local id = sensor.getID and sensor.getID() or ''
UI:configure('Entities', ...) UI:configure('Entities', ...)
local config = Config.load('Entities', { local config = Config.load('Entities', {
@@ -161,7 +159,7 @@ end
Event.onInterval(.5, function() Event.onInterval(.5, function()
local entities = sensor.sense() local entities = sensor.sense()
Util.filterInplace(entities, function(e) return e.id ~= id and not config.ignore[e.name] end) Util.filterInplace(entities, function(e) return not config.ignore[e.name] end)
if config.projecting then if config.projecting then
local meta = ni.getMetaOwner() local meta = ni.getMetaOwner()

View File

@@ -22,7 +22,7 @@
[ "Sensor" ] = { [ "Sensor" ] = {
title = "Sensor", title = "Sensor",
category = "Neural", category = "Neural",
run = "Entities.lua", run = "Sensor.lua",
}, },
[ "Scanner" ] = { [ "Scanner" ] = {
title = "Scanner", title = "Scanner",