Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local jars = {}
- local jarCount = 0
- local aspectLocations = {"instrumentum","venenum","perditio","vitreus","vinculum",
- "victus","pannus","alienis","sensus","mortuus","metallum",
- "permutatio","ordo","aqua","iter","auram","ignis","fabrico",
- "messis","herba","arbor","lucrum","corpus","praecantatio",
- "gelum","fames","motus","sano","meto","aer","bestia","tenebrae", "tutamen", "lux",
- "potentia", "vacous", "terra", "humanus", "spiritus", "machina", "perfodio", "exanimis", "limus",
- "telum", "volatus", "cognitio"}
- local waitTimes = {}
- local lastCheck = {}
- local primalNames = {"aer", "aqua", "ignis", "ordo", "perditio", "terra"}
- local primalJars = {}
- local primalIndex = 0
- local chest = peripheral.wrap("back")
- local offX = 20
- local offY = 5
- local monitor = peripheral.wrap("right")
- function locate (list, value)
- for i, v in ipairs(list) do
- if v == value then
- return i
- end
- end
- return 0
- end
- function printAspect(mon, px, py, jar)
- mon.setCursorPos(px, py)
- aspect = jar.getAspects()[1]
- count = jar.getAspectCount(aspect)
- index = locate(aspectLocations, aspect)
- if lastCheck[index] == nil then
- lastCheck[index] = count
- end
- if waitTimes[index] == nil or count == 64 then
- if lastCheck[index] > count then
- mon.setTextColor(colors.orange)
- else
- if lastCheck[index] < count then
- mon.setTextColor(colors.lightBlue)
- else
- if count < 32 then
- fillJar(aspect, count)
- mon.setTextColor(colors.red)
- else
- if count < 64 then
- fillJar(aspect, count)
- mon.setTextColor(colors.yellow)
- else
- waitTimes[index] = nil
- mon.setTextColor(colors.lime)
- end
- end
- end
- end
- else
- mon.setTextColor(colors.blue)
- if waitTimes[index] == count then
- waitTimes[index] = nil
- end
- end
- lastCheck[index] = count
- mon.write(aspect)
- mon.setCursorPos(px + 14, py)
- mon.write(tostring(count))
- end
- function loadJars()
- names = peripheral.getNames()
- for i, v in ipairs(names) do
- typ = peripheral.getType(v)
- if typ == "tt_aspectContainer" then
- jar = peripheral.wrap(v)
- aspect = jar.getAspects()[1]
- if locate(primalNames, aspect) > 0 then
- primalIndex = primalIndex + 1
- jars[primalIndex] = jar
- else
- jarCount = jarCount + 1
- jars[jarCount + 6] = jar
- end
- else
- monitor = peripheral.wrap(v)
- end
- end
- print(jarCount)
- end
- function fillJar(aspect, count)
- need = 64 - count;
- index = locate(aspectLocations, aspect)
- if waitTimes[index] == nil then
- if index == 0 then
- --print("no " .. aspect)
- else
- stack = chest.getStackInSlot(index)
- if stack.qty > 1 then
- take = math.min(stack.qty - 1, need)
- --print(take .. " " .. index)
- chest.pushItem("north", index, take)
- waitTimes[index] = count + take
- end
- end
- else
- if waitTimes[index] == count then
- waitTimes[index] = nil
- end
- end
- end
- loadJars()
- while true do
- monitor.clear()
- monitor.setTextScale(0.9)
- monitor.setCursorPos(1, 1)
- monitor.write(jarCount)
- for i, v in ipairs(jars) do
- if v == nil then
- else
- if i % 2 == 1 then
- printAspect(monitor, 1, (i - 1) / 2 + 1, v)
- -- monitor.setCursorPos(19 + offX, i / 2 + 1 + offY)
- -- monitor.setTextColor(colors.white)
- -- monitor.write("|")
- else
- printAspect(monitor, 21, (i - 1) / 2 + 1, v)
- end
- end
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement