Skip to content

Lua: Blockmap search library backport

Monster Iestyn requested to merge searchblockmap-backport into next

I have added a new Blockmap search library! (with a new file: lua_blockmaplib.c)

  • Format of iteration function: searchBlockmap(searchtype, function, mobj, [x1, x2, y1, y2]). Returns true if search was uninteruppted, false if the iteration function returned true or false at any point
  • searchtype can be either "objects" or "lines", for looking for mobj_t and line_t stuff in the blockmap respectively
  • function is a function of your choice to iterate with:
    • format of function needed: funcname(mobj, foundmobj) or funcname(mobj, foundline) (for searching for objects and lines, respectively)
    • return value of function affects searching somewhat: nil doesn't change searching, false ends searching in a block (but doesn't stop searching, it just moves onto the next), and true ends the full search. Both returning true or false ultimately makes searchBlockmap return false.
  • mobj is the reference mobj that you're checking around (if you don't supply x/y ranges to search in, it defaults to checking within the mobj's radius in both axes). If mobj was removed mid-search the search stops and searchBlockmap returns false
  • (optional) x1, x2, y1, y2 are coordinates on the map to search the blockmap between, if given
Edited by Monster Iestyn

Merge request reports