diff --git a/changelog/snippets/other.7155.md b/changelog/snippets/other.7155.md new file mode 100644 index 0000000000..ffbec8cc2c --- /dev/null +++ b/changelog/snippets/other.7155.md @@ -0,0 +1 @@ +- (#7155) Annotate `SetNavigatorPersonalPosMaxDistance` and check it exists before calling it. diff --git a/engine/Sim.lua b/engine/Sim.lua index 25e442043a..8aeffccdef 100644 --- a/engine/Sim.lua +++ b/engine/Sim.lua @@ -1194,6 +1194,19 @@ end function SetIgnorePlayableRect(army, ignore) end +--- Changes the distance at which the default navigator switches to a lower resolution +--- pathfinding grid (from "personal" per-unit waypoints to waypoints shared by many units), +--- typically resulting in units moving in columns over large distances instead of maintaining their formation. +--- +--- Default engine value is 50. +--- +--- Useful console commands for debugging: "dbg navwaypoints", "dbg navpath", "dbg navsteering" +--- +--- Introduced by https://github.com/FAForever/FA-Binary-Patches/pull/132 +---@param distance number +function SetNavigatorPersonalPosMaxDistance(distance) +end + --- sets the playable area of a map ---@param minX number ---@param minZ number diff --git a/lua/simInit.lua b/lua/simInit.lua index 48e3c8bcde..2505cc229a 100644 --- a/lua/simInit.lua +++ b/lua/simInit.lua @@ -586,7 +586,9 @@ end -- will be using personal positioning instead of waypoints for any move order (doesn't affect "formation move"). -- useful console commands for debugging: "dbg navwaypoints", "dbg navpath", "dbg navsteering" function SetupPathfinding() - SetNavigatorPersonalPosMaxDistance(9999) + if rawget(_G, "SetNavigatorPersonalPosMaxDistance") then + SetNavigatorPersonalPosMaxDistance(9999) + end end -- these imports break cycle dependencies of import sequences of mods