Skip to content

Commit

Permalink
change method of mod initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzyhau committed Jan 23, 2023
1 parent e5f2ee0 commit 959db0f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 13 additions & 3 deletions Patches/Fez.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using HatModLoader.Helpers;
using FezEngine.Tools;
using HatModLoader.Helpers;
using HatModLoader.Installers;
using HatModLoader.Source;
using Microsoft.Xna.Framework;
Expand All @@ -9,7 +10,7 @@

namespace FezGame
{
public class patch_Fez : Fez
class patch_Fez : Fez
{
public static Hat HatML;

Expand All @@ -36,7 +37,16 @@ protected override void Initialize()
orig_Initialize();
DrawingTools.Init();
HatML.InitializeAssets();
HatML.InitalizeComponents();
}

internal static extern void orig_LoadComponents(Fez game);
internal static void LoadComponents(Fez game)
{
bool doLoad = !ServiceHelper.FirstLoadDone;
orig_LoadComponents(game);
if (doLoad) {
HatML.InitalizeComponents();
}
}

protected extern void orig_Update(GameTime gameTime);
Expand Down
3 changes: 2 additions & 1 deletion Source/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public void InitializeComponents()
foreach (var component in Components)
{
ServiceHelper.AddComponent(component);
component.Initialize();
// initialization is done by just adding component if they're added past game init
//component.Initialize();
}
}

Expand Down

0 comments on commit 959db0f

Please sign in to comment.