Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ThaumComp = {--{{{
- wirelessModem = rednet.open("top"),
- aeCompID = 27,
- page = 1,
- recipesPerPage = 18,
- recipes = {
- ['Arcane Transmutator: Dull Shard'] = {['praecantatio'] = 8, ['vitreus'] = 8},
- ['Gold Transmutation'] = {['metallum'] = 2, ['carus'] = 1,},
- ['Nitor'] = {['ignis'] = 4, ['lux'] = 6, ['potentia'] = 4,},
- ['Thaumium'] = {['metallum'] = 8, ['praecantatio'] = 4,},
- ['Spellbinding Cloth'] = {['permutatio'] = 8, ['praecantatio'] = 6, ['pannus'] = 4,},
- ['Gaseous Tenebrae'] = {['tenebris'] = 2, ['aura'] = 6,},
- ['Alumentum'] = {['fractus'] = 3, ['ignis'] = 6, ['potentia'] = 6,},
- ['Gunpowder'] = {['fractus'] = 6, ['ignis'] = 6,},
- ['Iron Transmutation'] = {['metallum'] = 2,},
- ['Transvector Interface'] = {['machina'] = 6, ['permutatio'] = 6,},
- ['Interface Binder'] = {['potentia'] = 6, ['machina'] = 6,},
- ['Metabolic Frame'] = {['lignum'] = 6, ['permutatio'] = 8, ['praecantatio'] = 2, ['victus'] = 4,},
- ['Necrotic Frame'] = {['lignum'] = 6, ['permutatio'] = 12, ['praecantatio'] = 2, ['mortuus'] = 6,},
- ['Resilient Frame'] = {['lignum'] = 12, ['permutatio'] = 8, ['praecantatio'] = 2,},
- ['Magic Frame'] = {['lignum'] = 4, ['praecantatio'] = 2,},
- ['Gentle Frame'] = {['lignum'] = 4, ['praecantatio'] = 2, ['victus'] = 8,},
- ['Concentrated Compound'] = {['messis'] = 12,},
- ['Wand of the Adept'] = {['praecantatio'] = 16,},
- ['Gaseous Glowstone'] = {['aura'] = 8,},
- ['Wand of the Tinkerer'] = {['praecantatio'] = 16, ['vacuous'] = 12,},
- ['Magic Tallow'] = {['corpus'] = 4,},
- ["Thaumaturge's Backpack"] = {['praecantatio'] = 10, ['permutatio'] = 12, ['vacuos'] = 16, },
- ["Thaumium Chest"] = {['metallum'] = 64, ['praecantatio'] = 16, ['vacuos'] = 20, },
- ['Wand of Fire'] = {['ignis'] = 16, ['telum'] = 4,},
- ['Pickaxe of the Core'] = {['instrumentum'] = 16, ['metallum'] = 8, ['ignis'] = 16, ['visum'] = 8,},
- ['Goggles of Revealing'] = {['mutatio'] = 8, ['praecantatio'] = 8, ['visum'] = 8,},
- ['Shovel of the Earthmover'] = {['fabrico'] = 8, ['instrumentum'] = 16, ['fractus'] = 8, ['solum'] = 16,},
- ['Wand of Excavation'] = {['instrumentum'] = 4, ['metallum'] = 16,},
- ['Wand of Frost'] = {['telum'] = 4, ['gelum'] = 16,},
- ['Axe of the Stream'] = {['instrumentum'] = 16, ['lignum'] = 8, ['motus'] = 8, ['aqua'] = 16,},
- ['Ender Mirror'] = {['instrumentum'] = 8, ['visum'] = 6, ['alienis'] = 12,},
- ['Hoe of Growth'] = {['instrumentum'] = 16, ['herba'] = 16, ['messis'] = 8, ['victus'] = 8,},
- ['Wand of Equal Trade'] = {['instrumentum'] = 4, ['permutatio'] = 16,},
- ['Wand of Lightning'] = {['potentia'] = 16, ['telum'] = 4,},
- ['Sword of the Zephyr'] = {['motus'] = 8, ['fractus'] = 8, ['telum'] = 16, ['aura'] = 16,},
- ['Wand of Dislocation'] = {['permutatio'] = 14, ['vinculum'] = 12,},
- ['Wand of Uprising'] = {['aura'] = 6, ['volito'] = 12,},
- ['Magical Hand Mirror'] = {['instrumentum'] = 16,},
- ['Arcane Bellows'] = {['motus'] = 16, ['aura'] = 24,},
- ['Hungry Chest'] = {['motus'] = 8, ['vacuos'] = 8, ['animus'] = 4,},
- ['Portable Hole'] = {['permutatio'] = 16, ['vacuos'] = 24, ['alienis'] = 24,},
- ['Mirrored Glass'] = {['vitreus'] = 4, ['visum'] = 4,},
- ['Magic Mirror'] = {['motus'] = 16,},
- ['Infernal Bracelet'] = {['metallum'] = 12, ['ignis'] = 8, ['saxum'] = 6,},
- ['Void Capsule'] = {['permutatio'] = 8, ['vacuos'] = 16, ['alienis'] = 2,},
- ['Arcane Levitator'] = {['machina'] = 8, ['motus'] = 8, ['solum'] = 8, ['volito'] = 8,},
- ['Boots of the Traveller'] = {['motus'] = 24, ['aqua'] = 8, ['tutamen'] = 8, ['solum'] = 8, ['volito'] = 16,},
- ["Traveller's Paving Stone"] = {['motus'] = 16, ['solum'] = 8, ['saxum'] = 8, ['volito'] = 8,},
- ['Warded Chest'] = {['praecantatio'] = 16, ['vacuos'] = 12,},
- ['Rune Thanatos'] = {['potentia'] = 12, ['praecantatio'] = 20, ['mortuus'] = 16,},
- ['Arcane Ear'] = {['machina'] = 8, ['sonus'] = 16, ['aura'] = 8,},
- ['Arcane Door'] = {['imperito'] = 4, ['cognito'] = 4, ['machina'] = 8,},
- ['Arcane Pressure Plate'] = {['imperito'] = 4, ['cognito'] = 4, ['machina'] = 4,},
- ['Talisman of Withhold'] = {['cognito'] = 12, ['vinculum'] = 18, ['malum'] = 6,},
- ['Brain in a Jar'] = {['cognito'] = 8, ['malum'] = 8, ['animus'] = 8,},
- ['Advanced Stone Golem Worker'] = {['cognito'] = 16, ['animus'] = 8, ['victus'] = 8,},
- ['Advanced Clay Golem Worker'] = {['cognito'] = 16, ['animus'] = 8, ['victus'] = 8,},
- ["Goliath's Leggings"] = {['tutamen'] = 16, ['bestia'] = 16,},
- ['Stone Golem Worker'] = {['animus'] = 8, ['victus'] = 8,},
- ['Clay Golem Worker'] = {['animus'] = 8, ['victus'] = 8,},
- ['Tallow Golem Worker'] = {['animus'] = 8, ['victus'] = 8,},
- ['Decanting Golem'] = {['cognito'] = 16, ['animus'] = 8, ['victus'] = 8,},
- ['Golemancy'] = {['imperito'] = 8, ['animus'] = 8,},
- ['Wood Golem Worker'] = {['animus'] = 8, ['victus'] = 8,},
- ['Straw Golem Worker'] = {['animus'] = 8, ['victus'] = 8,},
- ['Crystal Clusters'] = {['vitreus'] = 8, ['praecantatio'] = 8, ['permutatio'] = 8,},
- ['Flux Filter'] = {['permutatio'] = 8, ['purus'] = 8,},
- ['Arcane Alembic'] = {['vitreus'] = 8, ['aqua'] = 8, ['aura'] = 8,},
- ['Talisman of Remedium'] = {['instrumentum'] = 12, ['sano'] = 16, ['cognito'] = 18, ['praecantatio'] = 10,},
- ['Golem Animation Core: Perception'] = {['Visum'] = 12,},
- ['Golem Animation Core: Speed'] = {['motus'] = 12,},
- ['Cryogenic Globe'] = {['tempus'] = 6, ['victus'] = 6, ['gelum'] = 12,},
- ['Aphrodisiac Concoction'] = {['imperito'] = 5, ['solum'] = 6, ['victus'] = 12,},
- ['Golem Animation Core: Strength'] = {['potentia'] = 12,},
- ['Golem Animation Core: Intelligence'] = {['cognito'] = 12,},
- ['Wand of the Thaumaturge'] = {['praecantatio'] = 32,},
- ['Crystal Capacitor'] = {['vitreus'] = 16, ['praecantatio'] = 16, ['permutatio'] = 16,},
- ['Crystal Core'] = {['mutatio'] = 8, ['praecantatio'] = 8, ['vacuos'] = 8, ['alienis'] = 8,},
- ['Arcane Transmutator'] = {['mutatio'] = 24, ['permutatio'] = 48,},
- ['Stopwatch of the Timetwister'] = {['machina'] = 20, ['tempus'] = 12,},
- ['Iron Golem Guardian'] = {['tutamen'] = 12, ['telum'] = 12, ['animus'] = 12, ['victus'] = 12,},
- ['Tool Dynamism Tablet'] = {['imperito'] = 16, ['machina'] = 16, ['motus'] = 8, ['praecantatio'] = 12,},
- ['Arcane Bore'] = {['potentia'] = 32, ['machina'] = 12, ['motus'] = 16, ['metallum'] = 64, ['vacuos'] = 24,},
- ['Sigil of Memories'] = {['machina'] = 12, ['motus'] = 16, ['alienis'] = 4,},
- ['Rod of the Nine Hells'] = {['ignis'] = 32, ['malum'] = 32, ['bestia'] = 32,},
- ['Advanced Thaumostatic Magnetizer'] = {['potentia'] = 12, ['machina'] = 6, ['motus'] = 16, ['corpus'] = 4,},
- ['Thaumostatic Magnetizer'] = {['imperito'] = 6, ['potentia'] = 12, ['metallum'] = 16,},
- ['Thaumostatic Harness'] = {['potentia'] = 24, ['machina'] = 32, ['tutamen'] = 16, ['aura'] = 24, ['volito'] = 64,},
- ['Hyperenergetic Nitor'] = {['potentia'] = 20, ['lux'] = 32, ['ignis'] = 16,},
- ["Reaper's Scythe"] = {['malum'] = 6, ['animus'] = 30, ['mortuus'] = 24, ['victus'] = 12,},
- ["Crystal of Sunlight"] = {['vitreus'] = 10, ['aer'] = 6, ['ignis'] = 12,},
- ["Crystal of Rainfall"] = {['vitreus'] = 10, ['aqua'] = 12, ['aer'] = 6,},
- ["Tiny Spectacles"] = {['visum'] = 8},
- ["Fortunate Maul"] = {["instrumentum"] = 25, ['carus'] = 25, ['praecantatio'] = 12, ['tenebris'] = 4},
- }
- }--}}}
- function ThaumComp:readNumber()--{{{
- local key = nil
- local amount = ""
- while key ~= 28 do
- event, key = os.pullEvent("key")
- if key > 1 and key < 12 then
- if key == 11 then
- key = 0
- else
- key = key - 1
- end
- io.write(tostring(key))
- amount = amount .. tostring(key)
- elseif key == 14 then
- local termX, termY = term.getCursorPos()
- termX = termX - 1
- term.setCursorPos(termX, termY)
- io.write(' ')
- term.setCursorPos(termX, termY)
- amount = amount:sub(0, amount:len() - 1)
- end
- end
- print("")
- return tonumber(amount)
- end--}}}
- function ThaumComp:readYesNo()--{{{
- local key = nil
- local amount = ""
- while key ~= 28 do
- event, key = os.pullEvent("key")
- if key == 21 or key == 49 then
- if key == 21 then
- return true
- else
- return false
- end
- end
- end
- return false
- end--}}}
- function ThaumComp:resetTerm()--{{{
- term.clear()
- term.setCursorPos(1,1)
- end--}}}
- function ThaumComp:powerOnMenu()--{{{
- self:resetTerm()
- print('How many minutes do you want to turn AE on for?')
- minutes = self:readNumber()
- seconds = minutes * 60
- rednet.send(self.aeCompID, 'powerOnFor ' .. tostring(seconds))
- self:resetTerm()
- end--}}}
- function ThaumComp:requestMenu(recipe)--{{{
- self:resetTerm()
- print('How many of ' .. recipe .. ' do you want.')
- amount = self:readNumber()
- self:resetTerm()
- return amount
- end--}}}
- function ThaumComp:getRecipeAspects(recipe)--{{{
- local recipeAmount = self:requestMenu(recipe)
- local getAspects = true
- if recipeAmount ~= nil then
- if recipeAmount == 1 then
- getAspects = self.recipes[recipe]
- elseif recipeAmount > 1 then
- aspects = self.recipes[recipe]
- getAspects = {}
- for aspect, aspectAmount in pairs(aspects) do
- getAspects[aspect] = aspectAmount * recipeAmount
- end
- elseif recipeAmount < 1 then
- getAspects = false
- end
- print(textutils.serialize(getAspects))
- if getAspects then
- print("Requesting aspects for " .. recipeAmount .. " * ".. recipe .. ".")
- rednet.send(tc.aeCompID, 'getAspects ' .. textutils.serialize(getAspects))
- end
- end
- end--}}}
- function ThaumComp:initRecipeList()--{{{
- self.numRecipes = 0
- self.recipeList = {}
- for recipe, value in pairs(self.recipes) do
- self.numRecipes = self.numRecipes + 1
- self.recipeList[self.numRecipes] = recipe
- end
- table.sort(self.recipeList)
- end--}}}
- function ThaumComp:displayRecipes()--{{{
- if self.page == nil or self.page == 1 then
- startRecipe = 1
- else
- startRecipe = (self.page - 1) * self.recipesPerPage - 1
- end
- endRecipe = startRecipe + (self.recipesPerPage - 1)
- if endRecipe > self.numRecipes then
- endRecipe = self.numRecipes
- end
- self:resetTerm()
- for recipeNum = startRecipe, endRecipe do
- print(tostring(recipeNum) .. '. ' .. self.recipeList[recipeNum])
- end
- end--}}}
- function ThaumComp:nextRecipePage()--{{{
- self.page = self.page + 1
- end--}}}
- function ThaumComp:prevRecipePage()--{{{
- if self.page > 1 then
- self.page = self.page - 1
- end
- end--}}}
- function ThaumComp:selectRecipe()--{{{
- self:resetTerm()
- print('What number recipe do you want to create?')
- local recipeNum = self:readNumber()
- if recipeNum then
- print('Are you sure you want to create ' .. self.recipeList[recipeNum] .. '?')
- if self:readYesNo() then
- self:getRecipeAspects(self.recipeList[recipeNum])
- else
- self:resetTerm()
- self:displayRecipes()
- end
- else
- tc:resetTerm()
- tc:displayRecipes()
- end
- end--}}}
- function ThaumComp:craftObsidian()--{{{
- self:resetTerm()
- print('How many Obsidian do you want?')
- local amount = self:readNumber()
- if amount then
- print('Are you sure you want to create ' .. tostring(amount) .. ' of Obsidian?')
- if self:readYesNo() then
- rednet.send(tc.aeCompID, 'obsidian ' .. tostring(amount))
- end
- end
- tc:resetTerm()
- tc:displayRecipes()
- end--}}}
- tc = ThaumComp
- tc:resetTerm()
- tc:initRecipeList()
- tc:displayRecipes()
- while true do
- event, param1, param2, param3 = os.pullEvent()
- if event == 'key' then -- param1 == scancode
- if param1 == 27 then -- ]
- print("Sending Reboot command")
- rednet.send(tc.aeCompID, 'reboot')
- elseif param1 == 24 then -- o
- tc:craftObsidian()
- elseif param1 == 26 then -- [
- tc:powerOnMenu()
- elseif param1 == 34 then -- g
- recipe = 'Gold Transmutation'
- tc:getRecipeAspects(recipe)
- elseif param1 == 38 then -- l
- tc:displayRecipes()
- elseif param1 == 19 then -- r
- recipe = "Reaper's Scythe"
- tc:getRecipeAspects(recipe)
- elseif param1 == 46 then -- c
- tc:selectRecipe()
- elseif param1 == 205 then -- right cursor
- tc:nextRecipePage()
- tc:displayRecipes()
- elseif param1 == 203 then -- left cursor
- tc:prevRecipePage()
- tc:displayRecipes()
- elseif param1 == 29 then -- CTRL
- tc:resetTerm()
- event, param1 = os.pullEvent('key')
- print(param1)
- end
- elseif event == 'rednet_message' then -- number senderid, string message, number distance
- if param1 == tc.aeCompID then
- if param2:find('error ') then
- print(param2:sub(6))
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement