diff --git a/builder/base64dl.lua b/builder/base64dl.lua index a76f494..1efc0d0 100644 --- a/builder/base64dl.lua +++ b/builder/base64dl.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Base64 = require('base64') local http = _G.http @@ -9,13 +7,13 @@ local shell = _ENV.shell local args = { ... } if not args[2] then - error('Syntax: base64dl ') + error('Syntax: base64dl ') end local c = http.get(args[2]) if not c then - error('unable to open url') + error('unable to open url') end local data = c.readAll() @@ -27,13 +25,13 @@ print('decoded: ' .. #decoded) local file = io.open(shell.resolve(args[1]), "wb") if not file then - error('Unable to open ' .. args[1], 2) + error('Unable to open ' .. args[1], 2) end for k,b in ipairs(decoded) do - if (k % 1000) == 0 then - os.sleep(0) - end - file:write(b) + if (k % 1000) == 0 then + os.sleep(0) + end + file:write(b) end file:close() diff --git a/builder/builder.lua b/builder/builder.lua index d09fd21..765f677 100644 --- a/builder/builder.lua +++ b/builder/builder.lua @@ -2,8 +2,6 @@ if not _G.turtle and not _G.commands then error('Must be run on a turtle or a command computer') end -_G.requireInjector() - local Adapter = require('inventoryAdapter') local Event = require('event') local GPS = require('gps') diff --git a/builder/supplier.lua b/builder/supplier.lua index 2b8dcee..58405f0 100644 --- a/builder/supplier.lua +++ b/builder/supplier.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Event = require('event') local Logger = require('logger') local MEProvider = require('meProvider') @@ -30,7 +28,7 @@ if Util.getVersion() == 1.8 then end if not device.wireless_modem then - error('No wireless modem detected') + error('No wireless modem detected') end Logger.filter('modem_send', 'event', 'ui') @@ -230,36 +228,36 @@ function Builder:finish() end function Builder:gotoBuilder() - if Builder.lastPoint then + if Builder.lastPoint then turtle.setStatus('tracking') - while true do - local pt = Point.copy(Builder.lastPoint) - pt.y = pt.y + 3 - if turtle.point.y ~= pt.y then - turtle.gotoY(pt.y) - else - local distance = Point.turtleDistance(turtle.point, pt) - if distance <= 3 then - Builder:log('Synchronized') - break - end + while true do + local pt = Point.copy(Builder.lastPoint) + pt.y = pt.y + 3 + if turtle.point.y ~= pt.y then + turtle.gotoY(pt.y) + else + local distance = Point.turtleDistance(turtle.point, pt) + if distance <= 3 then + Builder:log('Synchronized') + break + end - if turtle.point.heading % 2 == 0 then - if turtle.point.x == pt.x then - turtle.headTowardsZ(pt.z) - moveTowardsZ(pt.z) - else - moveTowardsX(pt.x) - end - elseif turtle.point.z ~= pt.z then - moveTowardsZ(pt.z) - else - turtle.headTowardsX(pt.x) - moveTowardsX(pt.x) - end - end - end - end + if turtle.point.heading % 2 == 0 then + if turtle.point.x == pt.x then + turtle.headTowardsZ(pt.z) + moveTowardsZ(pt.z) + else + moveTowardsX(pt.x) + end + elseif turtle.point.z ~= pt.z then + moveTowardsZ(pt.z) + else + turtle.headTowardsX(pt.x) + moveTowardsX(pt.x) + end + end + end + end end Message.addHandler('builder', @@ -385,8 +383,8 @@ Event.on('turtle_abort', local function onTheWay() -- parallel routine while true do - local _, _, _, id, msg, _ = os.pullEvent('modem_message') - if Builder.ready then + local _, _, _, id, msg, _ = os.pullEvent('modem_message') + if Builder.ready then if id == __BUILDER_ID and msg and msg.type then if msg.type == 'needSupplies' then Message.send(__BUILDER_ID, 'gotSupplies', { supplies = true }) diff --git a/core/Appstore.lua b/core/Appstore.lua index e2060d6..1387270 100644 --- a/core/Appstore.lua +++ b/core/Appstore.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Ansi = require('ansi') local SHA1 = require('sha1') local UI = require('ui') diff --git a/core/Events.lua b/core/Events.lua index 1b1734c..48829f8 100644 --- a/core/Events.lua +++ b/core/Events.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Event = require('event') local UI = require('ui') local Util = require('util') diff --git a/core/Music.lua b/core/Music.lua index c33f3ef..b69fd29 100644 --- a/core/Music.lua +++ b/core/Music.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Event = require('event') local UI = require('ui') diff --git a/core/Script.lua b/core/Script.lua index 82e0b30..94dfb7d 100644 --- a/core/Script.lua +++ b/core/Script.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Config = require('config') local Event = require('event') local Socket = require('socket') diff --git a/core/Turtles.lua b/core/Turtles.lua index 2af92e3..9025479 100644 --- a/core/Turtles.lua +++ b/core/Turtles.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Config = require('config') local Event = require('event') local itemDB = require('itemDB') diff --git a/core/recorder.lua b/core/recorder.lua index f801ad1..390e10e 100644 --- a/core/recorder.lua +++ b/core/recorder.lua @@ -14,8 +14,6 @@ local version = "Version 1.1.6" -- Original code by Bomb Bloke -- Modified to integrate with opus os -_G.requireInjector() - local Util = require('util') local multishell = _ENV.multishell @@ -151,7 +149,7 @@ end local tabId = multishell.getCurrent() _G.device.keyboard.addHotkey('control-p', function() - os.queueEvent('recorder_stop') + os.queueEvent('recorder_stop') end) local tabs = multishell.getTabs() diff --git a/core/shapes.lua b/core/shapes.lua index ac47f75..915ddd0 100644 --- a/core/shapes.lua +++ b/core/shapes.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local GPS = require('gps') local Socket = require('socket') local UI = require('ui') diff --git a/farms/help/superTreefarm b/farms/help/superTreefarm new file mode 100644 index 0000000..070830a --- /dev/null +++ b/farms/help/superTreefarm @@ -0,0 +1,35 @@ +An advanced tree farming program for use when you have gathered enough resources to fulfill the requirements (see the treefarm program for a day 1 tree farming program). + +The turtle will refuel itself from charcoal that it will make from the logs gathered (no fuel is required initially). + +Requirements +============ +* Advanced Turtle +* Diamond Pickaxe +* Standard Modem +* Block Scanner +* Entity Sensor +* Crafting Table +* Vanilla Chest +* GPS + +Setup +===== +> pastebin run uzghlbnc +> package install farms +> reboot + +The tree farm fits exactly in one chunk. It's best to have a mostly level ground around the center of the farming area as the turtle will only collect saplings that have fallen to the same level as the turtle. + +To align the turtle perfectly in one chunk, position the turtle 8 blocks diagonally from the bottom left corner. + +Place a sapling directly in front of the turtle and place all the required items into the inventory. + +To start the program, run: + +> superTreefarm +A startup file is created automatically the first time the program is run (usr/autorun/superTreefarm.lua). + +Tips +==== +At any time, you can add additional saplings into the turtle's inventory. The modem is only needed for GPS. Wireless network can be disabled via System->Networking. diff --git a/miners/simpleMiner.lua b/miners/simpleMiner.lua index c4c8d6e..55b135e 100644 --- a/miners/simpleMiner.lua +++ b/miners/simpleMiner.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Pathing = require('turtle.pathfind') local Point = require('point') local Util = require('util') diff --git a/monitor/mirror.lua b/monitor/mirror.lua index 61a710e..a6dd561 100644 --- a/monitor/mirror.lua +++ b/monitor/mirror.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Terminal = require('terminal') local Util = require('util') diff --git a/monitor/mirrorClient.lua b/monitor/mirrorClient.lua index c3c6225..8e3bb74 100644 --- a/monitor/mirrorClient.lua +++ b/monitor/mirrorClient.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Event = require('event') local Logger = require('logger') local Socket = require('socket') diff --git a/monitor/mirrorHost.lua b/monitor/mirrorHost.lua index 2be3c43..ac3da52 100644 --- a/monitor/mirrorHost.lua +++ b/monitor/mirrorHost.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Event = require('event') local Logger = require('logger') local Socket = require('socket') diff --git a/neural/etc/apps/neural-apps.db b/neural/etc/apps/neural-apps.db index 750a525..3495bee 100644 --- a/neural/etc/apps/neural-apps.db +++ b/neural/etc/apps/neural-apps.db @@ -19,9 +19,14 @@ category = "Neural", run = "neuralRemote.lua", }, - [ "Entities" ] = { - title = "Entities", + [ "Sensor" ] = { + title = "Sensor", category = "Neural", run = "Entities.lua", }, + [ "Scanner" ] = { + title = "Scanner", + category = "Neural", + run = "Scanner.lua", + }, } diff --git a/neural/neuralFight.lua b/neural/neuralFight.lua index 0fb4d77..e53d14f 100644 --- a/neural/neuralFight.lua +++ b/neural/neuralFight.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Angle = require('neural.angle') local GPS = require('gps') local Mobs = require('neural.mobs') @@ -16,20 +14,20 @@ local uid = ni.getID and ni.getID() or error('Introspection module is required') local pos = { x = 0, y = 0, z = 0 } local function findTargets() - local l = ni.sense() - table.sort(l, function(e1, e2) - return Point.distance(e1, pos) < Point.distance(e2, pos) - end) + local l = ni.sense() + table.sort(l, function(e1, e2) + return Point.distance(e1, pos) < Point.distance(e2, pos) + end) - local targets = { } - for _,v in ipairs(l) do - if v.id ~= uid and Mobs.getNames()[v.name] then - if math.abs(v.y) < 2 and Point.distance(v, pos) < 16 then -- pitch is broken - table.insert(targets, v) - end - end - end - return #targets > 0 and targets + local targets = { } + for _,v in ipairs(l) do + if v.id ~= uid and Mobs.getNames()[v.name] then + if math.abs(v.y) < 2 and Point.distance(v, pos) < 16 then -- pitch is broken + table.insert(targets, v) + end + end + end + return #targets > 0 and targets end local function shootAt(targets) @@ -69,11 +67,11 @@ while true do print('walking to starting point') local s, m = ni.goTo(pt.x, pt.y, pt.z) Util.print({ s, m }) - os.sleep(.05) - while ni.isWalking() do - os.sleep(0) - end - Util.print('done walking') + os.sleep(.05) + while ni.isWalking() do + os.sleep(0) + end + Util.print('done walking') end os.sleep(1) else diff --git a/neural/robotWars.lua b/neural/robotWars.lua index 4dc4604..422d053 100644 --- a/neural/robotWars.lua +++ b/neural/robotWars.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Angle = require('neural.angle') local ni = require('neural.interface') local Util = require('util') diff --git a/pickup/pickup.lua b/pickup/pickup.lua index 140c326..10ab7dc 100644 --- a/pickup/pickup.lua +++ b/pickup/pickup.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local Event = require('event') local ChestAdapter = require('chestAdapter18') local Point = require('point') diff --git a/storage/Crafter.lua b/storage/Crafter.lua index 0589d0e..ed9c0e0 100644 --- a/storage/Crafter.lua +++ b/storage/Crafter.lua @@ -24,8 +24,6 @@ MMMMMM ]]-- -_G.requireInjector() - local InventoryAdapter = require('inventoryAdapter') local Config = require('config') local Event = require('event') diff --git a/storage/chestManager.lua b/storage/chestManager.lua index 384a4e9..62b76eb 100644 --- a/storage/chestManager.lua +++ b/storage/chestManager.lua @@ -80,8 +80,6 @@ name/monitor_1 - specify the exact name of the peripheral ]]-- -_G.requireInjector() - local Ansi = require('ansi') local Config = require('config') local Craft = require('turtle.craft') diff --git a/storage/levelEmitter.lua b/storage/levelEmitter.lua index 424a6bd..292123b 100644 --- a/storage/levelEmitter.lua +++ b/storage/levelEmitter.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local InventoryAdapter = require('inventoryAdapter') local Config = require('config') local Event = require('event') diff --git a/storage/storageActivity.lua b/storage/storageActivity.lua index 186f977..d9a2ade 100644 --- a/storage/storageActivity.lua +++ b/storage/storageActivity.lua @@ -1,5 +1,3 @@ -_G.requireInjector() - local InventoryAdapter = require('inventoryAdapter') local Event = require('event') local UI = require('ui')