Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local flowrate = 100 --flow rate of the conduit in millibuckets/tick
- local sleeprate = 0.075 --length of a minecraft tick in seconds
- local magicnumber = 50
- function experienceToLiquid(xp)
- return xp * 20
- end
- function getExperienceForLevel(level)
- if level == 0 then return 0 end
- if level > 0 and level < 16 then
- return level * 17
- end
- if level > 15 and level < 31 then
- return 1.5 * math.pow(level, 2) - 29.5 * level + 360
- end
- return 3.5 * math.pow(level, 2) - 151.5 * level + 2220
- end
- function getLiquidForLevel(level)
- return experienceToLiquid(getExperienceForLevel(level))
- end
- function toggleRedstone(side, time)
- redstone.setOutput(side, true)
- sleep(time)
- redstone.setOutput(side, false)
- end
- local args = {...} --command line args
- if not args[1] then
- print("Usage: getlvl <level>")
- return
- end
- local liquidLevel = getLiquidForLevel(tonumber(args[1])) - magicnumber
- local ticks = liquidLevel / flowrate
- local tank = peripheral.wrap("left")
- local totalTankLiquid = 0
- print("XP: " .. liquidLevel .. "mB")
- print("Ticks: " .. ticks)
- while true do
- toggleRedstone("right", sleeprate)
- if tank.getTankInfo()[1].contents ~= nil then
- totalTankLiquid = totalTankLiquid + tank.getTankInfo()[1].contents.amount
- end
- if totalTankLiquid > liquidLevel then break end
- toggleRedstone("back", 0.2)
- end
- toggleRedstone("back", 1.0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement