Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sleepTime = .1
- local open = false
- local modemPos = 'top'
- local bundleCableSide = 'bottom'
- local topPistonColor = colors.black
- local bottomPistonColor = colors.white
- local upMotorColor = colors.green
- local downMotorColor = colors.orange
- function enableColor(color)
- rs.setBundledOutput(bundleCableSide, colors.combine(rs.getBundledOutput(bundleCableSide), color))
- os.sleep(sleepTime)
- end
- function disableColor(color)
- rs.setBundledOutput(bundleCableSide, colors.subtract(rs.getBundledOutput(bundleCableSide), color))
- os.sleep(sleepTime)
- end
- function resetColors()
- rs.setBundledOutput(bundleCableSide, 0)
- os.sleep(sleepTime)
- end
- function pulseColor(color, repeatNbr, delay)
- for i=1,repeatNbr do
- enableColor(color)
- os.sleep(delay)
- disableColor(color)
- os.sleep(delay)
- end
- end
- function doorUp(num)
- pulseColor(upMotorColor, num, .18)
- end
- function doorDown(num)
- pulseColor(downMotorColor, num, .18)
- end
- function topPiston(boolVal)
- if boolVal
- then
- enableColor(topPistonColor)
- else
- disableColor(topPistonColor)
- end
- end
- function bottomPiston(boolVal)
- if boolVal
- then
- enableColor(bottomPistonColor)
- else
- disableColor(bottomPistonColor)
- end
- end
- function openDoor()
- topPiston(false)
- doorUp(1)
- bottomPiston(true)
- doorUp(6)
- topPiston(true)
- end
- function closeDoor()
- topPiston(false)
- doorDown(6)
- bottomPiston(false)
- doorDown(1)
- topPiston(true)
- end
- function resetDoor()
- openDoor()
- end
- function resetPistons()
- topPiston(false)
- bottomPiston(false)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement