Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local sides = require("sides")
- local term = require("term")
- local transposer = component.transposer
- local gpu = component.gpu
- local mobCount = 2
- local chestSide = sides.down
- local duplicatorSide = sides.up
- local mobList = {
- witherSkeleton = 1,
- ghast = 2,
- }
- local abbr = {
- witherSkeleton = {"witherSkeleton", "ws", "wither skeleton"},
- ghast = {"ghast", "gh"},
- }
- function init()
- gpu.setResolution(60, 20)
- end
- function findEmpty()
- for i = 1, mobCount do
- if (transposer.getSlotStackSize(chestSide, i) == 0) then
- return i
- end
- end
- end
- function returnPokeball()
- transposer.transferItem(duplicatorSide, chestSide, 1, 7, findEmpty())
- print("Retrieving Mob...")
- os.sleep(1/2)
- end
- function sendPokeball(mob)
- returnPokeball()
- transposer.transferItem(chestSide, duplicatorSide, 1, mobList[mob], 7)
- print("Sending Mob...")
- os.sleep(1/2)
- end
- function readInput(input)
- if (input == "stop" or input == "STOP") then
- return "stop"
- end
- for k,v in pairs(abbr) do
- for _,n in ipairs(v) do
- if (n == input) then
- return v[1]
- end
- end
- end
- end
- init()
- while true do
- term.clear()
- print("Avaliable Mobs: ")
- for k, v in pairs(abbr) do
- io.write("\t"..v[1].." (")
- for i,n in ipairs(v) do
- if (i ~= #v) then
- io.write(n..", ")
- else
- io.write(n)
- end
- end
- io.write(")\n")
- end
- local mobName = nil
- repeat
- print("Enter a mob (stop to stop): ")
- input = readInput(io.read())
- until(input ~= nil)
- if (input == "stop") then
- returnPokeball()
- print("Process stopped.")
- else
- sendPokeball(input)
- end
- os.sleep(1)
- end
Add Comment
Please, Sign In to add comment