Updatesector

From EDukeWiki
(Redirected from Updatesectorneighbor)
Jump to navigation Jump to search

updatesector <in_x> <in_y> <in_out_sectnum>
updatesectorz <in_x> <in_y> <in_z> <in_out_sectnum>
updatesectorneighbour <in_x> <in_y> <in_out_sectnum> <initial distance> <max distance>
updatesectorneighbourz <in_x> <in_y> <in_z> <in_out_sectnum> <initial distance> <max distance>

Returns sector id of the sector containing the point (<in_x>,<in_y>) or (<in_x>,<in_y>,<in_z>) into <in_out_sectnum>. The final parameter must be pre-populated with what is assumed to be the correct sector, such as the sprite's pre-existing sectnum.

If the point is not a valid sector (like outside the map, inside a column, or below the floor), it returns -1. You should verify that the value return is not equal to -1 before manipulating the sector or you could have problems.

The "neighbour" counterparts are more performant for tasks that require determining whether nearby sectors exist at a point as they will not exhaustively search the map and has been added in since r7805