From 0679147a22313fc8bd240518b391458aca485e38 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Wed, 26 Dec 2018 14:21:28 -0500 Subject: [PATCH] revert peripheral change --- farms/superTreefarm.lua | 20 ++++++++++++++++---- miners/scanningMiner.lua | 1 + neural/{Entities.lua => Sensor.lua} | 4 +--- neural/etc/apps.db | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) rename neural/{Entities.lua => Sensor.lua} (96%) diff --git a/farms/superTreefarm.lua b/farms/superTreefarm.lua index 05caf40..d2df898 100644 --- a/farms/superTreefarm.lua +++ b/farms/superTreefarm.lua @@ -1,4 +1,5 @@ local GPS = require('gps') +local Peripheral = require('peripheral') local Point = require('point') local Util = require('util') @@ -67,12 +68,23 @@ local state = Util.readTable('usr/config/superTreefarm') or { local clock = os.clock() local function equip(side, item, rawName) - if peripheral.getType(side) == item or turtle.equip(side, rawName or item) then - turtle.select(1) + local equipped = Peripheral.lookup('side/' .. side) + + if equipped and equipped.type == item then return true end - error('Unable to equip ' .. (rawName or item)) + 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)) + end + end + + turtle.select(1) end local function inspect(fn) @@ -668,7 +680,7 @@ local function updateClock() end local function startupCheck() - equip('right', MODEM, 'modem') + equip('right', 'modem', MODEM) equip('left', PICKAXE) local slots = turtle.getSummedInventory() diff --git a/miners/scanningMiner.lua b/miners/scanningMiner.lua index 11053fd..09e77c7 100644 --- a/miners/scanningMiner.lua +++ b/miners/scanningMiner.lua @@ -55,6 +55,7 @@ local dictionary = { [ 'minecraft:chest' ] = 'suck', [ 'minecraft:lava' ] = 'liquid_fuel', [ 'minecraft:flowing_lava' ] = 'liquid_fuel', + [ 'minecraft:mob_spawner' ] = 'ignore', [ 'minecraft:bedrock' ] = 'ignore', [ 'minecraft:flowing_water' ] = 'ignore', [ 'minecraft:water' ] = 'ignore', diff --git a/neural/Entities.lua b/neural/Sensor.lua similarity index 96% rename from neural/Entities.lua rename to neural/Sensor.lua index 0c6649c..b613ac8 100644 --- a/neural/Entities.lua +++ b/neural/Sensor.lua @@ -22,8 +22,6 @@ if not sensor or not sensor.sense then error('Plethora sensor must be equipped') end -local id = sensor.getID and sensor.getID() or '' - UI:configure('Entities', ...) local config = Config.load('Entities', { @@ -161,7 +159,7 @@ end Event.onInterval(.5, function() 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 local meta = ni.getMetaOwner() diff --git a/neural/etc/apps.db b/neural/etc/apps.db index 3495bee..5a77795 100644 --- a/neural/etc/apps.db +++ b/neural/etc/apps.db @@ -22,7 +22,7 @@ [ "Sensor" ] = { title = "Sensor", category = "Neural", - run = "Entities.lua", + run = "Sensor.lua", }, [ "Scanner" ] = { title = "Scanner",