1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-10 05:15:42 +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> /// <value>The location of this object.</value>
public Location Location { get; internal set; } 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> /// <summary>
/// Gets the owner of this object. /// Gets the owner of this object.
/// </summary> /// </summary>
@ -232,6 +238,7 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
{ {
ArgumentNullException.ThrowIfNull(virtualParadiseObject); ArgumentNullException.ThrowIfNull(virtualParadiseObject);
Location = virtualParadiseObject.Location; Location = virtualParadiseObject.Location;
ModificationTimestamp = virtualParadiseObject.ModificationTimestamp;
Owner = virtualParadiseObject.Owner; Owner = virtualParadiseObject.Owner;
} }

View File

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