-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
356 additions
and
375 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 @@ | ||
using System.Threading.Tasks; | ||
using AltV.Net.Data; | ||
using AltV.Net.Elements.Entities; | ||
|
||
namespace AltV.Net.Async | ||
{ | ||
public partial class AltAsync | ||
{ | ||
public static Task<IObject> CreateObject(uint model, Position position, Rotation rotation, byte alpha = 255, byte textureVariation = 0, ushort lodDistance = 100) => | ||
AltVAsync.Schedule(() => Alt.CreateObject(model, position, rotation, alpha, textureVariation, lodDistance)); | ||
|
||
public static Task<IObject> CreateObject(string model, Position position, Rotation rotation, byte alpha = 255, byte textureVariation = 0, ushort lodDistance = 100) => | ||
AltVAsync.Schedule(() => Alt.CreateObject(Alt.Hash(model), position, rotation, alpha, textureVariation, lodDistance)); | ||
} | ||
} |
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
105 changes: 0 additions & 105 deletions
105
api/AltV.Net.Async/Elements/Entities/AsyncNetworkObject.cs
This file was deleted.
Oops, something went wrong.
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,106 @@ | ||
using System; | ||
using AltV.Net.Data; | ||
using AltV.Net.Elements.Entities; | ||
using Object = AltV.Net.Elements.Entities.Object; | ||
|
||
namespace AltV.Net.Async.Elements.Entities; | ||
|
||
public class AsyncObject : AsyncEntity, IObject, IAsyncConvertible<IObject> | ||
{ | ||
protected readonly IObject Object; | ||
public IntPtr ObjectNativePointer => Object.ObjectNativePointer; | ||
|
||
public AsyncObject(IObject @object, IAsyncContext asyncContext) : base(@object, asyncContext) | ||
{ | ||
Object = @object; | ||
} | ||
|
||
public AsyncObject(ICore core, IntPtr nativePointer, uint id) : this(new Object(core, nativePointer, id), | ||
null) | ||
{ | ||
} | ||
|
||
public byte Alpha | ||
{ | ||
get | ||
{ | ||
lock (Object) | ||
{ | ||
if (!AsyncContext.CheckIfExistsOrCachedNullable(Object)) return default; | ||
return Object.Alpha; | ||
} | ||
} | ||
set | ||
{ | ||
lock (Object) | ||
{ | ||
if (!AsyncContext.CheckIfExistsNullable(Object)) return; | ||
Object.Alpha = value; | ||
} | ||
} | ||
} | ||
|
||
public ushort LodDistance | ||
{ | ||
get | ||
{ | ||
lock (Object) | ||
{ | ||
if (!AsyncContext.CheckIfExistsOrCachedNullable(Object)) return default; | ||
return Object.LodDistance; | ||
} | ||
} | ||
set | ||
{ | ||
lock (Object) | ||
{ | ||
if (!AsyncContext.CheckIfExistsNullable(Object)) return; | ||
Object.LodDistance = value; | ||
} | ||
} | ||
} | ||
|
||
public void PlaceOnGroundProperly() | ||
{ | ||
lock (Object) | ||
{ | ||
if (!AsyncContext.CheckIfExistsNullable(Object)) return; | ||
Object.PlaceOnGroundProperly(); | ||
} | ||
} | ||
|
||
public void ActivatePhysics() | ||
{ | ||
lock (Object) | ||
{ | ||
if (!AsyncContext.CheckIfExistsNullable(Object)) return; | ||
Object.ActivatePhysics(); | ||
} | ||
} | ||
|
||
public byte TextureVariation | ||
{ | ||
get | ||
{ | ||
lock (Object) | ||
{ | ||
if (!AsyncContext.CheckIfExistsOrCachedNullable(Object)) return default; | ||
return Object.TextureVariation; | ||
} | ||
} | ||
set | ||
{ | ||
lock (Object) | ||
{ | ||
if (!AsyncContext.CheckIfExistsNullable(Object)) return; | ||
Object.TextureVariation = value; | ||
} | ||
} | ||
} | ||
|
||
[Obsolete("Use new async API instead")] | ||
public IObject ToAsync(IAsyncContext asyncContext) | ||
{ | ||
return this; | ||
} | ||
} |
14 changes: 0 additions & 14 deletions
14
api/AltV.Net.Async/Elements/Factories/AsyncNetworkObjectFactory.cs
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
api/AltV.Net.Async/Elements/Factories/AsyncObjectFactory.cs
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,14 @@ | ||
using System; | ||
using AltV.Net.Async.Elements.Entities; | ||
using AltV.Net.Elements.Entities; | ||
|
||
namespace AltV.Net.Async.Elements.Factories | ||
{ | ||
public class AsyncObjectFactory : IEntityFactory<IObject> | ||
{ | ||
public IObject Create(ICore core, IntPtr baseObjectPointer, uint id) | ||
{ | ||
return new AsyncObject(core, baseObjectPointer, id); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.