Skip to content

Commit 2695cda

Browse files
committed
Refactor and stuff
1 parent c381439 commit 2695cda

29 files changed

Lines changed: 505 additions & 174 deletions
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
namespace Torch
3+
namespace Torch.API
44
{
55
/// <summary>
66
/// Identifies a player's current connection state.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
namespace Torch.API
88
{
9-
public interface ITorchServer
9+
public interface IChatItem
1010
{
11-
void Start();
12-
void Stop();
11+
IPlayer Player { get; }
12+
string Message { get; }
13+
DateTime Time { get; }
1314
}
1415
}

‎Torch.API/IEnvironmentInfo.cs‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎Torch.API/IMultiplayer.cs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
5+
namespace Torch.API
6+
{
7+
public interface IMultiplayer
8+
{
9+
event Action<IPlayer> PlayerJoined;
10+
event Action<IPlayer> PlayerLeft;
11+
event Action<IChatItem> MessageReceived;
12+
Dictionary<ulong, IPlayer> Players { get; }
13+
List<IChatItem> Chat { get; }
14+
void SendMessage(string message);
15+
void KickPlayer(ulong id);
16+
void BanPlayer(ulong id, bool banned = true);
17+
}
18+
}

‎Torch.API/IPlayer.cs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Torch.API
8+
{
9+
public interface IPlayer
10+
{
11+
ulong SteamId { get; }
12+
List<ulong> IdentityIds { get; }
13+
string Name { get; }
14+
ConnectionState State { get; }
15+
DateTime LastConnected { get; }
16+
void SetConnectionState(ConnectionState state);
17+
}
18+
}

‎Torch.API/IPluginManager.cs‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using VRage.Collections;
3+
using VRage.Plugins;
4+
5+
namespace Torch.API
6+
{
7+
public interface IPluginManager
8+
{
9+
ListReader<IPlugin> Plugins { get; }
10+
11+
string[] GetPluginFolders();
12+
string GetPluginName(Type pluginType);
13+
void LoadAllPlugins();
14+
void LoadPlugin(IPlugin plugin);
15+
void LoadPluginFolder(string folderName);
16+
void ReloadAll();
17+
void ReloadPlugin(IPlugin plugin, bool forceNonPiston = false);
18+
bool UnblockDll(string fileName);
19+
void UnloadPlugin(IPlugin plugin);
20+
}
21+
}

‎Torch.API/ITorchBase.cs‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Torch.API
8+
{
9+
public interface ITorchBase
10+
{
11+
event Action SessionLoaded;
12+
IMultiplayer Multiplayer { get; }
13+
IPluginManager Plugins { get; }
14+
void GameAction(Action action);
15+
void BeginGameAction(Action action, Action<object> callback = null, object state = null);
16+
void Start();
17+
void Stop();
18+
void Init();
19+
}
20+
21+
public interface ITorchServer : ITorchBase
22+
{
23+
bool IsRunning { get; }
24+
string[] RunArgs { get; set; }
25+
}
26+
27+
public interface ITorchClient : ITorchBase
28+
{
29+
30+
}
31+
}

‎Torch.API/ITorchPlugin.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Torch.API
1010
{
1111
public interface ITorchPlugin : IPlugin
1212
{
13-
void Init(ITorchServer server);
13+
void Init(ITorchBase torch);
1414
void Reload();
1515
}
1616
}

‎Torch.API/Torch.API.csproj‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,20 @@
4545
<Reference Include="VRage">
4646
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.dll</HintPath>
4747
</Reference>
48+
<Reference Include="VRage.Library, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
49+
<SpecificVersion>False</SpecificVersion>
50+
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.Library.dll</HintPath>
51+
</Reference>
4852
</ItemGroup>
4953
<ItemGroup>
50-
<Compile Include="IEnvironmentInfo.cs" />
54+
<Compile Include="ConnectionState.cs" />
55+
<Compile Include="IChatItem.cs" />
56+
<Compile Include="IMultiplayer.cs" />
57+
<Compile Include="IPlayer.cs" />
58+
<Compile Include="IPluginManager.cs" />
5159
<Compile Include="ITorchPlugin.cs" />
5260
<Compile Include="IServerControls.cs" />
53-
<Compile Include="ITorchServer.cs" />
54-
<Compile Include="TorchAPI.cs" />
61+
<Compile Include="ITorchBase.cs" />
5562
<Compile Include="PluginAttribute.cs" />
5663
<Compile Include="Properties\AssemblyInfo.cs" />
5764
</ItemGroup>

‎Torch.API/TorchAPI.cs‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)