QSBMessageManager: init after addons

This commit is contained in:
JohnCorby 2023-09-24 13:41:02 -07:00
parent b33c4cae55
commit 74945dbeb4
3 changed files with 7 additions and 3 deletions

View File

@ -33,7 +33,7 @@ public static class QSBMessageManager
private static string _rxPath;
private static string _txPath;
static QSBMessageManager()
public static void InitTypes()
{
foreach (var type in typeof(QSBMessage).GetDerivedTypes())
{
@ -44,7 +44,7 @@ public static class QSBMessageManager
}
}
public static void Init()
public static void InitHandlers()
{
NetworkServer.RegisterHandler<Wrapper>((_, wrapper) => OnServerReceive(wrapper));
NetworkClient.RegisterHandler<Wrapper>(wrapper => OnClientReceive(wrapper));

View File

@ -122,6 +122,8 @@ public class QSBCore : ModBehaviour
public void Awake()
{
// TODO: try manually loading steam dll for xbox. need to move all the steam stuff to new method or else it tries to load it first :(
// no, we cant localize this - languages are loaded after the splash screen
UIHelper.ReplaceUI(UITextType.PleaseUseController,
"<color=orange>Quantum Space Buddies</color> is best experienced with friends...");
@ -251,6 +253,8 @@ public class QSBCore : ModBehaviour
// init again to get addon patches
QSBPatchManager.Init();
// have to register message after addons get added dummy
QSBMessageManager.InitTypes();
MenuApi = ModHelper.Interaction.TryGetModApi<IMenuAPI>(ModHelper.Manifest.Dependencies[0]);

View File

@ -291,7 +291,7 @@ public class QSBNetworkManager : NetworkManager, IAddComponentOnStart
OnClientConnected?.SafeInvoke();
QSBMessageManager.Init();
QSBMessageManager.InitHandlers();
gameObject.AddComponent<RespawnOnDeath>();
gameObject.AddComponent<ServerStateManager>();