Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local wi = peripheral.find("WorldInterface")
- local ed = peripheral.find("EntityDetector")
- if not (wi and ed) then
- rs.setOutput("left",true)
- printError("Missing interface: "..(wi and "" or "WorldInterface ")..(ed and "" or "EntityDetector")
- return
- end
- local _,name
- local watch = false
- local _floor = math.floor
- local present = {
- NaturalGeek = false,
- SukaiPoppuGo = false,
- }
- local prox = {
- NaturalGeek = false,
- SukaiPoppuGo = false,
- }
- local function watchUpdate()
- watch = false
- for _,name in pairs(wi.getPlayerList()) do
- if name=="NaturalGeek" then
- watch = true
- present.NaturalGeek = true
- end
- if name=="SukaiPoppuGo" then
- watch = true
- present.SukaiPoppuGo = true
- end
- if present.NaturalGeek and present.SukaiPoppuGo then
- return
- end
- end
- end
- local function check(playerName)
- local d = ed.getPlayerDetails(playerName)
- d = d[playerName]
- local x,y,z =_floor(d.x),_floor(d.y),_floor(d.z)}
- if y == 29
- and (
- (x==-588 and (z==130 or z==134 or z==135)
- or (x==-589 and z==130)
- ) then
- rs.setOutput("left",true)
- end
- return d.distance < 48
- end
- -- -588 29 135
- -- -588 29 134
- -- -588 29 130
- -- -589 29 130
- local delay = os.startTimer(.1)
- while true do
- os.pullEvent("timer")
- watchUpdate()
- if watch then
- if present.NaturalGeek then
- prox.NaturalGeek = check("NaturalGeek")
- end
- if present.SukaiPoppuGo then
- prox.SukaiPoppuGo = check("SukaiPoppuGo")
- end
- watch = prox.NaturalGeek or prox.SukaiPoppuGo
- end
- delay = os.startTimer(watch and 1 or 30)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement