Skip to content

Commit 4acce1c

Browse files
authored
Merge branch 'master' into master
2 parents 8ab16c3 + 7373dd3 commit 4acce1c

31 files changed

Lines changed: 597 additions & 319 deletions

‎Torch.API/ITorchBase.cs‎

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
@@ -8,37 +8,105 @@
88

99
namespace Torch.API
1010
{
11+
/// <summary>
12+
/// API for Torch functions shared between client and server.
13+
/// </summary>
1114
public interface ITorchBase
1215
{
16+
/// <summary>
17+
/// Fired when the session begins loading.
18+
/// </summary>
1319
event Action SessionLoading;
20+
21+
/// <summary>
22+
/// Fired when the session finishes loading.
23+
/// </summary>
1424
event Action SessionLoaded;
25+
26+
/// <summary>
27+
/// Fires when the session begins unloading.
28+
/// </summary>
1529
event Action SessionUnloading;
30+
31+
/// <summary>
32+
/// Fired when the session finishes unloading.
33+
/// </summary>
1634
event Action SessionUnloaded;
35+
36+
/// <summary>
37+
/// Configuration for the current instance.
38+
/// </summary>
1739
ITorchConfig Config { get; }
40+
41+
/// <inheritdoc cref="IMultiplayerManager"/>
1842
IMultiplayerManager Multiplayer { get; }
43+
44+
/// <inheritdoc cref="IPluginManager"/>
1945
IPluginManager Plugins { get; }
46+
47+
/// <summary>
48+
/// The binary version of the current instance.
49+
/// </summary>
2050
Version TorchVersion { get; }
51+
52+
/// <summary>
53+
/// Invoke an action on the game thread.
54+
/// </summary>
2155
void Invoke(Action action);
56+
57+
/// <summary>
58+
/// Invoke an action on the game thread and block until it has completed.
59+
/// If this is called on the game thread the action will execute immediately.
60+
/// </summary>
2261
void InvokeBlocking(Action action);
62+
63+
/// <summary>
64+
/// Invoke an action on the game thread asynchronously.
65+
/// </summary>
2366
Task InvokeAsync(Action action);
24-
string[] RunArgs { get; set; }
25-
bool IsOnGameThread();
67+
68+
/// <summary>
69+
/// Start the Torch instance.
70+
/// </summary>
2671
void Start();
72+
73+
/// <summary>
74+
/// Stop the Torch instance.
75+
/// </summary>
2776
void Stop();
77+
2878
/// <summary>
2979
/// Initializes a save of the game.
3080
/// </summary>
3181
/// <param name="callerId">Id of the player who initiated the save.</param>
3282
void Save(long callerId);
83+
84+
/// <summary>
85+
/// Initialize the Torch instance.
86+
/// </summary>
3387
void Init();
88+
89+
/// <summary>
90+
/// Get an <see cref="IManager"/> that is part of the Torch instance.
91+
/// </summary>
92+
/// <typeparam name="T">Manager type</typeparam>
3493
T GetManager<T>() where T : class, IManager;
3594
}
3695

96+
/// <summary>
97+
/// API for the Torch server.
98+
/// </summary>
3799
public interface ITorchServer : ITorchBase
38100
{
101+
/// <summary>
102+
/// Path of the dedicated instance folder.
103+
/// </summary>
39104
string InstancePath { get; }
40105
}
41106

107+
/// <summary>
108+
/// API for the Torch client.
109+
/// </summary>
42110
public interface ITorchClient : ITorchBase
43111
{
44112

‎Torch.API/ITorchConfig.cs‎

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,47 @@
1-
namespace Torch
1+
using System.Collections.Generic;
2+
3+
namespace Torch
24
{
35
public interface ITorchConfig
46
{
7+
/// <summary>
8+
/// (server) Name of the instance.
9+
/// </summary>
510
string InstanceName { get; set; }
11+
12+
/// <summary>
13+
/// (server) Dedicated instance path.
14+
/// </summary>
615
string InstancePath { get; set; }
7-
bool RedownloadPlugins { get; set; }
8-
bool AutomaticUpdates { get; set; }
16+
17+
/// <summary>
18+
/// Enable automatic Torch updates.
19+
/// </summary>
20+
bool GetTorchUpdates { get; set; }
21+
22+
/// <summary>
23+
/// Enable automatic Torch updates.
24+
/// </summary>
25+
bool GetPluginUpdates { get; set; }
26+
27+
/// <summary>
28+
/// Restart Torch automatically if it crashes.
29+
/// </summary>
930
bool RestartOnCrash { get; set; }
31+
32+
/// <summary>
33+
/// Time-out in seconds for the Torch watchdog (to detect a hung session).
34+
/// </summary>
1035
int TickTimeout { get; set; }
1136

37+
/// <summary>
38+
/// A list of plugins that should be installed.
39+
/// </summary>
40+
List<string> Plugins { get; }
41+
42+
/// <summary>
43+
/// Saves the config.
44+
/// </summary>
1245
bool Save(string path = null);
1346
}
1447
}

‎Torch.API/Managers/IManager.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66

77
namespace Torch.API.Managers
88
{
9+
/// <summary>
10+
/// Base interface for Torch managers.
11+
/// </summary>
912
public interface IManager
1013
{
14+
/// <summary>
15+
/// Initializes the manager. Called after Torch is initialized.
16+
/// </summary>
1117
void Init();
1218
}
1319
}

‎Torch.API/Managers/IMultiplayerManager.cs‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,56 @@
66

77
namespace Torch.API.Managers
88
{
9+
/// <summary>
10+
/// Delegate for received messages.
11+
/// </summary>
12+
/// <param name="message">Message data.</param>
13+
/// <param name="sendToOthers">Flag to broadcast message to other players.</param>
914
public delegate void MessageReceivedDel(IChatMessage message, ref bool sendToOthers);
1015

16+
/// <summary>
17+
/// API for multiplayer related functions.
18+
/// </summary>
1119
public interface IMultiplayerManager : IManager
1220
{
21+
/// <summary>
22+
/// Fired when a player joins.
23+
/// </summary>
1324
event Action<IPlayer> PlayerJoined;
25+
26+
/// <summary>
27+
/// Fired when a player disconnects.
28+
/// </summary>
1429
event Action<IPlayer> PlayerLeft;
30+
31+
/// <summary>
32+
/// Fired when a chat message is received.
33+
/// </summary>
1534
event MessageReceivedDel MessageReceived;
35+
36+
/// <summary>
37+
/// Send a chat message to all or one specific player.
38+
/// </summary>
1639
void SendMessage(string message, string author = "Server", long playerId = 0, string font = MyFontEnum.Blue);
40+
41+
/// <summary>
42+
/// Kicks the player from the game.
43+
/// </summary>
1744
void KickPlayer(ulong steamId);
45+
46+
/// <summary>
47+
/// Bans or unbans a player from the game.
48+
/// </summary>
1849
void BanPlayer(ulong steamId, bool banned = true);
50+
51+
/// <summary>
52+
/// Gets a player by their Steam64 ID or returns null if the player isn't found.
53+
/// </summary>
1954
IMyPlayer GetPlayerBySteamId(ulong id);
55+
56+
/// <summary>
57+
/// Gets a player by their display name or returns null if the player isn't found.
58+
/// </summary>
2059
IMyPlayer GetPlayerByName(string name);
2160
}
2261
}

‎Torch.API/Managers/INetworkManager.cs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,30 @@
99

1010
namespace Torch.API.Managers
1111
{
12+
/// <summary>
13+
/// API for the network intercept.
14+
/// </summary>
1215
public interface INetworkManager : IManager
1316
{
17+
/// <summary>
18+
/// Register a network handler.
19+
/// </summary>
1420
void RegisterNetworkHandler(INetworkHandler handler);
1521
}
1622

23+
/// <summary>
24+
/// Handler for multiplayer network messages.
25+
/// </summary>
1726
public interface INetworkHandler
1827
{
28+
/// <summary>
29+
/// Returns if the handler can process the call site.
30+
/// </summary>
1931
bool CanHandle(CallSite callSite);
32+
33+
/// <summary>
34+
/// Processes a network message.
35+
/// </summary>
2036
bool Handle(ulong remoteUserId, CallSite site, BitStream stream, object obj, MyPacket packet);
2137
}
2238
}

‎Torch.API/Managers/IPluginManager.cs‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,29 @@
66

77
namespace Torch.API.Managers
88
{
9+
/// <summary>
10+
/// API for the Torch plugin manager.
11+
/// </summary>
912
public interface IPluginManager : IManager, IEnumerable<ITorchPlugin>
1013
{
14+
/// <summary>
15+
/// Fired when plugins are loaded.
16+
/// </summary>
1117
event Action<List<ITorchPlugin>> PluginsLoaded;
12-
List<ITorchPlugin> Plugins { get; }
18+
19+
/// <summary>
20+
/// Collection of loaded plugins.
21+
/// </summary>
22+
ObservableCollection<ITorchPlugin> Plugins { get; }
23+
24+
/// <summary>
25+
/// Updates all loaded plugins.
26+
/// </summary>
1327
void UpdatePlugins();
28+
29+
/// <summary>
30+
/// Disposes all loaded plugins.
31+
/// </summary>
1432
void DisposePlugins();
1533
}
1634
}

‎Torch.API/ServerState.cs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,29 @@
66

77
namespace Torch.API
88
{
9+
/// <summary>
10+
/// Used to indicate the state of the dedicated server.
11+
/// </summary>
912
public enum ServerState
1013
{
14+
/// <summary>
15+
/// The server is not running.
16+
/// </summary>
1117
Stopped,
18+
19+
/// <summary>
20+
/// The server is starting/loading the session.
21+
/// </summary>
1222
Starting,
23+
24+
/// <summary>
25+
/// The server is running.
26+
/// </summary>
1327
Running,
28+
29+
/// <summary>
30+
/// The server encountered an error.
31+
/// </summary>
1432
Error
1533
}
1634
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
using System.Reflection;
22

3-
[assembly: AssemblyVersion("1.0.182.329")]
4-
[assembly: AssemblyFileVersion("1.0.182.329")]
3+
[assembly: AssemblyVersion("1.0.186.642")]
4+
[assembly: AssemblyFileVersion("1.0.186.642")]

‎Torch.Client/Torch.Client.csproj‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
<HintPath>..\packages\NLog.4.4.1\lib\net45\NLog.dll</HintPath>
4646
<Private>True</Private>
4747
</Reference>
48+
<Reference Include="Sandbox.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
49+
<SpecificVersion>False</SpecificVersion>
50+
<HintPath>..\GameBinaries\Sandbox.Common.dll</HintPath>
51+
</Reference>
4852
<Reference Include="Sandbox.Game">
4953
<HintPath>..\GameBinaries\Sandbox.Game.dll</HintPath>
5054
<Private>False</Private>

‎Torch.Client/TorchClient.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Sandbox.Engine.Platform;
1010
using Sandbox.Engine.Utils;
1111
using Sandbox.Game;
12+
using Sandbox.ModAPI;
1213
using SpaceEngineers.Game;
1314
using Torch.API;
1415
using VRage.FileSystem;

0 commit comments

Comments
 (0)