Patch MapPosition and BoundingBox to the named form

The api documents both as a union with a positional array because both
are accepted as input, which makes every read of `.x` or `.left_top`
optional. Everything read back from the game uses the named form, so
the positional variant is removed and we now always write it that way
too.

The spawn area config offsets and the mine depletion search areas were
the only positional writes left, and apply_offset no longer needs its
fallback.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5 committed 2026-08-07 15:31:43 +00:00
1 parent 231c3a9ea0
commit b5bbf73332
4 files changed
+22 -14

No files matched your search

+4 -4
View File
@@ -10,8 +10,8 @@ local config = require("modules.exp_legacy.config.spawn_area")
--- @return MapPosition.struct
local function apply_offset(position, offset)
return {
x = assert(position.x or position[1]) + assert(offset.x or offset[1]),
y = assert(position.y or position[2]) + assert(offset.y or offset[2])
x = position.x + offset.x,
y = position.y + offset.y,
}
end
@@ -21,8 +21,8 @@ end
--- @param x_index number
--- @param y_index number
local function apply_offset_to_array(positions, offset, x_index, y_index)
local x = assert(offset.x or offset[1])
local y = assert(offset.y or offset[2])
local x = offset.x
local y = offset.y
for _, position in ipairs(positions) do
position[x_index] = position[x_index] + x
position[y_index] = position[y_index] + y