1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-10 02:55:41 +00:00

Add modification timestamp

This commit is contained in:
Oliver Booth 2022-12-04 19:19:53 +00:00
parent cb29ad10a4
commit 61bafac567
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
2 changed files with 11 additions and 0 deletions

View File

@ -37,6 +37,12 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
/// <value>The location of this object.</value>
public Location Location { get; internal set; }
/// <summary>
/// Gets the modification timestamp of this object.
/// </summary>
/// <value>The modification timestamp.</value>
public DateTimeOffset ModificationTimestamp { get; internal set; }
/// <summary>
/// Gets the owner of this object.
/// </summary>
@ -232,6 +238,7 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
{
ArgumentNullException.ThrowIfNull(virtualParadiseObject);
Location = virtualParadiseObject.Location;
ModificationTimestamp = virtualParadiseObject.ModificationTimestamp;
Owner = virtualParadiseObject.Owner;
}

View File

@ -168,6 +168,7 @@ public sealed partial class VirtualParadiseClient
{
ObjectType type;
int id;
int time;
int owner;
Quaternion rotation;
Vector3d position;
@ -197,6 +198,8 @@ public sealed partial class VirtualParadiseClient
var axis = new Vector3(rotX, rotY, rotZ);
rotation = Quaternion.CreateFromAxisAngle(axis, angle);
}
time = vp_int(sender, IntegerAttribute.ObjectTime);
}
VirtualParadiseObject virtualParadiseObject = type switch
@ -211,6 +214,7 @@ public sealed partial class VirtualParadiseClient
var location = new Location(CurrentWorld!, position, rotation);
virtualParadiseObject.Location = location;
virtualParadiseObject.ModificationTimestamp = DateTimeOffset.FromUnixTimeSeconds(time);
virtualParadiseObject.Owner = await GetUserAsync(owner).ConfigureAwait(false);
return virtualParadiseObject;
}