feat: Enhance status broadcasting in turtle; include additional logging for better visibility
This commit is contained in:
12
turtle.lua
12
turtle.lua
@@ -424,6 +424,10 @@ function broadcastStatus()
|
|||||||
print("Broadcasting with NO POSITION (waiting for GPS)")
|
print("Broadcasting with NO POSITION (waiting for GPS)")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
print("📡 Broadcasting status on channel " .. STATUS_CHANNEL)
|
||||||
|
print(" Turtle ID: " .. os.getComputerID())
|
||||||
|
print(" Mode: " .. state.mode)
|
||||||
|
|
||||||
-- Scan surrounding blocks for map visualization
|
-- Scan surrounding blocks for map visualization
|
||||||
local surroundings = {}
|
local surroundings = {}
|
||||||
local hasBlock, data
|
local hasBlock, data
|
||||||
@@ -446,7 +450,7 @@ function broadcastStatus()
|
|||||||
surroundings.down = {name = data.name, metadata = data.metadata or 0}
|
surroundings.down = {name = data.name, metadata = data.metadata or 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
modem.transmit(STATUS_CHANNEL, CHANNEL_RECEIVE, {
|
local statusPacket = {
|
||||||
type = "status",
|
type = "status",
|
||||||
turtleID = os.getComputerID(),
|
turtleID = os.getComputerID(),
|
||||||
mode = state.mode,
|
mode = state.mode,
|
||||||
@@ -457,7 +461,11 @@ function broadcastStatus()
|
|||||||
inventory = state.inventory,
|
inventory = state.inventory,
|
||||||
facing = facing,
|
facing = facing,
|
||||||
surroundings = surroundings
|
surroundings = surroundings
|
||||||
})
|
}
|
||||||
|
|
||||||
|
print(" Packet type: " .. statusPacket.type)
|
||||||
|
modem.transmit(STATUS_CHANNEL, CHANNEL_RECEIVE, statusPacket)
|
||||||
|
print(" ✅ Status broadcast complete")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return to home step (non-blocking)
|
-- Return to home step (non-blocking)
|
||||||
|
|||||||
Reference in New Issue
Block a user