local tileTextData = {}
function init()
ProtocolGame.registerExtendedOpcode(76, handleTileTextData)
end
function terminate()
ProtocolGame.unregisterExtendedOpcode(76)
end
function handleTileTextData(_, _, data)
local positions = {}
for entry in data:gmatch("[^;]+") do
local x, y, z, text = entry:match("([^,]+),([^,]+),([^,]+),(.+)")
if x and y and z and text then
table.insert(positions, {x = tonumber(x), y = tonumber(y), z = tonumber(z), text = text})
end
end
tileTextData = {}
for _, posData in ipairs(positions) do
local hash = getTileHash(posData.x, posData.y, posData.z)
tileTextData[hash] = posData.text
end
createWidgetsForTiles()
end
function createWidgetsForTiles()
for _, posData in pairs(tileTextData) do
local tilePos = {x = posData.x, y = posData.y, z = posData.z}
local widget = g_ui.createWidget('Panel')
widget:setSize({width = 150, height = 22}) -- Adjust size as necessary
widget:setText(posData.text)
widget:setFont("terminus-10px")
widget:setBackgroundColor('#111111cc')
widget:setMarginBottom(40)
widget:setVisible(true)
end
end
function getTileHash(x, y, z)
return tostring(x) .. "," .. tostring(y) .. "," .. tostring(z)
end