worldobjects use new transformsyncs

This commit is contained in:
JohnCorby 2022-01-14 22:07:32 -08:00
parent 4a2fedb805
commit a30cd95e84
12 changed files with 26 additions and 40 deletions

View File

@ -47,7 +47,7 @@ namespace QSB.Anglerfish.TransformSync
protected override void Init()
{
_qsbAngler = AnglerManager.Anglers[_instances.IndexOf(this)].GetWorldObject<QSBAngler>();
// todo _qsbAngler.TransformSync = this;
_qsbAngler.TransformSync = this;
base.Init();
SetReferenceTransform(_qsbAngler.AttachedObject._brambleBody.transform);
@ -162,7 +162,7 @@ namespace QSB.Anglerfish.TransformSync
protected override void Init()
{
_qsbAngler = AnglerManager.Anglers[_instances.IndexOf(this)].GetWorldObject<QSBAngler>();
_qsbAngler.TransformSync = this;
// _qsbAngler.TransformSync = this;
base.Init();
SetReferenceTransform(_qsbAngler.AttachedObject._brambleBody.transform);

View File

@ -8,7 +8,7 @@ namespace QSB.Anglerfish.WorldObjects
{
public class QSBAngler : WorldObject<AnglerfishController>
{
public AnglerTransformSync TransformSync;
public AnglerTransformSync2 TransformSync;
public Transform TargetTransform;
public Vector3 TargetVelocity { get; private set; }

View File

@ -91,6 +91,7 @@ namespace QSB.AuthoritySync
#endregion
}
public static class AuthorityManager
{
#region host only
@ -173,7 +174,6 @@ namespace QSB.AuthoritySync
#region any client
public static void SendAuthQueueMessage(this QNetworkIdentity identity, AuthQueueAction action) =>
// todo REMOVE new AuthQueueMessage(identity.NetId, action).Send();
throw new System.NotImplementedException();
#endregion

View File

@ -48,7 +48,7 @@ namespace QSB.JellyfishSync.TransformSync
protected override void Init()
{
_qsbJellyfish = JellyfishManager.Jellyfish[_instances.IndexOf(this)].GetWorldObject<QSBJellyfish>();
// todo _qsbJellyfish.TransformSync = this;
_qsbJellyfish.TransformSync = this;
base.Init();
SetReferenceTransform(_qsbJellyfish.AttachedObject._planetBody.transform);
@ -202,7 +202,7 @@ namespace QSB.JellyfishSync.TransformSync
protected override void Init()
{
_qsbJellyfish = JellyfishManager.Jellyfish[_instances.IndexOf(this)].GetWorldObject<QSBJellyfish>();
_qsbJellyfish.TransformSync = this;
// _qsbJellyfish.TransformSync = this;
base.Init();
SetReferenceTransform(_qsbJellyfish.AttachedObject._planetBody.transform);

View File

@ -8,7 +8,7 @@ namespace QSB.JellyfishSync.WorldObjects
{
public class QSBJellyfish : WorldObject<JellyfishController>
{
public JellyfishTransformSync TransformSync;
public JellyfishTransformSync2 TransformSync;
private AlignWithTargetBody _alignWithTargetBody;
public override void Init()

View File

@ -15,7 +15,7 @@ namespace QSB.OrbSync.Messages
if (QSBCore.IsHost && Value)
{
qsbOrb.TransformSync.NetIdentity.UpdateAuthQueue(From, AuthQueueAction.Force);
qsbOrb.TransformSync.netIdentity.UpdateAuthQueue(From, AuthQueueAction.Force);
}
}
@ -25,7 +25,7 @@ namespace QSB.OrbSync.Messages
if (QSBCore.IsHost && Value)
{
qsbOrb.TransformSync.NetIdentity.UpdateAuthQueue(From, AuthQueueAction.Force);
qsbOrb.TransformSync.netIdentity.UpdateAuthQueue(From, AuthQueueAction.Force);
}
qsbOrb.SetDragging(Value);

View File

@ -46,7 +46,7 @@ namespace QSB.OrbSync.Patches
}
var qsbOrb = __instance.GetWorldObject<QSBOrb>();
if (!qsbOrb.TransformSync.HasAuthority)
if (!qsbOrb.TransformSync.hasAuthority)
{
return false;
}
@ -65,7 +65,7 @@ namespace QSB.OrbSync.Patches
}
var qsbOrb = __instance.GetWorldObject<QSBOrb>();
if (!qsbOrb.TransformSync.HasAuthority)
if (!qsbOrb.TransformSync.hasAuthority)
{
return false;
}

View File

@ -53,7 +53,7 @@ namespace QSB.OrbSync.TransformSync
}
_qsbOrb = orb.GetWorldObject<QSBOrb>();
// todo _qsbOrb.TransformSync = this;
_qsbOrb.TransformSync = this;
base.Init();
_attachedBody = AttachedTransform.GetAttachedOWRigidbody();
@ -125,7 +125,7 @@ namespace QSB.OrbSync.TransformSync
}
_qsbOrb = orb.GetWorldObject<QSBOrb>();
_qsbOrb.TransformSync = this;
// _qsbOrb.TransformSync = this;
base.Init();
_attachedBody = AttachedObject.GetAttachedOWRigidbody();

View File

@ -8,7 +8,7 @@ namespace QSB.OrbSync.WorldObjects
{
public class QSBOrb : WorldObject<NomaiInterfaceOrb>
{
public NomaiOrbTransformSync TransformSync;
public NomaiOrbTransformSync2 TransformSync;
public override void Init()
{

View File

@ -140,8 +140,7 @@ namespace QSB.Player.Messages
{
foreach (var qsbOrb in QSBWorldSync.GetWorldObjects<QSBOrb>())
{
if (!qsbOrb.TransformSync.enabled ||
!qsbOrb.TransformSync.HasAuthority)
if (!qsbOrb.TransformSync.hasAuthority)
{
continue;
}

View File

@ -253,17 +253,13 @@ namespace QSB
continue;
}
if (!qsbOrb.TransformSync.enabled)
{
continue;
}
var identity = qsbOrb.TransformSync.NetIdentity;
if (identity.ClientAuthorityOwner == conn)
{
qsbOrb.SetDragging(false);
qsbOrb.SendMessage(new OrbDragMessage(false));
}
var identity = qsbOrb.TransformSync.netIdentity;
// todo
// if (identity.connectionToClient == conn)
// {
// qsbOrb.SetDragging(false);
// qsbOrb.SendMessage(new OrbDragMessage(false));
// }
}
AuthorityManager.OnDisconnect(conn.GetPlayerId());

View File

@ -32,7 +32,8 @@ namespace QSB.Utility
#region MIRROR
public static uint GetPlayerId(this NetworkConnection conn) => conn.identity.netId;
public static uint GetPlayerId(this NetworkConnection conn) =>
conn.identity.netId;
public static uint GetPlayerId(this QNetworkConnection connection)
{
@ -52,18 +53,8 @@ namespace QSB.Utility
return playerController.UnetView.NetId.Value;
}
public static void SpawnWithServerAuthority2(this GameObject go) => NetworkServer.Spawn(go, NetworkServer.localConnection);
public static void SpawnWithServerAuthority(this GameObject go)
{
if (!QSBCore.IsHost)
{
DebugLog.ToConsole($"Error - Tried to spawn {go.name} using SpawnWithServerAuthority when not the host!", MessageType.Error);
return;
}
QNetworkServer.SpawnWithClientAuthority(go, QNetworkServer.localConnection);
}
public static void SpawnWithServerAuthority(this GameObject go) =>
NetworkServer.Spawn(go, NetworkServer.localConnection);
#endregion