Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
67bb3fd00c | ||
90546a78c2 | |||
![]() |
d301955609 | ||
![]() |
264daf7515 |
@@ -11,7 +11,7 @@ Torch is the successor to SE Server Extender and gives server admins the tools t
|
|||||||
* Extensible using the Torch plugin system
|
* Extensible using the Torch plugin system
|
||||||
|
|
||||||
### Fork Difference
|
### Fork Difference
|
||||||
* .NET 6.0 runtime
|
* .NET 8.0 runtime
|
||||||
* Optimized in-game scripts (also newer compiler & language versions)
|
* Optimized in-game scripts (also newer compiler & language versions)
|
||||||
* Better configuration via cli arguments, environment variables or xml config
|
* Better configuration via cli arguments, environment variables or xml config
|
||||||
* Designed to run multiple instance from same install directory without having you to waste disk space
|
* Designed to run multiple instance from same install directory without having you to waste disk space
|
||||||
@@ -19,7 +19,9 @@ Torch is the successor to SE Server Extender and gives server admins the tools t
|
|||||||
|
|
||||||
### Discord
|
### Discord
|
||||||
|
|
||||||
If you have any questions or issues please join our [discord](https://discord.gg/UyYFSe3TyQ)
|
If you have any questions or issues please join our discord
|
||||||
|
|
||||||
|
[](https://discord.gg/VAb2zgXHAN)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
@@ -30,7 +32,7 @@ If you have any questions or issues please join our [discord](https://discord.gg
|
|||||||
|
|
||||||
# Building
|
# Building
|
||||||
|
|
||||||
As a regular dotnet project with cli by running `dotnet build Torch.Server/Torch.Server.csproj`, with VS 2022 or higher, with JB Rider or Fleet.
|
As a regular dotnet project with cli by running `dotnet build Torch.Server/Torch.Server.csproj`, with VS 2022 or higher or JB Rider.
|
||||||
|
|
||||||
If you have a more enjoyable server experience because of Torch, please consider supporting us on Patreon. (https://www.patreon.com/TorchSE)
|
If you have a more enjoyable server experience because of Torch, please consider supporting us on Patreon. (https://www.patreon.com/TorchSE)
|
||||||
|
|
||||||
|
@@ -94,27 +94,11 @@ namespace Torch.Server
|
|||||||
|
|
||||||
_server.Init();
|
_server.Init();
|
||||||
|
|
||||||
var uiThread = new Thread(() =>
|
if (!Config.Autostart && !Config.TempAutostart) return;
|
||||||
{
|
|
||||||
var ui = new TorchUI(_server);
|
|
||||||
|
|
||||||
SynchronizationContext.SetSynchronizationContext(
|
|
||||||
new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));
|
|
||||||
|
|
||||||
ui.ShowDialog();
|
|
||||||
});
|
|
||||||
|
|
||||||
uiThread.SetApartmentState(ApartmentState.STA);
|
|
||||||
uiThread.Start();
|
|
||||||
|
|
||||||
if (Config.Autostart || Config.TempAutostart)
|
|
||||||
{
|
|
||||||
Config.TempAutostart = false;
|
Config.TempAutostart = false;
|
||||||
_server.Start();
|
_server.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
uiThread.Join();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task RunSteamCmdAsync(IConfiguration configuration)
|
public static async Task RunSteamCmdAsync(IConfiguration configuration)
|
||||||
|
37
Torch.Server/Managers/UiManager.cs
Normal file
37
Torch.Server/Managers/UiManager.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System.Threading;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Torch.Managers;
|
||||||
|
|
||||||
|
namespace Torch.Server.Managers;
|
||||||
|
|
||||||
|
public class UiManager(TorchServer torchInstance) : Manager(torchInstance)
|
||||||
|
{
|
||||||
|
[CanBeNull] private Thread _uiThread;
|
||||||
|
[CanBeNull] private Dispatcher _dispatcher;
|
||||||
|
|
||||||
|
public override void Attach()
|
||||||
|
{
|
||||||
|
_uiThread = new Thread(() =>
|
||||||
|
{
|
||||||
|
var ui = new TorchUI(torchInstance);
|
||||||
|
|
||||||
|
_dispatcher = Dispatcher.CurrentDispatcher;
|
||||||
|
|
||||||
|
SynchronizationContext.SetSynchronizationContext(
|
||||||
|
new DispatcherSynchronizationContext(_dispatcher));
|
||||||
|
|
||||||
|
ui.ShowDialog();
|
||||||
|
});
|
||||||
|
|
||||||
|
_uiThread.SetApartmentState(ApartmentState.STA);
|
||||||
|
_uiThread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Detach()
|
||||||
|
{
|
||||||
|
_dispatcher?.InvokeShutdown();
|
||||||
|
if (Thread.CurrentThread != _uiThread)
|
||||||
|
_uiThread?.Join();
|
||||||
|
}
|
||||||
|
}
|
@@ -114,8 +114,8 @@ public class TorchConfig : ViewModel, ITorchConfig
|
|||||||
|
|
||||||
public UpdateSource UpdateSource { get; set; } = new()
|
public UpdateSource UpdateSource { get; set; } = new()
|
||||||
{
|
{
|
||||||
Repository = "PveTeam/Torch",
|
Repository = "PvE/Torch",
|
||||||
Url = "https://api.github.com",
|
Url = "https://git.zznty.ru/api/v1",
|
||||||
SourceType = UpdateSourceType.Github
|
SourceType = UpdateSourceType.Github
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -56,6 +56,8 @@ namespace Torch.Server
|
|||||||
if (config.EntityManagerEnabled)
|
if (config.EntityManagerEnabled)
|
||||||
AddManager(new EntityControlManager(this));
|
AddManager(new EntityControlManager(this));
|
||||||
AddManager(new RemoteAPIManager(this));
|
AddManager(new RemoteAPIManager(this));
|
||||||
|
if (!ApplicationContext.Current.IsService && !config.NoGui)
|
||||||
|
AddManager(new UiManager(this));
|
||||||
|
|
||||||
var sessionManager = Managers.GetManager<ITorchSessionManager>();
|
var sessionManager = Managers.GetManager<ITorchSessionManager>();
|
||||||
sessionManager.AddFactory(_ => new MultiplayerManagerDedicated(this));
|
sessionManager.AddFactory(_ => new MultiplayerManagerDedicated(this));
|
||||||
@@ -185,7 +187,7 @@ namespace Torch.Server
|
|||||||
|
|
||||||
if (IsRunning || HasRun)
|
if (IsRunning || HasRun)
|
||||||
{
|
{
|
||||||
Restart();
|
Restart(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -65,7 +65,8 @@ internal static class AssemblyRewriter
|
|||||||
{
|
{
|
||||||
using var assembly = AssemblyDefinition.ReadAssembly(inputStream, new()
|
using var assembly = AssemblyDefinition.ReadAssembly(inputStream, new()
|
||||||
{
|
{
|
||||||
AssemblyResolver = resolver
|
AssemblyResolver = resolver,
|
||||||
|
ReadSymbols = true
|
||||||
});
|
});
|
||||||
foreach (var fieldDefinition in FindAllToRewrite(assembly.MainModule))
|
foreach (var fieldDefinition in FindAllToRewrite(assembly.MainModule))
|
||||||
{
|
{
|
||||||
|
@@ -293,15 +293,20 @@ namespace Torch
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _disposed = false;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual void Destroy()
|
public virtual void Destroy()
|
||||||
{
|
{
|
||||||
|
if (_disposed) return;
|
||||||
Game.SignalDestroy();
|
Game.SignalDestroy();
|
||||||
if (!Game.WaitFor(VRageGame.GameState.Destroyed))
|
if (!Game.WaitFor(VRageGame.GameState.Destroyed))
|
||||||
Log.Warn("Failed to wait for the game to be destroyed");
|
Log.Warn("Failed to wait for the game to be destroyed");
|
||||||
Game = null;
|
Game = null;
|
||||||
|
|
||||||
Managers.Detach();
|
Managers.Detach();
|
||||||
|
|
||||||
|
_disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Reference in New Issue
Block a user