From 6b85a9696a89e8d7ccaf4235bd71fdb115488cfa Mon Sep 17 00:00:00 2001 From: Tommy Soucy Date: Sat, 5 Oct 2024 15:06:20 -0400 Subject: [PATCH 1/6] Fixed patch I broke because I misread --- src/patches/InteractionPatches.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/patches/InteractionPatches.cs b/src/patches/InteractionPatches.cs index 2515f33..71fbfe5 100644 --- a/src/patches/InteractionPatches.cs +++ b/src/patches/InteractionPatches.cs @@ -722,18 +722,12 @@ static IEnumerable Transpiler(IEnumerable inst toInsert.Add(new CodeInstruction(OpCodes.Stloc_S, 7)); // Set flag2 bool applied = false; - bool skippedFirst = false; for (int i = 0; i < instructionList.Count; ++i) { CodeInstruction instruction = instructionList[i]; if (instruction.opcode == OpCodes.Ldloc_S && instruction.operand.ToString().Contains("(7)")) { - if (!skippedFirst) - { - skippedFirst = true; - continue; - } instructionList.InsertRange(i, toInsert); applied = true; break; From ac3f968470635fc4bd1464a62eb989deda963829 Mon Sep 17 00:00:00 2001 From: Tommy Soucy Date: Sat, 5 Oct 2024 15:07:31 -0400 Subject: [PATCH 2/6] Version update --- Properties/AssemblyInfo.cs | 4 ++-- src/Mod.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index eb8b0db..3d17036 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.10.2.0")] -[assembly: AssemblyFileVersion("1.10.2.0")] +[assembly: AssemblyVersion("1.10.3.0")] +[assembly: AssemblyFileVersion("1.10.3.0")] diff --git a/src/Mod.cs b/src/Mod.cs index 15b9efb..2218190 100644 --- a/src/Mod.cs +++ b/src/Mod.cs @@ -42,7 +42,7 @@ public class Mod : BaseUnityPlugin // BepinEx public const string pluginGuid = "VIP.TommySoucy.H3MP"; public const string pluginName = "H3MP"; - public const string pluginVersion = "1.10.2"; + public const string pluginVersion = "1.10.3"; // Assets public static JObject config; From f0801fb395f9946bfeeb4b0c115f31eaceb9b3cc Mon Sep 17 00:00:00 2001 From: Tommy Soucy Date: Sun, 13 Oct 2024 16:40:06 -0400 Subject: [PATCH 3/6] Version update --- Properties/AssemblyInfo.cs | 4 ++-- src/Mod.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 3d17036..3fed305 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.10.3.0")] -[assembly: AssemblyFileVersion("1.10.3.0")] +[assembly: AssemblyVersion("1.10.4.0")] +[assembly: AssemblyFileVersion("1.10.4.0")] diff --git a/src/Mod.cs b/src/Mod.cs index 2218190..184bd80 100644 --- a/src/Mod.cs +++ b/src/Mod.cs @@ -42,7 +42,7 @@ public class Mod : BaseUnityPlugin // BepinEx public const string pluginGuid = "VIP.TommySoucy.H3MP"; public const string pluginName = "H3MP"; - public const string pluginVersion = "1.10.3"; + public const string pluginVersion = "1.10.4"; // Assets public static JObject config; From 0e261827f69ac29212abbf1d9bb232741f391e8d Mon Sep 17 00:00:00 2001 From: Tommy Soucy Date: Fri, 1 Nov 2024 18:35:34 -0400 Subject: [PATCH 4/6] Disabled AlertSosig event syncing Version update --- Properties/AssemblyInfo.cs | 4 +-- src/Mod.cs | 2 +- src/networking/ClientHandle.cs | 20 ++++++------ src/networking/ServerHandle.cs | 32 +++++++++---------- src/patches/ActionPatches.cs | 2 +- src/patches/TNHPatches.cs | 56 +++++++++++++++++----------------- 6 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 3fed305..53b4041 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.10.4.0")] -[assembly: AssemblyFileVersion("1.10.4.0")] +[assembly: AssemblyVersion("1.10.5.0")] +[assembly: AssemblyFileVersion("1.10.5.0")] diff --git a/src/Mod.cs b/src/Mod.cs index 184bd80..5598e85 100644 --- a/src/Mod.cs +++ b/src/Mod.cs @@ -42,7 +42,7 @@ public class Mod : BaseUnityPlugin // BepinEx public const string pluginGuid = "VIP.TommySoucy.H3MP"; public const string pluginName = "H3MP"; - public const string pluginVersion = "1.10.4"; + public const string pluginVersion = "1.10.5"; // Assets public static JObject config; diff --git a/src/networking/ClientHandle.cs b/src/networking/ClientHandle.cs index eabb72e..7e09747 100644 --- a/src/networking/ClientHandle.cs +++ b/src/networking/ClientHandle.cs @@ -5473,16 +5473,16 @@ public static void SentinelInit(Packet packet) public static void AlertSosigs(Packet packet) { - string scene = packet.ReadString(); - int instance = packet.ReadInt(); - if (GameManager.scene.Equals(scene) && GameManager.instance == instance) - { - Vector3 position = packet.ReadVector3(); - SM.PlayCoreSound(FVRPooledAudioType.GenericClose, Mod.sosigAlertAlarm, position); - ++OnSosigAlertPatch.skip; - GM.CurrentSceneSettings.OnSosigAlert(null, position); - --OnSosigAlertPatch.skip; - } + //string scene = packet.ReadString(); + //int instance = packet.ReadInt(); + //if (GameManager.scene.Equals(scene) && GameManager.instance == instance) + //{ + // Vector3 position = packet.ReadVector3(); + // SM.PlayCoreSound(FVRPooledAudioType.GenericClose, Mod.sosigAlertAlarm, position); + // ++OnSosigAlertPatch.skip; + // GM.CurrentSceneSettings.OnSosigAlert(null, position); + // --OnSosigAlertPatch.skip; + //} } public static void SetModulWeaponPart(Packet packet) diff --git a/src/networking/ServerHandle.cs b/src/networking/ServerHandle.cs index d7755a2..5eb3acd 100644 --- a/src/networking/ServerHandle.cs +++ b/src/networking/ServerHandle.cs @@ -5643,22 +5643,22 @@ public static void SentinelInit(int clientID, Packet packet) public static void AlertSosigs(int clientID, Packet packet) { - string scene = packet.ReadString(); - int instance = packet.ReadInt(); - Vector3 position = packet.ReadVector3(); - if(scene.Equals(GameManager.scene) && instance == GameManager.instance) - { - SM.PlayCoreSound(FVRPooledAudioType.GenericClose, Mod.sosigAlertAlarm, position); - ++OnSosigAlertPatch.skip; - GM.CurrentSceneSettings.OnSosigAlert(null, position); - --OnSosigAlertPatch.skip; - } - if (GameManager.playersByInstanceByScene.TryGetValue(scene, out Dictionary> instances) - && instances.TryGetValue(instance, out List players) - && players.Count > 1) - { - ServerSend.AlertSosigs(players, scene, instance, position, clientID); - } + //string scene = packet.ReadString(); + //int instance = packet.ReadInt(); + //Vector3 position = packet.ReadVector3(); + //if(scene.Equals(GameManager.scene) && instance == GameManager.instance) + //{ + // SM.PlayCoreSound(FVRPooledAudioType.GenericClose, Mod.sosigAlertAlarm, position); + // ++OnSosigAlertPatch.skip; + // GM.CurrentSceneSettings.OnSosigAlert(null, position); + // --OnSosigAlertPatch.skip; + //} + //if (GameManager.playersByInstanceByScene.TryGetValue(scene, out Dictionary> instances) + // && instances.TryGetValue(instance, out List players) + // && players.Count > 1) + //{ + // ServerSend.AlertSosigs(players, scene, instance, position, clientID); + //} } public static void SetModulWeaponPart(int clientID, Packet packet) diff --git a/src/patches/ActionPatches.cs b/src/patches/ActionPatches.cs index 433edb9..0c865d4 100644 --- a/src/patches/ActionPatches.cs +++ b/src/patches/ActionPatches.cs @@ -7687,7 +7687,7 @@ static IEnumerable FixedUpdateTranspiler(IEnumerable 0) - { - return; - } - - if (ThreadManager.host) - { - ServerSend.AlertSosigs(GameManager.playersPresent, GameManager.scene, GameManager.instance, p, 0); - } - else - { - ClientSend.AlertSosigs(GameManager.scene, GameManager.instance, p); - } - } - } + //// Patches FVRSceneSettings.OnSosigAlert to make everyone alert their sosigs + //class OnSosigAlertPatch + //{ + // public static int skip; + + // static void Prefix(Vector3 p) + // { + // // If we are in a TNH instance hosted by a spectator host but spectator host is not yet in the game + // if (Mod.managerObject == null || skip > 0) + // { + // return; + // } + + // if (ThreadManager.host) + // { + // ServerSend.AlertSosigs(GameManager.playersPresent, GameManager.scene, GameManager.instance, p, 0); + // } + // else + // { + // ClientSend.AlertSosigs(GameManager.scene, GameManager.instance, p); + // } + // } + //} } From afbfa65976b4a721e6f69ca4ae662a4bd7b60337 Mon Sep 17 00:00:00 2001 From: Wilnath <29179103+Wilnath@users.noreply.github.com> Date: Sun, 29 Dec 2024 01:07:34 +0100 Subject: [PATCH 5/6] Fix unreachable codepath in Server.registerCustomPacketType --- src/networking/Server.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/networking/Server.cs b/src/networking/Server.cs index 36014a0..e7ad70a 100644 --- a/src/networking/Server.cs +++ b/src/networking/Server.cs @@ -582,8 +582,7 @@ private static void InitializeServerData() public static int RegisterCustomPacketType(string handlerID, int clientID = 0) { - int index = -1; - + int index; if (Mod.registeredCustomPacketIDs.TryGetValue(handlerID, out index)) { Mod.LogWarning("Client " + clientID + " requested for " + handlerID + " custom packet handler to be registered but this ID already exists."); @@ -591,14 +590,12 @@ public static int RegisterCustomPacketType(string handlerID, int clientID = 0) else // We don't yet have this handlerID, add it { // Get next available handler ID - if(Mod.availableCustomPacketIndices.Count > 0) + if (Mod.availableCustomPacketIndices.Count > 0) { index = Mod.availableCustomPacketIndices[Mod.availableCustomPacketIndices.Count - 1]; Mod.availableCustomPacketIndices.RemoveAt(Mod.availableCustomPacketIndices.Count - 1); } - - // If couldn't find one, need to add more space to handlers array - if (index == -1) + else // If couldn't find one, need to add more space to handlers array { index = Mod.customPacketHandlers.Length; Mod.CustomPacketHandler[] temp = Mod.customPacketHandlers; From 0b8f10e25370872655283665a69924f848123d30 Mon Sep 17 00:00:00 2001 From: Tommy Soucy Date: Sun, 26 Jan 2025 13:28:23 -0500 Subject: [PATCH 6/6] Version Update --- Properties/AssemblyInfo.cs | 4 ++-- src/Mod.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 53b4041..445ed6d 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.10.5.0")] -[assembly: AssemblyFileVersion("1.10.5.0")] +[assembly: AssemblyVersion("1.11.0.0")] +[assembly: AssemblyFileVersion("1.11.0.0")] diff --git a/src/Mod.cs b/src/Mod.cs index 5598e85..d1eb5f7 100644 --- a/src/Mod.cs +++ b/src/Mod.cs @@ -42,7 +42,7 @@ public class Mod : BaseUnityPlugin // BepinEx public const string pluginGuid = "VIP.TommySoucy.H3MP"; public const string pluginName = "H3MP"; - public const string pluginVersion = "1.10.5"; + public const string pluginVersion = "1.11.0"; // Assets public static JObject config;