Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Feel free to change these:
- local pulseLength = 0.1
- local collectionDelay = 7
- local bus
- local busOut
- local showPrep = true
- local bc = { --Bus Colour for each machine (Local)
- copperCable = colors.orange,
- refinedIron = colors.yellow,
- rubber = colors.blue,
- circuit = colors.pink,
- coalDust = colors.red,
- generator = colors.magenta,
- solarPanel = colors.white,
- -- machineBlock = colors.white, --Change Me
- ironFurnace = colors.purple,
- rpBattery = colors.lightBlue,
- }
- local req = {
- copperCable = 0,
- redstone = 0,
- iron = 0,
- refinedIron = 0,
- ironFurnace = 0,
- goldCable = 0,
- tin = 0,
- coal = 0,
- glass = 0,
- coalDust = 0,
- rubber = 0,
- woodPlanks = 0,
- machineBlock = 0,
- stickySap = 0,
- circuit = 0,
- rpBattery = 0,
- generator = 0,
- copper = 0 }
- function paws()
- print("Paused, press any key except esc to continue")
- local key = false -- set Variable
- while key == false do -- Loop
- test, test2 = os.pullEvent() -- wait for input
- if test=="key" then -- check input is keypress
- if test2 ~= 1 then -- not ESC, may want to leave terminal paws'd
- key = true -- end loop
- end
- end
- end
- end
- function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- function pulse(col, numPulse)
- x,y = term.getCursorPos()
- x = x + 2
- pct = 100 / numPulse
- for i = 1,numPulse do
- term.setCursorPos(30,y)
- write(round((i * pct), 0) .. "% ")
- rs.setBundledOutput(bus, col)
- sleep(pulseLength)
- rs.setBundledOutput(bus, 0)
- sleep(pulseLength)
- end
- end
- function copperCable(num)
- -- if num < 6 then num = 6 print("Copper Cable increased to 6") end -- Minimum level of 6 cables
- if showPrep then print ("Preparing for "..num.." Copper Cable") end
- req.rubber = req.rubber + (num)
- rubber(num)
- req.copper = req.copper + (num / 2)
- end
- function rubber(num)
- -- if num < 3 then num = 3 print("Rubber increased to 3") end -- Minimum level of 3 Rubber
- if showPrep then print ("Preparing for "..num.." Rubber") end
- req.stickySap = req.stickySap + (num / 3)
- end
- function circuit(num)
- if showPrep then print ("Preparing for "..num.." Circuit") end
- req.copperCable = req.copperCable + (num * 6)
- copperCable(num * 6)
- req.redstone = req.redstone + (num * 2)
- req.refinedIron = req.refinedIron + (num)
- refinedIron(num)
- end
- function refinedIron(num)
- if showPrep then print ("Preparing for "..num.." Refined Iron") end
- req.iron = req.iron + (num)
- end
- function coalDust(num)
- if showPrep then print ("Preparing for "..num.." Coal Dust") end
- req.coal = req.coal + (num)
- end
- function rpBattery(num)
- if showPrep then print ("Preparing for "..num.." RedPower Battery") end
- req.tin = req.tin + (num *4)
- req.redstone = req.redstone + (num *2)
- req.copperCable = req.copperCable + (num)
- copperCable(num)
- end
- function machineBlock(num)
- if showPrep then print ("Preparing for "..num.." Machine Block") end
- req.refinedIron = req.refinedIron + (num * 8)
- refinedIron(num * 8)
- end
- function generator(num)
- if showPrep then print ("Preparing for "..num.." Generator") end
- req.refinedIron = req.refinedIron + (num * 3)
- req.rpBattery = req.rpBattery + (num)
- req.ironFurnace = req.ironFurnace + (num)
- refinedIron(num * 3)
- rpBattery(num)
- ironFurnace(num)
- end
- function ironFurnace(num)
- if showPrep then print ("Preparing for "..num.." Iron Furnace") end
- req.iron = req.iron + (num * 8)
- end
- function solarPanel(num)
- if showPrep then print ("Preparing for "..num.." Solar Panel") end
- req.circuit = req.circuit + (num * 2)
- circuit(num * 2)
- req.glass = req.glass + (num * 3)
- req.generator = req.generator + num
- req.coalDust = req.coalDust + (num * 3)
- coalDust(num * 3)
- generator(num)
- end
- function goldCable(num)
- if showPrep then print ("Preparing for "..num.." Gold Cable") end
- if num < 4 then num = 4 print("Gold Cable increased to 4") end -- Minimum level of 4 cables
- req.rubber = req.rubber + (num)
- rubber(num)
- req.gold = req.gold + (num / 4)
- end
- function makeItHappen()
- write("\nStage 1 - Transforming Raw Materials")
- if req.coalDust ~= 0 then write("\n Coal Dust: ") pulse(bc.coalDust, req.coalDust) end
- if req.refinedIron ~= 0 then write("\n Refined Iron: ") pulse(bc.refinedIron, req.refinedIron) end
- if req.rubber ~= 0 then write("\n Rubber: ") pulse(bc.rubber, req.rubber) end
- write("\nPausing for Collection..")
- sleep(collectionDelay)
- write("\n\nStage 2 - First Pass")
- if req.copperCable ~= 0 then write("\n Copper Cable: ") pulse(bc.copperCable, req.copperCable) end
- if req.goldCable ~= 0 then write("\n Gold Cable: ") pulse(bc.goldCable, req.goldCable) end
- if req.ironFurnace ~= 0 then write("\n Iron Furnace: ") pulse(bc.ironFurnace, req.ironFurnace) end
- if req.machineBlock ~= 0 then write("\n Machine Block: ") pulse(bc.machineBlock, req.machineBlock) end
- write("\nPausing for Collection..")
- sleep(collectionDelay)
- write("\n\nStage 3 - Second Pass")
- if req.circuit ~= 0 then write("\n Circuit: ") pulse(bc.circuit, req.circuit) end
- if req.rpBattery ~= 0 then write("\n RedPower Battery: ") pulse(bc.rpBattery, req.rpBattery) end
- write("\nPausing for Collection..")
- sleep(collectionDelay)
- write("\n\nStage 4 - Third Pass")
- if req.generator ~= 0 then write("\n Generator: ") pulse(bc.generator, req.generator) end
- write("\nPausing for Collection..")
- sleep(collectionDelay)
- write("\n\nStage 5 - Fourth Pass")
- if req.solarPanel ~= 0 then write("\n Solar Panel: ") pulse(bc.solarPanel, req.solarPanel) end
- write("\nPausing for Collection..")
- sleep(collectionDelay)
- end
- tArgs = { ... }
- if #tArgs ~= 2 then
- print("Usage: af <Machine bus side> <output pulse side> <monitor side>")
- else
- mon=peripheral.wrap(tArgs[3])
- term.redirect(mon) ]]--
- term.clear()
- term.setCursorPos(1,1)
- bus = tArgs[1]
- collect = tArgs[2]
- rs.setOutput(collect, true)
- write("How many Solar Panels boss? ")
- req.solarPanel = read()
- solarPanel(req.solarPanel)
- print ("")
- print("You want "..req.solarPanel.." Solar Panels! I'll be needing the following items:")
- if req.iron ~= 0 then print("Iron: "..req.iron) end
- if req.woodPlanks ~= 0 then print("Wooden Planks (Oak): "..req.woodPlanks) end
- if req.stickySap ~= 0 then print("Sticky Sap: "..req.stickySap) end
- if req.redstone ~= 0 then print("Redstone: "..req.redstone) end
- if req.coal ~= 0 then print("Coal: "..req.coal) end
- if req.tin ~= 0 then print("Tin: "..req.tin) end
- if req.copper ~= 0 then print("Copper: "..req.copper) end
- if req.glass ~= 0 then print("Glass: "..req.glass) end
- print("")
- write ("Now either type go or exit: ")
- input = ""
- while true do
- if input == "exit" then
- break
- elseif input == "go" then
- makeItHappen()
- write("\nDone!")
- break
- end
- input=read()
- end
- term.restore()
- print("\nShutting Down")
- rs.setOutput(collect, false)
- end
Add Comment
Please, Sign In to add comment