Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --File: /cattech/comms.lua
- function initializeRednetModem()
- local sides = {"left", "right", "top", "bottom", "front", "back"}
- for _, side in ipairs(sides) do
- if peripheral.isPresent(side) then
- local peripheralType = peripheral.getType(side)
- if peripheralType == "modem" or peripheralType == "ender_modem" then
- rednet.open(side) -- Initialize rednet on the modem
- log("debug",peripheralType .. " available on " .. side .. ". Rednet active.")
- return true
- else
- log("debug","Peripheral found : " .. (peripheralType or "none"))
- end
- end
- end
- log("error","No modem found on any side.")
- return false
- end
- function chunkload()
- local turtleName = os.getComputerLabel()
- local message = "err chunkload " .. (turtleName or "unnamed")
- local x, y, z = gps.locate(5) -- Attempt to locate with a timeout of 5 seconds
- --if x then
- local message = string.format("chunkLoad %d %d %d", x, y, z)
- --end
- log("debug","Sending: " .. message)
- rednet.broadcast(message,"worldServer")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement