Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- RedstoneControl Main PC
- The goal is to have this main PC handle Rednet signals directed at it, and do actions depending on the signal.
- Also it has a huge monitor. Because why not?
- 0 123456789012345678901234567
- +---------------------------+
- 1| ---- | System Status |
- 2| | | |--------------------|
- 3| |##| |Lift: Stopped - B1F |
- 4| |##| |Storage: Pipe Jam |
- 5| |##| | | <-- Looks plain, needs more detection.
- 6| |##| |BT: Moderate |
- 7| |##| |Mchn Room: Pipe Jam |
- 8| |##| |BC Engines: No Power|
- 9| |##| |Farms: Working |
- 0| ---- | |
- 1| EU | |
- +---------------------------+
- EU meter depends on BatBox ability to give off a redstone signal when not empty.
- Requires 8 BatBoxes / MFEs / MFSUs to work.
- Constantly send PC signals and check for ping to see if PCs are OK
- Use Item Detector in Stuffed Mode to check if storage has a pipe jam []TR==ID==>
- The computer itself handles lift redstone signals, so it'll always know.
- EU will show as full when EUBats[8] still has power, but is not full.
- EU will show with 1 pip when EUBats[1] still has power, but is not full.
- EU will show with 0 pips when no EUBats have any energy left.
- Lift controlled by PC - PC always knows where it is.
- Storage managed by Item Detectors, if there's a permanent power going out, something's stuck
- BT.. no clue
- Machine Room same as storage
- BC Engines.. no clue
- Farms using Item Detectors again, *should* work.
- --]]
- -- * * * VARIABLES * * *
- detectSide = "bottom" -- Detect EU and Storage
- rednetSide = "top"
- monSide = "back"
- outputSide = "left" -- Output lift movement.
- floorSize = 8
- liftFloor = 4
- targetLiftFloor = 0
- -- * * * CODE * * *
- rednet.open(rednetSide)
- function moveLift()
- print("Moving Lift..")
- local moveLift = true
- while moveLift do
- if liftFloor < targetLiftFloor then
- print("Going up!")
- for i=1,floorSize do
- rs.setBundledOutput(outputSide, colors.white)
- sleep(0.1)
- rs.setBundledOutput(outputSide, colors.white + colors.red)
- sleep(0.4)
- rs.setBundledOutput(outputSide, 0)
- sleep(0.5)
- end
- liftFloor = liftFloor + 1
- elseif liftFloor > targetLiftFloor then
- print("Going down!")
- for i=1,floorSize do
- rs.setBundledOutput(outputSide, colors.orange)
- sleep(0.1)
- rs.setBundledOutput(outputSide, colors.orange + colors.yellow)
- sleep(0.4)
- rs.setBundledOutput(outputSide, 0)
- sleep(0.5)
- end
- liftFloor = liftFloor - 1
- else
- moveLift = false
- print("Going nowhere!")
- end
- end
- end
- moveLift()
- rednet.broadcast("[RedCTRL] liftMoved B1F !")
- while true do
- local events = {os.pullEvent()}
- if events[1] == "rednet_message" then
- if events[3] == "[RedCTRL] moveLift B1F !" then
- targetLiftFloor = 0
- rednet.broadcast("[RedCTRL] liftMoving !")
- moveLift()
- rednet.broadcast("[RedCTRL] liftMoved B1F !")
- elseif events[3] == "[RedCTRL] moveLift 1F !" then
- targetLiftFloor = 1
- rednet.broadcast("[RedCTRL] liftMoving !")
- moveLift()
- rednet.broadcast("[RedCTRL] liftMoved 1F !")
- elseif events[3] == "[RedCTRL] moveLift 2F !" then
- targetLiftFloor = 2
- rednet.broadcast("[RedCTRL] liftMoving !")
- moveLift()
- rednet.broadcast("[RedCTRL] liftMoved 2F !")
- elseif events[3] == "[RedCTRL] moveLift 3F !" then
- targetLiftFloor = 3
- rednet.broadcast("[RedCTRL] liftMoving !")
- moveLift()
- rednet.broadcast("[RedCTRL] liftMoved 3F !")
- elseif events[3] == "[RedCTRL] moveLift 4F !" then
- targetLiftFloor = 4
- rednet.broadcast("[RedCTRL] liftMoving !")
- moveLift()
- rednet.broadcast("[RedCTRL] liftMoved 4F !")
- elseif events[3] == "[RedCTRL] sendMeLift !" then
- if liftFloor == 0 then
- rednet.broadcast("[RedCTRL] liftMoved B1F !")
- else
- rednet.broadcast("[RedCTRL] liftMoved "..liftFloor.."F !")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement