Skip to content
Permalink
Browse files
Fix "IsPersistent" and "MarkAsNoLongerNeeded()" using the wrong nativ…
…es (#907)
  • Loading branch information
drunderscore authored and crosire committed Jan 26, 2020
1 parent 8720671 commit cac50e53733a5ac903768608db597548381c5ce9
Showing with 22 additions and 4 deletions.
  1. +11 −2 source/scripting_v2/GTA/Entities/Entity.cs
  2. +11 −2 source/scripting_v3/GTA/Entities/Entity.cs
@@ -68,7 +68,17 @@ public int LodDistance
public bool IsPersistent
{
get => Function.Call<bool>(Hash.IS_ENTITY_A_MISSION_ENTITY, Handle);
set => Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, Handle, value, !value);
set
{
if (value)
{
Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, Handle, true, true);
}
else
{
MarkAsNoLongerNeeded();
}
}
}

public bool FreezePosition
@@ -579,7 +589,6 @@ public void ApplyForceRelative(Vector3 direction, Vector3 rotation, ForceType fo
public void MarkAsNoLongerNeeded()
{
int handle = Handle;
Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, handle, false, true);
unsafe
{
Function.Call(Hash.SET_ENTITY_AS_NO_LONGER_NEEDED, &handle);
@@ -116,7 +116,17 @@ public int LodDistance
public bool IsPersistent
{
get => Function.Call<bool>(Hash.IS_ENTITY_A_MISSION_ENTITY, Handle);
set => Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, Handle, value, !value);
set
{
if (value)
{
Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, Handle, true, true);
}
else
{
MarkAsNoLongerNeeded();
}
}
}

/// <summary>
@@ -1197,7 +1207,6 @@ public void ApplyForceRelative(Vector3 direction, Vector3 rotation = default, Fo
public void MarkAsNoLongerNeeded()
{
int handle = Handle;
Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, handle, false, true);
unsafe
{
Function.Call(Hash.SET_ENTITY_AS_NO_LONGER_NEEDED, &handle);

0 comments on commit cac50e5

Please sign in to comment.