Skip to content

Commit

Permalink
Revert "Revert "feat(navmesh/scenario): Update various natives (#1025)…
Browse files Browse the repository at this point in the history
…" (#1042)" (#1049)

This reverts commit dde8f66 and should effectively resolve the previous issue where `BOOL` to `int` changes caused breakage related to native TaskFollowNavMeshToCoord.
  • Loading branch information
4mmonium authored Mar 8, 2024
1 parent 6a42385 commit b9bb128
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 66 deletions.
18 changes: 14 additions & 4 deletions PATHFIND/AddNavmeshBlockingObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ ns: PATHFIND

```c
// 0xFCD5C8E06E502F5A 0x2952BA56
Any ADD_NAVMESH_BLOCKING_OBJECT(float x, float y, float z, float width, float length, float height, float heading, BOOL p7, Any p8);
Any ADD_NAVMESH_BLOCKING_OBJECT(float x, float y, float z, float width, float length, float height, float heading, BOOL bPermanent, int flags);
```
Creates a navmesh blocking object, vehicles will avoid driving through this area.
Only 32 blocking objects may exist at a given time and must be manually managed. See [`REMOVE_NAVMESH_BLOCKING_OBJECT`](#\_0x46399A7895957C0E) and [onResourceStop](https://docs.fivem.net/docs/scripting-reference/events/list/onResourceStop/)
Only 32 blocking objects may exist at a given time and must be manually managed. See [`REMOVE_NAVMESH_BLOCKING_OBJECT`](#_0x46399A7895957C0E) and [`onResourceStop`](https://docs.fivem.net/docs/scripting-reference/events/list/onResourceStop/)
```
enum eBlockingObjectFlags {
BLOCKING_OBJECT_DEFAULT = 0, // Default Flag
BLOCKING_OBJECT_WANDERPATH = 1, // Blocking object will block wander paths
BLOCKING_OBJECT_SHORTESTPATH = 2, // Blocking object will block (regular) shortest-paths
BLOCKING_OBJECT_FLEEPATH = 4, // Blocking object will block flee paths
BLOCKING_OBJECT_ALLPATHS = 7, // Blocking object will block all paths
}
```
## Parameters
* **x**: The x coordinate to create the block on.
Expand All @@ -20,7 +30,7 @@ Only 32 blocking objects may exist at a given time and must be manually managed.
* **length**: The length of the block.
* **height**: The height of the block.
* **heading**: The heading of object in degrees.
* **p7**: Usually false.
* **p8**: A bitfield; usually 7.
* **bPermanent**: A boolean indicating if the blocking object is permanent (`true`/`false`).
* **flags**: Flag for the blocking object, refer to `eBlockingObjectFlags`.
## Return value
18 changes: 10 additions & 8 deletions PATHFIND/DisableNavmeshInArea.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ ns: PATHFIND

```c
// 0x4C8872D8CDBE1B8B 0x6E37F132
void DISABLE_NAVMESH_IN_AREA(Any p0, Any p1, Any p2, Any p3, Any p4, Any p5, Any p6);
void DISABLE_NAVMESH_IN_AREA(cs_type(Any) float posMinX, cs_type(Any) float posMinY, cs_type(Any) float posMinZ, cs_type(Any) float posMaxX, cs_type(Any) float posMaxY, cs_type(Any) float posMaxZ, cs_type(Any) bool bDisable);
```
Use this if you want to completely disable a large area of navmesh.
For smaller areas, use [`ADD_NAVMESH_BLOCKING_OBJECT`](#_0xFCD5C8E06E502F5A) instead.
## Parameters
* **p0**:
* **p1**:
* **p2**:
* **p3**:
* **p4**:
* **p5**:
* **p6**:
* **posMinX**: X Min Coordinate.
* **posMinY**: Y Min Coordinate.
* **posMinZ**: Z Min Coordinate.
* **posMaxX**: X Max Coordinate.
* **posMaxY**: Y Max Coordinate.
* **posMaxZ**: Z Max Coordinate.
* **bDisable**: Whether to disable the navmesh or not.
16 changes: 8 additions & 8 deletions PATHFIND/GetNumNavmeshesExistingInArea.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ aliases: ["0x01708E8DD3FF8C65"]

```c
// 0x01708E8DD3FF8C65 0x76AFFBB5
int GET_NUM_NAVMESHES_EXISTING_IN_AREA(float p0, float p1, float p2, float p3, float p4, float p5);
int GET_NUM_NAVMESHES_EXISTING_IN_AREA(float posMinX, float posMinY, float posMinZ, float posMaxX, float posMaxY, float posMaxZ);
```
## Parameters
* **p0**:
* **p1**:
* **p2**:
* **p3**:
* **p4**:
* **p5**:
* **posMinX**: Min X Coordinate.
* **posMinY**: Min Y Coordinate.
* **posMinZ**: Min Z Coordinate.
* **posMaxX**: Max X Coordinate.
* **posMaxY**: Max Y Coordinate.
* **posMaxZ**: Max Z Coordinate.
## Return value
Returns the number of navmeshes which exist in the given area (irrespective of whether they are currently loaded or not)
21 changes: 10 additions & 11 deletions PATHFIND/UpdateNavmeshBlockingObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ ns: PATHFIND

```c
// 0x109E99373F290687 0x4E9776D0
void UPDATE_NAVMESH_BLOCKING_OBJECT(Any p0, float p1, float p2, float p3, float p4, float p5, float p6, float p7, Any p8);
void UPDATE_NAVMESH_BLOCKING_OBJECT(Object object, float posX, float posY, float posZ, float scaleX, float scaleY, float scaleZ, float heading, int flags);
```
## Parameters
* **p0**:
* **p1**:
* **p2**:
* **p3**:
* **p4**:
* **p5**:
* **p6**:
* **p7**:
* **p8**:
* **object**: Navmesh Blocking Object by ID. must be returned by [`ADD_NAVMESH_BLOCKING_OBJECT`](#_0xFCD5C8E06E502F5A).
* **posX**: X position coordinate.
* **posY**: Y position coordinate.
* **posZ**: Z position coordinate.
* **scaleX**: X Scale.
* **scaleY**: Y Scale.
* **scaleZ**: Z Scale.
* **heading**: Heading of the blocking object.
* **flags**: Flags for the blocking object, see [`ADD_NAVMESH_BLOCKING_OBJECT`](#_0xFCD5C8E06E502F5A) for list of blocking object flags.
24 changes: 13 additions & 11 deletions PED/AddScenarioBlockingArea.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ ns: PED

```c
// 0x1B5C85C612E5256E 0xA38C0234
int ADD_SCENARIO_BLOCKING_AREA(float x1, float y1, float z1, float x2, float y2, float z2, BOOL p6, BOOL p7, BOOL p8, BOOL p9);
int ADD_SCENARIO_BLOCKING_AREA(float posMinX, float posMinY, float posMinZ, float posMaxX, float posMaxY, float posMaxZ, BOOL network, BOOL cancelActive, BOOL blockPeds, BOOL blockVehicles);
```
Sets an area where scenarios are blocked
## Parameters
* **x1**:
* **y1**:
* **z1**:
* **x2**:
* **y2**:
* **z2**:
* **p6**:
* **p7**:
* **p8**:
* **p9**:
* **posMinX**: Min X Coordinate.
* **posMinY**: Min Y Coordinate.
* **posMinZ**: Min Z Coordinate.
* **posMaxX**: Max X Coordinate.
* **posMaxY**: Max Y Coordinate.
* **posMaxZ**: Max Z Coordinate.
* **network**: Optionally networked to all other players
* **cancelActive**: Should this cause peds already in active scenario points in the area specified to leave
* **blockPeds**: if this area effects scenarios with peds
* **blockVehicles**: if this area effects scenarios with vehicles
## Return value
7 changes: 3 additions & 4 deletions PED/RemoveScenarioBlockingArea.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ ns: PED

```c
// 0x31D16B74C6E29D66 0x4483EF06
void REMOVE_SCENARIO_BLOCKING_AREA(Any p0, BOOL p1);
void REMOVE_SCENARIO_BLOCKING_AREA(int scenarioBlockingIndex, BOOL bNetwork);
```
## Parameters
* **p0**:
* **p1**:
* **scenarioBlockingIndex**: the index of the Scenario blocking area
* **bNetwork**: Optionally networked to all other players
16 changes: 11 additions & 5 deletions PED/SetPedShouldPlayDirectedScenarioExit.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ aliases: ["0xEC6935EBE0847B90"]

```c
// 0xEC6935EBE0847B90 0x761F8F48
Any _SET_PED_SHOULD_PLAY_DIRECTED_SCENARIO_EXIT(Any p0, Any p1, Any p2, Any p3);
cs_type(Any) BOOL _SET_PED_SHOULD_PLAY_DIRECTED_SCENARIO_EXIT(Ped ped, cs_type(Any) float x, cs_type(Any) float y, cs_type(Any) float z);
```
When this ped receives its next script task, they will exit from their scenario using the normal scenario exit.
Exiting the scenario may take several frames while the ped is playing the exit animation.
If the ped is not currently using a scenario at the time of the command or 0,0,0 is specified as the reaction position,
then the ped will by default attempt to direct their exit forwards.
## Parameters
* **p0**:
* **p1**:
* **p2**:
* **p3**:
* **ped**: the ped who should play a normal (unhurried) exit the next time they are given a script command.
* **x**: X Coordinate.
* **y**: Y Coordinate.
* **z**: Z Coordinate.
## Return value
Returns true if the position was successfully set.
8 changes: 5 additions & 3 deletions PED/SetScenarioPedDensityMultiplierThisFrame.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ ns: PED

```c
// 0x7A556143A1C03898 0x2909ABF0
void SET_SCENARIO_PED_DENSITY_MULTIPLIER_THIS_FRAME(float p0, float p1);
void SET_SCENARIO_PED_DENSITY_MULTIPLIER_THIS_FRAME(float interiorMult, float exteriorMult);
```
Set the number of scenario peds on the entire map
## Parameters
* **p0**:
* **p1**:
* **interiorMult**: Multiplier for ped scenarios inside interiors.
* **exteriorMult**: Multiplier for ped scenarios outside interiors.
45 changes: 33 additions & 12 deletions TASK/TaskFollowNavMeshToCoord.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,42 @@ ns: TASK

```c
// 0x15D3A79D4E44B913 0xFE4A10D9
void TASK_FOLLOW_NAV_MESH_TO_COORD(Ped ped, float x, float y, float z, float speed, int timeout, float stoppingRange, BOOL persistFollowing, float unk);
void TASK_FOLLOW_NAV_MESH_TO_COORD(Ped ped, float x, float y, float z, float moveBlendRatio, int time, float radius, cs_type(BOOL) int flags, float finalHeading);
```
```
If no timeout, set timeout to -1.
Sometimes a path may not be able to be found. This could happen because there simply isn't any way to get there, or maybe a bunch of dynamic objects have blocked the way,
or maybe the destination is too far away. In this case the ped will simply stand still.
To identify when this has happened, you can use GET_NAVMESH_ROUTE_RESULT. This will help you find situations where peds cannot get to their target.
```c
enum eNavScriptFlags {
ENAV_DEFAULT = 0, // Default flag
ENAV_NO_STOPPING = 1, // Will ensure the ped continues to move whilst waiting for the path to be found, and will not slow down at the end of their route.
ENAV_ADV_SLIDE_TO_COORD_AND_ACHIEVE_HEADING_AT_END = 2, // Performs a slide-to-coord at the end of the task. This requires that the accompanying NAVDATA structure has the 'SlideToCoordHeading' member set correctly.
ENAV_GO_FAR_AS_POSSIBLE_IF_TARGET_NAVMESH_NOT_LOADED = 4, // If the navmesh is not loaded in under the target position, then this will cause the ped to get as close as is possible on whatever navmesh is loaded. The navmesh must still be loaded at the path start.
ENAV_ALLOW_SWIMMING_UNDERWATER = 8, // Will allow navigation underwater - by default this is not allowed.
ENAV_KEEP_TO_PAVEMENTS = 16, // Will only allow navigation on pavements. If the path starts or ends off the pavement, the command will fail. Likewise if no pavement-only route can be found even although the start and end are on pavement.
ENAV_NEVER_ENTER_WATER = 32, // Prevents the path from entering water at all.
ENAV_DONT_AVOID_OBJECTS = 64, // Disables object-avoidance for this path. The ped may still make minor steering adjustments to avoid objects, but will not pathfind around them.
ENAV_ADVANCED_USE_MAX_SLOPE_NAVIGABLE = 128, // Specifies that the navmesh route will only be able to traverse up slopes which are under the angle specified, in the MaxSlopeNavigable member of the accompanying NAVDATA structure.
ENAV_STOP_EXACTLY = 512, // Unused.
ENAV_ACCURATE_WALKRUN_START = 1024, // The entity will look ahead in its path for a longer distance to make the walk/run start go more in the right direction.
ENAV_DONT_AVOID_PEDS = 2048, // Disables ped-avoidance for this path while we move.
ENAV_DONT_ADJUST_TARGET_POSITION = 4096, // If target pos is inside the boundingbox of an object it will otherwise be pushed out.
ENAV_SUPPRESS_EXACT_STOP = 8192, // Turns off the default behaviour, which is to stop exactly at the target position. Occasionally this can cause footsliding/skating problems.
ENAV_ADVANCED_USE_CLAMP_MAX_SEARCH_DISTANCE = 16384, // Prevents the path-search from finding paths outside of this search distance. This can be used to prevent peds from finding long undesired routes.
ENAV_PULL_FROM_EDGE_EXTRA = 32768 // Pulls out the paths from edges at corners for a longer distance, to prevent peds walking into stuff.
};
```

## Parameters
* **ped**:
* **x**:
* **y**:
* **z**:
* **speed**:
* **timeout**:
* **stoppingRange**:
* **persistFollowing**:
* **unk**:
* **ped**: Ped Index.
* **x**: X Position Coordinate.
* **y**: Y Position Coordinate.
* **z**: Z Position Coordinate
* **moveBlendRatio**: Ratio for ped movement (0 to 3.0 in the following order: still, walk, run and sprint)
* **time**: INT value in milliseconds.
* **radius**: distance from the final coordinates that the pedestrian should be to consider itself at the target.
* **flags**: Navigation Flags for the ped (see `eNavScriptFlags`).
* **finalHeading**: Peds heading when finished.

0 comments on commit b9bb128

Please sign in to comment.