Closed MegadreamsBE closed 1 month ago
Updated based on the reviews (except the enum name, which I kept the way it is as Hungarian notation is not used in the codebase anymore).
Good code reviews, and a fairly small change. Thanks!
This won't work with objects (tested) but with buildings everything is fine.
Adds a new function enginePreloadWorldArea. This function takes in three required parameters, x, y and z for the position and a fourth optional parameter, option, which is a string (or actually an enum in the code) with the following valid values:
The game determines the zone the given coordinates are in and loads everything in it. This function is not radius based (as the underlying game functions aren't either).
The game will automatically unload this area based on its own internal rule, often this can already happen the next frame. This functions loads in the area immediately so it's advisable to do the desired action, such as teleporting a player/ped/vehicle, or getting the position of the ground in the same frame.
Some use cases: Load in the area, then retrieve the ground position at the desired location, then teleport the location to that location. The map will already be loaded, and the player is neatly put on the ground.
Load in the area (collisions only), then retrieve the ground position at the desired location and output it.
NOTE: This function has been tested with the building removal functions and is not conflicting with them.