Skip to content

Commit

Permalink
Fix: Prefix SpriteManager.GetWithNoDefault to avoid potential issues …
Browse files Browse the repository at this point in the history
…with custom icons (#482)

* Prefix GetWithNoDefault to avoid issues

* Oops, forgot to push fixes for BZ branch
  • Loading branch information
LeeTwentyThree authored Oct 2, 2023
1 parent 9eee31a commit 7a5ba3b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Nautilus/Patchers/SpritePatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@ internal static void Patch(Harmony harmony)
PatchSprites();
#if SUBNAUTICA
MethodInfo spriteManagerGet = AccessTools.Method(typeof(SpriteManager), nameof(SpriteManager.Get), new Type[] { typeof(SpriteManager.Group), typeof(string) });
MethodInfo spriteManagerGetWithNoDefault = AccessTools.Method(typeof(SpriteManager), nameof(SpriteManager.GetWithNoDefault), new Type[] { typeof(SpriteManager.Group), typeof(string) });
#elif BELOWZERO
MethodInfo spriteManagerGet = AccessTools.Method(typeof(SpriteManager), nameof(SpriteManager.Get), new Type[] { typeof(SpriteManager.Group), typeof(string), typeof(Sprite) });
MethodInfo spriteManagerGet = AccessTools.Method(typeof(SpriteManager), nameof(SpriteManager.Get), new Type[] { typeof(SpriteManager.Group), typeof(string), typeof(Sprite) });
#endif
MethodInfo spriteManagerGetBackground = AccessTools.Method(typeof(SpriteManager), nameof(SpriteManager.GetBackground), new Type[] { typeof(CraftData.BackgroundType) });

HarmonyMethod patchCheck = new(AccessTools.Method(typeof(SpritePatcher), nameof(SpritePatcher.PatchCheck)));
HarmonyMethod patchBackgrounds = new(AccessTools.Method(typeof(SpritePatcher), nameof(PatchBackgrounds)));
harmony.Patch(spriteManagerGet, prefix: patchCheck);
# if SUBNAUTICA
harmony.Patch(spriteManagerGetWithNoDefault, prefix: patchCheck);
#endif
harmony.Patch(spriteManagerGetBackground, prefix: patchBackgrounds);
}

Expand Down

0 comments on commit 7a5ba3b

Please sign in to comment.