Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Mana bean storage system - Computer Side.
- -- This needs to be connected to all jars using Peripheral Proxys and networking cables.
- -- Written by LKummer on the 24/2/2014.
- local aspects = {"Aer", "Alienis", "Aqua", "Arbor", "Auram", "Bestia", "Cognitio", "Corpus", "Exanimis", "Fabrico", "Fames", "Gelum", "Granum", "Herba", "Humanus", "Ignis", "Instrumentum", "Iter", "Limus", "Lucrum", "Lux", "Machina", "Messis", "Metallum", "Meto", "Mortuus", "Motus", "Ordo", "Pannus", "Perditio", "Perfodio", "Permutatio", "Potentia", "Praecantatio", "Sano", "Saxum", "Sensus", "Spiritus", "Tlum", "Tempestas",
- "Enebrae", "Terra", "Tutamen", "Vacuos", "Venenum", "Victus", "Vunculum", "Vitium", "Vitreus", "Volatus"}
- local jarNames = peripheral.getNames()
- local rID = "37" -- Receiver Turtle ID.
- rednet.open("back") -- Wired modem.
- rednet.open("right") -- Wireless modem.
- while true do
- for num, per in ipairs(jarNames) do -- Detect all connected peripherals using getNames().
- if peripheral.getType(per) == "tt_aspectContainer" then -- Detect only the jars.
- aspName = peripheral.call(per, "getAspects") -- Detect aspect.
- aspNum = peripheral.call(per, "getAspectCount", aspName[1]) -- Detect aspect count.
- if aspNum < 64 then -- Detect if aspect needs refilling.
- aspNumNeeded = 64 - aspNum -- Calculate how much mana beans it needs to send.
- for n, a in ipairs(aspects) do -- Conversion from aspect name to bean number for the Turtle.
- if a == peripheral.call(per, "getAspects") then
- for i = 1, aspNumNeeded do -- Repeat for how many beans needed to refill jar.
- rednet.close("back")
- rednet.broadcast(n)
- rednet.open("back")
- sleep(2.5)
- end
- end
- end
- end
- end
- end
- sleep(120)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement