Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Copyright 2012 John Paul Alcala
- --
- -- Licensed under the Apache License, Version 2.0 (the "License");
- -- you may not use this file except in compliance with the License.
- -- You may obtain a copy of the License at
- --
- -- http://www.apache.org/licenses/LICENSE-2.0
- --
- -- Unless required by applicable law or agreed to in writing, software
- -- distributed under the License is distributed on an "AS IS" BASIS,
- -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- -- See the License for the specific language governing permissions and
- -- limitations under the License.
- local args = { ... }
- local cableLocation = "bottom"
- local drainPump = colors.black
- local fillPump = colors.blue
- local doorLock = colors.red
- local fillTime = 30
- local drainTime = 45
- local isDoorClosed = redstone.testBundledInput(cableLocation, doorLock)
- local pumpControl = function(cableLocation, op, time)
- redstone.setBundledOutput(cableLocation, op)
- sleep(time)
- redstone.setBundledOutput(cableLocation, 0)
- end
- local fillAirlock = function()
- if isDoorClosed then
- print("Filling Airlock.")
- pumpControl(cableLocation, fillPump, fillTime)
- else
- print("Close the door first!")
- end
- end
- local drainAirlock = function()
- print("Draining Airlock.")
- pumpControl(cableLocation, drainPump, drainTime)
- end
- local checkArguments = function()
- local arg = args[1]
- if arg == "fill" then
- fillAirlock()
- elseif arg == "drain" then
- drainAirlock()
- end
- end
- -- check args
- if #args > 0 then
- checkArguments()
- else
- print("pumpcontrol [fill/drain]")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement