Skip to content

Commit

Permalink
fix GetSceneName throwing exceptions
Browse files Browse the repository at this point in the history
- done by using regex's
bump version
  • Loading branch information
SFGrenade committed Nov 9, 2024
1 parent b74a05e commit 854c977
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Core_FsmUtil.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<AssemblyTitle>Core_FsmUtil</AssemblyTitle>
<Description>A Hollow Knight Mod</Description>
<Copyright>Copyright © HK Modding 2023</Copyright>
<AssemblyVersion>1.1.1.2</AssemblyVersion>
<AssemblyVersion>1.1.2.0</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<ImplicitUsings>false</ImplicitUsings>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
Expand Down
7 changes: 6 additions & 1 deletion src/Hooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Text.RegularExpressions;
using Core.FsmUtil.delegates;
using HutongGames.PlayMaker;
using MonoMod.RuntimeDetour;
Expand Down Expand Up @@ -262,7 +263,11 @@ public static FSMHookHandle<Action<PlayMakerFSM, string>> CreateStateExitedViaTr

private static string GetSceneName(Fsm self)
{
return GameManager.instance.GetSceneNameString();
string tmpSceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
tmpSceneName = Regex.Replace(tmpSceneName, "_boss_defeated$", "");
tmpSceneName = Regex.Replace(tmpSceneName, "_boss$", "");
tmpSceneName = Regex.Replace(tmpSceneName, "_preload$", "");
return tmpSceneName;
}

private static void EnterState(Action<Fsm, FsmState> orig, Fsm self, FsmState state)
Expand Down

0 comments on commit 854c977

Please sign in to comment.