fix initialization issues

This commit is contained in:
zznty
2023-07-01 19:57:18 +07:00
parent 1396c8b1da
commit 343420f1d8
5 changed files with 52 additions and 20 deletions

View File

@@ -58,7 +58,9 @@ namespace Torch.Server
AddManager(new EntityControlManager(this));
AddManager(new RemoteAPIManager(this));
var sessionManager = Managers.GetManager<ITorchSessionManager>();
sessionManager.AddFactory(_ => new MultiplayerManagerDedicated(this));
sessionManager.SessionStateChanged += OnSessionStateChanged;
// Needs to be done at some point after MyVRageWindows.Init
// where the debug listeners are registered
@@ -128,10 +130,6 @@ namespace Torch.Server
{
Log.Info("Initializing server");
base.Init();
var sessionManager = Managers.GetManager<ITorchSessionManager>();
sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this));
sessionManager.SessionStateChanged += OnSessionStateChanged;
GetManager<InstanceManager>().LoadInstance(InstancePath);
CanRun = true;
Initialized?.Invoke(this);