Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sensor = peripheral.find "plethora:sensor"
- local modem = peripheral.find "modem"
- local channel = 49961
- local offset = vector.new(-3, -3, 2)
- local function randbytes(len)
- local out = ""
- for i = 1, len do
- out = out .. string.char(math.random(0, 255))
- end
- return out
- end
- local function main()
- while true do
- local entities = sensor.sense()
- local open = false
- for _, entity in pairs(entities) do
- local position = vector.new(entity.x, entity.y, entity.z) + offset
- if entity.displayName == "6_4" or entity.displayName == "gollark" and position:length() < 4 then
- open = true
- end
- end
- math.randomseed(math.floor(os.clock() * 100))
- local rc = math.random(0, 65535)
- modem.transmit(channel, rc, open)
- print(open, rc)
- sleep(0.1)
- end
- end
- main()
Add Comment
Please, Sign In to add comment