Rewrite plugin system to update plugins in parallel after each game tick.

This commit is contained in:
John Gross
2017-01-03 02:49:33 -08:00
parent 090ebd5ef5
commit a3e29fff4e
7 changed files with 66 additions and 100 deletions

View File

@@ -23,7 +23,7 @@ namespace Torch.Server
{
public class TorchServer : TorchBase, ITorchServer
{
public Thread ServerThread { get; private set; }
public Thread GameThread { get; private set; }
public bool IsRunning { get; private set; }
public event Action SessionLoading;
@@ -66,7 +66,7 @@ namespace Torch.Server
private void OnSessionReady()
{
Plugins.LoadAllPlugins();
Plugins.LoadPlugins();
InvokeSessionLoaded();
}
@@ -92,7 +92,7 @@ namespace Torch.Server
/// </summary>
public override void Stop()
{
if (Thread.CurrentThread.ManagedThreadId != ServerThread?.ManagedThreadId)
if (Thread.CurrentThread.ManagedThreadId != GameThread?.ManagedThreadId)
{
Log.Write("Requesting server stop.");
MySandboxGame.Static.Invoke(Stop);