Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
FreddyEnemy Patch
An unofficial compatibility patch for OrtonLongGaming's Freddy Enemy mod. Fixes critical crashes and restores AI/Audio logic. Tested on R.E.P.O. v0.4.4.x.
By erv
| Last updated | 4 hours ago |
| Total downloads | 132 |
| Total rating | 1 |
| Categories | Mods Misc Audio Monsters |
| Dependency string | erv-FreddyEnemy_Patch-1.0.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2305OrtonLongGaming-FreddyEnemy
NOW WORKING IN MONSTER UPDATE! - Freddy Fazbear has come to haunt your squad of lowly Semibots!
Preferred version: 1.1.1README
FreddyEnemy Patch - Unofficial Compatibility Patch
An unofficial hotfix for the FreddyEnemy mod by OrtonLongGaming.
Compatibility: Tested and working on R.E.P.O. version 0.4.4.x. Other game versions have not been tested and are not guaranteed to work.
Due to recent R.E.P.O. game updates, the original mod causes severe NullReferenceException errors, leading to broken AI and missing sounds. This patch dynamically intercepts and fixes the broken code in the game's RAM, bringing Freddy Fazbear back to life without modifying or reuploading the original mod assets.
Summary of Changes
- Restored Attack Logic: Fixed the critical crash that occurred whenever Freddy attempted to attack a player.
- Restored Audio Loops: Fixed the crashes caused by Freddy's Stunned, Haywire, and Cloaked sound effects.
- Stuck/Pathfinding Fix: Ensured Freddy's
StuckCountresets correctly so he doesn't get permanently stuck on the map. - Surgical Compatibility: The patch automatically scans for and removes old or conflicting patches targeting Freddy before applying itself, preventing mod conflicts.
Installation
Use a Mod Manager (Recommended):
Simply click "Install with Mod Manager" on Thunderstore. The original FreddyEnemy mod will be downloaded automatically as a required dependency.
Manual Installation:
- Install BepInEx.
- Install the original FreddyEnemy mod.
- Drop the
FreddyEnemy_Patch.dllinto yourBepInEx/pluginsfolder.
Technical Details for Developers
Recent R.E.P.O. updates introduced breaking signature changes to core game methods, most notably PlayerHealth.HurtOther and Sound.PlayLoop (both updated to require 5 arguments instead of 4).
Because the original mod's compiled assembly references the outdated signatures, attempting to patch the broken methods (HandleAttack, SfxStunnedLoop, etc.) directly causes Harmony to throw an IL Compile Error (ArgumentNullException: Invalid argument for callvirt NULL). The engine crashes simply by trying to read the broken IL instructions.
To bypass this issue cleanly, this patch uses a Surgical Transpiler approach:
- Parent Interception: Instead of patching the broken methods,
HarmonyTranspileris applied to their parent methods (EnemyFreddy.UpdateandEnemyFreddyAnim.Update). - Call Rerouting: The transpilers scan for
OpCodes.Callinstructions pointing to the broken methods, erase them, and reroute the execution flow to custom static C# methods within the patch. - Reflection via Traverse: The custom methods rebuild the attack and audio logic from scratch. Harmony's
Traverseclass is used to dynamically resolve private fields (_stateImpulse,_enemy,_sfxStunnedLoop) and bypass compiler restrictions for hidden variables likeStuckCount, effectively injecting the updated 5-argument method calls safely. - Pre-patch Cleanup: Uses
Harmony.GetPatchInfoto unpatch any potentially conflicting third-party modifications to Freddy's logic before applying the fixes.
Thanks
OrtonLongGaming for creating this fantastic original FreddyEnemy mod.