Refactor and stuff
This commit is contained in:
18
Torch.API/ConnectionState.cs
Normal file
18
Torch.API/ConnectionState.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace Torch.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies a player's current connection state.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ConnectionState
|
||||
{
|
||||
Unknown,
|
||||
Connected = 1,
|
||||
Left = 2,
|
||||
Disconnected = 4,
|
||||
Kicked = 8,
|
||||
Banned = 16,
|
||||
}
|
||||
}
|
@@ -6,9 +6,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface ITorchServer
|
||||
public interface IChatItem
|
||||
{
|
||||
void Start();
|
||||
void Stop();
|
||||
IPlayer Player { get; }
|
||||
string Message { get; }
|
||||
DateTime Time { get; }
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface IEnvironmentInfo
|
||||
{
|
||||
EnvironmentType Type { get; }
|
||||
}
|
||||
|
||||
public enum EnvironmentType
|
||||
{
|
||||
DedicatedServer,
|
||||
GameClient
|
||||
}
|
||||
}
|
18
Torch.API/IMultiplayer.cs
Normal file
18
Torch.API/IMultiplayer.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface IMultiplayer
|
||||
{
|
||||
event Action<IPlayer> PlayerJoined;
|
||||
event Action<IPlayer> PlayerLeft;
|
||||
event Action<IChatItem> MessageReceived;
|
||||
Dictionary<ulong, IPlayer> Players { get; }
|
||||
List<IChatItem> Chat { get; }
|
||||
void SendMessage(string message);
|
||||
void KickPlayer(ulong id);
|
||||
void BanPlayer(ulong id, bool banned = true);
|
||||
}
|
||||
}
|
18
Torch.API/IPlayer.cs
Normal file
18
Torch.API/IPlayer.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface IPlayer
|
||||
{
|
||||
ulong SteamId { get; }
|
||||
List<ulong> IdentityIds { get; }
|
||||
string Name { get; }
|
||||
ConnectionState State { get; }
|
||||
DateTime LastConnected { get; }
|
||||
void SetConnectionState(ConnectionState state);
|
||||
}
|
||||
}
|
21
Torch.API/IPluginManager.cs
Normal file
21
Torch.API/IPluginManager.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using VRage.Collections;
|
||||
using VRage.Plugins;
|
||||
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface IPluginManager
|
||||
{
|
||||
ListReader<IPlugin> Plugins { get; }
|
||||
|
||||
string[] GetPluginFolders();
|
||||
string GetPluginName(Type pluginType);
|
||||
void LoadAllPlugins();
|
||||
void LoadPlugin(IPlugin plugin);
|
||||
void LoadPluginFolder(string folderName);
|
||||
void ReloadAll();
|
||||
void ReloadPlugin(IPlugin plugin, bool forceNonPiston = false);
|
||||
bool UnblockDll(string fileName);
|
||||
void UnloadPlugin(IPlugin plugin);
|
||||
}
|
||||
}
|
31
Torch.API/ITorchBase.cs
Normal file
31
Torch.API/ITorchBase.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Torch.API
|
||||
{
|
||||
public interface ITorchBase
|
||||
{
|
||||
event Action SessionLoaded;
|
||||
IMultiplayer Multiplayer { get; }
|
||||
IPluginManager Plugins { get; }
|
||||
void GameAction(Action action);
|
||||
void BeginGameAction(Action action, Action<object> callback = null, object state = null);
|
||||
void Start();
|
||||
void Stop();
|
||||
void Init();
|
||||
}
|
||||
|
||||
public interface ITorchServer : ITorchBase
|
||||
{
|
||||
bool IsRunning { get; }
|
||||
string[] RunArgs { get; set; }
|
||||
}
|
||||
|
||||
public interface ITorchClient : ITorchBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@@ -10,7 +10,7 @@ namespace Torch.API
|
||||
{
|
||||
public interface ITorchPlugin : IPlugin
|
||||
{
|
||||
void Init(ITorchServer server);
|
||||
void Init(ITorchBase torch);
|
||||
void Reload();
|
||||
}
|
||||
}
|
||||
|
@@ -45,13 +45,20 @@
|
||||
<Reference Include="VRage">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="VRage.Library, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64\VRage.Library.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="IEnvironmentInfo.cs" />
|
||||
<Compile Include="ConnectionState.cs" />
|
||||
<Compile Include="IChatItem.cs" />
|
||||
<Compile Include="IMultiplayer.cs" />
|
||||
<Compile Include="IPlayer.cs" />
|
||||
<Compile Include="IPluginManager.cs" />
|
||||
<Compile Include="ITorchPlugin.cs" />
|
||||
<Compile Include="IServerControls.cs" />
|
||||
<Compile Include="ITorchServer.cs" />
|
||||
<Compile Include="TorchAPI.cs" />
|
||||
<Compile Include="ITorchBase.cs" />
|
||||
<Compile Include="PluginAttribute.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Torch.API
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user