@@ -13,6 +13,7 @@ local Tracker = {}
1313--- @field userCanEnable boolean When true , the user can enabled /disable the tracker , otherwise the tracker is controlled by TLBE
1414--- @field moveToNextTracker boolean | nil Disables the tracker after the cameras are processed (end of game tick )
1515--- @field changeId integer Incremented on each position /size change of the tracker
16+ --- @field cubePadding number Padding (in tiles ) applied around the cube area when multiple cubes are present
1617--- @field centerPos MapPosition.0 | nil Center position of the tracker area (Calculated from minPos and maxPos )
1718--- @field size MapPosition.0 | nil Size of the tracker area (Calculated from minPos and maxPos )
1819--- @field minPos MapPosition.0 Bottom /Left of tracker area
@@ -61,9 +62,10 @@ function Tracker.newTracker(player, trackerType, trackerList)
6162 smooth = true ,
6263 untilBuild = false ,
6364 changeId = 0 ,
65+ cubePadding = 0 ,
6466 -- Set some sensible defaults but will be most likely overwritten by the tracker specific implementations
6567 minPos = { x = - 5 , y = - 5 },
66- maxPos = { x = 5 , y = 5 }
68+ maxPos = { x = 5 , y = 5 },
6769 }
6870
6971 -- Add tracker specific details
@@ -178,23 +180,23 @@ function Tracker.tick(tracker, player)
178180 local size
179181
180182 if minPos ~= nil and maxPos ~= nil then
181- local sizeX = maxPos .x - minPos .x
182- local sizeY = maxPos .y - minPos .y
183+ local baseSizeX = maxPos .x - minPos .x
184+ local baseSizeY = maxPos .y - minPos .y
183185
184- if sizeX == 0 then
185- sizeX = 1
186+ if baseSizeX == 0 then
187+ baseSizeX = 1
186188 end
187- if sizeY == 0 then
188- sizeY = 1
189+ if baseSizeY == 0 then
190+ baseSizeY = 1
189191 end
190192
191193 size = {
192- x = sizeX ,
193- y = sizeY
194+ x = baseSizeX + 2 * tracker . cubePadding ,
195+ y = baseSizeY + 2 * tracker . cubePadding
194196 }
195197 centerPos = {
196- x = minPos .x + size . x / 2 ,
197- y = minPos .y + size . y / 2
198+ x = minPos .x + baseSizeX / 2 ,
199+ y = minPos .y + baseSizeY / 2
198200 }
199201 elseif info .position ~= nil then
200202 centerPos = {
0 commit comments