-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSystemsStarterPatch.cs
More file actions
30 lines (28 loc) · 889 Bytes
/
SystemsStarterPatch.cs
File metadata and controls
30 lines (28 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using HarmonyLib;
using Unity.Entities;
namespace PainMod;
[HarmonyPatch]
public static class SystemsStarterPatch
{
public static bool isInit = false;
[HarmonyPatch(typeof(SceneHandler), nameof(SceneHandler.Start))]
[HarmonyPostfix]
public static void OnWorldLoad()
{
World world = Manager.ecs.ServerWorld;
if (world != null)
{
Plugin.logger.LogInfo("Starting all systems!");
FirstSystemTest.instance.SetWorld(world);
//CustomStateSystem.instance.SetWorld(world);
isInit = true;
}
}
[HarmonyPatch(typeof(RadicalPauseMenuOption_ExitToTitle), nameof(RadicalPauseMenuOption_ExitToTitle.OnActivated))]
[HarmonyPostfix]
public static void OnLeaveServerWorld()
{
FirstSystemTest.instance.RemoveWorld();
//CustomStateSystem.instance.RemoveWorld();
}
}