Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local controller = peripheral.wrap("right")
- local g_level = controller.getTargetSpeed()
- local statelist = {
- ["top"] = redstone.getInput("top"),
- ["left"] = redstone.getInput("left"),
- }
- local function init()
- end
- local function set_speed(pLevel)
- g_level = g_level + pLevel
- if g_level > 256 then
- g_level =256
- elseif g_level < -256 then
- g_level = -256
- end
- -- print(g_level)
- controller.setTargetSpeed(g_level)
- end
- local function redstoneCheck()
- while true do
- os.pullEvent("redstone")
- for side, state in pairs(statelist) do
- if redstone.getInput(side) ~= false then
- if side == "top" then
- set_speed(4)
- elseif side == "left" then
- set_speed(-4)
- end
- break
- end
- end
- end
- end
- -- parallel.waitForAny(redstoneCheck)
- redstoneCheck()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement