diff --git a/QSB/ItemSync/ItemManager.cs b/QSB/ItemSync/ItemManager.cs index d4a04af4..f80543e4 100644 --- a/QSB/ItemSync/ItemManager.cs +++ b/QSB/ItemSync/ItemManager.cs @@ -19,18 +19,6 @@ namespace QSB.ItemSync QSBWorldSync.Init(); QSBWorldSync.Init(); QSBWorldSync.Init(); - foreach (var streaming in Resources.FindObjectsOfTypeAll()) - { - streaming.gameObject.AddComponent(); - } - foreach (var camera in Resources.FindObjectsOfTypeAll()) - { - camera.gameObject.AddComponent(); - } - foreach (var platform in Resources.FindObjectsOfTypeAll()) - { - platform.gameObject.AddComponent(); - } } public static IQSBOWItem GetObject(OWItem unityObject) diff --git a/QSB/ItemSync/Patches/ItemPatches.cs b/QSB/ItemSync/Patches/ItemPatches.cs index 6f390649..8a06c754 100644 --- a/QSB/ItemSync/Patches/ItemPatches.cs +++ b/QSB/ItemSync/Patches/ItemPatches.cs @@ -18,15 +18,6 @@ namespace QSB.ItemSync.Patches QSBCore.HarmonyHelper.AddPrefix("StartUnsocketItem", typeof(ItemPatches), nameof(ItemTool_StartUnsocketItem)); QSBCore.HarmonyHelper.AddPrefix("CompleteUnsocketItem", typeof(ItemPatches), nameof(ItemTool_CompleteUnsocketItem)); QSBCore.HarmonyHelper.AddPrefix("DropItem", typeof(ItemPatches), nameof(ItemTool_DropItem)); - QSBCore.HarmonyHelper.AddPrefix("Update", typeof(ItemPatches), nameof(ReturnFalse)); - QSBCore.HarmonyHelper.AddPrefix("OnSocketableRemoved", typeof(ItemPatches), nameof(ReturnFalse)); - QSBCore.HarmonyHelper.AddPrefix("OnSocketableDonePlacing", typeof(ItemPatches), nameof(ReturnFalse)); - QSBCore.HarmonyHelper.AddPrefix("OnPedestalContact", typeof(ItemPatches), nameof(ReturnFalse)); - QSBCore.HarmonyHelper.AddPrefix("FixedUpdate", typeof(ItemPatches), nameof(ReturnFalse)); - QSBCore.HarmonyHelper.AddPrefix("OnSectorOccupantAdded", typeof(ItemPatches), nameof(ReturnFalse)); - QSBCore.HarmonyHelper.AddPrefix("OnSectorOccupantRemoved", typeof(ItemPatches), nameof(ReturnFalse)); - QSBCore.HarmonyHelper.AddPrefix("OnEntry", typeof(ItemPatches), nameof(ReturnFalse)); - QSBCore.HarmonyHelper.AddPrefix("OnExit", typeof(ItemPatches), nameof(ReturnFalse)); } public override void DoUnpatches() @@ -36,19 +27,8 @@ namespace QSB.ItemSync.Patches QSBCore.HarmonyHelper.Unpatch("StartUnsocketItem"); QSBCore.HarmonyHelper.Unpatch("CompleteUnsocketItem"); QSBCore.HarmonyHelper.Unpatch("DropItem"); - QSBCore.HarmonyHelper.Unpatch("Update"); - QSBCore.HarmonyHelper.Unpatch("OnSocketableRemoved"); - QSBCore.HarmonyHelper.Unpatch("OnSocketableDonePlacing"); - QSBCore.HarmonyHelper.Unpatch("OnPedestalContact"); - QSBCore.HarmonyHelper.Unpatch("FixedUpdate"); - QSBCore.HarmonyHelper.Unpatch("OnSectorOccupantAdded"); - QSBCore.HarmonyHelper.Unpatch("OnSectorOccupantRemoved"); - QSBCore.HarmonyHelper.Unpatch("OnEntry"); - QSBCore.HarmonyHelper.Unpatch("OnExit"); } - public static bool ReturnFalse() => false; - public static bool ItemTool_MoveItemToCarrySocket(OWItem item) { var itemId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(item)); diff --git a/QSB/Patches/QSBPatchManager.cs b/QSB/Patches/QSBPatchManager.cs index 6a98a2fd..96192fee 100644 --- a/QSB/Patches/QSBPatchManager.cs +++ b/QSB/Patches/QSBPatchManager.cs @@ -7,6 +7,7 @@ using QSB.GeyserSync.Patches; using QSB.ItemSync.Patches; using QSB.LogSync.Patches; using QSB.OrbSync.Patches; +using QSB.PoolSync.Patches; using QSB.QuantumSync.Patches; using QSB.StatueSync.Patches; using QSB.TimeSync.Patches; @@ -43,7 +44,8 @@ namespace QSB.Patches new QuantumPatches(), new ItemPatches(), new StatuePatches(), - new GeyserPatches() + new GeyserPatches(), + new PoolPatches() }; DebugLog.DebugWrite("Patch Manager ready.", MessageType.Success); diff --git a/QSB/Player/Events/EnterLeaveEvent.cs b/QSB/Player/Events/EnterLeaveEvent.cs index d87c7071..e57f801c 100644 --- a/QSB/Player/Events/EnterLeaveEvent.cs +++ b/QSB/Player/Events/EnterLeaveEvent.cs @@ -1,5 +1,6 @@ using QSB.Events; using QSB.ItemSync; +using QSB.PoolSync; using QSB.Utility; namespace QSB.Player.Events diff --git a/QSB/ItemSync/CustomNomaiRemoteCamera.cs b/QSB/PoolSync/CustomNomaiRemoteCamera.cs similarity index 98% rename from QSB/ItemSync/CustomNomaiRemoteCamera.cs rename to QSB/PoolSync/CustomNomaiRemoteCamera.cs index 15b6df13..3c7c8b26 100644 --- a/QSB/ItemSync/CustomNomaiRemoteCamera.cs +++ b/QSB/PoolSync/CustomNomaiRemoteCamera.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace QSB.ItemSync +namespace QSB.PoolSync { internal class CustomNomaiRemoteCamera : MonoBehaviour { diff --git a/QSB/ItemSync/CustomNomaiRemoteCameraPlatform.cs b/QSB/PoolSync/CustomNomaiRemoteCameraPlatform.cs similarity index 99% rename from QSB/ItemSync/CustomNomaiRemoteCameraPlatform.cs rename to QSB/PoolSync/CustomNomaiRemoteCameraPlatform.cs index c6893efc..7ebf6bfe 100644 --- a/QSB/ItemSync/CustomNomaiRemoteCameraPlatform.cs +++ b/QSB/PoolSync/CustomNomaiRemoteCameraPlatform.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; -namespace QSB.ItemSync +namespace QSB.PoolSync { internal class CustomNomaiRemoteCameraPlatform : NomaiShared { diff --git a/QSB/ItemSync/CustomNomaiRemoteCameraStreaming.cs b/QSB/PoolSync/CustomNomaiRemoteCameraStreaming.cs similarity index 98% rename from QSB/ItemSync/CustomNomaiRemoteCameraStreaming.cs rename to QSB/PoolSync/CustomNomaiRemoteCameraStreaming.cs index ec4a4636..d98f6b80 100644 --- a/QSB/ItemSync/CustomNomaiRemoteCameraStreaming.cs +++ b/QSB/PoolSync/CustomNomaiRemoteCameraStreaming.cs @@ -1,6 +1,6 @@ using OWML.Utils; -namespace QSB.ItemSync +namespace QSB.PoolSync { internal class CustomNomaiRemoteCameraStreaming : SectoredMonoBehaviour { diff --git a/QSB/PoolSync/Patches/PoolPatches.cs b/QSB/PoolSync/Patches/PoolPatches.cs new file mode 100644 index 00000000..24d2bcf6 --- /dev/null +++ b/QSB/PoolSync/Patches/PoolPatches.cs @@ -0,0 +1,37 @@ +using QSB.Patches; + +namespace QSB.PoolSync.Patches +{ + internal class PoolPatches : QSBPatch + { + public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect; + + public override void DoPatches() + { + QSBCore.HarmonyHelper.AddPrefix("Update", typeof(PoolPatches), nameof(ReturnFalse)); + QSBCore.HarmonyHelper.AddPrefix("OnSocketableRemoved", typeof(PoolPatches), nameof(ReturnFalse)); + QSBCore.HarmonyHelper.AddPrefix("OnSocketableDonePlacing", typeof(PoolPatches), nameof(ReturnFalse)); + QSBCore.HarmonyHelper.AddPrefix("OnPedestalContact", typeof(PoolPatches), nameof(ReturnFalse)); + QSBCore.HarmonyHelper.AddPrefix("FixedUpdate", typeof(PoolPatches), nameof(ReturnFalse)); + QSBCore.HarmonyHelper.AddPrefix("OnSectorOccupantAdded", typeof(PoolPatches), nameof(ReturnFalse)); + QSBCore.HarmonyHelper.AddPrefix("OnSectorOccupantRemoved", typeof(PoolPatches), nameof(ReturnFalse)); + QSBCore.HarmonyHelper.AddPrefix("OnEntry", typeof(PoolPatches), nameof(ReturnFalse)); + QSBCore.HarmonyHelper.AddPrefix("OnExit", typeof(PoolPatches), nameof(ReturnFalse)); + } + + public override void DoUnpatches() + { + QSBCore.HarmonyHelper.Unpatch("Update"); + QSBCore.HarmonyHelper.Unpatch("OnSocketableRemoved"); + QSBCore.HarmonyHelper.Unpatch("OnSocketableDonePlacing"); + QSBCore.HarmonyHelper.Unpatch("OnPedestalContact"); + QSBCore.HarmonyHelper.Unpatch("FixedUpdate"); + QSBCore.HarmonyHelper.Unpatch("OnSectorOccupantAdded"); + QSBCore.HarmonyHelper.Unpatch("OnSectorOccupantRemoved"); + QSBCore.HarmonyHelper.Unpatch("OnEntry"); + QSBCore.HarmonyHelper.Unpatch("OnExit"); + } + + public static bool ReturnFalse() => false; + } +} diff --git a/QSB/PoolSync/PoolManager.cs b/QSB/PoolSync/PoolManager.cs new file mode 100644 index 00000000..2ea1b52c --- /dev/null +++ b/QSB/PoolSync/PoolManager.cs @@ -0,0 +1,24 @@ +using QSB.WorldSync; +using UnityEngine; + +namespace QSB.PoolSync +{ + class PoolManager : WorldObjectManager + { + protected override void RebuildWorldObjects(OWScene scene) + { + foreach (var streaming in Resources.FindObjectsOfTypeAll()) + { + streaming.gameObject.AddComponent(); + } + foreach (var camera in Resources.FindObjectsOfTypeAll()) + { + camera.gameObject.AddComponent(); + } + foreach (var platform in Resources.FindObjectsOfTypeAll()) + { + platform.gameObject.AddComponent(); + } + } + } +} diff --git a/QSB/QSB.csproj b/QSB/QSB.csproj index 6a2065eb..41d0668b 100644 --- a/QSB/QSB.csproj +++ b/QSB/QSB.csproj @@ -134,8 +134,8 @@ - - + + @@ -144,7 +144,7 @@ - + @@ -177,6 +177,8 @@ + + diff --git a/QSB/QSBNetworkManager.cs b/QSB/QSBNetworkManager.cs index 486de516..4de1e1e0 100644 --- a/QSB/QSBNetworkManager.cs +++ b/QSB/QSBNetworkManager.cs @@ -7,6 +7,7 @@ using QSB.Instruments; using QSB.ItemSync; using QSB.Patches; using QSB.Player; +using QSB.PoolSync; using QSB.TimeSync; using QSB.TransformSync; using QSB.Utility; diff --git a/QSB/manifest.json b/QSB/manifest.json index addb0571..112fda3d 100644 --- a/QSB/manifest.json +++ b/QSB/manifest.json @@ -4,6 +4,6 @@ "name": "Quantum Space Buddies", "description": "Adds online multiplayer to the game.", "uniqueName": "Raicuparta.QuantumSpaceBuddies", - "version": "0.9.0", + "version": "0.9.1", "owmlVersion": "1.1.8" } \ No newline at end of file