feat: Enhance turtle model and visualization with block surroundings and world block management
This commit is contained in:
25
turtle.lua
25
turtle.lua
@@ -358,6 +358,28 @@ function broadcastStatus()
|
||||
-- Don't update position on every broadcast to avoid GPS delays
|
||||
-- Position will be updated by movement functions
|
||||
|
||||
-- Scan surrounding blocks for map visualization
|
||||
local surroundings = {}
|
||||
local hasBlock, data
|
||||
|
||||
-- Check forward
|
||||
hasBlock, data = turtle.inspect()
|
||||
if hasBlock and data then
|
||||
surroundings.forward = {name = data.name, metadata = data.metadata or 0}
|
||||
end
|
||||
|
||||
-- Check up
|
||||
hasBlock, data = turtle.inspectUp()
|
||||
if hasBlock and data then
|
||||
surroundings.up = {name = data.name, metadata = data.metadata or 0}
|
||||
end
|
||||
|
||||
-- Check down
|
||||
hasBlock, data = turtle.inspectDown()
|
||||
if hasBlock and data then
|
||||
surroundings.down = {name = data.name, metadata = data.metadata or 0}
|
||||
end
|
||||
|
||||
modem.transmit(STATUS_CHANNEL, CHANNEL_RECEIVE, {
|
||||
type = "status",
|
||||
turtleID = os.getComputerID(),
|
||||
@@ -367,7 +389,8 @@ function broadcastStatus()
|
||||
fuel = state.fuel,
|
||||
inventoryCount = #state.inventory,
|
||||
inventory = state.inventory,
|
||||
facing = facing
|
||||
facing = facing,
|
||||
surroundings = surroundings
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user