Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --IC2 Reinforced Stone automation
- --Sand autonomous activator logic
- --declare variables that persist across iterations
- local pulseTriggered, foamState, activatorState = false, false, false
- while true do
- local foamExists = rs.getInput("bottom")
- local activatorEmpty = rs.getInput("back")
- --check if the input from CF Turtle master changed
- if foamExists ~= foamState then
- pulseTriggered = false
- end
- --relay input to next computer
- rs.setOutput("top", foamExists)
- --output signal to export bus if foam in system and activator is empty
- if not pulseTriggered then
- rs.setOutput("left", (foamExists and activatorEmpty))
- print("sand export = "..tostring((foamExists and activatorEmpty)))
- end
- --update variables carried to next iteration
- if (foamExists and activatorEmpty) ~= (foamState and activatorState) then
- pulseTriggered = true
- end
- foamState = foamExists
- activatorState = activatorEmpty
- --wait for redstone signal change
- os.pullEvent("redstone")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement