Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("radarAPI.lua")
- on = {}
- function calculate(player)
- local num = math.pow(2, math.floor((player.y - 2) / 11))
- add(num)
- end
- function add(number)
- --print("add " .. number)
- local cur = redstone.getBundledOutput("right")
- if not colors.test(cur, number) then
- redstone.setBundledOutput("right", cur + number)
- end
- on["" .. number] = 5
- end
- function remove(number)
- --print("remove" .. number)
- local cur = redstone.getBundledOutput("right")
- if colors.test(cur, number) then
- redstone.setBundledOutput("right", cur - number)
- end
- end
- function check()
- for k, v in pairs(on) do
- -- print(k .. ": " .. v)
- if v == 0 then
- remove(tonumber(k))
- else
- on[k] = on[k] - 1
- end
- end
- end
- radarAPI.init("bottom", 0.1, nil, check)
- radarAPI.addArea(-1, 0, 2, 117, 0, 0, calculate)
- --radarAPI.addArea(-1, 0, 13, 18, 0, 0, function() add(2) end)
- --radarAPI.addArea(-1, 0, 24, 29, 0, 0, function() add(4) end)
- --radarAPI.addArea(-1, 0, 35, 40, 0, 0, function() add(8) end)
- --radarAPI.addArea(-1, 0, 46, 51, 0, 0, function() add(16) end)
- --radarAPI.addArea(-1, 0, 57, 62, 0, 0, function() add(64) end)
- --radarAPI.addArea(-1, 0, 68, 73, 0, 0, function() add(128) end)
- radarAPI.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement