From 1f7ef4a4831483c03fbcf0ab288c9019ffcdec12 Mon Sep 17 00:00:00 2001 From: kepler155c Date: Sat, 3 Nov 2018 18:14:11 -0400 Subject: [PATCH] package management --- builder/.package | 9 + {apis => builder/apis}/base64.lua | 0 {apis => builder/apis}/builder/blocks.lua | 0 {apis => builder/apis}/builder/builder.lua | 0 {apis => builder/apis}/builder/commands.lua | 0 {apis => builder/apis}/builder/schematic.lua | 0 {apis => builder/apis}/builder/turtle.lua | 0 {apis => builder/apis}/deflatelua.lua | 0 {apps => builder}/base64dl.lua | 0 {apps => builder}/builder.lua | 0 {apps => builder}/supplier.lua | 0 core/.package | 9 + {apps => core}/Appstore.lua | 0 {apps => core}/Devices.lua | 0 {apps => core}/Events.lua | 0 {apps => core}/Music.lua | 0 {apps => core}/Script.lua | 0 {apps => core}/Turtles.lua | 0 {apis => core/apis}/chestAdapter.lua | 0 {apis => core/apis}/chestAdapter18.lua | 0 {apis => core/apis}/controllerAdapter.lua | 0 {apis => core/apis}/inventoryAdapter.lua | 0 {apis => core/apis}/itemDB.lua | 0 {apis => core/apis}/meAdapter.lua | 0 {apis => core/apis}/meAdapter18.lua | 0 {apis => core/apis}/message.lua | 0 {apis => core/apis}/nameDB.lua | 2 +- {apis => core/apis}/refinedAdapter.lua | 0 {apis => core/apis}/tableDB.lua | 0 {apis => core/apis}/turtle/craft.lua | 2 +- {apis => core/apis}/turtle/crafting.lua | 0 {apis => core/apis}/turtle/home.lua | 0 {apis => core/apis}/turtle/level.lua | 0 {apps => core}/debug.lua | 0 {apps => core}/edit.lua | 0 {etc => core/etc}/apps/opus-apps.db | 0 .../etc}/names/appliedenergistics2.json | 0 {etc => core/etc}/names/computercraft.json | 0 {etc => core/etc}/names/enderio.json | 0 .../etc}/names/exnihiloadscensio.json | 0 {etc => core/etc}/names/extrautils2.json | 0 {etc => core/etc}/names/ironchest.json | 0 {etc => core/etc}/names/minecraft.json | 0 {etc => core/etc}/names/rftools.json | 0 {etc => core/etc}/names/storagedrawers.json | 0 {etc => core/etc}/names/tconstruct.json | 0 {etc => core/etc}/recipes/minecraft.db | 0 {etc => core/etc}/scripts/abort | 0 {etc => core/etc}/scripts/follow | 0 {etc => core/etc}/scripts/goHome | 0 {etc => core/etc}/scripts/moveTo | 0 {etc => core/etc}/scripts/obsidian | 0 {etc => core/etc}/scripts/reboot | 0 {etc => core/etc}/scripts/setHome | 0 {etc => core/etc}/scripts/shutdown | 0 {etc => core/etc}/scripts/summon | 0 {apps => core}/logMonitor.lua | 0 {apps => core}/mirror.lua | 0 {apps => core}/mirrorClient.lua | 0 {apps => core}/mirrorHost.lua | 0 {apps => core}/mwm.lua | 0 {apps => core}/namedb.lua | 0 {apps => core}/persist.lua | 0 {apps => core}/recorder.lua | 0 {apps => core}/shapes.lua | 0 {apps => core}/t.lua | 0 {apps => core}/termShare.lua | 0 {apps => core}/trace.lua | 0 farms/.package | 9 + {apps => farms}/cows.lua | 0 {apps => farms}/farm.lua | 0 {apps => farms}/treefarm.lua | 0 forestry/.package | 9 + forestry/alveary.lua | 106 +++++++++++ forestry/beeInfo.lua | 176 ++++++++++++++++++ forestry/filing.lua | 34 ++++ forestry/serums.lua | 34 ++++ glasses/.package | 9 + {apis => glasses/apis}/shatter.lua | 1 - {apps => glasses}/glassesDriver.lua | 0 milo/.package | 7 +- milo/apis/turtle/craft.lua | 2 +- miners/.package | 9 + {apps => miners}/scanningMiner.lua | 0 {apps => miners}/simpleMiner.lua | 0 neural/.package | 9 + neural/apis/neural/angle.lua | 11 ++ neural/apis/neural/interface.lua | 139 ++++++++++++++ neural/apis/neural/mobs.lua | 22 +++ neural/autorun/6.neural.lua | 24 +++ neural/etc/apps/neural-apps.db | 22 +++ neural/mobfollow.lua | 49 +++++ neural/neuralFight.lua | 98 ++++++++++ neural/neuralFly.lua | 78 ++++++++ neural/neuralRecorder.lua | 88 +++++++++ neural/neuralRemote.lua | 56 ++++++ neural/neuralReplay.lua | 52 ++++++ neural/neuralSword.lua | 28 +++ neural/robotWars.lua | 83 +++++++++ neural/shootMob.lua | 31 +++ neural/shootingGallery.lua | 48 +++++ pickup/.package | 9 + {apps => pickup}/pickup.lua | 0 {apps => pickup}/pickupRemote.lua | 0 recipeBook/.package | 9 + .../etc}/recipes/appliedenergistics2.db | 0 {etc => recipeBook/etc}/recipes/botania.db | 0 .../etc}/recipes/computercraft.db | 0 {etc => recipeBook/etc}/recipes/enderio.db | 0 {etc => recipeBook/etc}/recipes/exnihilo.db | 0 .../etc}/recipes/extrautils2.db | 0 {etc => recipeBook/etc}/recipes/ironchest.db | 0 {etc => recipeBook/etc}/recipes/mekanism.db | 0 .../etc}/recipes/mysticalagriculture.db | 0 {etc => recipeBook/etc}/recipes/rftools.db | 0 .../etc}/recipes/skyblockinfinity.db | 0 .../etc}/recipes/storagedrawers.db | 0 {etc => recipeBook/etc}/recipes/tconstruct.db | 0 {apps => recipeBook}/recipeBook.lua | 0 storageManager/.package | 9 + {apps => storageManager}/Crafter.lua | 0 {apps => storageManager}/chestManager.lua | 0 {apps => storageManager}/levelEmitter.lua | 0 {apps => storageManager}/storageActivity.lua | 0 124 files changed, 1274 insertions(+), 9 deletions(-) create mode 100644 builder/.package rename {apis => builder/apis}/base64.lua (100%) rename {apis => builder/apis}/builder/blocks.lua (100%) rename {apis => builder/apis}/builder/builder.lua (100%) rename {apis => builder/apis}/builder/commands.lua (100%) rename {apis => builder/apis}/builder/schematic.lua (100%) rename {apis => builder/apis}/builder/turtle.lua (100%) rename {apis => builder/apis}/deflatelua.lua (100%) rename {apps => builder}/base64dl.lua (100%) rename {apps => builder}/builder.lua (100%) rename {apps => builder}/supplier.lua (100%) create mode 100644 core/.package rename {apps => core}/Appstore.lua (100%) rename {apps => core}/Devices.lua (100%) rename {apps => core}/Events.lua (100%) rename {apps => core}/Music.lua (100%) rename {apps => core}/Script.lua (100%) rename {apps => core}/Turtles.lua (100%) rename {apis => core/apis}/chestAdapter.lua (100%) rename {apis => core/apis}/chestAdapter18.lua (100%) rename {apis => core/apis}/controllerAdapter.lua (100%) rename {apis => core/apis}/inventoryAdapter.lua (100%) rename {apis => core/apis}/itemDB.lua (100%) rename {apis => core/apis}/meAdapter.lua (100%) rename {apis => core/apis}/meAdapter18.lua (100%) rename {apis => core/apis}/message.lua (100%) rename {apis => core/apis}/nameDB.lua (95%) rename {apis => core/apis}/refinedAdapter.lua (100%) rename {apis => core/apis}/tableDB.lua (100%) rename {apis => core/apis}/turtle/craft.lua (99%) rename {apis => core/apis}/turtle/crafting.lua (100%) rename {apis => core/apis}/turtle/home.lua (100%) rename {apis => core/apis}/turtle/level.lua (100%) rename {apps => core}/debug.lua (100%) rename {apps => core}/edit.lua (100%) rename {etc => core/etc}/apps/opus-apps.db (100%) rename {etc => core/etc}/names/appliedenergistics2.json (100%) rename {etc => core/etc}/names/computercraft.json (100%) rename {etc => core/etc}/names/enderio.json (100%) rename {etc => core/etc}/names/exnihiloadscensio.json (100%) rename {etc => core/etc}/names/extrautils2.json (100%) rename {etc => core/etc}/names/ironchest.json (100%) rename {etc => core/etc}/names/minecraft.json (100%) rename {etc => core/etc}/names/rftools.json (100%) rename {etc => core/etc}/names/storagedrawers.json (100%) rename {etc => core/etc}/names/tconstruct.json (100%) rename {etc => core/etc}/recipes/minecraft.db (100%) rename {etc => core/etc}/scripts/abort (100%) rename {etc => core/etc}/scripts/follow (100%) rename {etc => core/etc}/scripts/goHome (100%) rename {etc => core/etc}/scripts/moveTo (100%) rename {etc => core/etc}/scripts/obsidian (100%) rename {etc => core/etc}/scripts/reboot (100%) rename {etc => core/etc}/scripts/setHome (100%) rename {etc => core/etc}/scripts/shutdown (100%) rename {etc => core/etc}/scripts/summon (100%) rename {apps => core}/logMonitor.lua (100%) rename {apps => core}/mirror.lua (100%) rename {apps => core}/mirrorClient.lua (100%) rename {apps => core}/mirrorHost.lua (100%) rename {apps => core}/mwm.lua (100%) rename {apps => core}/namedb.lua (100%) rename {apps => core}/persist.lua (100%) rename {apps => core}/recorder.lua (100%) rename {apps => core}/shapes.lua (100%) rename {apps => core}/t.lua (100%) rename {apps => core}/termShare.lua (100%) rename {apps => core}/trace.lua (100%) create mode 100644 farms/.package rename {apps => farms}/cows.lua (100%) rename {apps => farms}/farm.lua (100%) rename {apps => farms}/treefarm.lua (100%) create mode 100644 forestry/.package create mode 100644 forestry/alveary.lua create mode 100644 forestry/beeInfo.lua create mode 100644 forestry/filing.lua create mode 100644 forestry/serums.lua create mode 100644 glasses/.package rename {apis => glasses/apis}/shatter.lua (99%) rename {apps => glasses}/glassesDriver.lua (100%) create mode 100644 miners/.package rename {apps => miners}/scanningMiner.lua (100%) rename {apps => miners}/simpleMiner.lua (100%) create mode 100644 neural/.package create mode 100644 neural/apis/neural/angle.lua create mode 100644 neural/apis/neural/interface.lua create mode 100644 neural/apis/neural/mobs.lua create mode 100644 neural/autorun/6.neural.lua create mode 100644 neural/etc/apps/neural-apps.db create mode 100644 neural/mobfollow.lua create mode 100644 neural/neuralFight.lua create mode 100644 neural/neuralFly.lua create mode 100644 neural/neuralRecorder.lua create mode 100644 neural/neuralRemote.lua create mode 100644 neural/neuralReplay.lua create mode 100644 neural/neuralSword.lua create mode 100644 neural/robotWars.lua create mode 100644 neural/shootMob.lua create mode 100644 neural/shootingGallery.lua create mode 100644 pickup/.package rename {apps => pickup}/pickup.lua (100%) rename {apps => pickup}/pickupRemote.lua (100%) create mode 100644 recipeBook/.package rename {etc => recipeBook/etc}/recipes/appliedenergistics2.db (100%) rename {etc => recipeBook/etc}/recipes/botania.db (100%) rename {etc => recipeBook/etc}/recipes/computercraft.db (100%) rename {etc => recipeBook/etc}/recipes/enderio.db (100%) rename {etc => recipeBook/etc}/recipes/exnihilo.db (100%) rename {etc => recipeBook/etc}/recipes/extrautils2.db (100%) rename {etc => recipeBook/etc}/recipes/ironchest.db (100%) rename {etc => recipeBook/etc}/recipes/mekanism.db (100%) rename {etc => recipeBook/etc}/recipes/mysticalagriculture.db (100%) rename {etc => recipeBook/etc}/recipes/rftools.db (100%) rename {etc => recipeBook/etc}/recipes/skyblockinfinity.db (100%) rename {etc => recipeBook/etc}/recipes/storagedrawers.db (100%) rename {etc => recipeBook/etc}/recipes/tconstruct.db (100%) rename {apps => recipeBook}/recipeBook.lua (100%) create mode 100644 storageManager/.package rename {apps => storageManager}/Crafter.lua (100%) rename {apps => storageManager}/chestManager.lua (100%) rename {apps => storageManager}/levelEmitter.lua (100%) rename {apps => storageManager}/storageActivity.lua (100%) diff --git a/builder/.package b/builder/.package new file mode 100644 index 0000000..308669a --- /dev/null +++ b/builder/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Schematic Builder', + repository = 'kepler155c/opus-apps/develop1.8/builder', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/apis/base64.lua b/builder/apis/base64.lua similarity index 100% rename from apis/base64.lua rename to builder/apis/base64.lua diff --git a/apis/builder/blocks.lua b/builder/apis/builder/blocks.lua similarity index 100% rename from apis/builder/blocks.lua rename to builder/apis/builder/blocks.lua diff --git a/apis/builder/builder.lua b/builder/apis/builder/builder.lua similarity index 100% rename from apis/builder/builder.lua rename to builder/apis/builder/builder.lua diff --git a/apis/builder/commands.lua b/builder/apis/builder/commands.lua similarity index 100% rename from apis/builder/commands.lua rename to builder/apis/builder/commands.lua diff --git a/apis/builder/schematic.lua b/builder/apis/builder/schematic.lua similarity index 100% rename from apis/builder/schematic.lua rename to builder/apis/builder/schematic.lua diff --git a/apis/builder/turtle.lua b/builder/apis/builder/turtle.lua similarity index 100% rename from apis/builder/turtle.lua rename to builder/apis/builder/turtle.lua diff --git a/apis/deflatelua.lua b/builder/apis/deflatelua.lua similarity index 100% rename from apis/deflatelua.lua rename to builder/apis/deflatelua.lua diff --git a/apps/base64dl.lua b/builder/base64dl.lua similarity index 100% rename from apps/base64dl.lua rename to builder/base64dl.lua diff --git a/apps/builder.lua b/builder/builder.lua similarity index 100% rename from apps/builder.lua rename to builder/builder.lua diff --git a/apps/supplier.lua b/builder/supplier.lua similarity index 100% rename from apps/supplier.lua rename to builder/supplier.lua diff --git a/core/.package b/core/.package new file mode 100644 index 0000000..5ad65a1 --- /dev/null +++ b/core/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Core apps and apis', + repository = 'kepler155c/opus-apps/develop1.8/core', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/apps/Appstore.lua b/core/Appstore.lua similarity index 100% rename from apps/Appstore.lua rename to core/Appstore.lua diff --git a/apps/Devices.lua b/core/Devices.lua similarity index 100% rename from apps/Devices.lua rename to core/Devices.lua diff --git a/apps/Events.lua b/core/Events.lua similarity index 100% rename from apps/Events.lua rename to core/Events.lua diff --git a/apps/Music.lua b/core/Music.lua similarity index 100% rename from apps/Music.lua rename to core/Music.lua diff --git a/apps/Script.lua b/core/Script.lua similarity index 100% rename from apps/Script.lua rename to core/Script.lua diff --git a/apps/Turtles.lua b/core/Turtles.lua similarity index 100% rename from apps/Turtles.lua rename to core/Turtles.lua diff --git a/apis/chestAdapter.lua b/core/apis/chestAdapter.lua similarity index 100% rename from apis/chestAdapter.lua rename to core/apis/chestAdapter.lua diff --git a/apis/chestAdapter18.lua b/core/apis/chestAdapter18.lua similarity index 100% rename from apis/chestAdapter18.lua rename to core/apis/chestAdapter18.lua diff --git a/apis/controllerAdapter.lua b/core/apis/controllerAdapter.lua similarity index 100% rename from apis/controllerAdapter.lua rename to core/apis/controllerAdapter.lua diff --git a/apis/inventoryAdapter.lua b/core/apis/inventoryAdapter.lua similarity index 100% rename from apis/inventoryAdapter.lua rename to core/apis/inventoryAdapter.lua diff --git a/apis/itemDB.lua b/core/apis/itemDB.lua similarity index 100% rename from apis/itemDB.lua rename to core/apis/itemDB.lua diff --git a/apis/meAdapter.lua b/core/apis/meAdapter.lua similarity index 100% rename from apis/meAdapter.lua rename to core/apis/meAdapter.lua diff --git a/apis/meAdapter18.lua b/core/apis/meAdapter18.lua similarity index 100% rename from apis/meAdapter18.lua rename to core/apis/meAdapter18.lua diff --git a/apis/message.lua b/core/apis/message.lua similarity index 100% rename from apis/message.lua rename to core/apis/message.lua diff --git a/apis/nameDB.lua b/core/apis/nameDB.lua similarity index 95% rename from apis/nameDB.lua rename to core/apis/nameDB.lua index f21851e..c068c14 100644 --- a/apis/nameDB.lua +++ b/core/apis/nameDB.lua @@ -3,7 +3,7 @@ local TableDB = require('tableDB') local fs = _G.fs -local NAME_DIR = '/usr/etc/names' +local NAME_DIR = '/packages/core/etc/names' local nameDB = TableDB() diff --git a/apis/refinedAdapter.lua b/core/apis/refinedAdapter.lua similarity index 100% rename from apis/refinedAdapter.lua rename to core/apis/refinedAdapter.lua diff --git a/apis/tableDB.lua b/core/apis/tableDB.lua similarity index 100% rename from apis/tableDB.lua rename to core/apis/tableDB.lua diff --git a/apis/turtle/craft.lua b/core/apis/turtle/craft.lua similarity index 99% rename from apis/turtle/craft.lua rename to core/apis/turtle/craft.lua index 1b7b676..0d5c017 100644 --- a/apis/turtle/craft.lua +++ b/core/apis/turtle/craft.lua @@ -4,7 +4,7 @@ local Util = require('util') local fs = _G.fs local turtle = _G.turtle -local RECIPES_DIR = 'usr/etc/recipes' +local RECIPES_DIR = 'packages/core/etc/recipes' local USER_RECIPES = 'usr/config/recipes.db' local Craft = { } diff --git a/apis/turtle/crafting.lua b/core/apis/turtle/crafting.lua similarity index 100% rename from apis/turtle/crafting.lua rename to core/apis/turtle/crafting.lua diff --git a/apis/turtle/home.lua b/core/apis/turtle/home.lua similarity index 100% rename from apis/turtle/home.lua rename to core/apis/turtle/home.lua diff --git a/apis/turtle/level.lua b/core/apis/turtle/level.lua similarity index 100% rename from apis/turtle/level.lua rename to core/apis/turtle/level.lua diff --git a/apps/debug.lua b/core/debug.lua similarity index 100% rename from apps/debug.lua rename to core/debug.lua diff --git a/apps/edit.lua b/core/edit.lua similarity index 100% rename from apps/edit.lua rename to core/edit.lua diff --git a/etc/apps/opus-apps.db b/core/etc/apps/opus-apps.db similarity index 100% rename from etc/apps/opus-apps.db rename to core/etc/apps/opus-apps.db diff --git a/etc/names/appliedenergistics2.json b/core/etc/names/appliedenergistics2.json similarity index 100% rename from etc/names/appliedenergistics2.json rename to core/etc/names/appliedenergistics2.json diff --git a/etc/names/computercraft.json b/core/etc/names/computercraft.json similarity index 100% rename from etc/names/computercraft.json rename to core/etc/names/computercraft.json diff --git a/etc/names/enderio.json b/core/etc/names/enderio.json similarity index 100% rename from etc/names/enderio.json rename to core/etc/names/enderio.json diff --git a/etc/names/exnihiloadscensio.json b/core/etc/names/exnihiloadscensio.json similarity index 100% rename from etc/names/exnihiloadscensio.json rename to core/etc/names/exnihiloadscensio.json diff --git a/etc/names/extrautils2.json b/core/etc/names/extrautils2.json similarity index 100% rename from etc/names/extrautils2.json rename to core/etc/names/extrautils2.json diff --git a/etc/names/ironchest.json b/core/etc/names/ironchest.json similarity index 100% rename from etc/names/ironchest.json rename to core/etc/names/ironchest.json diff --git a/etc/names/minecraft.json b/core/etc/names/minecraft.json similarity index 100% rename from etc/names/minecraft.json rename to core/etc/names/minecraft.json diff --git a/etc/names/rftools.json b/core/etc/names/rftools.json similarity index 100% rename from etc/names/rftools.json rename to core/etc/names/rftools.json diff --git a/etc/names/storagedrawers.json b/core/etc/names/storagedrawers.json similarity index 100% rename from etc/names/storagedrawers.json rename to core/etc/names/storagedrawers.json diff --git a/etc/names/tconstruct.json b/core/etc/names/tconstruct.json similarity index 100% rename from etc/names/tconstruct.json rename to core/etc/names/tconstruct.json diff --git a/etc/recipes/minecraft.db b/core/etc/recipes/minecraft.db similarity index 100% rename from etc/recipes/minecraft.db rename to core/etc/recipes/minecraft.db diff --git a/etc/scripts/abort b/core/etc/scripts/abort similarity index 100% rename from etc/scripts/abort rename to core/etc/scripts/abort diff --git a/etc/scripts/follow b/core/etc/scripts/follow similarity index 100% rename from etc/scripts/follow rename to core/etc/scripts/follow diff --git a/etc/scripts/goHome b/core/etc/scripts/goHome similarity index 100% rename from etc/scripts/goHome rename to core/etc/scripts/goHome diff --git a/etc/scripts/moveTo b/core/etc/scripts/moveTo similarity index 100% rename from etc/scripts/moveTo rename to core/etc/scripts/moveTo diff --git a/etc/scripts/obsidian b/core/etc/scripts/obsidian similarity index 100% rename from etc/scripts/obsidian rename to core/etc/scripts/obsidian diff --git a/etc/scripts/reboot b/core/etc/scripts/reboot similarity index 100% rename from etc/scripts/reboot rename to core/etc/scripts/reboot diff --git a/etc/scripts/setHome b/core/etc/scripts/setHome similarity index 100% rename from etc/scripts/setHome rename to core/etc/scripts/setHome diff --git a/etc/scripts/shutdown b/core/etc/scripts/shutdown similarity index 100% rename from etc/scripts/shutdown rename to core/etc/scripts/shutdown diff --git a/etc/scripts/summon b/core/etc/scripts/summon similarity index 100% rename from etc/scripts/summon rename to core/etc/scripts/summon diff --git a/apps/logMonitor.lua b/core/logMonitor.lua similarity index 100% rename from apps/logMonitor.lua rename to core/logMonitor.lua diff --git a/apps/mirror.lua b/core/mirror.lua similarity index 100% rename from apps/mirror.lua rename to core/mirror.lua diff --git a/apps/mirrorClient.lua b/core/mirrorClient.lua similarity index 100% rename from apps/mirrorClient.lua rename to core/mirrorClient.lua diff --git a/apps/mirrorHost.lua b/core/mirrorHost.lua similarity index 100% rename from apps/mirrorHost.lua rename to core/mirrorHost.lua diff --git a/apps/mwm.lua b/core/mwm.lua similarity index 100% rename from apps/mwm.lua rename to core/mwm.lua diff --git a/apps/namedb.lua b/core/namedb.lua similarity index 100% rename from apps/namedb.lua rename to core/namedb.lua diff --git a/apps/persist.lua b/core/persist.lua similarity index 100% rename from apps/persist.lua rename to core/persist.lua diff --git a/apps/recorder.lua b/core/recorder.lua similarity index 100% rename from apps/recorder.lua rename to core/recorder.lua diff --git a/apps/shapes.lua b/core/shapes.lua similarity index 100% rename from apps/shapes.lua rename to core/shapes.lua diff --git a/apps/t.lua b/core/t.lua similarity index 100% rename from apps/t.lua rename to core/t.lua diff --git a/apps/termShare.lua b/core/termShare.lua similarity index 100% rename from apps/termShare.lua rename to core/termShare.lua diff --git a/apps/trace.lua b/core/trace.lua similarity index 100% rename from apps/trace.lua rename to core/trace.lua diff --git a/farms/.package b/farms/.package new file mode 100644 index 0000000..8fd8d66 --- /dev/null +++ b/farms/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Programs for farming resources', + repository = 'kepler155c/opus-apps/develop1.8/farms', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/apps/cows.lua b/farms/cows.lua similarity index 100% rename from apps/cows.lua rename to farms/cows.lua diff --git a/apps/farm.lua b/farms/farm.lua similarity index 100% rename from apps/farm.lua rename to farms/farm.lua diff --git a/apps/treefarm.lua b/farms/treefarm.lua similarity index 100% rename from apps/treefarm.lua rename to farms/treefarm.lua diff --git a/forestry/.package b/forestry/.package new file mode 100644 index 0000000..efff75c --- /dev/null +++ b/forestry/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Forestry mod applications', + repository = 'kepler155c/opus-apps/develop1.8/forestry', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/forestry/alveary.lua b/forestry/alveary.lua new file mode 100644 index 0000000..b25a701 --- /dev/null +++ b/forestry/alveary.lua @@ -0,0 +1,106 @@ +_G.requireInjector(_ENV) + +local Event = require('event') +local UI = require('ui') + +redstone.setBundledOutput('bottom', 0) + +local function regulate(humidity, heat) + local heater = heat == 'Up 1' or heat == 'Both 1' + local lava = heat == 'Both 1' + local water = humidity == 'Up 1' + + local c = colors.combine( + lava and colors.green or 0, + heater and colors.red or 0, + water and colors.blue or 0) + + redstone.setBundledOutput('bottom', c) +end + +function create(alveary, terminal) + local window = UI.Window({ + alveary = alveary, + parent = UI.Device({ + device = terminal, + textScale = 0.5, + backgroundColor = colors.green + }), + progressBar = UI.ProgressBar({ + y = 3, + x = 2, ex = -2, + }), +--[[ + heater = UI.Button { + x = 2, y = -2, width = 7, + text = 'heater', + }, + humidifier = UI.Button { + x = 2, y = -4, + text = 'Humidify', + }, + dehumidifier = UI.Button { + x = 2, y = -6, + text = 'Dehumidify', + }, +--]] + }) + + function window:draw() + + local queen = self.alveary.getQueen() + if not queen then + self:clear(colors.black) + regulate() + else + self.backgroundColor = self.alveary.canBreed() and colors.green or colors.red + self:clear() + local percDone = 100 - math.floor(queen.health * 100 / queen.maxHealth) + if not queen.canSpawn then + percDone = 0 + end + self.progressBar.value = percDone + --self.progressBar:draw() + for _,c in pairs(self.children) do + c:draw() + end + + self:centeredWrite(2, queen.displayName) + self:centeredWrite(4, percDone .. '%') + self:write(1, 6, 'Generation: ' .. queen.generation) + self:setCursorPos(1, 7) + if queen.active then + regulate( + queen.active.humidityTolerance, + queen.active.temperatureTolerance) + + if queen.active.flowerProvider ~= 'Flowers' then + self:print(queen.active.flowerProvider .. '\n') + end + if queen.active.effect ~= 'None' then + self:print('Effect: ' .. queen.active.effect) + end + else + self:print('(pure)') + end + end + end + + return window +end + +local pages = { + create(device.items, device.monitor), + --create(device.items_6, device.monitor_22), + --create(device.items_5, device.monitor_21), +} + +Event.onInterval(5, function() + for _,v in pairs(pages) do + v:draw() + v:sync() + end +end) + +UI:pullEvents() + diff --git a/forestry/beeInfo.lua b/forestry/beeInfo.lua new file mode 100644 index 0000000..7a4fdfd --- /dev/null +++ b/forestry/beeInfo.lua @@ -0,0 +1,176 @@ +_G.requireInjector(_ENV) + +local Event = require('event') +local UI = require('ui') +local Util = require('util') + +local chest = peripheral.wrap('bottom') + +local data +local monitor = UI.Device({ + deviceType = 'monitor', + textScale = .5 +}) + +UI:setDefaultDevice(monitor) + +local breedingPage = UI.Page({ + titleBar = UI.TitleBar(), + grid = UI.Grid({ + columns = { + { heading = ' ', key = 'chance' }, + { heading = 'Princess', key = 'princess', }, + { heading = 'Drone', key = 'drone' }, + { heading = 'Result', key = 'result', }, + }, + y = 2, ey = -8, + sortColumn = 'result', + autospace = true + }), + specialConditions = UI.Window({ + backgroundColor = colors.red, + y = -7, + height = 2 + }), + buttons = UI.Window({ + y = monitor.height - 4, + width = monitor.width, + height = 5, + backgroundColor = colors.gray, + prevButton = UI.Button({ + event = 'previous', + x = 2, + y = 2, + height = 3, + width = 5, + text = ' < ' + }), + resetButton = UI.Button({ + event = 'clear', + x = 8, + y = 2, + height = 3, + width = monitor.width - 14, + text = 'Clear' + }), + nextButton = UI.Button({ + event = 'next', + x = monitor.width - 5, + y = 2, + height = 3, + width = 5, + text = ' > ' + }) + }) +}) + +function breedingPage:getBreedingData() + self.grid.values = { } + local stacks = chest.getAllStacks(false) + local stack = stacks[1] + self.titleBar.title = stack.individual.displayName + if stack.individual.active then + end + for _,d in pairs(data) do + if d.allele1 == stack.individual.displayName or + d.allele2 == stack.individual.displayName then + local ind = '' + if d.specialConditions then + ind = '*' + end + table.insert(self.grid.values, { + princess = d.allele1 .. ind, + drone = d.allele2, + result = d.result, + chance = d.chance .. '%', + specialConditions = d.specialConditions + }) + end + end + self.grid.index = 1 + self.grid:adjustWidth() + self.grid:update() + self:draw() + self:sync() +end + +function breedingPage.specialConditions:draw() + local selected = self.parent.grid:getSelected() + if selected and selected.specialConditions then + local sc = '' + if selected.specialConditions then + for _,v in ipairs(selected.specialConditions) do + if sc ~= '' then + sc = sc .. ', ' + end + sc = sc .. v + end + end + self:clear() + self:setCursorPos(2, 1) + self:print(sc) + else + self:clear(colors.red) + end +end + +function breedingPage.grid:draw() + UI.Grid.draw(self) + self.parent.specialConditions:draw() +end + +function breedingPage:eventHandler(event) + if event.type == 'next' then + self.grid:setPage(self.grid:getPage() + 1) + elseif event.type == 'previous' then + self.grid:setPage(self.grid:getPage() - 1) + elseif event.type == 'clear' then + self.grid:setTable({}) + self.grid:draw() + elseif event.type == 'grid_focus_row' then + self.specialConditions:draw() + else + return UI.Page.eventHandler(self, event) + end + return false +end + +Event.on('turtle_inventory', function() + local slot = turtle.selectSlotWithQuantity(1) + + if slot then + turtle.dropDown() + breedingPage:getBreedingData() + turtle.suckDown() + turtle.drop() + end + +end) + +if not fs.exists('.bee.data') then + local p = peripheral.wrap("back") + local data = p.getBeeBreedingData() + local t = { } + for _,d in pairs(data) do + d = Util.shallowCopy(d) + if type(d.specialConditions) == 'string' then + if d.specialConditions == '[]' then + d.specialConditions = '' + end + end + if #d.specialConditions == 0 then + d.specialConditions = nil + else + d.specialConditions = Util.shallowCopy(d.specialConditions) + end + table.insert(t, d) + end + Util.writeTable('.bee.data', t) +else + data = Util.readTable('.bee.data') +end + +UI:setPage(breedingPage) + +UI:pullEvents() + diff --git a/forestry/filing.lua b/forestry/filing.lua new file mode 100644 index 0000000..17423fd --- /dev/null +++ b/forestry/filing.lua @@ -0,0 +1,34 @@ +_G.requireInjector(_ENV) + +local Event = require('event') +local Util = require('util') + +local chest = peripheral.wrap('top') + +function getOpenChestSlot(stacks) + for i = 1, chest.getInventorySize() do + if not stacks[i] then + return i + end + end +end + +Event.on('turtle_inventory', function() + for i = 1, 16 do + if turtle.getItemCount(i) > 0 then + chest.pullItem('down', i, 1) + os.sleep(.5) + local stacks = chest.getAllStacks(false) + local _,slot = Util.find(stacks, 'qty', 2) + if slot then + print('Duplicate') + chest.pushItem('north', slot, 1) + else + print('New Serum') + end + end + end +end) + +Event.pullEvents() + diff --git a/forestry/serums.lua b/forestry/serums.lua new file mode 100644 index 0000000..7eb3e1e --- /dev/null +++ b/forestry/serums.lua @@ -0,0 +1,34 @@ +_G.requireInjector(_ENV) + +local Event = require('event') +local Util = require('util') + +local chest = peripheral.wrap('top') + +function getOpenChestSlot(stacks) + for i = 1, chest.getInventorySize() do + if not stacks[i] then + return i + end + end +end + +Event.on('turtle_inventory', function() + for i = 1, 16 do + if turtle.getItemCount(i) > 0 then + local stacks = chest.getAllStacks(false) + local slot = getOpenChestSlot(stacks) + chest.pullItemIntoSlot('down', i, 1, slot) + local serum = chest.getStackInSlot(slot) + if Util.find(stacks, 'nbt_hash', serum.nbt_hash) then + print('Duplicate') + chest.pushItem('north', slot, 1) + else + print('New Serum') + end + end + end + +end) + +Event.pullEvents() diff --git a/glasses/.package b/glasses/.package new file mode 100644 index 0000000..00581da --- /dev/null +++ b/glasses/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Plethora overlay glasses support', + repository = 'kepler155c/opus-apps/develop1.8/glasses', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/apis/shatter.lua b/glasses/apis/shatter.lua similarity index 99% rename from apis/shatter.lua rename to glasses/apis/shatter.lua index ed741dc..6c58810 100644 --- a/apis/shatter.lua +++ b/glasses/apis/shatter.lua @@ -440,7 +440,6 @@ out.setTextScale = function(scale) end if textScale ~= scale then local factor = textScale/scale -debug({ scale, textScale, factor, tx*factor, ty*factor }) textScale = scale resize(tx*factor, ty*factor) end diff --git a/apps/glassesDriver.lua b/glasses/glassesDriver.lua similarity index 100% rename from apps/glassesDriver.lua rename to glasses/glassesDriver.lua diff --git a/milo/.package b/milo/.package index 737e1e0..62e9262 100644 --- a/milo/.package +++ b/milo/.package @@ -3,10 +3,7 @@ 'opus-develop-1.8', }, title = 'Inventory manager for Opus OS', - description = [[ -Unstable Branch -]], + repository = 'kepler155c/opus-apps/develop1.8/milo', + description = [[ ... ]], licence = 'MIT', - --location = '', - --mount = 'packages/opus-neural gitfs kepler155c/opus-neural/master', } diff --git a/milo/apis/turtle/craft.lua b/milo/apis/turtle/craft.lua index 22b9481..d05dd4a 100644 --- a/milo/apis/turtle/craft.lua +++ b/milo/apis/turtle/craft.lua @@ -11,7 +11,7 @@ local Craft = { STATUS_ERROR = 'error', STATUS_SUCCESS = 'success', - RECIPES_DIR = 'usr/etc/recipes', + RECIPES_DIR = 'packages/core/etc/recipes', USER_RECIPES = 'usr/config/recipes.db', MACHINE_LOOKUP = 'usr/config/machine_crafting.db', } diff --git a/miners/.package b/miners/.package new file mode 100644 index 0000000..b872f56 --- /dev/null +++ b/miners/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Turtle mining programs', + repository = 'kepler155c/opus-apps/develop1.8/miners', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/apps/scanningMiner.lua b/miners/scanningMiner.lua similarity index 100% rename from apps/scanningMiner.lua rename to miners/scanningMiner.lua diff --git a/apps/simpleMiner.lua b/miners/simpleMiner.lua similarity index 100% rename from apps/simpleMiner.lua rename to miners/simpleMiner.lua diff --git a/neural/.package b/neural/.package new file mode 100644 index 0000000..6af5b15 --- /dev/null +++ b/neural/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Programs for the neural interface', + repository = 'kepler155c/opus-apps/develop1.8/neural', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/neural/apis/neural/angle.lua b/neural/apis/neural/angle.lua new file mode 100644 index 0000000..f378a31 --- /dev/null +++ b/neural/apis/neural/angle.lua @@ -0,0 +1,11 @@ +local Angle = { } + +function Angle.towards(x, y, z) + return math.deg(math.atan2(-x, z)), 0 +end + +function Angle.away(x, y, z) + return math.deg(math.atan2(x, -z)), 0 +end + +return Angle diff --git a/neural/apis/neural/interface.lua b/neural/apis/neural/interface.lua new file mode 100644 index 0000000..ea36793 --- /dev/null +++ b/neural/apis/neural/interface.lua @@ -0,0 +1,139 @@ +local Interface = { } + +local Angle = require('neural.angle') +local Util = require('util') + +local device = _G.device +local os = _G.os + +local ni = device.neuralInterface or { } +for k,v in pairs(ni) do + Interface[k] = v +end + +local function yap(pt) + local x, y, z = pt.x, pt.y + 1, pt.z + local pitch = -math.atan2(y, math.atan2(-(x - .5), z - .5)) + local yaw = math.deg(math.atan2(-(x - .5), z - .5)) + + return math.deg(yaw), math.deg(pitch) +end + +function Interface.launchTo(pt, strength) + local yaw = math.deg(math.atan2(pt.x, -pt.z)) + if not strength then + local dist = math.sqrt( + math.pow(pt.x, 2) + + math.pow(pt.z, 2)) + strength = math.sqrt(math.max(32, dist) / 3) + debug(strength) + end + Interface.launch(yaw, 225, strength or 1) +end + +function Interface.dropArmor() + for i = 3, 5 do + Interface.unequip(i) + end +end + +function Interface.walkTo(pt) + local s, m = ni.walk(pt.x, pt.y, pt.z) + if not s then + _G.printError(m) + end + os.sleep(.05) + while ni.isWalking() do + os.sleep(0) + end +end + +-- flatten equipment functions +function Interface.getEquipmentList() + local l = Interface.getEquipment and Interface.getEquipment().list() or { } + + for k, v in pairs(l) do + v.slot = k + end + + return l +end + +function Interface.equip(slot) + return Interface.getEquipment and Interface.getEquipment().suck(slot) or 0 +end + +function Interface.unequip(slot) + return Interface.getEquipment and Interface.getEquipment().drop(slot) +end + +function Interface.getUniqueNames() + local t = { } + for _,v in pairs(Interface.sense()) do + t[v.name] = v.name + end + return Util.transpose(t) +end + +function Interface.lookAt(pt) + local yaw, pitch = Angle.towards(pt.x - .5, pt.y + 1, pt.z - .5) + return Interface.look(yaw, pitch) +end + +function Interface.shootAt(entity, strength) + Interface.lookAt(entity) + return Interface.shoot(strength or 1) +end + +function Interface.shootAt2(entity, strength) + local x, z = entity.x - .5, entity.z - .5 + + local function quad(a, b, c) + if math.abs(a) < 1e-6 then + if math.abs(b) < 1e-6 then + return math.abs(c) < 1e-6 and 0, 0 + else + return -c/b, -c/b + end + else + local disc = b*b - 4*a*c + if disc >= 0 then + disc = math.sqrt(disc) + a = 2*a + return (-b-disc)/a, (-b+disc)/a + end + end + end + + local v = .025 -- velocity of arrow + + local tvx = entity.motionX + local tvz = entity.motionZ + local a = tvx*tvx + tvz*tvz - v*v + local b = 2 * (tvx * x + tvz * z) + local c = x * x + z * z + local t0, t1 = quad(a, b, c) + if t0 then + local t = math.min(t0, t1) + if t < 0 then + t = math.max(t0, t1) + end + if t > 0 then + --Util.print({ x, t, tvx, x + tvx * t }) + x = x + tvx * t + z = z + tvz * t + end + end + + local yaw = math.deg(math.atan2(-(x - .5), z - .5)) + local pitch = -math.deg(math.atan2(entity.y, math.sqrt(x * x + z * z))) + + Interface.look(yaw, pitch) -- pitch is broken + return Interface.shoot(strength or 1) +end + +function Interface.setStatus(s) + ni.status = s +end + +return Interface diff --git a/neural/apis/neural/mobs.lua b/neural/apis/neural/mobs.lua new file mode 100644 index 0000000..88b6cf8 --- /dev/null +++ b/neural/apis/neural/mobs.lua @@ -0,0 +1,22 @@ +local Mobs = { } + +local hostiles = { + ancient_golem = true, + BabySkeleton = true, + BabyZombie = true, + Bat = true, + Creeper = true, + Husk = true, + Skeleton = true, + Slime = true, + Spider = true, + Witch = true, + Zombie = true, + ZombieVillager = true, +} + +function Mobs.getNames() + return hostiles +end + +return Mobs diff --git a/neural/autorun/6.neural.lua b/neural/autorun/6.neural.lua new file mode 100644 index 0000000..10ab439 --- /dev/null +++ b/neural/autorun/6.neural.lua @@ -0,0 +1,24 @@ +_G.requireInjector(_ENV) + +local GPS = require('gps') + +local kernel = _G.kernel + +kernel.onDeviceAttach('neuralInterface', function(dev) + dev.goTo = function(x, _, z) + local pt = GPS.locate(2) + if pt then + return pcall(function() + local gpt = { + x = x - pt.x, + y = 0, + z = z - pt.z, + } + gpt.x = math.min(math.max(gpt.x, -15), 15) + gpt.z = math.min(math.max(gpt.z, -15), 15) + return dev.walk(gpt.x, gpt.y, gpt.z) + end) + end + return false, 'No GPS' + end +end) diff --git a/neural/etc/apps/neural-apps.db b/neural/etc/apps/neural-apps.db new file mode 100644 index 0000000..3004314 --- /dev/null +++ b/neural/etc/apps/neural-apps.db @@ -0,0 +1,22 @@ +{ + [ "shootingGallery" ] = { + title = "Gallery", + category = "Neural", + run = "shootingGallery.lua", + }, + [ "neuralFight" ] = { + title = "Fight", + category = "Neural", + run = "neuralFight.lua", + }, + [ "neuralFly" ] = { + title = "Fly", + category = "Neural", + run = "neuralFly.lua", + }, + [ "neuralRemote" ] = { + title = "Remote", + category = "Neural", + run = "neuralRemote.lua", + }, +} diff --git a/neural/mobfollow.lua b/neural/mobfollow.lua new file mode 100644 index 0000000..5c819fc --- /dev/null +++ b/neural/mobfollow.lua @@ -0,0 +1,49 @@ +_G.requireInjector(_ENV) + +local GPS = require('gps') +local Util = require('util') +local Peripheral = require('peripheral') +local Point = require('point') + +local os = _G.os + +local args = { ... } +local remoteId = args[1] or error('mobFollow ') +local ni = Peripheral.lookup(remoteId .. '://name/neuralInterface') + +if not ni then + error('failed to connect') +end + +local lpt = nil + +while true do + local pt = GPS.locate(2) + + if not pt then + print('No GPS') + else + local gpt = Util.shallowCopy(pt) + if pt and lpt and Point.same(pt, lpt) then + -- havent moved + print('no move') + else + if not lpt then + gpt.x = gpt.x - 2 + else + local dx = lpt.x - pt.x + local dz = lpt.z - pt.z + local angle = math.atan2(dx, dz) + gpt.x = pt.x + 2.5 * math.sin(angle) + gpt.z = pt.z + 2.5 * math.cos(angle) + end + lpt = pt + local s, m = ni.goTo(gpt.x, gpt.y + 1, gpt.z) + if not s then + print(m) + end + end + end + + os.sleep(.5) +end \ No newline at end of file diff --git a/neural/neuralFight.lua b/neural/neuralFight.lua new file mode 100644 index 0000000..0fb4d77 --- /dev/null +++ b/neural/neuralFight.lua @@ -0,0 +1,98 @@ +_G.requireInjector() + +local Angle = require('neural.angle') +local GPS = require('gps') +local Mobs = require('neural.mobs') +local ni = require('neural.interface') +local Point = require('point') +local Util = require('util') + +local os = _G.os + +local RADIUS = 13 +local ROTATION = math.pi / 16 + +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 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) + for _,target in ipairs(targets) do + target = ni.getMetaByID(target.id) + if target and target.isAlive and Point.distance(target, pos) < 14 then + ni.shootAt(target) + end + end +end + +local potions = Util.filter( + ni.getEquipmentList(), + function(a) + return a.name == 'minecraft:splash_potion' + end) + +local function heal(target) + local hands = { 'main', 'off' } + + if #potions > 0 and ni.getMetaOwner().health < 10 then + local yaw, pitch = Angle.away(target.x - .5, 0, target.z - .5) + ni.look(yaw, pitch) + ni.use(.01, hands[potions[1].slot]) + ni.launch(yaw, pitch, 1) + table.remove(potions, 1) + end +end + +local pt = GPS.locate() + +while true do + local targets = findTargets() + if not targets then + local cpt = GPS.locate() + if Point.distance(pt, cpt) > 2 then + 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') + end + os.sleep(1) + else + local target = targets[1] + local angle = math.atan2(-target.x, -target.z) + ROTATION + + ni.launchTo({ + x = target.x + RADIUS * math.sin(angle), + y = 0, + z = target.z + RADIUS * math.cos(angle) + }, 1) + os.sleep(.2) + + shootAt(targets) + + heal(target) + + if math.random(1, 3) == 3 then + ROTATION = -ROTATION + end + end +end diff --git a/neural/neuralFly.lua b/neural/neuralFly.lua new file mode 100644 index 0000000..35ae482 --- /dev/null +++ b/neural/neuralFly.lua @@ -0,0 +1,78 @@ +_G.requireInjector(_ENV) + +local ni = require('neural.interface') +local GPS = require('gps') + +local strength = .315 +local delay = .1 + +while ni.getMetaOwner().health < 26 do + print('health: ' .. ni.getMetaOwner().health) + os.sleep(1) +end + +ni.launch(0, 270, 1.5) +os.sleep(.25) + +local pt + +local function fly() + for i = 1, 100 do + os.sleep(1) + if pt then + print(pt.y) + print(strength) + end + end +end + +local function gps() + local lastY = 12 + while true do + pt = GPS.locate() + if pt then + local d = math.abs(lastY - pt.y) + + -- force required to get to lvl 12 + + local motionY = ni.getMetaOwner().motionY +-- print('y: ' .. pt.y) + if pt.y < 12 then + if pt.y > lastY then + --strength = strength + .001 + else + strength = strength + .02 * d + end + elseif pt.y > 12 then + if pt.y > lastY then + strength = strength - .02 * d + else + --strength = strength - .001 + end + end + lastY = pt.y + + -- force required to offset motion + local om = (motionY - 0.138) / 0.8 + + ni.launch(0, 270, strength-motionY) +-- print('strength: ' .. strength) + os.sleep(delay) + end + end +end + +parallel.waitForAny(fly, gps) + +repeat + ni.launch(0, 270, .25) + os.sleep(.1) +until not ni.getMetaOwner().isAirborne + +print('descending') +for i = 1, 50 do + ni.launch(0, 270, .2) + os.sleep(.1) +end + +ni.look(180, 0) diff --git a/neural/neuralRecorder.lua b/neural/neuralRecorder.lua new file mode 100644 index 0000000..eac4da5 --- /dev/null +++ b/neural/neuralRecorder.lua @@ -0,0 +1,88 @@ +_G.requireInjector(_ENV) + +local GPS = require('gps') +local Point = require('point') +local Util = require('util') + +local os = _G.os +local parallel = _G.parallel + +local t = { } +local ni = _G.device.neuralInterface or error('Neural Interface not found') + +if not ni.getID then + error('Missing Introspection Module') +end + +local uid = ni.getID() +local c = os.clock() + +local pt = GPS.locate(3) or error('GPS failed') +local lpt +local me = Util.find(ni.sense(), 'id', uid) + +local function gps() + while true do + me = Util.find(ni.sense(), 'id', uid) + pt = GPS.locate(3) or error('GPS failed') + os.sleep(.3) + print('got gps') + end +end + +local function record() + local timerId = os.startTimer(.1) + repeat + local event, ch = os.pullEvent() + local v + local delay = os.clock() - c + c = os.clock() + --print(event .. ' ' .. tostring(ch)) + if event == 'char' then + print('char ' .. ch) + if ch == ' ' then + v = { + action = 'walk', + x = pt.x, + y = pt.y, + z = pt.z, + pitch = me.pitch, + yaw = me.yaw, + delay = delay, + } + elseif ch == 'u' then + v = { + action = 'use', + x = pt.x, + y = pt.y, + z = pt.z, + pitch = me.pitch, + yaw = me.yaw, + delay = delay, + } + end + elseif event == 'timer' and ch == timerId then + if not lpt or not Point.same(pt, lpt) then + v = { + action = 'walk', + x = pt.x, + y = pt.y, + z = pt.z, + pitch = me.pitch, + yaw = me.yaw, + delay = delay, + } + lpt = pt + end + timerId = os.startTimer(.2) + end + + if v then + Util.print(v) + table.insert(t, v) + end + until event == 'char' and ch == 'q' +end + +parallel.waitForAny(gps, record) +Util.writeTable('neural.tbl', t) diff --git a/neural/neuralRemote.lua b/neural/neuralRemote.lua new file mode 100644 index 0000000..2833681 --- /dev/null +++ b/neural/neuralRemote.lua @@ -0,0 +1,56 @@ +rednet.open("right") +local sensor = peripheral.wrap("back") +local modules = peripheral.wrap("back") +local Ka = peripheral.find("neuralInterface") +local function fire(entity) + local x, y, z = entity.x, entity.y, entity.z + local pitch = -math.atan2(y, math.sqrt(x * x + z * z)) + local yaw = math.atan2(-x, z) + + Ka.look(math.deg(yaw), math.deg(pitch), 5) + Ka.shoot(1) + sleep(0.2) +end +local mobNames = {"Skeleton"} +local mobLookup = {} +for i = 1, #mobNames do + mobLookup[mobNames[i]] = true +end + +function SkeletonShoot() + local mobs = sensor.sense() + local candidates = {} + for i = 1, #mobs do + local mob = mobs[i] + if mobLookup[mob.name] then + candidates[#candidates + 1] = mob + end + end + if #candidates > 0 then + local mob = candidates[math.random(1, #candidates)] + fire(mob) + else + sleep(.1) + end +end + + while true do + local id,message = rednet.receive() + print(tostring(id)..message) + if id == 582 then + if message == "forward" then --W + Ka.walk(1,0,0) + elseif message == "back" then --S + Ka.walk(-1,0,0) + elseif message == "turnLeft" then--A + Ka.walk(0,0,-1) + elseif message == "turnRight" then--D + Ka.walk(0,0,1) + elseif message == "shoot" then--Starts fell program + SkeletonShoot() + end + else + write(" Denied!") + end + end + diff --git a/neural/neuralReplay.lua b/neural/neuralReplay.lua new file mode 100644 index 0000000..b2264ca --- /dev/null +++ b/neural/neuralReplay.lua @@ -0,0 +1,52 @@ +_G.requireInjector(_ENV) + +local GPS = require('gps') +local Util = require('util') + +local os = _G.os +local shell = _ENV.shell + +local args = { ... } +local fileName = args[1] or 'neural.tbl' + +local t = Util.readTable(shell.resolve(fileName)) or error('Unable to read ' .. fileName) +local ni = _G.device.neuralInterface + +local function walkTo(x, y, z) + local pt = GPS.locate(2) + if pt then + local s, m, m2 = pcall(function() + local gpt = { + x = x - pt.x, + y = math.floor(y) - math.floor(pt.y), + z = z - pt.z, + } + gpt.x = math.min(math.max(gpt.x, -30), 30) + gpt.z = math.min(math.max(gpt.z, -30), 30) + return ni.walk(gpt.x, gpt.y, gpt.z) + end) + if not s or not m then + _G.printError(m2 or m) + end + end + os.sleep(.5) + while ni.isWalking() do + os.sleep(0) + end +end + +for _,v in pairs(t) do + Util.print(v) + + --if v.action == 'walk' then + walkTo(v.x, v.y, v.z) + --end + ni.look(v.yaw, v.pitch) + if v.action == 'use' then + ni.use() + os.sleep(2) + end +-- os.sleep(v.delay) + -- os.sleep(2) + -- read() +end diff --git a/neural/neuralSword.lua b/neural/neuralSword.lua new file mode 100644 index 0000000..c269c62 --- /dev/null +++ b/neural/neuralSword.lua @@ -0,0 +1,28 @@ +_G.requireInjector(_ENV) + +local ni = require('neural.interface') +local Util = require('util') + +local os = _G.os + +while true do + local target = Util.find(ni.sense(), 'name', 'joebodo') + if target then + if math.abs(target.x) < 2 and + math.abs(target.z) < 2 then + ni.lookAt(target) + ni.swing() + os.sleep(.5) + else + local angle = math.atan2(-(target.x - .5), target.z - .5) + ni.walkTo({ + x = target.x + 1.5 * math.sin(angle), + y = 0, + z = target.z - 1.5 * math.cos(angle) + }, 1) + end + else + print('no target') + os.sleep(1) + end +end \ No newline at end of file diff --git a/neural/robotWars.lua b/neural/robotWars.lua new file mode 100644 index 0000000..4dc4604 --- /dev/null +++ b/neural/robotWars.lua @@ -0,0 +1,83 @@ +_G.requireInjector() + +local Angle = require('neural.angle') +local ni = require('neural.interface') +local Util = require('util') + +local os = _G.os + +local RADIUS = 13 +local ROTATION = math.pi / 16 + +local args = { ... } +local TARGET = args[1] or error('Syntax: robotWars ') +local uid = ni.getID and ni.getID() or error('Introspection module is required') + +local function findTarget(name) + for _, v in pairs(ni.sense()) do + if v.name == name and v.id ~= uid then + return v + end + end +end + +local function shootAt(entity) + local target = ni.getMetaByID(entity.id) + if target then + ni.shootAt(target) + end +end + +local enemy = findTarget(TARGET) +local potions = Util.filter( + ni.getEquipmentList(), + function(a) + return a.name == 'minecraft:splash_potion' + end) + +if not enemy then + print('Current enemies:') + for _,v in pairs(ni.getUniqueNames()) do + print(v) + end + print() + error('Invalid enemy') +end + +local function heal(target) + local hands = { 'main', 'off' } + + if #potions > 0 and ni.getMetaOwner().health < 10 then + local yaw, pitch = Angle.away({ x = target.x, y = 0, z = target.z }) + ni.look(yaw, pitch) + ni.use(.01, hands[potions[1].slot]) + ni.launch(yaw, pitch, 1) + table.remove(potions, 1) + end +end + +repeat + local target = ni.getMetaByID(enemy.id) + if not target then + print('lost target') + break + end + local angle = math.atan2(-target.x, -target.z) + ROTATION + + ni.launchTo({ + x = target.x + RADIUS * math.sin(angle), + y = 0, + z = target.z + RADIUS * math.cos(angle) + }, 1) + os.sleep(.2) + + shootAt(enemy) + + heal(enemy) + + if math.random(1, 3) == 3 then + ROTATION = -ROTATION + end +until not target.isAlive + +print('Won !') \ No newline at end of file diff --git a/neural/shootMob.lua b/neural/shootMob.lua new file mode 100644 index 0000000..02b4815 --- /dev/null +++ b/neural/shootMob.lua @@ -0,0 +1,31 @@ +_G.requireInjector(_ENV) + +local ni = require('neural.interface') +local uid = ni.getID and ni.getID() or error('Introspection module is required') + +local os = _G.os + +local args = { ... } + +local function findEntity(name) + for _,v in pairs(ni.sense()) do + if v.id ~= uid and v.name == name then + return v + end + end +end + +print('Targets:') +for _,v in pairs(ni.sense()) do + print(v.name) +end + +local target = args[1] or error('specify target name') + +repeat + local entity = findEntity(target) + if entity then + ni.shootAt(entity, 1) + end + os.sleep(.5) +until not entity diff --git a/neural/shootingGallery.lua b/neural/shootingGallery.lua new file mode 100644 index 0000000..6344508 --- /dev/null +++ b/neural/shootingGallery.lua @@ -0,0 +1,48 @@ +_G.requireInjector(_ENV) + +local Mobs = require('neural.mobs') +local ni = require('neural.interface') +local Point = require('point') +local Util = require('util') + +local os = _G.os + +if not ni.look then + error('neuralInterface required') +end + +local uid = ni.getID and ni.getID() or error('Introspection module is required') + +local function findTargets() + local pos = { x = 0, y = 0, z = 0 } + 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 then -- pitch is broken + table.insert(targets, v) + end + end + end + return #targets > 0 and targets +end + +print('Targets:') +for _,v in pairs(ni.sense()) do + print(v.name) +end + +while true do + local targets = findTargets() + if targets then + for _, entity in ipairs(targets) do +Util.print(entity) + ni.shootAt(entity, 1) + end + end + os.sleep(.5) +end diff --git a/pickup/.package b/pickup/.package new file mode 100644 index 0000000..7174c0b --- /dev/null +++ b/pickup/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Move resources around with turtles', + repository = 'kepler155c/opus-apps/develop1.8/pickup', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/apps/pickup.lua b/pickup/pickup.lua similarity index 100% rename from apps/pickup.lua rename to pickup/pickup.lua diff --git a/apps/pickupRemote.lua b/pickup/pickupRemote.lua similarity index 100% rename from apps/pickupRemote.lua rename to pickup/pickupRemote.lua diff --git a/recipeBook/.package b/recipeBook/.package new file mode 100644 index 0000000..86f1361 --- /dev/null +++ b/recipeBook/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Recipe books for crafting programs', + repository = 'kepler155c/opus-apps/develop1.8/recipeBook', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/etc/recipes/appliedenergistics2.db b/recipeBook/etc/recipes/appliedenergistics2.db similarity index 100% rename from etc/recipes/appliedenergistics2.db rename to recipeBook/etc/recipes/appliedenergistics2.db diff --git a/etc/recipes/botania.db b/recipeBook/etc/recipes/botania.db similarity index 100% rename from etc/recipes/botania.db rename to recipeBook/etc/recipes/botania.db diff --git a/etc/recipes/computercraft.db b/recipeBook/etc/recipes/computercraft.db similarity index 100% rename from etc/recipes/computercraft.db rename to recipeBook/etc/recipes/computercraft.db diff --git a/etc/recipes/enderio.db b/recipeBook/etc/recipes/enderio.db similarity index 100% rename from etc/recipes/enderio.db rename to recipeBook/etc/recipes/enderio.db diff --git a/etc/recipes/exnihilo.db b/recipeBook/etc/recipes/exnihilo.db similarity index 100% rename from etc/recipes/exnihilo.db rename to recipeBook/etc/recipes/exnihilo.db diff --git a/etc/recipes/extrautils2.db b/recipeBook/etc/recipes/extrautils2.db similarity index 100% rename from etc/recipes/extrautils2.db rename to recipeBook/etc/recipes/extrautils2.db diff --git a/etc/recipes/ironchest.db b/recipeBook/etc/recipes/ironchest.db similarity index 100% rename from etc/recipes/ironchest.db rename to recipeBook/etc/recipes/ironchest.db diff --git a/etc/recipes/mekanism.db b/recipeBook/etc/recipes/mekanism.db similarity index 100% rename from etc/recipes/mekanism.db rename to recipeBook/etc/recipes/mekanism.db diff --git a/etc/recipes/mysticalagriculture.db b/recipeBook/etc/recipes/mysticalagriculture.db similarity index 100% rename from etc/recipes/mysticalagriculture.db rename to recipeBook/etc/recipes/mysticalagriculture.db diff --git a/etc/recipes/rftools.db b/recipeBook/etc/recipes/rftools.db similarity index 100% rename from etc/recipes/rftools.db rename to recipeBook/etc/recipes/rftools.db diff --git a/etc/recipes/skyblockinfinity.db b/recipeBook/etc/recipes/skyblockinfinity.db similarity index 100% rename from etc/recipes/skyblockinfinity.db rename to recipeBook/etc/recipes/skyblockinfinity.db diff --git a/etc/recipes/storagedrawers.db b/recipeBook/etc/recipes/storagedrawers.db similarity index 100% rename from etc/recipes/storagedrawers.db rename to recipeBook/etc/recipes/storagedrawers.db diff --git a/etc/recipes/tconstruct.db b/recipeBook/etc/recipes/tconstruct.db similarity index 100% rename from etc/recipes/tconstruct.db rename to recipeBook/etc/recipes/tconstruct.db diff --git a/apps/recipeBook.lua b/recipeBook/recipeBook.lua similarity index 100% rename from apps/recipeBook.lua rename to recipeBook/recipeBook.lua diff --git a/storageManager/.package b/storageManager/.package new file mode 100644 index 0000000..f7481b5 --- /dev/null +++ b/storageManager/.package @@ -0,0 +1,9 @@ +{ + required = { + 'opus-develop-1.8', + }, + title = 'Manage inventory', + repository = 'kepler155c/opus-apps/develop1.8/storageManager', + description = [[ ... ]], + licence = 'MIT', +} diff --git a/apps/Crafter.lua b/storageManager/Crafter.lua similarity index 100% rename from apps/Crafter.lua rename to storageManager/Crafter.lua diff --git a/apps/chestManager.lua b/storageManager/chestManager.lua similarity index 100% rename from apps/chestManager.lua rename to storageManager/chestManager.lua diff --git a/apps/levelEmitter.lua b/storageManager/levelEmitter.lua similarity index 100% rename from apps/levelEmitter.lua rename to storageManager/levelEmitter.lua diff --git a/apps/storageActivity.lua b/storageManager/storageActivity.lua similarity index 100% rename from apps/storageActivity.lua rename to storageManager/storageActivity.lua