Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local sides = require("sides")
- local robot = require("robot")
- local db = component.database
- local invcontrol = component.inventory_controller
- function gib(gibber)
- print(db.get(gibber))
- print(db.computeHash(gibber))
- end
- function drop(dropper)
- robot.select(1)
- invcontrol.dropIntoSlot(1, dropper)
- end
- function check()
- invcontrol.store(1, _G.slot, db.address, 1)
- local checkret = db.computeHash(1)
- --print(checkret)
- return(checkret)
- end
- function isEmpty()
- if(string.find(check(), _G.empty) == nil)
- then
- --print("Not Empty!")
- return(false)
- else
- print("Empty!")
- return(true)
- end
- end
- function main()
- if(isEmpty() == true)
- then
- charge()
- else
- main()
- end
- end
- function charge()
- print("Charging!")
- invcontrol.suckFromSlot(1, _G.slot)
- invcontrol.dropIntoSlot(3,1)
- pull()
- end
- function pull()
- print("checkin")
- if(invcontrol.getStackInInternalSlot(1) == nil)
- then
- fucklua()
- else
- print("Charged!")
- invcontrol.suckFromSlot(3,2)
- invcontrol.dropIntoSlot(1, _G.slot)
- main()
- end
- end
- function fucklua()
- pull()
- end
- io.write("Welcome to Railgun Reload! Please input the # of the hotbar slot you are going to use for your railgun: ")
- io.flush()
- _G.slot = tonumber(io.read())
- repeat
- io.write("Please place your UNCHARGED railgun in the slot you selected, type 'ok' when you are ready to continue")
- io.flush()
- until io.read() == "ok"
- invcontrol.store(1, _G.slot, db.address, 2)
- _G.empty = db.computeHash(2)
- db.clear(2)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement