Skip to content

Expose P_PathTraverse to Lua

MIDIMan requested to merge MIDIMan/SRB2:expose-path-traverse into next

Exposes P_PathTraverse to Lua, allowing modders to search objects and linedefs touching a line within specified coordinates. Also exposes PT_ADDLINES, PT_ADDTHINGS, and PT_EARLYOUT to pass in as flags for P_PathTraverse.

This MR also fixes some blockmap bugs:

  • Fixes #1025 by adding a new argument to P_BlockThingsIterator that takes an mobj_t and checks for it, instead of just checking for tmthing.
  • Fixes a few bugs with P_PathTraverse itself:
    • Ports over a couple of fixes regarding path traversal from ZDoom (traversing through blockmap corners, etc.).
    • Fixes incorrect calculation(s) of partial (now partialx and partialy), xstep, ystep, xintercept, and yintercept.
    • Path traversals can now go beyond a map's blockmap limit, granted they stay within the hardcoded limit of 65536x65536.

Example Lua: P_PathTraverseTesting.lua

Special thanks to the following users for helping me out with this MR:

  • Golden (This MR was based off of the p-path-traverse-lua-exposure branch, which Golden worked on)
  • Monster Iestyn (For helping me figure out how to pass in a Lua function as a parameter)
  • AlamTaz (For helping me figure out why my branch was failing to build)
  • Anyone else who helped out (I hope I didn't forget anyone...)

Merge request reports

Loading