mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-23 00:28:48 +00:00
Lock handle when extracting object
This commit is contained in:
parent
9408e2a100
commit
fde3508fc1
@ -144,20 +144,27 @@ public sealed partial class VirtualParadiseClient
|
|||||||
|
|
||||||
private async Task<VirtualParadiseObject> ExtractObjectAsync(nint sender)
|
private async Task<VirtualParadiseObject> ExtractObjectAsync(nint sender)
|
||||||
{
|
{
|
||||||
var type = (ObjectType)vp_int(sender, IntegerAttribute.ObjectType);
|
ObjectType type;
|
||||||
int id = vp_int(sender, IntegerAttribute.ObjectId);
|
int id;
|
||||||
int owner = vp_int(sender, IntegerAttribute.ObjectUserId);
|
int owner;
|
||||||
|
Quaternion rotation;
|
||||||
|
Vector3d position;
|
||||||
|
|
||||||
|
lock (Lock)
|
||||||
|
{
|
||||||
|
type = (ObjectType)vp_int(sender, IntegerAttribute.ObjectType);
|
||||||
|
id = vp_int(sender, IntegerAttribute.ObjectId);
|
||||||
|
owner = vp_int(sender, IntegerAttribute.ObjectUserId);
|
||||||
|
|
||||||
double x = vp_double(sender, FloatAttribute.ObjectX);
|
double x = vp_double(sender, FloatAttribute.ObjectX);
|
||||||
double y = vp_double(sender, FloatAttribute.ObjectY);
|
double y = vp_double(sender, FloatAttribute.ObjectY);
|
||||||
double z = vp_double(sender, FloatAttribute.ObjectZ);
|
double z = vp_double(sender, FloatAttribute.ObjectZ);
|
||||||
var position = new Vector3d(x, y, z);
|
position = new Vector3d(x, y, z);
|
||||||
|
|
||||||
float rotX = vp_float(sender, FloatAttribute.ObjectRotationX);
|
float rotX = vp_float(sender, FloatAttribute.ObjectRotationX);
|
||||||
float rotY = vp_float(sender, FloatAttribute.ObjectRotationY);
|
float rotY = vp_float(sender, FloatAttribute.ObjectRotationY);
|
||||||
float rotZ = vp_float(sender, FloatAttribute.ObjectRotationZ);
|
float rotZ = vp_float(sender, FloatAttribute.ObjectRotationZ);
|
||||||
float angle = vp_float(sender, FloatAttribute.ObjectRotationAngle);
|
float angle = vp_float(sender, FloatAttribute.ObjectRotationAngle);
|
||||||
Quaternion rotation;
|
|
||||||
|
|
||||||
if (double.IsPositiveInfinity(angle))
|
if (double.IsPositiveInfinity(angle))
|
||||||
{
|
{
|
||||||
@ -168,6 +175,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
var axis = new Vector3(rotX, rotY, rotZ);
|
var axis = new Vector3(rotX, rotY, rotZ);
|
||||||
rotation = Quaternion.CreateFromAxisAngle(axis, angle);
|
rotation = Quaternion.CreateFromAxisAngle(axis, angle);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VirtualParadiseObject virtualParadiseObject = type switch
|
VirtualParadiseObject virtualParadiseObject = type switch
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user