fix: Enhance message logging for modem events and status updates

This commit is contained in:
MayaTheShy
2026-02-16 00:52:25 -05:00
parent a2d43d0cfb
commit 8172431e44

View File

@@ -60,9 +60,18 @@ end
while true do
local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
if channel == STATUS_CHANNEL and type(message) == "table" then
print("Received modem message on channel " .. channel)
if type(message) == "table" then
print(" Message type: " .. (message.type or "no type"))
print(" Turtle ID: " .. tostring(message.turtleID))
else
print(" Message is not a table, it's: " .. type(message))
end
if channel == STATUS_CHANNEL and type(message) == "table" and message.type == "status" then
-- Status update from turtle
print("Status from Turtle " .. (message.turtleID or "?"))
print("✓ Valid status from Turtle " .. (message.turtleID or "?"))
-- Update local cache
turtles[message.turtleID] = message