From dce4395b8fa73f64a1f39b1c100b51541891c998 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 11 May 2023 23:01:27 -0400 Subject: [PATCH 1/2] Update versions --- CosmicHorrorFishingBuddies/CosmicHorrorFishingBuddies.csproj | 2 +- CosmicHorrorFishingBuddies/mod_meta.json | 2 +- EpicOnlineTransport/EpicOnlineTransport.csproj | 2 +- MirrorWeaver/MirrorWeaver.csproj | 2 +- SteamAPIPatcher/SteamAPIPatcher.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CosmicHorrorFishingBuddies/CosmicHorrorFishingBuddies.csproj b/CosmicHorrorFishingBuddies/CosmicHorrorFishingBuddies.csproj index 69406f0..e2ab63e 100644 --- a/CosmicHorrorFishingBuddies/CosmicHorrorFishingBuddies.csproj +++ b/CosmicHorrorFishingBuddies/CosmicHorrorFishingBuddies.csproj @@ -33,7 +33,7 @@ - + $(GameInstall)\Winch.dll false diff --git a/CosmicHorrorFishingBuddies/mod_meta.json b/CosmicHorrorFishingBuddies/mod_meta.json index 47b1615..f99de91 100644 --- a/CosmicHorrorFishingBuddies/mod_meta.json +++ b/CosmicHorrorFishingBuddies/mod_meta.json @@ -1,6 +1,6 @@ { "Author": "xen-42", - "Version": "0.0.2", + "Version": "0.0.3", "ModAssembly": "CosmicHorrorFishingBuddies.dll", "MinWinchVersion": "alpha-1.3", "Entrypoint": "CosmicHorrorFishingBuddies.Loader/Initialize" diff --git a/EpicOnlineTransport/EpicOnlineTransport.csproj b/EpicOnlineTransport/EpicOnlineTransport.csproj index e848dfa..6e3729e 100644 --- a/EpicOnlineTransport/EpicOnlineTransport.csproj +++ b/EpicOnlineTransport/EpicOnlineTransport.csproj @@ -10,7 +10,7 @@ x86 - + diff --git a/MirrorWeaver/MirrorWeaver.csproj b/MirrorWeaver/MirrorWeaver.csproj index 76959a2..67c7497 100644 --- a/MirrorWeaver/MirrorWeaver.csproj +++ b/MirrorWeaver/MirrorWeaver.csproj @@ -27,6 +27,6 @@ $(GameInstall)\Winch.dll - + \ No newline at end of file diff --git a/SteamAPIPatcher/SteamAPIPatcher.csproj b/SteamAPIPatcher/SteamAPIPatcher.csproj index 1f68a39..7e73f70 100644 --- a/SteamAPIPatcher/SteamAPIPatcher.csproj +++ b/SteamAPIPatcher/SteamAPIPatcher.csproj @@ -18,7 +18,7 @@ - + From dce6dd8302c61255c55c4185291f917874e3149b Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 12 May 2023 00:09:27 -0400 Subject: [PATCH 2/2] I think this works --- .../BaseSync/TransformSync.cs | 23 ++++++++++--------- .../Debugging/Patches/DebugLogPatches.cs | 2 -- .../NetworkHarvestPOIManager.cs | 2 +- .../PlayerSync/PlayerTransformSync.cs | 15 +++++++++--- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/CosmicHorrorFishingBuddies/BaseSync/TransformSync.cs b/CosmicHorrorFishingBuddies/BaseSync/TransformSync.cs index 286d405..1edb681 100644 --- a/CosmicHorrorFishingBuddies/BaseSync/TransformSync.cs +++ b/CosmicHorrorFishingBuddies/BaseSync/TransformSync.cs @@ -11,23 +11,24 @@ internal abstract class TransformSync : NetworkBehaviour private Transform _syncedTransform; - private void Start() + private NetworkTransform _networkTransform; + + public void Awake() + { + _networkTransform = gameObject.GetComponent(); + _networkTransform.target = transform; + } + + public void Start() { CFBCore.LogInfo($"Start TransformSync: {netId}"); _syncedTransform = isOwned ? InitLocalTransform() : InitRemoteTransform(); - var networkTransform = gameObject.GetComponent(); - networkTransform.target = transform; - } + _networkTransform.transform.position = Vector3.zero; + _networkTransform.transform.rotation = Quaternion.identity; - private void Update() - { - if (isOwned) - { - transform.position = GameManager.Instance.Player.transform.position; - transform.rotation = GameManager.Instance.Player.transform.rotation; - } + _networkTransform.target = _syncedTransform; } } } diff --git a/CosmicHorrorFishingBuddies/Debugging/Patches/DebugLogPatches.cs b/CosmicHorrorFishingBuddies/Debugging/Patches/DebugLogPatches.cs index 4f66650..d04d9c7 100644 --- a/CosmicHorrorFishingBuddies/Debugging/Patches/DebugLogPatches.cs +++ b/CosmicHorrorFishingBuddies/Debugging/Patches/DebugLogPatches.cs @@ -12,7 +12,6 @@ namespace CosmicHorrorFishingBuddies.Debugging.Patches [HarmonyPatch(typeof(Debug))] internal static class DebugLogPatches { - /* [HarmonyPostfix] [HarmonyPatch(nameof(Debug.Log), new Type[] { typeof(object) })] public static void Debug_Log(object message) => CFBCore.LogInfo($"[UnityEngine.Debug.Log] {message}"); @@ -20,7 +19,6 @@ internal static class DebugLogPatches [HarmonyPostfix] [HarmonyPatch(nameof(Debug.LogWarning), new Type[] { typeof(object) })] public static void Debug_LogWarning(object message) => CFBCore.LogWarning($"[UnityEngine.Debug.Log] {message}"); - */ [HarmonyPostfix] [HarmonyPatch(nameof(Debug.LogError), new Type[] { typeof(object) })] diff --git a/CosmicHorrorFishingBuddies/HarvestPOISync/NetworkHarvestPOIManager.cs b/CosmicHorrorFishingBuddies/HarvestPOISync/NetworkHarvestPOIManager.cs index 6e73b03..73c7283 100644 --- a/CosmicHorrorFishingBuddies/HarvestPOISync/NetworkHarvestPOIManager.cs +++ b/CosmicHorrorFishingBuddies/HarvestPOISync/NetworkHarvestPOIManager.cs @@ -97,7 +97,7 @@ public NetworkHarvestPOI GetNetworkObject(HarvestPOI harvestPOI) } else { - CFBCore.LogError($"Untracked HarvestPOI {harvestPOI.name} on {NetworkPlayer.LocalPlayer.netId}"); + CFBCore.LogError($"Untracked HarvestPOI {harvestPOI?.name} on {NetworkPlayer.LocalPlayer?.netId}"); return null; } } diff --git a/CosmicHorrorFishingBuddies/PlayerSync/PlayerTransformSync.cs b/CosmicHorrorFishingBuddies/PlayerSync/PlayerTransformSync.cs index fcb217d..8629ab7 100644 --- a/CosmicHorrorFishingBuddies/PlayerSync/PlayerTransformSync.cs +++ b/CosmicHorrorFishingBuddies/PlayerSync/PlayerTransformSync.cs @@ -81,7 +81,7 @@ protected override Transform InitLocalTransform() GameManager.Instance.Player.gameObject.AddComponent(); - return GameManager.Instance.Player.transform; + return transform; } protected override Transform InitRemoteTransform() @@ -97,7 +97,7 @@ protected override Transform InitRemoteTransform() remotePlayer.transform.localRotation = Quaternion.identity; var networkPlayer = GetComponent(); - + networkPlayer.remotePlayerBoatGraphics.boatSubModelTogglers = remotePlayer.GetComponentsInChildren(); networkPlayer.remotePlayerBoatGraphics.boatModelProxies = remotePlayer.GetComponentsInChildren(); networkPlayer.remotePlayerBoatGraphics.wake = remotePlayer.Find("BoatTrailParticles").gameObject; @@ -116,7 +116,16 @@ protected override Transform InitRemoteTransform() networkPlayer.remoteAtrophyAbility.loopAudio.minDistance = 5; networkPlayer.remoteAtrophyAbility.loopAudio.clip = atrophy.loopAudioSource.clip; - return remotePlayer; + return transform; + } + + private void Update() + { + if (isOwned) + { + transform.position = GameManager.Instance.Player.transform.position; + transform.rotation = GameManager.Instance.Player.transform.rotation; + } } } }