feat: Enhance turtle model and visualization with block surroundings and world block management

This commit is contained in:
MayaTheShy
2026-02-16 01:35:52 -05:00
parent 836d734b1f
commit 5ec385c1f2
4 changed files with 312 additions and 28 deletions

View File

@@ -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