Merge branch 'disconnect-fixes' of https://github.com/Raicuparta/quantum-space-buddies into disconnect-fixes

This commit is contained in:
Mister_Nebula 2020-08-19 21:30:55 +01:00
commit 6f67567f89
5 changed files with 11 additions and 16 deletions

View File

@ -15,7 +15,6 @@ namespace QSB
public static string DefaultServerIP; public static string DefaultServerIP;
public static bool DebugMode; public static bool DebugMode;
public static AssetBundle NetworkAssetBundle; public static AssetBundle NetworkAssetBundle;
private static GameObject GameObject;
private void Awake() private void Awake()
{ {
@ -25,10 +24,9 @@ namespace QSB
private void Start() private void Start()
{ {
Helper = ModHelper; Helper = ModHelper;
GameObject = gameObject;
NetworkAssetBundle = Helper.Assets.LoadBundle("assets/network"); NetworkAssetBundle = Helper.Assets.LoadBundle("assets/network");
QSB.Helper.HarmonyHelper.EmptyMethod<NetworkManagerHUD>("Update"); Helper.HarmonyHelper.EmptyMethod<NetworkManagerHUD>("Update");
gameObject.AddComponent<DebugLog>(); gameObject.AddComponent<DebugLog>();
gameObject.AddComponent<QSBNetworkManager>(); gameObject.AddComponent<QSBNetworkManager>();

View File

@ -146,13 +146,9 @@ namespace QSB
public void CleanupNetworkBehaviour(uint netId) public void CleanupNetworkBehaviour(uint netId)
{ {
var networkBehaviours = FindObjectsOfType<NetworkBehaviour>() var networkBehaviours = FindObjectsOfType<NetworkBehaviour>()
.Where(x => x.netId.Value == netId); .Where(x => x != null && x.netId.Value == netId);
foreach (var networkBehaviour in networkBehaviours) foreach (var networkBehaviour in networkBehaviours)
{ {
if (networkBehaviour == null)
{
continue;
}
var transformSync = networkBehaviour.GetComponent<TransformSync.TransformSync>(); var transformSync = networkBehaviour.GetComponent<TransformSync.TransformSync>();
if (transformSync != null) if (transformSync != null)

View File

@ -20,6 +20,7 @@ namespace QSB.TransformSync
{ {
LocalInstance = this; LocalInstance = this;
} }
private Transform GetPlayerModel() private Transform GetPlayerModel()
{ {
return Locator.GetPlayerTransform().Find("Traveller_HEA_Player_v2"); return Locator.GetPlayerTransform().Find("Traveller_HEA_Player_v2");

View File

@ -14,6 +14,7 @@ namespace QSB.TransformSync
{ {
LocalInstance = this; LocalInstance = this;
} }
private Transform GetShipModel() private Transform GetShipModel()
{ {
return Locator.GetShipTransform(); return Locator.GetShipTransform();

View File

@ -29,23 +29,22 @@ namespace QSB.Utility
ToHud(message); ToHud(message);
} }
public static string GenerateTable(List<string> collumsData, List<string> rowData) public static string GenerateTable(List<string> columnsData, List<string> rowData)
{ {
var longestKey = collumsData.OrderByDescending(s => s.Length).First(); var longestKey = columnsData.OrderByDescending(s => s.Length).First();
var longestValue = rowData.OrderByDescending(s => s.Length).First(); var longestValue = rowData.OrderByDescending(s => s.Length).First();
var longestObject = (longestKey.Length > longestValue.Length) ? longestKey : longestValue; var longestObject = (longestKey.Length > longestValue.Length) ? longestKey : longestValue;
string collums = "|"; var columns = "|";
string data = "|"; var data = "|";
foreach (var item in collumsData) foreach (var item in columnsData)
{ {
collums += " " + item.PadRight(longestObject.Length) + " |"; columns += " " + item.PadRight(longestObject.Length) + " |";
} }
foreach (var item in rowData) foreach (var item in rowData)
{ {
data += " " + item.PadRight(longestObject.Length) + " |"; data += " " + item.PadRight(longestObject.Length) + " |";
} }
return collums + Environment.NewLine + data; return columns + Environment.NewLine + data;
} }
} }
} }