feat(extra-natives-rdr3): add GET_ENTITIES_IN_RADIUS for RedM#3283
Merged
prikolium-cfx merged 1 commit intocitizenfx:masterfrom Apr 7, 2025
Merged
Conversation
Contributor
Author
|
I cant squash this commits ... because i cant discard ros changes just fails |
Collaborator
No problem. Thank you for FXServer implementation too. I will squash in merge process |
3a19534 to
bc5e281
Compare
9218b1d to
3b81aeb
Compare
prikolium-cfx
approved these changes
Apr 7, 2025
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal of this PR
This PR introduces a new native function that retrieves entities within a specified radius using various parameters. It addresses several key issues:
Entity Set Limitations: Current entity sets are limited to 255 entries, and many servers fail to clear them, leading to pool overflows.
Single Object Limitation: The existing
GET_CLOSEST_OBJECT_OF_TYPEfunction returns only one object and one model, which restricts its usability.Performance Improvements: Although servers can achieve similar results using Lua with the
GET_GAME_POOLnative, running this function every frame with same logic takes approximately 0.45ms in Lua, whereas the new native performs the task in around 0.05ms. [Done just for test performance no one use this every frame]The new native function provides a more flexible and efficient solution for managing and querying entities.
How is this PR achieving the goal
This PR registers a new native function,
GET_ENTITIES_IN_RADIUS, which iterates through the appropriate entity pool to filter entities based on their distance from a given point and an optional list of model hashes, with an option to sort results by proximity. It then serializes and returns a list of entits, providing a more efficient and flexible alternative for entity querying.This PR applies to the following area(s)
RedM
Successfully tested on
Game builds: 1491
Platforms: Windows, Linux
Checklist