remove qnet references (except AnimationSync)

This commit is contained in:
JohnCorby 2022-01-14 22:54:18 -08:00
parent 5d4af69719
commit ff9a93108c
17 changed files with 54 additions and 75 deletions

View File

@ -1,7 +1,7 @@
using QSB.Anglerfish.TransformSync;
using Mirror;
using QSB.Anglerfish.TransformSync;
using QSB.Utility;
using QSB.WorldSync;
using QuantumUNET;
using UnityEngine;
namespace QSB.Anglerfish.WorldObjects
@ -29,7 +29,7 @@ namespace QSB.Anglerfish.WorldObjects
{
if (QSBCore.IsHost)
{
QNetworkServer.Destroy(TransformSync.gameObject);
NetworkServer.Destroy(TransformSync.gameObject);
}
}

View File

@ -67,7 +67,7 @@ namespace QSB.Animation.Player
NetworkAnimator.enabled = true;
VisibleAnimator = body.GetComponent<Animator>();
Mirror = body.gameObject.AddComponent<AnimatorMirror>();
if (IsLocalPlayer)
if (isLocalPlayer)
{
Mirror.Init(VisibleAnimator, InvisibleAnimator);
}
@ -130,7 +130,7 @@ namespace QSB.Animation.Player
private void InitAccelerationSync()
{
Player.JetpackAcceleration = GetComponent<JetpackAccelerationSync>();
var thrusterModel = HasAuthority ? Locator.GetPlayerBody().GetComponent<ThrusterModel>() : null;
var thrusterModel = hasAuthority ? Locator.GetPlayerBody().GetComponent<ThrusterModel>() : null;
Player.JetpackAcceleration.Init(thrusterModel);
}

View File

@ -1,10 +1,10 @@
using QSB.Utility.VariableSync;
using QuantumUNET;
using Mirror;
using QSB.Utility.VariableSync;
using UnityEngine;
namespace QSB.Animation.Player
{
public class CrouchSync : QNetworkBehaviour
public class CrouchSync : NetworkBehaviour
{
public AnimFloatParam CrouchParam { get; } = new AnimFloatParam();
@ -24,7 +24,7 @@ namespace QSB.Animation.Player
public void Update()
{
if (IsLocalPlayer)
if (isLocalPlayer)
{
SyncLocalCrouch();
return;

View File

@ -1,9 +1,9 @@
using QSB.Utility.VariableSync;
using QuantumUNET;
using Mirror;
using QSB.Utility.VariableSync;
namespace QSB.Animation.Player.Thrusters
{
public class JetpackAccelerationSync : QNetworkBehaviour
public class JetpackAccelerationSync : NetworkBehaviour
{
public Vector3VariableSyncer AccelerationVariableSyncer;
public BoolVariableSyncer ThrustingVariableSyncer;
@ -17,7 +17,7 @@ namespace QSB.Animation.Player.Thrusters
public void Update()
{
if (IsLocalPlayer)
if (isLocalPlayer)
{
SyncLocalAccel();
}

View File

@ -1,7 +1,7 @@
using QSB.GeyserSync.Messages;
using Mirror;
using QSB.GeyserSync.Messages;
using QSB.Messaging;
using QSB.WorldSync;
using QuantumUNET;
namespace QSB.GeyserSync.WorldObjects
{
@ -15,7 +15,7 @@ namespace QSB.GeyserSync.WorldObjects
private void HandleEvent(bool state)
{
if (QNetworkServer.active)
if (QSBCore.IsHost)
{
this.SendMessage(new GeyserMessage(state));
}

View File

@ -38,7 +38,7 @@ namespace QSB.Instruments
protected void OnDestroy()
{
if (!IsLocalPlayer)
if (!isLocalPlayer)
{
return;
}
@ -90,7 +90,7 @@ namespace QSB.Instruments
public void StartInstrument(AnimationType type)
{
if (!IsLocalPlayer)
if (!isLocalPlayer)
{
DebugLog.ToConsole("Error - Tried to start instrument on non-local player!", MessageType.Error);
return;

View File

@ -1,7 +1,7 @@
using QSB.JellyfishSync.TransformSync;
using Mirror;
using QSB.JellyfishSync.TransformSync;
using QSB.Utility;
using QSB.WorldSync;
using QuantumUNET;
using UnityEngine;
namespace QSB.JellyfishSync.WorldObjects
@ -28,7 +28,7 @@ namespace QSB.JellyfishSync.WorldObjects
{
if (QSBCore.IsHost)
{
QNetworkServer.Destroy(TransformSync.gameObject);
NetworkServer.Destroy(TransformSync.gameObject);
}
}

View File

@ -1,7 +1,7 @@
using QSB.OrbSync.TransformSync;
using Mirror;
using QSB.OrbSync.TransformSync;
using QSB.Utility;
using QSB.WorldSync;
using QuantumUNET;
using UnityEngine;
namespace QSB.OrbSync.WorldObjects
@ -25,7 +25,7 @@ namespace QSB.OrbSync.WorldObjects
{
if (QSBCore.IsHost)
{
QNetworkServer.Destroy(TransformSync.gameObject);
NetworkServer.Destroy(TransformSync.gameObject);
}
}

View File

@ -2,7 +2,6 @@
using QSB.Menus;
using QSB.Messaging;
using QSB.Utility;
using QuantumUNET;
using System.Linq;
namespace QSB.Player.Messages
@ -43,7 +42,7 @@ namespace QSB.Player.Messages
}
private void KickPlayer()
=> QNetworkServer.connections.First(x => PlayerId == x.GetPlayerId()).Disconnect();
=> NetworkServer.connections.Values.First(x => PlayerId == x.GetPlayerId()).Disconnect();
public override void OnReceiveRemote()
{

View File

@ -1,10 +1,10 @@
using QuantumUNET;
using Mirror;
namespace QSB.Player
{
public abstract class PlayerSyncObject : QNetworkBehaviour
public abstract class PlayerSyncObject : NetworkBehaviour
{
protected uint PlayerId => NetId.Value;
protected uint PlayerId => netId;
protected PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
}
}

View File

@ -1,4 +1,5 @@
using OWML.Common;
using Mirror;
using OWML.Common;
using OWML.ModHelper;
using OWML.ModHelper.Input;
using QSB.EyeOfTheUniverse.GalaxyMap;
@ -13,8 +14,6 @@ using QSB.StatueSync;
using QSB.TimeSync;
using QSB.Utility;
using QSB.WorldSync;
using QuantumUNET;
using QuantumUNET.Components;
using System.Linq;
using UnityEngine;
@ -57,8 +56,8 @@ namespace QSB
public static AssetBundle ConversationAssetBundle { get; private set; }
public static AssetBundle DebugAssetBundle { get; private set; }
public static AssetBundle TextAssetsBundle { get; private set; }
public static bool IsHost => QNetworkServer.active;
public static bool IsInMultiplayer => QNetworkManager.singleton.isNetworkActive;
public static bool IsHost => NetworkServer.active;
public static bool IsInMultiplayer => NetworkManager.singleton.isNetworkActive;
public static string QSBVersion => Helper.Manifest.Version;
public static string GameVersion => Application.version;
public static GamePlatform Platform => typeof(Achievements).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever")
@ -145,7 +144,8 @@ namespace QSB
}
public void Update() =>
QNetworkIdentity.UNetStaticUpdate();
// TODO MIRROR NetworkIdentity.UNetStaticUpdate();
throw new System.NotImplementedException();
public override void Configure(IModConfig config)
{

View File

@ -20,7 +20,6 @@ using QSB.Tools.ProbeTool.TransformSync;
using QSB.TornadoSync.TransformSync;
using QSB.Utility;
using QSB.WorldSync;
using QuantumUNET;
using System;
using UnityEngine;
using UnityEngine.Networking;
@ -177,7 +176,7 @@ namespace QSB
QSBWorldSync.Init();
}
var specificType = QNetworkServer.active ? QSBPatchTypes.OnServerClientConnect : QSBPatchTypes.OnNonServerClientConnect;
var specificType = QSBCore.IsHost ? QSBPatchTypes.OnServerClientConnect : QSBPatchTypes.OnNonServerClientConnect;
QSBPatchManager.DoPatchType(specificType);
QSBPatchManager.DoPatchType(QSBPatchTypes.OnClientConnect);
@ -215,7 +214,7 @@ namespace QSB
if (_everConnected)
{
var specificType = QNetworkServer.active ? QSBPatchTypes.OnServerClientConnect : QSBPatchTypes.OnNonServerClientConnect;
var specificType = QSBCore.IsHost ? QSBPatchTypes.OnServerClientConnect : QSBPatchTypes.OnNonServerClientConnect;
QSBPatchManager.DoUnpatchType(specificType);
QSBPatchManager.DoUnpatchType(QSBPatchTypes.OnClientConnect);
}

View File

@ -1,10 +1,10 @@
using OWML.Common;
using Mirror;
using OWML.Common;
using QSB.Player;
using QSB.ShipSync.TransformSync;
using QSB.ShipSync.WorldObjects;
using QSB.Utility;
using QSB.WorldSync;
using QuantumUNET;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@ -78,7 +78,7 @@ namespace QSB.ShipSync
return;
}
QNetworkServer.Destroy(ShipTransformSync.LocalInstance.gameObject);
NetworkServer.Destroy(ShipTransformSync.LocalInstance.gameObject);
}
if (QSBPlayerManager.LocalPlayer.TransformSync == null)

View File

@ -1,8 +1,8 @@
using QuantumUNET;
using Mirror;
namespace QSB.TimeSync
{
public class PreserveTimeScale : QNetworkBehaviour
public class PreserveTimeScale : NetworkBehaviour
{
public void Start()
{
@ -10,7 +10,7 @@ namespace QSB.TimeSync
//QSBCore.Helper.Menus.PauseMenu.GetTitleButton("Button-EndCurrentLoop").Hide(); // Remove the meditation button
// Allow server to sleep at campfires
if (IsServer)
if (isServer)
{
return;
}

View File

@ -1,4 +1,5 @@
using OWML.Common;
using Mirror;
using OWML.Common;
using QSB.ClientServerStateSync;
using QSB.DeathSync;
using QSB.Inputs;
@ -7,13 +8,12 @@ using QSB.Player;
using QSB.Player.Messages;
using QSB.TimeSync.Messages;
using QSB.Utility;
using QuantumUNET;
using System;
using UnityEngine;
namespace QSB.TimeSync
{
public class WakeUpSync : QNetworkBehaviour
public class WakeUpSync : NetworkBehaviour
{
public static WakeUpSync LocalInstance { get; private set; }
@ -54,7 +54,7 @@ namespace QSB.TimeSync
public void Start()
{
if (!IsLocalPlayer)
if (!isLocalPlayer)
{
return;
}
@ -78,7 +78,7 @@ namespace QSB.TimeSync
private void OnWakeUp()
{
DebugLog.DebugWrite($"OnWakeUp", MessageType.Info);
if (QNetworkServer.active)
if (QSBCore.IsHost)
{
RespawnOnDeath.Instance.Init();
}
@ -115,7 +115,7 @@ namespace QSB.TimeSync
new RequestStateResyncMessage().Send();
CurrentState = State.Loaded;
gameObject.GetAddComponent<PreserveTimeScale>();
if (IsServer)
if (isServer)
{
SendServerTime();
}
@ -144,7 +144,7 @@ namespace QSB.TimeSync
return;
}
if (PlayerData.LoadLoopCount() != _serverLoopCount && !IsServer)
if (PlayerData.LoadLoopCount() != _serverLoopCount && !isServer)
{
DebugLog.ToConsole($"Warning - ServerLoopCount is not the same as local loop count! local:{PlayerData.LoadLoopCount()} server:{_serverLoopCount}");
return;
@ -244,11 +244,11 @@ namespace QSB.TimeSync
public void Update()
{
if (IsServer)
if (isServer)
{
UpdateServer();
}
else if (IsLocalPlayer && !QSBCore.AvoidTimeSync)
else if (isLocalPlayer && !QSBCore.AvoidTimeSync)
{
UpdateClient();
}

View File

@ -1,8 +1,8 @@
using QSB.TornadoSync.TransformSync;
using Mirror;
using QSB.TornadoSync.TransformSync;
using QSB.TornadoSync.WorldObjects;
using QSB.Utility;
using QSB.WorldSync;
using QuantumUNET;
namespace QSB.TornadoSync
{
@ -21,7 +21,7 @@ namespace QSB.TornadoSync
foreach (var transformSync in QSBWorldSync.GetUnityObjects<OccasionalTransformSync>())
{
QNetworkServer.Destroy(transformSync.gameObject);
NetworkServer.Destroy(transformSync.gameObject);
}
var gdBody = Locator._giantsDeep.GetOWRigidbody();

View File

@ -1,6 +1,5 @@
using Mirror;
using OWML.Common;
using QuantumUNET;
using System;
using System.Collections.Generic;
using System.Linq;
@ -35,24 +34,6 @@ namespace QSB.Utility
public static uint GetPlayerId(this NetworkConnection conn) =>
conn.identity.netId;
public static uint GetPlayerId(this QNetworkConnection connection)
{
if (connection == null)
{
DebugLog.ToConsole($"Error - Trying to get player id of null QNetworkConnection.\r\n{Environment.StackTrace}", MessageType.Error);
return uint.MaxValue;
}
var playerController = connection.PlayerControllers.FirstOrDefault();
if (playerController == null)
{
DebugLog.ToConsole($"Error - Player Controller of {connection.address} is null.", MessageType.Error);
return uint.MaxValue;
}
return playerController.UnetView.NetId.Value;
}
public static void SpawnWithServerAuthority(this GameObject go) =>
NetworkServer.Spawn(go, NetworkServer.localConnection);