Skip to content

respect pathTo flags when sending a new point

MowFord requested to merge MowFord/wings:pathTo_fixes into master

[] I have read, understood and agreed to the contributor's agreement. I understand that Project Wings operates under the GNU GPL licensing structure, which can be found here: https://www.gnu.org/licenses/gpl-3.0.en.html

[] I am either the the sole copyright owner of the code or I am acting on behalf of and with the permission of the copyright holder to push the code within this merge request under the GNU GPL license. The credited party, if not myself, should be:

[] My request includes a C++ change. I have compiled the project and run a debug build within a debugging enviornment, and fixed any issues including assertion errors. I have checked my code for, and closed any memory allocations so as not to possibly introduce a memory leak.

[] My request includes a Lua change. I have enabled full debug logs and fixed all errors and warnings displayed on startup and during my tests, including any navmesh errors.

[] My request includes a SQL change. I have imported all modified SQL files into my local database and verified that there are no syntax errors.

[] I confirm that I've run basic sanity tests on my contribution. This includes not only the above checkboxes, but also basic interactions with your code contribution in a test environment. (Such as a local install or hosted VPS.) Contributors that frequently do not test their code may not have future merge requests approved.

DESCRIBE IN LAYMAN'S TERMS WHAT YOUR MERGE REQUEST IS MEANT TO ACCOMPLISH HERE

This is a pretty core change, which always makes me nervous. But what follows is a tale of woe and a happy ending 😉

  • lua_baseentity has a function pathTo which let's you force a path point. It clears all other paths in the queue and if you set the "scripted" flag it follows that path until completion.
    • Wulgaru is a good example of a mob that uses this
  • At some point it worked as expected, but unsure when as the core functionality of pathfind.cpp's function pathTo clears after setting flags for the new point, essentially ignoring the flags and letting mob_controller Move() function send the mob to the player if they are out of melee range.
  • This MR removes that second, erroneous clear() call (it's called above in the same function, before recording the pathFlags
  • This MR also adjusts the lua isMobFollowingPath() function to allow passing a number (any number) to return isFollowingScriptedPath(), to help diagnose things if this change breaks things (as core changes like this can sometimes do)
    • Ex: image

Provide a "patch note" for your merge request here. This patch note will be directly copy and pasted into the #patch-notes section of the Wings Discord when this content is patched to the live server. Make sure to include whatever in-game name you would like people to see in parenthesis after the patch note.

  • Scripted paths for mobs should now work as they should (MowFord)

Merge request reports