mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-09 12:54:51 +00:00
37 lines
959 B
C#
37 lines
959 B
C#
using QSB.Messaging;
|
|
using QSB.SectorSync.WorldObjects;
|
|
using QSB.WorldSync;
|
|
using QuantumUNET.Transport;
|
|
using UnityEngine;
|
|
|
|
namespace QSB.ItemSync.Events
|
|
{
|
|
public class DropItemMessage : PlayerMessage
|
|
{
|
|
public int ObjectId { get; set; }
|
|
public Vector3 Position { get; set; }
|
|
public Vector3 Normal { get; set; }
|
|
public Sector Sector { get; set; }
|
|
|
|
public override void Deserialize(QNetworkReader reader)
|
|
{
|
|
base.Deserialize(reader);
|
|
ObjectId = reader.ReadInt32();
|
|
Position = reader.ReadVector3();
|
|
Normal = reader.ReadVector3();
|
|
var sectorId = reader.ReadInt32();
|
|
Sector = QSBWorldSync.GetWorldFromId<QSBSector>(sectorId).AttachedObject;
|
|
}
|
|
|
|
public override void Serialize(QNetworkWriter writer)
|
|
{
|
|
base.Serialize(writer);
|
|
writer.Write(ObjectId);
|
|
writer.Write(Position);
|
|
writer.Write(Normal);
|
|
var qsbSector = QSBWorldSync.GetWorldFromUnity<QSBSector>(Sector);
|
|
writer.Write(qsbSector.ObjectId);
|
|
}
|
|
}
|
|
}
|