Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- TO INSTALL JUST EXECUTE: pastebin get W8StF2e0 gasmining.lua
- local component = require("component")
- local compuer = require("computer")
- local shell = require("shell")
- local sides = require("sides")
- local arguments_as_a_table = {...}
- local detector = {}
- GasMiningAlarm = component.proxy("5787f052-4b3a-4882-9314-bcf26a68c82c")
- GasMiningControl = component.proxy("1b1103ea-3683-4177-854e-0fbe11efb5b1")
- GasMiningDoorUp = component.proxy("7e686f3e-3791-4b80-af3d-70e6a21642c2")
- GasMiningDoorDown = component.proxy("4030d6f6-4f5a-4467-9826-138fa6d70940")
- GasMiningDetector = component.proxy("e2f77baa-394c-4dae-9d66-3a2adedc3ae0")
- local function startRocket(alarm, doorUp, doorDown, control, detector)
- alarm.setRange(2)
- alarm.activate()
- print("!!!Caution!!!")
- print("Starting mining mission")
- print("LEAVE rocket platform imidietly!!!")
- print("We will lock doors soon")
- os.sleep(3)
- for t=10,0,-1 do
- print("t - "..t)
- os.sleep(1)
- end
- doorUp.setOutput(sides.up,15)
- os.sleep(3)
- doorDown.setOutput(sides.up,0)
- --start rocket
- control.setOutput(sides.up,15)
- os.sleep(1)
- control.setOutput(sides.up,0)
- os.sleep(20)
- alarm.deactivate()
- --wait for rocket
- local rocketPresent = false
- while rocketPresent == false do
- local entityScan = detector.scanEntities(7)
- if entityScan ~= false and #entityScan ~= 0 then
- for k in pairs(entityScan) do
- if entityScan[k].name == "entity.deployedRocket.name" then
- rocketPresent = true
- print("rocket there: "..entityScan[k].name)
- end
- end
- end
- if rocketPresent == false then
- print("rocket is absent, waiting...")
- os.sleep(5)
- end
- end
- --close door
- os.sleep(3)
- doorDown.setOutput(sides.up,15)
- os.sleep(3)
- doorUp.setOutput(sides.up,0)
- os.sleep(3)
- end
- --program starts here--
- startRocket(GasMiningAlarm, GasMiningDoorUp, GasMiningDoorDown, GasMiningControl, GasMiningDetector)
Advertisement
Add Comment
Please, Sign In to add comment