Posted 30 April 2014 - 05:35 PM
What is this? The code is supposed to open/close a drawbridge from TMech T-flip-flop style. WHAT IS GOING ON?
drawbridge = false
function updateBundle(side, new, old)
cur = rs.getBundledOutput(side)
if new then
cur = colors.combine(cur, new)
end
if old then
cur = colors.subtract(cur, old)
end
rs.setBundledOutput(side, cur)
end
function testIfDraw()
if rs.testBundledInput("left", colors.brown) then
drawbridge = not drawbridge
updateDrawbridge()
sleep(1)
end
end
function updateDrawbridge()
if drawbridge == false then
updateBundle("left", colors.yellow)
sleep(0.5)
updateBundle("left", colors.orange)
elseif drawbridge == true then
updateBundle("left", nil, colors.orange)
sleep(0.5)
updateBundle("left", nil, colors.yellow)
end
end
while rs.getInput("top") do
testIfDraw()
end