-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server/state): add
[GET/SET]_ENTITY_ORPHAN_MODE
- this allows the end user to be able to define how they want an entity to be deleted instead of automatically cleaning up every entity on entity GC - this is mainly useful for allowing the server to keep specific client entities (like vehicles) from being automatically deleted - this allows for the same persistence as server created entities but without the draw backs. - also allows for specific entities (like objects) to be marked for deletion whenever the client leaves the server
- Loading branch information
1 parent
8a1586d
commit e7ec01f
Showing
5 changed files
with
155 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
ns: CFX | ||
apiset: server | ||
--- | ||
## GET_ENTITY_ORPHAN_MODE | ||
|
||
```c | ||
int GET_ENTITY_ORPHAN_MODE(Entity entity); | ||
``` | ||
## Parameters | ||
* **entity**: The entity to get the orphan mode of | ||
## Return value | ||
Returns the entities current orphan mode, refer to enum in [SET_ENTITY_ORPHAN_MODE](#_0x489E9162) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
ns: CFX | ||
apiset: server | ||
--- | ||
## SET_ENTITY_ORPHAN_MODE | ||
|
||
```c | ||
void SET_ENTITY_ORPHAN_MODE(Entity entity, int orphanMode); | ||
``` | ||
```c | ||
enum EntityOrphanMode { | ||
// Default, this will delete the entity when it isn't relevant to any players | ||
// NOTE: this *doesn't* mean when they're no longer in scope | ||
DeleteWhenNotRelevant = 0, | ||
// The entity will be deleted whenever its original owner disconnects | ||
// NOTE: if this is set when the entities original owner has already left it will be | ||
// marked for deletion (similar to just calling DELETE_ENTITY) | ||
DeleteOnOwnerDisconnect = 1, | ||
// The entity will never be deleted by the server when it does relevancy checks | ||
// you should only use this on entities that need to be relatively persistent | ||
KeepEntity = 2 | ||
} | ||
``` | ||
|
||
Sets what happens when the entity is orphaned and no longer has its original owner. | ||
|
||
**NOTE**: This native doesn't guarantee the persistence of the entity. | ||
|
||
## Parameters | ||
* **entity**: The entity to set the orphan mode of | ||
* **orphanMode**: The mode that the server should use for determining if an entity should be removed. |