mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-26 18:35:34 +00:00
commit
0628af1634
@ -176,7 +176,7 @@ namespace QSB.Menus
|
|||||||
|
|
||||||
DisconnectButton = MenuApi.PauseMenu_MakeMenuOpenButton("DISCONNECT", DisconnectPopup);
|
DisconnectButton = MenuApi.PauseMenu_MakeMenuOpenButton("DISCONNECT", DisconnectPopup);
|
||||||
|
|
||||||
QuitButton = Locator.GetSceneMenuManager().pauseMenu._exitToMainMenuAction.gameObject;
|
QuitButton = FindObjectOfType<PauseMenuManager>()._exitToMainMenuAction.gameObject;
|
||||||
|
|
||||||
if (QSBCore.IsInMultiplayer)
|
if (QSBCore.IsInMultiplayer)
|
||||||
{
|
{
|
||||||
|
@ -17,13 +17,18 @@ namespace QSB.Player
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WorldObjectManager.AllObjectsReady)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var controller = Locator.GetPlayerController();
|
var controller = Locator.GetPlayerController();
|
||||||
if (controller == null)
|
if (controller == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var collidingQuantumObject = controller.GetValue<QuantumObject>("_collidingQuantumObject");
|
var collidingQuantumObject = controller._collidingQuantumObject;
|
||||||
if (_previousCollidingQuantumObject != collidingQuantumObject)
|
if (_previousCollidingQuantumObject != collidingQuantumObject)
|
||||||
{
|
{
|
||||||
var objectIndex = (collidingQuantumObject != null)
|
var objectIndex = (collidingQuantumObject != null)
|
||||||
|
@ -5,6 +5,7 @@ using QSB.Patches;
|
|||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
using System;
|
using System;
|
||||||
|
using QSB.ShipSync.TransformSync;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace QSB.ShipSync.Patches
|
namespace QSB.ShipSync.Patches
|
||||||
@ -206,7 +207,7 @@ namespace QSB.ShipSync.Patches
|
|||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(ShipDamageController), nameof(ShipDamageController.OnImpact))]
|
[HarmonyPatch(typeof(ShipDamageController), nameof(ShipDamageController.OnImpact))]
|
||||||
public static bool ShipDamageController_OnImpact()
|
public static bool ShipDamageController_OnImpact()
|
||||||
=> ShipManager.Instance.HasAuthority;
|
=> ShipTransformSync.LocalInstance == null || ShipManager.Instance.HasAuthority;
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.RepairTick))]
|
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.RepairTick))]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using QSB.Player;
|
using OWML.Common;
|
||||||
|
using QSB.Player;
|
||||||
using QSB.SectorSync;
|
using QSB.SectorSync;
|
||||||
using QSB.SectorSync.WorldObjects;
|
using QSB.SectorSync.WorldObjects;
|
||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
@ -65,7 +66,7 @@ namespace QSB.Syncs.Sectored
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Warning - {LogName}'s initial sector was null.", OWML.Common.MessageType.Warning);
|
DebugLog.ToConsole($"Warning - {LogName}'s initial sector was null.", MessageType.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ namespace QSB.Syncs.Sectored
|
|||||||
{
|
{
|
||||||
if (ReferenceSector != null && ReferenceSector.Transform != ReferenceTransform)
|
if (ReferenceSector != null && ReferenceSector.Transform != ReferenceTransform)
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Warning - {LogName} : ReferenceSector.Transform was different to ReferenceTransform. Correcting...", OWML.Common.MessageType.Warning);
|
DebugLog.ToConsole($"Warning - {LogName} : ReferenceSector.Transform was different to ReferenceTransform. Correcting...", MessageType.Warning);
|
||||||
SetReferenceTransform(ReferenceSector.Transform);
|
SetReferenceTransform(ReferenceSector.Transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ namespace QSB.Syncs.Sectored
|
|||||||
{
|
{
|
||||||
if (sector == null)
|
if (sector == null)
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Error - {PlayerId}.{GetType().Name} got sector of ID -1.", OWML.Common.MessageType.Error);
|
DebugLog.ToConsole($"Error - {LogName} got sector of ID -1. (From waiting slot.)", MessageType.Error);
|
||||||
base.Update();
|
base.Update();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -112,15 +113,21 @@ namespace QSB.Syncs.Sectored
|
|||||||
|
|
||||||
public override void SerializeTransform(QNetworkWriter writer, bool initialState)
|
public override void SerializeTransform(QNetworkWriter writer, bool initialState)
|
||||||
{
|
{
|
||||||
if (!QSBPlayerManager.PlayerExists(PlayerId))
|
if (IsPlayerObject)
|
||||||
{
|
{
|
||||||
writer.Write(-1);
|
if (!QSBPlayerManager.PlayerExists(PlayerId))
|
||||||
|
{
|
||||||
|
writer.Write(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!Player.IsReady)
|
||||||
|
{
|
||||||
|
writer.Write(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!Player.IsReady)
|
|
||||||
{
|
if (ReferenceSector != null)
|
||||||
writer.Write(-1);
|
|
||||||
}
|
|
||||||
else if (ReferenceSector != null)
|
|
||||||
{
|
{
|
||||||
writer.Write(ReferenceSector.ObjectId);
|
writer.Write(ReferenceSector.ObjectId);
|
||||||
}
|
}
|
||||||
@ -128,7 +135,7 @@ namespace QSB.Syncs.Sectored
|
|||||||
{
|
{
|
||||||
if (_isInitialized)
|
if (_isInitialized)
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Warning - ReferenceSector of {PlayerId}.{GetType().Name} is null.", OWML.Common.MessageType.Warning);
|
DebugLog.ToConsole($"Warning - ReferenceSector of {LogName} is null.", MessageType.Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.Write(-1);
|
writer.Write(-1);
|
||||||
@ -143,7 +150,6 @@ namespace QSB.Syncs.Sectored
|
|||||||
sectorId = reader.ReadInt32();
|
sectorId = reader.ReadInt32();
|
||||||
if (initialState && sectorId != -1)
|
if (initialState && sectorId != -1)
|
||||||
{
|
{
|
||||||
DebugLog.DebugWrite($"{LogName} set waiting sector id:{sectorId}");
|
|
||||||
_sectorIdWaitingSlot = sectorId;
|
_sectorIdWaitingSlot = sectorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +165,7 @@ namespace QSB.Syncs.Sectored
|
|||||||
{
|
{
|
||||||
if (sector == null)
|
if (sector == null)
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Error - {PlayerId}.{GetType().Name} got sector of ID -1.", OWML.Common.MessageType.Error);
|
DebugLog.ToConsole($"Error - {LogName} got sector of ID -1. (From deserializing transform.)", MessageType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +184,7 @@ namespace QSB.Syncs.Sectored
|
|||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Warning - Reference was null, but sector manager wasn't ready. " +
|
DebugLog.ToConsole($"Warning - Reference was null, but sector manager wasn't ready. " +
|
||||||
$"Transform:{ReferenceTransform == null}, Sector:{ReferenceSector == null}",
|
$"Transform:{ReferenceTransform == null}, Sector:{ReferenceSector == null}",
|
||||||
OWML.Common.MessageType.Warning);
|
MessageType.Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugLog.DebugWrite($"{LogName} : Sector Manager not ready.");
|
DebugLog.DebugWrite($"{LogName} : Sector Manager not ready.");
|
||||||
@ -202,7 +208,7 @@ namespace QSB.Syncs.Sectored
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugLog.ToConsole($"Error - No closest sector found to {PlayerId}.{GetType().Name}!", OWML.Common.MessageType.Error);
|
DebugLog.ToConsole($"Error - No closest sector found to {LogName}!", MessageType.Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,9 @@ namespace QSB.TornadoSync.TransformSync
|
|||||||
{
|
{
|
||||||
public class OccasionalTransformSync : UnsectoredRigidbodySync
|
public class OccasionalTransformSync : UnsectoredRigidbodySync
|
||||||
{
|
{
|
||||||
public override bool IsReady => WorldObjectManager.AllObjectsReady;
|
public override bool IsReady => WorldObjectManager.AllObjectsReady
|
||||||
|
&& _bodyIndex >= 0 && _bodyIndex < CenterOfTheUniverse.s_rigidbodies.Count
|
||||||
|
&& _refBodyIndex >= 0 && _refBodyIndex < CenterOfTheUniverse.s_rigidbodies.Count;
|
||||||
public override bool UseInterpolation => false;
|
public override bool UseInterpolation => false;
|
||||||
public override bool IsPlayerObject => false;
|
public override bool IsPlayerObject => false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user