From 4481ef7489db46d4f041f02034fcd1ce2b68520e Mon Sep 17 00:00:00 2001 From: SDraw Date: Sun, 4 Sep 2022 14:42:33 +0300 Subject: [PATCH] Props spawn notification --- ml_aci/Main.cs | 20 ++++++++++++++++++++ ml_aci/Properties/AssemblyInfo.cs | 6 +++--- ml_aci/ml_aci.csproj | 3 +++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ml_aci/Main.cs b/ml_aci/Main.cs index e9cd220..71c27cf 100644 --- a/ml_aci/Main.cs +++ b/ml_aci/Main.cs @@ -1,5 +1,8 @@ using ABI_RC.Core.EventSystem; using ABI_RC.Core.InteractionSystem; +using ABI_RC.Core.Networking; +using ABI_RC.Core.Util; +using DarkRift; namespace ml_aci { @@ -12,6 +15,12 @@ namespace ml_aci null, new HarmonyLib.HarmonyMethod(typeof(AvatarChangeInfo).GetMethod(nameof(OnLocalAvatarLoad), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)) ); + + HarmonyInstance.Patch( + typeof(CVRSyncHelper).GetMethod(nameof(CVRSyncHelper.SpawnProp)), + null, + new HarmonyLib.HarmonyMethod(typeof(AvatarChangeInfo).GetMethod(nameof(OnPropSpawned), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)) + ); } static void OnLocalAvatarLoad() @@ -19,5 +28,16 @@ namespace ml_aci if(ViewManager.Instance != null) ViewManager.Instance.TriggerPushNotification("Avatar changed", 1f); } + + static void OnPropSpawned() + { + if(ViewManager.Instance != null) + { + if((NetworkManager.Instance != null) && (NetworkManager.Instance.GameNetwork.ConnectionState == ConnectionState.Connected)) + ViewManager.Instance.TriggerPushNotification("Prop spawned", 1f); + else + ViewManager.Instance.TriggerAlert("Prop Error", "Not connected to live instance", -1, true); + } + } } } diff --git a/ml_aci/Properties/AssemblyInfo.cs b/ml_aci/Properties/AssemblyInfo.cs index ed199f6..822e4c4 100644 --- a/ml_aci/Properties/AssemblyInfo.cs +++ b/ml_aci/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; [assembly: AssemblyTitle("AvatarChangeInfo")] -[assembly: AssemblyVersion("1.0.1")] -[assembly: AssemblyFileVersion("1.0.1")] +[assembly: AssemblyVersion("1.0.2")] +[assembly: AssemblyFileVersion("1.0.2")] -[assembly: MelonLoader.MelonInfo(typeof(ml_aci.AvatarChangeInfo), "AvatarChangeInfo", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_aci.AvatarChangeInfo), "AvatarChangeInfo", "1.0.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_aci/ml_aci.csproj b/ml_aci/ml_aci.csproj index 562ab8b..25e1641 100644 --- a/ml_aci/ml_aci.csproj +++ b/ml_aci/ml_aci.csproj @@ -42,6 +42,9 @@ F:\games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll False + + False + False F:\games\Steam\common\ChilloutVR\MelonLoader\MelonLoader.dll