-
-
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
16 changed files
with
617 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
namespace AltV.Net.Data | ||
{ | ||
[StructLayout(LayoutKind.Sequential)] | ||
public struct AABB : IEquatable<AABB> | ||
{ | ||
public static AABB Zero = new AABB(Position.Zero, Position.Zero); | ||
|
||
public Position Min; | ||
public Position Max; | ||
|
||
public AABB(Position min, Position max) | ||
{ | ||
Min = min; | ||
Max = max; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"AABB(min: {Min}, max: {Max})"; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
return obj is AABB other && Equals(other); | ||
} | ||
|
||
public bool Equals(AABB other) | ||
{ | ||
return Min.Equals(other.Min) && Max.Equals(other.Max); | ||
} | ||
|
||
public override int GetHashCode() => HashCode.Combine(Min.GetHashCode(), Max.GetHashCode()); | ||
} | ||
} |
Large diffs are not rendered by default.
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
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 @@ | ||
using AltV.Net.Data; | ||
|
||
namespace AltV.Net.Client.Elements.Data; | ||
|
||
public interface IInterior | ||
{ | ||
IInteriorRoom GetRoomByIndex(uint roomIndex); | ||
IInteriorRoom GetRoomByHash(uint roomHash); | ||
IInteriorPortal GetPortalByIndex(uint portalIndex); | ||
ushort RoomCount { get; } | ||
ushort PortalCount { get; } | ||
Position Position { get; } | ||
Rotation Rotation { get; } | ||
AABB EntitiesExtents { get; } | ||
} |
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,22 @@ | ||
using AltV.Net.Data; | ||
|
||
namespace AltV.Net.Client.Elements.Data; | ||
|
||
public interface IInteriorPortal | ||
{ | ||
uint Index { get; } | ||
ushort CornerCount { get; } | ||
Position GetCornerPosition(uint cornerIndex); | ||
IInteriorRoom RoomFrom { get; set; } | ||
IInteriorRoom RoomTo { get; set; } | ||
int Flag { get; set; } | ||
|
||
ushort EntityCount { get; } | ||
uint GetEntityArcheType(uint entityIndex); | ||
int GetEntityFlag(uint entityIndex); | ||
void SetEntityFlag(uint entityIndex, int flag); | ||
Position GetEntityPosition(uint entityIndex); | ||
Rotation GetEntityRotation(uint entityIndex); | ||
|
||
void SetCornerPosition(uint cornerIndex, Position position); | ||
} |
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,13 @@ | ||
using AltV.Net.Data; | ||
|
||
namespace AltV.Net.Client.Elements.Data; | ||
|
||
public interface IInteriorRoom | ||
{ | ||
uint Index { get; } | ||
string Name { get; } | ||
uint NameHash { get; } | ||
int Flag { get; set; } | ||
uint Timecycle { get; set; } | ||
AABB Extents { get; set; } | ||
} |
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,87 @@ | ||
using AltV.Net.Data; | ||
|
||
namespace AltV.Net.Client.Elements.Data; | ||
|
||
public class Interior : IInterior | ||
{ | ||
private readonly ICore _core; | ||
private readonly uint _interiorId; | ||
|
||
internal Interior(ICore core, uint interiorId) | ||
{ | ||
_core = core; | ||
_interiorId = interiorId; | ||
} | ||
|
||
public IInteriorRoom GetRoomByIndex(uint roomIndex) | ||
{ | ||
return new InteriorRoom(_core, _interiorId, roomIndex, true); | ||
} | ||
|
||
public IInteriorRoom GetRoomByHash(uint roomHash) | ||
{ | ||
return new InteriorRoom(_core, _interiorId, roomHash, false); | ||
} | ||
|
||
public IInteriorPortal GetPortalByIndex(uint portalIndex) | ||
{ | ||
return new InteriorPortal(_core, _interiorId, portalIndex); | ||
} | ||
|
||
public ushort RoomCount | ||
{ | ||
get | ||
{ | ||
unsafe | ||
{ | ||
return _core.Library.Client.Interior_GetRoomCount(_interiorId); | ||
} | ||
} | ||
} | ||
|
||
public ushort PortalCount | ||
{ | ||
get | ||
{ | ||
unsafe | ||
{ | ||
return _core.Library.Client.Interior_GetPortalCount(_interiorId); | ||
} | ||
} | ||
} | ||
|
||
public Position Position | ||
{ | ||
get | ||
{ | ||
unsafe | ||
{ | ||
return _core.Library.Client.Interior_GetPosition(_interiorId); | ||
} | ||
} | ||
} | ||
|
||
public Rotation Rotation | ||
{ | ||
get | ||
{ | ||
unsafe | ||
{ | ||
return _core.Library.Client.Interior_GetPosition(_interiorId); | ||
} | ||
} | ||
} | ||
|
||
public AABB EntitiesExtents | ||
{ | ||
get | ||
{ | ||
unsafe | ||
{ | ||
var interiorExtentInfo = AABB.Zero; | ||
_core.Library.Client.Interior_GetEntitiesExtents(_interiorId, &interiorExtentInfo); | ||
return interiorExtentInfo; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.