Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cam, fp1, fp2
- local tryWrap = true
- local wl = {"drPepper"}
- while tryWrap do
- if not cam then
- local sides = peripheral.getNames()
- for _, side in pairs(sides) do
- if peripheral.getType(side) == "warpdriveCamera" then
- cam = peripheral.wrap(side)
- print("Wrapped warpdriveCamera on " .. side .. " side")
- end
- end
- end
- if not fp1 then
- if peripheral.getType("top") == "warpdriveForceFieldProjector" then
- fp1 = peripheral.wrap("top")
- print("Wrapped warpdriveForceFieldProjector 1")
- end
- end
- if not fp2 then
- if peripheral.getType("bottom") == "warpdriveForceFieldProjector" then
- fp2 = peripheral.wrap("bottom")
- print("Wrapped warpdriveForceFieldProjector 2")
- end
- end
- if not cam or not fp1 or not fp2 then
- sleep(2)
- else
- tryWrap = false
- end
- end
- --TODO set params for the peripherals
- local doEnable = false
- while true do
- local rCnt = cam.getResultsCount()
- doEnable = rCnt > 0
- if not doEnable then
- print(textutils.formatTime(os.time("local")), "Disabling...")
- fp1.enable(false)
- fp2.enable(false)
- end
- for i_r = 0, rCnt-1 do
- local ok, entityType, entityName = cam.getResult(i_r)
- if ok then
- print(textutils.formatTime(os.time("local")), entityName)
- for _, name in pairs(wl) do
- if entityName == name then
- doEnable = false
- print("found " .. name)
- end
- end
- end
- end
- if doEnable then
- print("Firing...")
- if not fp1.enable() then
- fp1.enable(true)
- end
- --fp2.enable(true)
- sleep(10)
- else
- sleep(0.5)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement