Skip to content

Commit

Permalink
update colshape/checkpoint event
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Apr 14, 2023
1 parent 3ef8530 commit 423b822
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions api/AltV.Net.Async/AsyncCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public override bool IsMainThread()
return AltAsync.AltVAsync.TickThread == Thread.CurrentThread || base.IsMainThread();
}

public override void OnCheckPointEvent(ICheckpoint checkpoint, IEntity entity, bool state)
public override void OnCheckPointEvent(ICheckpoint checkpoint, IWorldObject entity, bool state)
{
base.OnCheckPointEvent(checkpoint, entity, state);
if (!CheckpointAsyncEventHandler.HasEvents()) return;
Expand Down Expand Up @@ -516,7 +516,7 @@ await SyncedMetaDataChangeAsyncEventHandler.CallAsync(@delegate =>
});
}

public override void OnColShapeEvent(IColShape colShape, IEntity entity, bool state)
public override void OnColShapeEvent(IColShape colShape, IWorldObject entity, bool state)
{
base.OnColShapeEvent(colShape, entity, state);
if (!ColShapeAsyncEventHandler.HasEvents()) return;
Expand Down
4 changes: 2 additions & 2 deletions api/AltV.Net.Async/Events/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace AltV.Net.Async.Events
{
public delegate Task CheckpointAsyncDelegate(ICheckpoint checkpoint, IEntity entity, bool state);
public delegate Task CheckpointAsyncDelegate(ICheckpoint checkpoint, IWorldObject entity, bool state);

public delegate Task ClientEventAsyncDelegate(IPlayer player, object[] args);

Expand Down Expand Up @@ -41,7 +41,7 @@ public delegate Task PlayerChangeVehicleSeatAsyncDelegate(IVehicle vehicle, IPla

public delegate Task MetaDataChangeAsyncDelegate(IEntity entity, string key, object value);

public delegate Task ColShapeAsyncDelegate(IColShape colShape, IEntity targetEntity, bool state);
public delegate Task ColShapeAsyncDelegate(IColShape colShape, IWorldObject targetEntity, bool state);

public delegate Task ExplosionAsyncDelegate(IPlayer player, ExplosionType explosionType, Position position,
uint explosionFx, IEntity target);
Expand Down
12 changes: 8 additions & 4 deletions api/AltV.Net/Core.Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ public void OnCheckpoint(IntPtr checkpointPointer, IntPtr entityPointer, BaseObj
return;
}

if (!BaseEntityPool.Get(entityPointer, baseObjectType, out var entity))
var entity = (IWorldObject)BaseBaseObjectPool.Get(entityPointer, baseObjectType);

if (entity is null)
{
Console.WriteLine("OnCheckpoint Invalid entity " + checkpointPointer + " " + entityPointer + " " +
baseObjectType + " " + state);
Expand All @@ -165,7 +167,7 @@ public void OnCheckpoint(IntPtr checkpointPointer, IntPtr entityPointer, BaseObj
OnCheckPointEvent(checkpoint, entity, state);
}

public virtual void OnCheckPointEvent(ICheckpoint checkpoint, IEntity entity, bool state)
public virtual void OnCheckPointEvent(ICheckpoint checkpoint, IWorldObject entity, bool state)
{
foreach (var @delegate in CheckpointEventHandler.GetEvents())
{
Expand Down Expand Up @@ -917,7 +919,9 @@ public void OnColShape(IntPtr colShapePointer, IntPtr targetEntityPointer, BaseO
return;
}

if (!BaseEntityPool.Get(targetEntityPointer, entityType, out var entity))
var entity = (IWorldObject)BaseBaseObjectPool.Get(targetEntityPointer, entityType);

if (entity is null)
{
Console.WriteLine("OnColShape Invalid entity " + colShapePointer + " " + targetEntityPointer + " " + entityType + " " + state);
return;
Expand All @@ -926,7 +930,7 @@ public void OnColShape(IntPtr colShapePointer, IntPtr targetEntityPointer, BaseO
OnColShapeEvent(colShape, entity, state);
}

public virtual void OnColShapeEvent(IColShape colShape, IEntity entity, bool state)
public virtual void OnColShapeEvent(IColShape colShape, IWorldObject entity, bool state)
{
if (!ColShapeEventHandler.HasEvents()) return;
foreach (var eventHandler in ColShapeEventHandler.GetEvents())
Expand Down
4 changes: 2 additions & 2 deletions api/AltV.Net/Events/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace AltV.Net.Events
{
public delegate void CheckpointDelegate(ICheckpoint checkpoint, IEntity entity, bool state);
public delegate void CheckpointDelegate(ICheckpoint checkpoint, IWorldObject entity, bool state);

public delegate void ClientEventDelegate(IPlayer player, object[] args);

Expand Down Expand Up @@ -52,7 +52,7 @@ public delegate void PlayerConnectDeniedDelegate(PlayerConnectDeniedReason reaso

public delegate void MetaDataChangeDelegate(IEntity entity, string key, object value);

public delegate void ColShapeDelegate(IColShape colShape, IEntity targetEntity, bool state);
public delegate void ColShapeDelegate(IColShape colShape, IWorldObject targetEntity, bool state);

public delegate bool ExplosionDelegate(IPlayer player, ExplosionType explosionType, Position position,
uint explosionFx, IEntity targetEntity);
Expand Down
2 changes: 1 addition & 1 deletion runtime

0 comments on commit 423b822

Please sign in to comment.