quantum-space-buddies/QSB/OrbSync/Messages/OrbDragMessage.cs

36 lines
811 B
C#
Raw Normal View History

2021-12-23 09:50:09 +00:00
using QSB.AuthoritySync;
using QSB.Messaging;
using QSB.OrbSync.WorldObjects;
using QSB.WorldSync;
2021-12-23 10:17:56 +00:00
namespace QSB.OrbSync.Messages
2021-12-23 09:50:09 +00:00
{
public class OrbDragMessage : QSBBoolWorldObjectMessage<QSBOrb>
{
public OrbDragMessage(bool isDragging) => Value = isDragging;
public OrbDragMessage() { }
public override void OnReceiveLocal()
{
var qsbOrb = QSBWorldSync.GetWorldFromId<QSBOrb>(ObjectId);
if (QSBCore.IsHost && Value)
{
qsbOrb.TransformSync.NetIdentity.UpdateAuthQueue(From, AuthQueueAction.Force);
}
}
public override void OnReceiveRemote()
{
var qsbOrb = QSBWorldSync.GetWorldFromId<QSBOrb>(ObjectId);
if (QSBCore.IsHost && Value)
{
qsbOrb.TransformSync.NetIdentity.UpdateAuthQueue(From, AuthQueueAction.Force);
}
qsbOrb.SetDragging(Value);
}
}
}