split pool code into seperate namespace

This commit is contained in:
Mister_Nebula 2021-03-28 17:53:05 +01:00
parent 4bff2973c1
commit cac24fcc34
12 changed files with 75 additions and 40 deletions

View File

@ -19,18 +19,6 @@ namespace QSB.ItemSync
QSBWorldSync.Init<QSBWarpCoreItem, WarpCoreItem>();
QSBWorldSync.Init<QSBNomaiConversationStoneSocket, NomaiConversationStoneSocket>();
QSBWorldSync.Init<QSBNomaiConversationStone, NomaiConversationStone>();
foreach (var streaming in Resources.FindObjectsOfTypeAll<NomaiRemoteCameraStreaming>())
{
streaming.gameObject.AddComponent<CustomNomaiRemoteCameraStreaming>();
}
foreach (var camera in Resources.FindObjectsOfTypeAll<NomaiRemoteCamera>())
{
camera.gameObject.AddComponent<CustomNomaiRemoteCamera>();
}
foreach (var platform in Resources.FindObjectsOfTypeAll<NomaiRemoteCameraPlatform>())
{
platform.gameObject.AddComponent<CustomNomaiRemoteCameraPlatform>();
}
}
public static IQSBOWItem GetObject(OWItem unityObject)

View File

@ -18,15 +18,6 @@ namespace QSB.ItemSync.Patches
QSBCore.HarmonyHelper.AddPrefix<ItemTool>("StartUnsocketItem", typeof(ItemPatches), nameof(ItemTool_StartUnsocketItem));
QSBCore.HarmonyHelper.AddPrefix<ItemTool>("CompleteUnsocketItem", typeof(ItemPatches), nameof(ItemTool_CompleteUnsocketItem));
QSBCore.HarmonyHelper.AddPrefix<ItemTool>("DropItem", typeof(ItemPatches), nameof(ItemTool_DropItem));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("Update", typeof(ItemPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("OnSocketableRemoved", typeof(ItemPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("OnSocketableDonePlacing", typeof(ItemPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("OnPedestalContact", typeof(ItemPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("FixedUpdate", typeof(ItemPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnSectorOccupantAdded", typeof(ItemPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnSectorOccupantRemoved", typeof(ItemPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnEntry", typeof(ItemPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnExit", typeof(ItemPatches), nameof(ReturnFalse));
}
public override void DoUnpatches()
@ -36,19 +27,8 @@ namespace QSB.ItemSync.Patches
QSBCore.HarmonyHelper.Unpatch<ItemTool>("StartUnsocketItem");
QSBCore.HarmonyHelper.Unpatch<ItemTool>("CompleteUnsocketItem");
QSBCore.HarmonyHelper.Unpatch<ItemTool>("DropItem");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("Update");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("OnSocketableRemoved");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("OnSocketableDonePlacing");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("OnPedestalContact");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("FixedUpdate");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnSectorOccupantAdded");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnSectorOccupantRemoved");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnEntry");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnExit");
}
public static bool ReturnFalse() => false;
public static bool ItemTool_MoveItemToCarrySocket(OWItem item)
{
var itemId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(item));

View File

@ -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);

View File

@ -1,5 +1,6 @@
using QSB.Events;
using QSB.ItemSync;
using QSB.PoolSync;
using QSB.Utility;
namespace QSB.Player.Events

View File

@ -1,6 +1,6 @@
using UnityEngine;
namespace QSB.ItemSync
namespace QSB.PoolSync
{
internal class CustomNomaiRemoteCamera : MonoBehaviour
{

View File

@ -8,7 +8,7 @@ using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace QSB.ItemSync
namespace QSB.PoolSync
{
internal class CustomNomaiRemoteCameraPlatform : NomaiShared
{

View File

@ -1,6 +1,6 @@
using OWML.Utils;
namespace QSB.ItemSync
namespace QSB.PoolSync
{
internal class CustomNomaiRemoteCameraStreaming : SectoredMonoBehaviour
{

View File

@ -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<NomaiRemoteCameraPlatform>("Update", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("OnSocketableRemoved", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("OnSocketableDonePlacing", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraPlatform>("OnPedestalContact", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("FixedUpdate", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnSectorOccupantAdded", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnSectorOccupantRemoved", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnEntry", typeof(PoolPatches), nameof(ReturnFalse));
QSBCore.HarmonyHelper.AddPrefix<NomaiRemoteCameraStreaming>("OnExit", typeof(PoolPatches), nameof(ReturnFalse));
}
public override void DoUnpatches()
{
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("Update");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("OnSocketableRemoved");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("OnSocketableDonePlacing");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraPlatform>("OnPedestalContact");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("FixedUpdate");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnSectorOccupantAdded");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnSectorOccupantRemoved");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnEntry");
QSBCore.HarmonyHelper.Unpatch<NomaiRemoteCameraStreaming>("OnExit");
}
public static bool ReturnFalse() => false;
}
}

View File

@ -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<NomaiRemoteCameraStreaming>())
{
streaming.gameObject.AddComponent<CustomNomaiRemoteCameraStreaming>();
}
foreach (var camera in Resources.FindObjectsOfTypeAll<NomaiRemoteCamera>())
{
camera.gameObject.AddComponent<CustomNomaiRemoteCamera>();
}
foreach (var platform in Resources.FindObjectsOfTypeAll<NomaiRemoteCameraPlatform>())
{
platform.gameObject.AddComponent<CustomNomaiRemoteCameraPlatform>();
}
}
}
}

View File

@ -134,8 +134,8 @@
<Compile Include="Instruments\QSBCamera\CameraManager.cs" />
<Compile Include="Instruments\QSBCamera\CameraMode.cs" />
<Compile Include="Instruments\InstrumentsManager.cs" />
<Compile Include="ItemSync\CustomNomaiRemoteCameraPlatform.cs" />
<Compile Include="ItemSync\CustomNomaiRemoteCameraStreaming.cs" />
<Compile Include="PoolSync\CustomNomaiRemoteCameraPlatform.cs" />
<Compile Include="PoolSync\CustomNomaiRemoteCameraStreaming.cs" />
<Compile Include="ItemSync\Events\DropItemEvent.cs" />
<Compile Include="ItemSync\Events\DropItemMessage.cs" />
<Compile Include="ItemSync\Events\MoveToCarryEvent.cs" />
@ -144,7 +144,7 @@
<Compile Include="ItemSync\ItemManager.cs" />
<Compile Include="ItemSync\Patches\ItemPatches.cs" />
<Compile Include="ItemSync\SocketEventType.cs" />
<Compile Include="ItemSync\CustomNomaiRemoteCamera.cs" />
<Compile Include="PoolSync\CustomNomaiRemoteCamera.cs" />
<Compile Include="ItemSync\WorldObjects\IQSBOWItem.cs" />
<Compile Include="ItemSync\WorldObjects\IQSBOWItemSocket.cs" />
<Compile Include="ItemSync\WorldObjects\QSBNomaiConversationStone.cs" />
@ -177,6 +177,8 @@
<Compile Include="Player\PlayerEntanglementWatcher.cs" />
<Compile Include="Player\PlayerMapMarker.cs" />
<Compile Include="Player\PlayerSyncObject.cs" />
<Compile Include="PoolSync\Patches\PoolPatches.cs" />
<Compile Include="PoolSync\PoolManager.cs" />
<Compile Include="QSBInputManager.cs" />
<Compile Include="QSBNetworkLobby.cs" />
<Compile Include="Patches\QSBPatch.cs" />

View File

@ -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;

View File

@ -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"
}