SamSWAT.WatchAnims fix for aki 3.4.x
This commit is contained in:
parent
aa5279cdef
commit
6034c42dd5
@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using Aki.Reflection.Patching;
|
||||
using EFT;
|
||||
|
||||
namespace SamSWAT.WatchAnims
|
||||
{
|
||||
public class GameWorldDisposePatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return typeof(GameWorld).GetMethod(nameof(GameWorld.Dispose));
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
private static void PatchPrefix()
|
||||
{
|
||||
Plugin.Controllers.Clear();
|
||||
}
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ namespace SamSWAT.WatchAnims
|
||||
private void Awake()
|
||||
{
|
||||
new GamePlayerOwnerPatch().Enable();
|
||||
new GameWorldDisposePatch().Enable();
|
||||
Controllers = new Dictionary<IAnimator, AnimatorOverrideController>();
|
||||
SuitsLookup = new Dictionary<string, int>
|
||||
{
|
||||
@ -62,7 +63,7 @@ namespace SamSWAT.WatchAnims
|
||||
};
|
||||
var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
AnimationClips = AssetBundle.LoadFromFile($"{directory}/bundles/watch animations.bundle").LoadAllAssets<AnimationClip>();
|
||||
GameWorld.OnDispose += () => Controllers.Clear();
|
||||
//GameWorld.OnDispose += () => Controllers.Clear(); doesn't exist yet in eft 3.4.x
|
||||
}
|
||||
}
|
||||
}
|
@ -66,6 +66,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GamePlayerOwnerPatch.cs" />
|
||||
<Compile Include="GameWorldDisposePatch.cs" />
|
||||
<Compile Include="Plugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user