Sandbox Gamemode (#486)

* Adds skeleton Sandbox Content projects to the solution.

* Change BuildChecker output type to Class Library so that Resharper stops complaining about the project not having a Main() function.

* Added basic player event hooks to BaseServer.
Moved Server run level from PlayerManager to BaseServer.
Added concmds to switch between run levels on server.

* Forgot to commit project file.

* Entry points got changed a bit.

* You can now join a game without a map loaded on the server.

* Moved map loading to Content.

* Adds 'tp' command.

* Added 'addmap' command. Client crashes when used.

* Teleporting between maps works.

* Added GridId and MapId types.
Removed Test concmd, it was useless.
Misc formatting/cleanup.

* Tile placement kinda works.

* Added OnPlayerStatusChanged event.

* Server now auto starts the round.

* HandlePlayerStatusChanged works better now.

* Removed PlayerJoined* events from BaseServer, PlayerStatusChanged event does the same thing.

* Changed default platform of Sandbox from AnyCPU to x86.
Added "content.dllprefix" ConVar so that the config file can specify which content dll to load.
Changed LoadContentAssembly name argument to contain the entire name of the dll being searched for.

* SS14.Shared now copies Lidgren to the output directory.
More project configuration changes to remove the AnyCPU nonsense.
This commit is contained in:
Acruid
2018-01-15 10:03:50 -08:00
committed by Silver
parent 29d2320ca3
commit 785025f23c
86 changed files with 1601 additions and 992 deletions

View File

@@ -23,14 +23,16 @@ https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild
</Choose>
<PropertyGroup>
<ProjectGuid>{D0DA124B-5580-4345-A02B-9F051F78915F}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' " />
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<Target Name="Build">
<Exec Command="$(Python) git_helper.py" CustomErrorRegularExpression="^Error" />
</Target>
@@ -38,4 +40,4 @@ https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild
<Target Name="Clean">
<Message Importance="low" Text="Ignoring 'Clean' target." />
</Target>
</Project>
</Project>

View File

@@ -455,7 +455,7 @@ namespace SS14.Client.Graphics
/// <summary>
/// Transforms a point from the screen (pixel) space, to world (tile) space.
/// </summary>
public static LocalCoordinates ScreenToWorld(Vector2i point, int argMap)
public static LocalCoordinates ScreenToWorld(Vector2i point, MapId argMap)
{
var pos = ((Vector2)point - Window.Viewport.Size / 2) / Camera.PixelsPerMeter + Camera.Position;
var grid = IoCManager.Resolve<IMapManager>().GetMap(argMap).FindGridAt(pos);
@@ -465,7 +465,7 @@ namespace SS14.Client.Graphics
/// <summary>
/// Scales a vector from pixel coordinates to tile coordinates.
/// </summary>
/// <param name="size"></param>
/// <param name="vec"></param>
/// <returns></returns>
public static Vector2 PixelToTile(Vector2 vec)
{

View File

@@ -14,8 +14,8 @@ namespace SS14.Client.Graphics.Lighting
private LightState lightState = LightState.On;
private Vector2 position;
private int MapID;
private int GridID;
private MapId MapID;
private GridId GridID;
private int radius;

View File

@@ -1,7 +1,6 @@
using System;
using System.Diagnostics;
using Lidgren.Network;
using SS14.Client.Console;
using SS14.Client.Interfaces;
using SS14.Client.Interfaces.Player;
using SS14.Client.Interfaces.State;
@@ -34,7 +33,7 @@ namespace SS14.Client
/// <inheritdoc />
public ServerInfo GameInfo { get; private set; }
/// <inheritdoc />
public void Initialize()
{
@@ -84,6 +83,11 @@ namespace SS14.Client
/// <inheritdoc />
public event EventHandler<RunLevelChangedEventArgs> RunLevelChanged;
public event EventHandler<PlayerEventArgs> PlayerJoinedServer;
public event EventHandler<PlayerEventArgs> PlayerJoinedLobby;
public event EventHandler<PlayerEventArgs> PlayerJoinedGame;
public event EventHandler<PlayerEventArgs> PlayerLeaveServer;
private void OnConnected(object sender, NetChannelArgs args)
{
// request base info about the server
@@ -97,36 +101,36 @@ namespace SS14.Client
/// receiving states when they join the lobby.
/// </summary>
/// <param name="session">Session of the player.</param>
private void PlayerJoinedServer(PlayerSession session)
private void OnPlayerJoinedServer(PlayerSession session)
{
Debug.Assert(RunLevel < ClientRunLevel.Connected);
OnRunLevelChanged(ClientRunLevel.Connected);
//TODO: Notify Content
PlayerJoinedServer?.Invoke(this, new PlayerEventArgs(session));
}
/// <summary>
/// Player is joining the lobby for whatever reason.
/// </summary>
/// <param name="session">Session of the player.</param>
private void PlayerJoinedLobby(PlayerSession session)
private void OnPlayerJoinedLobby(PlayerSession session)
{
Debug.Assert(RunLevel >= ClientRunLevel.Connected);
OnRunLevelChanged(ClientRunLevel.Lobby);
//TODO: Notify Content
PlayerJoinedLobby?.Invoke(this, new PlayerEventArgs(session));
}
/// <summary>
/// Player is joining the game (usually from lobby.)
/// </summary>
/// <param name="session">Session of the player.</param>
private void PlayerJoinedGame(PlayerSession session)
private void OnPlayerJoinedGame(PlayerSession session)
{
Debug.Assert(RunLevel >= ClientRunLevel.Lobby);
OnRunLevelChanged(ClientRunLevel.Ingame);
//TODO: Notify Content
PlayerJoinedGame?.Invoke(this, new PlayerEventArgs(session));
}
private void Reset()
@@ -144,8 +148,9 @@ namespace SS14.Client
{
Debug.Assert(RunLevel > ClientRunLevel.Initialize);
_playMan.Shutdown();
PlayerLeaveServer?.Invoke(this, new PlayerEventArgs(_playMan.LocalPlayer.Session));
_playMan.Shutdown();
Reset();
}
@@ -177,21 +182,21 @@ namespace SS14.Client
private void OnLocalStatusChanged(object obj, StatusEventArgs eventArgs)
{
// player finished fully connecting to the server.
if (eventArgs.OldStatus == SessionStatus.Connected)
PlayerJoinedServer(_playMan.LocalPlayer.Session);
if (eventArgs.OldStatus == SessionStatus.Connecting)
OnPlayerJoinedServer(_playMan.LocalPlayer.Session);
if (eventArgs.NewStatus == SessionStatus.InLobby)
{
var stateMan = IoCManager.Resolve<IStateManager>();
stateMan.RequestStateChange<Lobby>();
PlayerJoinedLobby(_playMan.LocalPlayer.Session);
OnPlayerJoinedLobby(_playMan.LocalPlayer.Session);
}
if (eventArgs.NewStatus == SessionStatus.InGame)
else if (eventArgs.NewStatus == SessionStatus.InGame)
{
var stateMan = IoCManager.Resolve<IStateManager>();
stateMan.RequestStateChange<GameScreen>();
PlayerJoinedGame(_playMan.LocalPlayer.Session);
OnPlayerJoinedGame(_playMan.LocalPlayer.Session);
}
}
@@ -218,6 +223,25 @@ namespace SS14.Client
ChangeMap
}
/// <summary>
/// Event arguments for when something changed with the player.
/// </summary>
public class PlayerEventArgs : EventArgs
{
/// <summary>
/// The session that triggered the event.
/// </summary>
private PlayerSession Session { get; }
/// <summary>
/// Constructs a new instance of the class.
/// </summary>
public PlayerEventArgs(PlayerSession session)
{
Session = session;
}
}
/// <summary>
/// Event arguments for when the RunLevel has changed in the BaseClient.
/// </summary>

View File

@@ -95,8 +95,12 @@ namespace SS14.Client
_resourceCache.LoadLocalResources();
LoadContentAssembly<GameShared>("Shared");
LoadContentAssembly<GameClient>("Client");
// load the content dlls into the game
_configurationManager.RegisterCVar("content.dllprefix", "Sandbox", CVar.ARCHIVE);
var prefix = _configurationManager.GetCVar<string>("content.dllprefix");
LoadContentAssembly<GameShared>($"{prefix}.Shared");
LoadContentAssembly<GameClient>($"{prefix}.Client");
IoCManager.Resolve<ILightManager>().Initialize();
@@ -206,12 +210,12 @@ namespace SS14.Client
private void LoadContentAssembly<T>(string name) where T : GameShared
{
// get the assembly from the file system
if (_resourceManager.TryContentFileRead($@"Assemblies/Content.{name}.dll", out MemoryStream gameDll))
if (_resourceManager.TryContentFileRead($@"Assemblies/{name}.dll", out MemoryStream gameDll))
{
Logger.Debug($"[SRV] Loading {name} Content DLL");
// see if debug info is present
if (_resourceManager.TryContentFileRead($@"Assemblies/Content.{name}.pdb", out MemoryStream gamePdb))
if (_resourceManager.TryContentFileRead($@"Assemblies/{name}.pdb", out MemoryStream gamePdb))
{
try
{
@@ -220,7 +224,7 @@ namespace SS14.Client
}
catch (Exception e)
{
Logger.Error($"[SRV] Exception loading DLL Content.{name}.dll: {e}");
Logger.Error($"[SRV] Exception loading DLL {name}.dll: {e}");
}
}
else
@@ -232,13 +236,13 @@ namespace SS14.Client
}
catch (Exception e)
{
Logger.Error($"[SRV] Exception loading DLL Content.{name}.dll: {e}");
Logger.Error($"[SRV] Exception loading DLL {name}.dll: {e}");
}
}
}
else
{
Logger.Warning($"[ENG] Could not find {name} Content DLL");
Logger.Warning($"[ENG] Could not find {name} Content DLL.");
}
}
@@ -259,8 +263,8 @@ namespace SS14.Client
_networkManager.ProcessPackets();
CluwneLib.RunIdle(this, e);
AssemblyLoader.BroadcastUpdate(AssemblyLoader.UpdateLevel.PreEngine, e.Elapsed);
_stateManager.Update(e);
_timerManager.UpdateTimers(e.Elapsed);
_stateManager.Update(e);
AssemblyLoader.BroadcastUpdate(AssemblyLoader.UpdateLevel.PostEngine, e.Elapsed);
}

View File

@@ -5,6 +5,7 @@ using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Interfaces.Physics;
using SS14.Shared.IoC;
using SS14.Shared.Map;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using YamlDotNet.RepresentationModel;
@@ -35,7 +36,7 @@ namespace SS14.Client.GameObjects
Box2 ICollidable.AABB => Owner.GetComponent<BoundingBoxComponent>().AABB;
/// <inheritdoc />
public int MapID => Owner.GetComponent<ITransformComponent>().MapID;
public MapId MapID => Owner.GetComponent<ITransformComponent>().MapID;
/// <summary>
/// Called when the collidable is bumped into by someone/something

View File

@@ -38,7 +38,7 @@ namespace SS14.Client.GameObjects
public DrawDepth DrawDepth { get; set; }
private SpeechBubble _speechBubble;
public Color Color { get; set; } = Color.White;
public int MapID { get; private set; }
public MapId MapID { get; private set; }
public override Type StateType => typeof(AnimatedSpriteComponentState);

View File

@@ -24,7 +24,7 @@ namespace SS14.Client.GameObjects
private Dictionary<string, ParticleSystem> _emitters = new Dictionary<string, ParticleSystem>(); // List of particle emitters.
protected IRenderableComponent master;
protected List<IRenderableComponent> slaves = new List<IRenderableComponent>();
public int MapID { get; private set; }
public MapId MapID { get; private set; }
public DrawDepth DrawDepth { get; set; } = DrawDepth.ItemsOnTables;
#endregion Variables.

View File

@@ -44,7 +44,7 @@ namespace SS14.Client.GameObjects
protected bool visible = true;
public DrawDepth DrawDepth { get; set; }
public Color Color { get; set; } = Color.White;
public int MapID { get; private set; }
public MapId MapID { get; private set; }
public override Type StateType => typeof(SpriteComponentState);

View File

@@ -16,8 +16,8 @@ namespace SS14.Client.GameObjects
public class TransformComponent : Component, ITransformComponent
{
private Vector2 _position;
public int MapID { get; private set; }
public int GridID { get; private set; }
public MapId MapID { get; private set; }
public GridId GridID { get; private set; }
public Angle Rotation { get; private set; }
public ITransformComponent Parent { get; private set; }
//TODO: Make parenting actually work.

View File

@@ -1,6 +1,7 @@
using OpenTK;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Map;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Client.Interfaces.GameObjects
@@ -17,6 +18,6 @@ namespace SS14.Client.Interfaces.GameObjects
void UnsetMaster();
void AddSlave(IRenderableComponent slavecompo);
void RemoveSlave(IRenderableComponent slavecompo);
int MapID { get; }
MapId MapID { get; }
}
}

View File

@@ -2,6 +2,9 @@
namespace SS14.Client.Interfaces
{
/// <summary>
/// Top level class that controls the game logic of the client.
/// </summary>
public interface IBaseClient : IDisposable
{
/// <summary>
@@ -25,6 +28,26 @@ namespace SS14.Client.Interfaces
/// </summary>
event EventHandler<RunLevelChangedEventArgs> RunLevelChanged;
/// <summary>
/// Raised when the player successfully joins the server.
/// </summary>
event EventHandler<PlayerEventArgs> PlayerJoinedServer;
/// <summary>
/// Raised when the player switches to the lobby.
/// </summary>
event EventHandler<PlayerEventArgs> PlayerJoinedLobby;
/// <summary>
/// Raised when the player switches to the game.
/// </summary>
event EventHandler<PlayerEventArgs> PlayerJoinedGame;
/// <summary>
/// Raised right before the player leaves the server.
/// </summary>
event EventHandler<PlayerEventArgs> PlayerLeaveServer;
/// <summary>
/// Call this after BaseClient has been created. This sets up the object to its initial state. Only call this once.
/// </summary>

View File

@@ -1,18 +1,9 @@
using OpenTK;
using SS14.Client.GameObjects;
using System.Linq;
using OpenTK;
using SS14.Client.Graphics;
using SS14.Client.Helpers;
using SS14.Client.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.IoC;
using SS14.Shared.Maths;
using System.Collections.Generic;
using System.Linq;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
using SS14.Shared.Map;
using Vector2 = SS14.Shared.Maths.Vector2;
@@ -20,15 +11,13 @@ namespace SS14.Client.Placement.Modes
{
public class AlignSimilar : PlacementMode
{
private const uint snapToRange = 50;
private const uint SnapToRange = 50;
public AlignSimilar(PlacementManager pMan) : base(pMan)
{
}
public AlignSimilar(PlacementManager pMan) : base(pMan) { }
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);
@@ -43,19 +32,14 @@ namespace SS14.Client.Placement.Modes
var manager = IoCManager.Resolve<IClientEntityManager>();
IOrderedEnumerable<IEntity> snapToEntities =
from IEntity entity in manager.GetEntitiesInRange(MouseCoords, snapToRange)
where entity.Prototype == pManager.CurrentPrototype &&
entity.GetComponent<ITransformComponent>().MapID == MouseCoords.MapID
orderby
(entity.GetComponent<ITransformComponent>(
).WorldPosition - MouseCoords.ToWorld().Position).LengthSquared
ascending
select entity;
var snapToEntities = manager.GetEntitiesInRange(MouseCoords, SnapToRange)
.Where(entity => entity.Prototype == pManager.CurrentPrototype && entity.GetComponent<ITransformComponent>().MapID == MouseCoords.MapID)
.OrderBy(entity => (entity.GetComponent<ITransformComponent>().WorldPosition - MouseCoords.ToWorld().Position).LengthSquared)
.ToList();
if (snapToEntities.Any())
{
IEntity closestEntity = snapToEntities.First();
var closestEntity = snapToEntities.First();
if (closestEntity.TryGetComponent<ISpriteRenderableComponent>(out var component))
{
var closestSprite = component.GetCurrentSprite();
@@ -67,16 +51,16 @@ namespace SS14.Client.Placement.Modes
closestEntity.GetComponent<ITransformComponent>().WorldPosition.Y - closestBounds.Height / 2f,
closestBounds.Width, closestBounds.Height);
var sides = new Vector2[]
var sides = new[]
{
new Vector2(closestRect.Left + (closestRect.Width / 2f), closestRect.Top - closestBounds.Height / 2f),
new Vector2(closestRect.Left + (closestRect.Width / 2f), closestRect.Bottom + closestBounds.Height / 2f),
new Vector2(closestRect.Left - closestBounds.Width / 2f, closestRect.Top + (closestRect.Height / 2f)),
new Vector2(closestRect.Right + closestBounds.Width / 2f, closestRect.Top + (closestRect.Height / 2f))
new Vector2(closestRect.Left + closestRect.Width / 2f, closestRect.Top - closestBounds.Height / 2f),
new Vector2(closestRect.Left + closestRect.Width / 2f, closestRect.Bottom + closestBounds.Height / 2f),
new Vector2(closestRect.Left - closestBounds.Width / 2f, closestRect.Top + closestRect.Height / 2f),
new Vector2(closestRect.Right + closestBounds.Width / 2f, closestRect.Top + closestRect.Height / 2f)
};
Vector2 closestSide =
(from Vector2 side in sides orderby (side - MouseCoords.Position).LengthSquared ascending select side).First();
var closestSide =
(from Vector2 side in sides orderby (side - MouseCoords.Position).LengthSquared select side).First();
MouseCoords = new LocalCoordinates(closestSide, MouseCoords.Grid);
MouseScreen = CluwneLib.WorldToScreen(MouseCoords);

View File

@@ -1,44 +1,32 @@
using OpenTK;
using SS14.Client.GameObjects;
using SS14.Client.Graphics;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Utility;
using SS14.Shared.Maths;
using System;
using System;
using OpenTK.Graphics;
using SS14.Client.Graphics;
using SS14.Shared.Map;
using SS14.Shared.Prototypes;
using SS14.Shared.IoC;
using Vector2 = SS14.Shared.Maths.Vector2;
using SS14.Shared.Maths;
namespace SS14.Client.Placement.Modes
{
public class SnapgridBorder : PlacementMode
{
bool ongrid;
float snapsize;
private bool _onGrid;
private float _snapSize;
public SnapgridBorder(PlacementManager pMan) : base(pMan)
{
}
public SnapgridBorder(PlacementManager pMan) : base(pMan) { }
public override void Render()
{
base.Render();
if (ongrid)
if (_onGrid)
{
var position = CluwneLib.ScreenToCoordinates(new ScreenCoordinates(0, 0, MouseCoords.MapID)); //Find world coordinates closest to screen origin
var position = CluwneLib.ScreenToCoordinates(new ScreenCoordinates(0, 0, MouseCoords.MapID)); //Find world coordinates closest to screen origin
var gridstart = CluwneLib.WorldToScreen(new Vector2( //Find snap grid closest to screen origin and convert back to screen coords
(float)Math.Round((position.X / snapsize), MidpointRounding.AwayFromZero) * snapsize,
(float)Math.Round((position.Y / snapsize), MidpointRounding.AwayFromZero) * snapsize));
for (float a = gridstart.X; a < CluwneLib.Window.Viewport.Size.X; a += snapsize * 32) //Iterate through screen creating gridlines
(float) Math.Round(position.X / _snapSize, MidpointRounding.AwayFromZero) * _snapSize,
(float) Math.Round(position.Y / _snapSize, MidpointRounding.AwayFromZero) * _snapSize));
for (var a = gridstart.X; a < CluwneLib.Window.Viewport.Size.X; a += _snapSize * 32) //Iterate through screen creating gridlines
{
CluwneLib.drawLine(a, 0, CluwneLib.Window.Viewport.Size.Y, 90, 0.5f, Color4.Blue);
}
for (float a = gridstart.Y; a < CluwneLib.Window.Viewport.Size.Y; a += snapsize * 32)
for (var a = gridstart.Y; a < CluwneLib.Window.Viewport.Size.Y; a += _snapSize * 32)
{
CluwneLib.drawLine(0, a, CluwneLib.Window.Viewport.Size.X, 0, 0.5f, Color4.Blue);
}
@@ -47,7 +35,7 @@ namespace SS14.Client.Placement.Modes
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);
@@ -55,8 +43,8 @@ namespace SS14.Client.Placement.Modes
var snapsize = MouseCoords.Grid.SnapSize; //Find snap size.
var mouselocal = new Vector2( //Round local coordinates onto the snap grid
(float)Math.Round((MouseCoords.X / (double)snapsize), MidpointRounding.AwayFromZero) * snapsize,
(float)Math.Round((MouseCoords.Y / (double)snapsize), MidpointRounding.AwayFromZero) * snapsize);
(float) Math.Round(MouseCoords.X / (double) snapsize, MidpointRounding.AwayFromZero) * snapsize,
(float) Math.Round(MouseCoords.Y / (double) snapsize, MidpointRounding.AwayFromZero) * snapsize);
//Convert back to original world and screen coordinates after applying offset
MouseCoords = new LocalCoordinates(mouselocal + new Vector2(pManager.CurrentPrototype.PlacementOffset.X, pManager.CurrentPrototype.PlacementOffset.Y), MouseCoords.Grid);

View File

@@ -1,24 +1,15 @@
using OpenTK;
using SS14.Client.GameObjects;
using SS14.Client.Graphics;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Utility;
using SS14.Shared.Maths;
using SS14.Client.Graphics;
using System;
using OpenTK.Graphics;
using SS14.Shared.Map;
using SS14.Shared.IoC;
using SS14.Shared.Prototypes;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Client.Placement.Modes
{
public class SnapgridCenter : PlacementMode
{
bool ongrid;
float snapsize;
bool onGrid;
float snapSize;
public SnapgridCenter(PlacementManager pMan) : base(pMan)
{
@@ -27,18 +18,18 @@ namespace SS14.Client.Placement.Modes
public override void Render()
{
base.Render();
if (ongrid)
if (onGrid)
{
var position = CluwneLib.ScreenToCoordinates(new ScreenCoordinates(0,0,MouseCoords.MapID)); //Find world coordinates closest to screen origin
var gridstart = CluwneLib.WorldToScreen(new Vector2( //Find snap grid closest to screen origin and convert back to screen coords
(float)(Math.Round(((position.X / snapsize)-0.5), MidpointRounding.AwayFromZero)+0.5) * snapsize,
(float)(Math.Round(((position.Y / snapsize)-0.5), MidpointRounding.AwayFromZero)+0.5) * snapsize));
for (float a = gridstart.X; a < CluwneLib.Window.Viewport.Size.X; a += snapsize * 32) //Iterate through screen creating gridlines
(float)(Math.Round(((position.X / snapSize)-0.5), MidpointRounding.AwayFromZero)+0.5) * snapSize,
(float)(Math.Round(((position.Y / snapSize)-0.5), MidpointRounding.AwayFromZero)+0.5) * snapSize));
for (float a = gridstart.X; a < CluwneLib.Window.Viewport.Size.X; a += snapSize * 32) //Iterate through screen creating gridlines
{
CluwneLib.drawLine(a, 0, CluwneLib.Window.Viewport.Size.Y, 90, 0.5f, Color4.Blue);
}
for (float a = gridstart.Y; a < CluwneLib.Window.Viewport.Size.Y; a += snapsize * 32)
for (float a = gridstart.Y; a < CluwneLib.Window.Viewport.Size.Y; a += snapSize * 32)
{
CluwneLib.drawLine(0, a, CluwneLib.Window.Viewport.Size.X, 0, 0.5f, Color4.Blue);
}
@@ -47,19 +38,19 @@ namespace SS14.Client.Placement.Modes
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);
var snapsize = MouseCoords.Grid.SnapSize; //Find snap size.
var snapSize = MouseCoords.Grid.SnapSize; //Find snap size.
var mouselocal = new Vector2( //Round local coordinates onto the snap grid
(float)(Math.Round((MouseCoords.Position.X / (double)snapsize-0.5), MidpointRounding.AwayFromZero)+0.5) * snapsize,
(float)(Math.Round((MouseCoords.Position.Y / (double)snapsize-0.5), MidpointRounding.AwayFromZero)+0.5) * snapsize);
var mouseLocal = new Vector2( //Round local coordinates onto the snap grid
(float)(Math.Round((MouseCoords.Position.X / (double)snapSize-0.5), MidpointRounding.AwayFromZero)+0.5) * snapSize,
(float)(Math.Round((MouseCoords.Position.Y / (double)snapSize-0.5), MidpointRounding.AwayFromZero)+0.5) * snapSize);
//Adjust mouseCoords to new calculated position
MouseCoords = new LocalCoordinates(mouselocal + new Vector2(pManager.CurrentPrototype.PlacementOffset.X, pManager.CurrentPrototype.PlacementOffset.Y), MouseCoords.Grid);
MouseCoords = new LocalCoordinates(mouseLocal + new Vector2(pManager.CurrentPrototype.PlacementOffset.X, pManager.CurrentPrototype.PlacementOffset.Y), MouseCoords.Grid);
MouseScreen = CluwneLib.WorldToScreen(MouseCoords);
if (!RangeCheck())

View File

@@ -1,48 +1,37 @@
using OpenTK;
using SS14.Client.GameObjects;
using SS14.Client.Graphics;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
using SS14.Client.Graphics;
using SS14.Shared.Map;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Client.Placement.Modes
{
public class AlignTileAny : PlacementMode
{
public AlignTileAny(PlacementManager pMan) : base(pMan)
{
}
public AlignTileAny(PlacementManager pMan) : base(pMan) { }
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);
CurrentTile = MouseCoords.Grid.GetTile(MouseCoords);
var tilesize = MouseCoords.Grid.TileSize;
var tileSize = MouseCoords.Grid.TileSize;
if (!RangeCheck())
return false;
if (pManager.CurrentPermission.IsTile)
{
MouseCoords = new LocalCoordinates(CurrentTile.X + tilesize/2,
CurrentTile.Y + tilesize/2,
MouseCoords.Grid);
MouseCoords = new LocalCoordinates(CurrentTile.X + tileSize / 2,
CurrentTile.Y + tileSize / 2,
MouseCoords.Grid);
MouseScreen = CluwneLib.WorldToScreen(MouseCoords);
}
else
{
MouseCoords = new LocalCoordinates(CurrentTile.X + tilesize/2 + pManager.CurrentPrototype.PlacementOffset.X,
CurrentTile.Y + tilesize/2 + pManager.CurrentPrototype.PlacementOffset.Y,
MouseCoords.Grid);
MouseCoords = new LocalCoordinates(CurrentTile.X + tileSize / 2 + pManager.CurrentPrototype.PlacementOffset.X,
CurrentTile.Y + tileSize / 2 + pManager.CurrentPrototype.PlacementOffset.Y,
MouseCoords.Grid);
MouseScreen = CluwneLib.WorldToScreen(MouseCoords);
}

View File

@@ -1,12 +1,5 @@
using OpenTK;
using SS14.Client.GameObjects;
using SS14.Client.Graphics;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
using SS14.Shared.IoC;
using SS14.Client.Interfaces.GameObjects;
using SS14.Shared.Map;
@@ -22,7 +15,7 @@ namespace SS14.Client.Placement.Modes
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);

View File

@@ -1,14 +1,5 @@
using OpenTK;
using SS14.Client.GameObjects;
using SS14.Client.Graphics;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
using SS14.Client.Graphics;
using SS14.Shared.Map;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Client.Placement.Modes
{
@@ -20,7 +11,7 @@ namespace SS14.Client.Placement.Modes
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);

View File

@@ -1,14 +1,5 @@
using OpenTK;
using SS14.Client.GameObjects;
using SS14.Client.Graphics;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
using SS14.Client.Graphics;
using SS14.Shared.Map;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Client.Placement.Modes
{
@@ -20,28 +11,28 @@ namespace SS14.Client.Placement.Modes
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);
CurrentTile = MouseCoords.Grid.GetTile(MouseCoords);
var tilesize = MouseCoords.Grid.TileSize;
var tileSize = MouseCoords.Grid.TileSize;
if (!RangeCheck())
return false;
if (pManager.CurrentPermission.IsTile)
{
MouseCoords = new LocalCoordinates(CurrentTile.X + tilesize/2,
CurrentTile.Y + tilesize/2,
MouseCoords = new LocalCoordinates(CurrentTile.X + tileSize/2,
CurrentTile.Y + tileSize/2,
MouseCoords.Grid);
MouseScreen = CluwneLib.WorldToScreen(MouseCoords);
}
else
{
MouseCoords = new LocalCoordinates(CurrentTile.X + tilesize/2 + pManager.CurrentPrototype.PlacementOffset.X,
CurrentTile.Y + tilesize/2 + pManager.CurrentPrototype.PlacementOffset.Y,
MouseCoords = new LocalCoordinates(CurrentTile.X + tileSize/2 + pManager.CurrentPrototype.PlacementOffset.X,
CurrentTile.Y + tileSize/2 + pManager.CurrentPrototype.PlacementOffset.Y,
MouseCoords.Grid);
MouseScreen = CluwneLib.WorldToScreen(MouseCoords);

View File

@@ -1,14 +1,6 @@
using OpenTK;
using SS14.Client.GameObjects;
using SS14.Client.Graphics;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Maths;
using SS14.Client.Graphics;
using System.Collections.Generic;
using System.Linq;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
using SS14.Shared.Map;
using Vector2 = SS14.Shared.Maths.Vector2;
@@ -22,7 +14,7 @@ namespace SS14.Client.Placement.Modes
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);

View File

@@ -1,9 +1,5 @@
using SS14.Client.Graphics;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.Map;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
namespace SS14.Client.Placement.Modes
{
@@ -15,7 +11,7 @@ namespace SS14.Client.Placement.Modes
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);

View File

@@ -1,12 +1,4 @@
using OpenTK;
using SS14.Client.GameObjects;
using SS14.Client.Graphics;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
using SS14.Client.Graphics;
using SS14.Shared.Map;
namespace SS14.Client.Placement.Modes
@@ -21,7 +13,7 @@ namespace SS14.Client.Placement.Modes
public override bool Update(ScreenCoordinates mouseS)
{
if (mouseS.MapID == MapManager.NULLSPACE) return false;
if (mouseS.MapID == MapId.Nullspace) return false;
MouseScreen = mouseS;
MouseCoords = CluwneLib.ScreenToCoordinates(MouseScreen);

View File

@@ -1,12 +1,8 @@
using Lidgren.Network;
using OpenTK;
using OpenTK.Graphics;
using SS14.Client.GameObjects;
using SS14.Client.Graphics;
using SS14.Client.Graphics.Sprites;
using SS14.Client.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Map;
using SS14.Client.Interfaces.Network;
using SS14.Client.Interfaces.Placement;
using SS14.Client.Interfaces.Player;
using SS14.Client.Interfaces.Resource;
@@ -21,13 +17,10 @@ using SS14.Shared.Prototypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using SS14.Client.ResourceManagement;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Interfaces.Physics;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
using SS14.Shared.Network.Messages;
using SS14.Shared.Interfaces.Reflection;
@@ -176,7 +169,7 @@ namespace SS14.Client.Placement
public void Update(ScreenCoordinates mouseScreen)
{
if (mouseScreen.MapID == MapManager.NULLSPACE || CurrentPermission == null || CurrentMode == null) return;
if (mouseScreen.MapID == MapId.Nullspace || CurrentPermission == null || CurrentMode == null) return;
ValidPosition = CurrentMode.Update(mouseScreen);
}

View File

@@ -1,13 +1,9 @@
using OpenTK;
using SS14.Client.Graphics;
using SS14.Client.Graphics.Sprites;
using SS14.Client.Graphics.Utility;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.Map;
using SS14.Shared.Maths;
using SS14.Shared.Utility;
using Vector2i = SS14.Shared.Maths.Vector2i;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Client.Placement
@@ -21,10 +17,7 @@ namespace SS14.Client.Placement
public Sprite SpriteToDraw { get; set; }
public Color ValidPlaceColor { get; set; } = new Color(34, 139, 34); //Default valid color is green
public Color InvalidPlaceColor { get; set; } = new Color(34, 34, 139); //Default invalid placement is red
public virtual bool rangerequired => false;
public PlacementMode(PlacementManager pMan)

View File

@@ -11,7 +11,7 @@ namespace SS14.Client.Player
/// <summary>
/// Status of the session.
/// </summary>
public SessionStatus Status { get; set; } = SessionStatus.Zombie;
public SessionStatus Status { get; set; } = SessionStatus.Connecting;
/// <summary>
/// Index of the session.

View File

@@ -40,7 +40,6 @@ using Vector2i = SS14.Shared.Maths.Vector2i;
using SS14.Client.UserInterface;
using SS14.Client.UserInterface.Controls;
using SS14.Client.UserInterface.CustomControls;
using SS14.Shared.ContentPack;
namespace SS14.Client.State.States
{
@@ -68,8 +67,8 @@ namespace SS14.Client.State.States
private SpriteBatch _decalBatch;
#region Mouse/Camera stuff
public ScreenCoordinates MousePosScreen { get; set; } = new ScreenCoordinates(0, 0, 0);
public LocalCoordinates MousePosWorld { get; set; } = new LocalCoordinates(0, 0, 0, 0);
public ScreenCoordinates MousePosScreen { get; set; }
public LocalCoordinates MousePosWorld { get; set; }
private View view;
#endregion Mouse/Camera stuff
@@ -160,7 +159,7 @@ namespace SS14.Client.State.States
_entityManager = IoCManager.Resolve<IClientEntityManager>();
_componentManager = IoCManager.Resolve<IComponentManager>();
IoCManager.Resolve<IMapManager>().OnTileChanged += OnTileChanged;
IoCManager.Resolve<IMapManager>().OnTileChanged += (gridId, tileRef, oldTile) => OnTileChanged(gridId, tileRef, oldTile);
IoCManager.Resolve<IPlayerManager>().LocalPlayer.EntityMoved += OnPlayerMove;
NetworkManager.MessageArrived += NetworkManagerMessageArrived;
@@ -323,7 +322,7 @@ namespace SS14.Client.State.States
playerVision = lightManager.CreateLight();
playerVision.Color = Color.Blue;
playerVision.Radius = 1024;
playerVision.Coordinates = new LocalCoordinates(0, 0, 0, 0);
playerVision.Coordinates = new LocalCoordinates();
OccluderDebugTarget = new RenderImage("debug", width, height);
}
@@ -398,7 +397,7 @@ namespace SS14.Client.State.States
// vp is the rectangle in which we can render in world space.
var vp = CluwneLib.WorldViewport;
int map = 0;
var map = MapId.Nullspace;
if(PlayerManager.LocalPlayer.ControlledEntity != null)
map = PlayerManager.LocalPlayer.ControlledEntity.GetComponent<ITransformComponent>().MapID;
@@ -689,7 +688,7 @@ namespace SS14.Client.State.States
}
else
{
MousePosScreen = new ScreenCoordinates(e.NewPosition, Shared.Map.MapManager.NULLSPACE);
MousePosScreen = new ScreenCoordinates(e.NewPosition, MapId.Nullspace);
}
MousePosWorld = CluwneLib.ScreenToCoordinates(MousePosScreen);
UserInterfaceManager.MouseMove(e);
@@ -768,7 +767,7 @@ namespace SS14.Client.State.States
RecalculateScene();
}
public void OnTileChanged(int gridId, TileRef tileRef, Tile oldTile)
public void OnTileChanged(GridId gridId, TileRef tileRef, Tile oldTile)
{
IoCManager.Resolve<ILightManager>().RecalculateLightsInView(Box2.FromDimensions(tileRef.X, tileRef.Y, 1, 1));
// Recalculate the scene batches.
@@ -1093,7 +1092,7 @@ namespace SS14.Client.State.States
foreach (var grid in grids)
{
//We've already drawn the default grid
if (grid.Index == SS14.Shared.Map.MapManager.DEFAULTGRID)
if (grid.Index == GridId.DefaultGrid)
continue;
//Collects all tiles from grids in vision, gathering empty tiles only from the default grid
@@ -1105,8 +1104,11 @@ namespace SS14.Client.State.States
/// <summary>
/// Render the renderables
/// </summary>
/// <param name="frameTime"></param>
/// <param name="viewPort"></param>
/// <param name="argMapLevel"></param>
/// <param name="frametime">time since the last frame was rendered.</param>
private void RenderComponents(float frameTime, Box2 viewPort, int argMapLevel)
private void RenderComponents(float frameTime, Box2 viewPort, MapId argMapLevel)
{
IEnumerable<IComponent> components = _componentManager.GetComponents<ISpriteRenderableComponent>()
.Cast<IComponent>()
@@ -1345,7 +1347,7 @@ namespace SS14.Client.State.States
};
}
public void RenderDebug(Box2 viewport, int argMap)
public void RenderDebug(Box2 viewport, MapId argMap)
{
if (CluwneLib.Debug.DebugColliders)
{
@@ -1397,8 +1399,8 @@ Mouse Pos:
Pixel: {mouseWorldOffset.X} / {mouseWorldOffset.Y}
World: {mouseTile.X} / {mouseTile.Y}
Screen: {mouseScreenPos.X} / {mouseScreenPos.Y}
Grid: {mousepos.GridID}
Map: {mousepos.MapID}";
Grid: {(int)mousepos.GridID}
Map: {(int)mousepos.MapID}";
PositionDebugText.Draw();
}

View File

@@ -13,9 +13,7 @@ using SS14.Server.Interfaces.GameState;
using SS14.Server.Interfaces.Log;
using SS14.Server.Interfaces.Placement;
using SS14.Server.Interfaces.Player;
using SS14.Server.Interfaces.Round;
using SS14.Server.Interfaces.ServerConsole;
using SS14.Server.Round;
using SS14.Shared;
using SS14.Shared.Configuration;
using SS14.Shared.ContentPack;
@@ -33,26 +31,11 @@ using SS14.Shared.Log;
using SS14.Shared.Network;
using SS14.Shared.Network.Messages;
using SS14.Shared.Prototypes;
using SS14.Shared.ServerEnums;
using SS14.Shared.Map;
using SS14.Server.Interfaces.Maps;
using SS14.Shared.Console;
namespace SS14.Server
{
/// <summary>
/// Event delegate for when the run level of the BaseServer changes.
/// </summary>
/// <param name="oldLevel">Previous level.</param>
/// <param name="newLevel">Net Level.</param>
public delegate void EventRunLevelChanged(RunLevel oldLevel, RunLevel newLevel);
/// <summary>
/// Event delegate for when the server ticks.
/// </summary>
/// <param name="curTick">Current tick the server is at.</param>
public delegate void EventTick(int curTick);
/// <summary>
/// The master class that runs the rest of the engine.
/// </summary>
@@ -67,39 +50,32 @@ namespace SS14.Server
[Dependency]
private readonly IServerEntityManager _entities;
[Dependency]
private readonly IServerLogManager _logman;
private readonly IServerLogManager _log;
[Dependency]
private readonly ISS14Serializer Serializer;
private readonly ISS14Serializer _serializer;
[Dependency]
private readonly IGameTiming _time;
[Dependency]
private readonly IResourceManager _resources;
[Dependency]
private readonly IMapLoader mapLoader;
private readonly IMapLoader _mapLoader;
[Dependency]
private readonly IMapManager mapManager;
private readonly IMapManager _mapManager;
[Dependency]
private readonly ITimerManager timerManager;
private const int GAME_COUNTDOWN = 15;
private RunLevel _runLevel;
private bool _active;
private int _lastAnnounced;
private DateTime _startAt;
private ServerRunLevel _runLevel;
private TimeSpan _lastTitleUpdate;
private int _lastReceivedBytes;
private int _lastSentBytes;
private RunLevel Level
/// <inheritdoc />
public ServerRunLevel RunLevel
{
get => _runLevel;
set
{
IoCManager.Resolve<IPlayerManager>().RunLevel = value;
_runLevel = value;
}
set => OnRunLevelChanged(value);
}
/// <inheritdoc />
@@ -115,8 +91,11 @@ namespace SS14.Server
public string Motd => _config.GetCVar<string>("game.welcomemsg");
/// <inheritdoc />
public event EventRunLevelChanged OnRunLevelChanged;
public string GameModeName { get; set; } = string.Empty;
/// <inheritdoc />
public event EventHandler<RunLevelChangedEventArgs> RunLevelChanged;
/// <inheritdoc />
public void Restart()
{
@@ -125,7 +104,6 @@ namespace SS14.Server
IoCManager.Resolve<IPlayerManager>().SendJoinLobbyToAll();
SendGameStateUpdate();
DisposeForRestart();
StartLobby();
}
/// <inheritdoc />
@@ -141,7 +119,7 @@ namespace SS14.Server
/// <inheritdoc />
public void SaveGame()
{
mapLoader.Save(PathHelpers.ExecutableRelativeFile(Path.Combine("Resources", MapName)), mapManager.GetMap(1));
_mapLoader.Save(PathHelpers.ExecutableRelativeFile(Path.Combine("Resources", MapName)), _mapManager.GetMap(new MapId(1)));
}
/// <inheritdoc />
@@ -159,16 +137,17 @@ namespace SS14.Server
var logFormat = _config.GetCVar<string>("log.format");
var logFilename = logFormat.Replace("%(date)s", DateTime.Now.ToString("yyyyMMdd")).Replace("%(time)s", DateTime.Now.ToString("hhmmss"));
var fullPath = Path.Combine(logPath, logFilename);
if (!Path.IsPathRooted(fullPath))
logPath = PathHelpers.ExecutableRelativeFile(fullPath);
// Create log directory if it does not exist yet.
Directory.CreateDirectory(Path.GetDirectoryName(logPath));
_logman.CurrentLevel = _config.GetCVar<LogLevel>("log.level");
_logman.LogPath = logPath;
_log.CurrentLevel = _config.GetCVar<LogLevel>("log.level");
_log.LogPath = logPath;
Level = RunLevel.Init;
OnRunLevelChanged(ServerRunLevel.Init);
LoadSettings();
@@ -197,7 +176,7 @@ namespace SS14.Server
netMan.RegisterNetMessage<MsgPlayerListReq>(MsgPlayerListReq.NAME, (int)MsgPlayerListReq.ID, HandlePlayerListReq);
netMan.RegisterNetMessage<MsgPlayerList>(MsgPlayerList.NAME, (int)MsgPlayerList.ID, HandleErrorMessage);
netMan.RegisterNetMessage<MsgSession>(MsgSession.NAME, (int)MsgSession.ID, message => IoCManager.Resolve<IPlayerManager>().HandleNetworkMessage((MsgSession)message));
netMan.RegisterNetMessage<MsgSession>(MsgSession.NAME, (int)MsgSession.ID);
netMan.RegisterNetMessage<MsgMapReq>(MsgMapReq.NAME, (int)MsgMapReq.ID, message => SendMap(message.MsgChannel));
@@ -215,19 +194,23 @@ namespace SS14.Server
_resources.MountContentDirectory(@"./Resources/");
//mount the engine content pack
// mount the engine content pack
_resources.MountContentPack(@"EngineContentPack.zip");
//mount the default game ContentPack defined in config
// mount the default game ContentPack defined in config
_resources.MountDefaultContentPack();
LoadContentAssembly<GameShared>("Shared");
LoadContentAssembly<GameServer>("Server");
// load the content dlls into the game
_config.RegisterCVar("content.dllprefix", "Sandbox", CVar.ARCHIVE);
var prefix = _config.GetCVar<string>("content.dllprefix");
LoadContentAssembly<GameShared>($"{prefix}.Shared");
LoadContentAssembly<GameServer>($"{prefix}.Server");
// HAS to happen after content gets loaded.
// Else the content types won't be included.
// TODO: solve this properly.
Serializer.Initialize();
_serializer.Initialize();
// Initialize Tier 2 services
IoCManager.Resolve<IChatManager>().Initialize();
@@ -248,8 +231,7 @@ namespace SS14.Server
var consoleManager = IoCManager.Resolve<IConsoleManager>();
consoleManager.Initialize();
StartLobby();
StartGame();
OnRunLevelChanged(ServerRunLevel.PreGame);
_active = true;
return false;
@@ -258,12 +240,12 @@ namespace SS14.Server
private void LoadContentAssembly<T>(string name) where T : GameShared
{
// get the assembly from the file system
if (_resources.TryContentFileRead($@"Assemblies/Content.{name}.dll", out MemoryStream gameDll))
if (_resources.TryContentFileRead($@"Assemblies/{name}.dll", out MemoryStream gameDll))
{
Logger.Debug($"[SRV] Loading {name} Content DLL");
// see if debug info is present
if (_resources.TryContentFileRead($@"Assemblies/Content.{name}.pdb", out MemoryStream gamePdb))
if (_resources.TryContentFileRead($@"Assemblies/{name}.pdb", out MemoryStream gamePdb))
{
try
{
@@ -272,7 +254,7 @@ namespace SS14.Server
}
catch (Exception e)
{
Logger.Error($"[SRV] Exception loading DLL Content.{name}.dll: {e}");
Logger.Error($"[SRV] Exception loading DLL {name}.dll: {e}");
}
}
else
@@ -284,13 +266,13 @@ namespace SS14.Server
}
catch (Exception e)
{
Logger.Error($"[SRV] Exception loading DLL Content.{name}.dll: {e}");
Logger.Error($"[SRV] Exception loading DLL {name}.dll: {e}");
}
}
}
else
{
Logger.Warning($"[ENG] Could not find {name} Content DLL");
Logger.Warning($"[ENG] Could not find {name} Content DLL.");
}
}
@@ -329,6 +311,9 @@ namespace SS14.Server
}
}
// process the CLI console of the program
IoCManager.Resolve<IConsoleManager>().Update();
_time.InSimulation = true;
// run the simulation for every accumulated tick
@@ -363,7 +348,7 @@ namespace SS14.Server
Process.GetCurrentProcess().PrivateMemorySize64 >> 10);
_lastTitleUpdate = _time.RealTime;
}
// Set this to 1 if you want to be nice and give the rest of the timeslice up to the os scheduler.
// Set this to 0 if you want to use 100% cpu, but still cooperate with the scheduler.
// comment this out if you want to be 'that thread' and hog 100% cpu.
@@ -398,101 +383,35 @@ namespace SS14.Server
}
/// <summary>
/// Controls what modules are running.
/// Switches the run level of the BaseServer to the desired value.
/// </summary>
/// <param name="runLevel"></param>
private void InitModules(RunLevel runLevel = RunLevel.Lobby)
private void OnRunLevelChanged(ServerRunLevel level)
{
if (runLevel == Level)
if (level == _runLevel)
return;
var oldLevel = Level;
Level = runLevel;
OnRunLevelChanged?.Invoke(oldLevel, Level);
if (Level == RunLevel.Lobby)
{
_startAt = DateTime.Now.AddSeconds(GAME_COUNTDOWN);
}
else if (Level == RunLevel.Game)
{
LoadMap(MapName);
_entities.Initialize();
IoCManager.Resolve<IRoundManager>().CurrentGameMode.StartGame();
Logger.Debug($"[ENG] Runlevel changed to: {level}");
var args = new RunLevelChangedEventArgs(_runLevel, level);
_runLevel = level;
RunLevelChanged?.Invoke(this, args);
// positive edge triggers
switch (level) {
case ServerRunLevel.PreGame:
_entities.Initialize();
break;
}
}
#region File Operations
public bool LoadMap(string mapName)
{
var defManager = IoCManager.Resolve<ITileDefinitionManager>();
var mapMgr = IoCManager.Resolve<IMapManager>();
NewDefaultMap(mapMgr, defManager, 1);
mapLoader.Load(MapName, mapMgr.GetMap(1));
return true;
}
//TODO: This whole method should be removed once file loading/saving works, and replaced with a 'Demo' map.
/// <summary>
/// Generates 'Demo' grid and inserts it into the map manager.
/// </summary>
/// <param name="mapManager">The map manager to work with.</param>
/// <param name="defManager">The definition manager to work with.</param>
/// <param name="gridId">The ID of the grid to generate and insert into the map manager.</param>
private static void NewDefaultMap(IMapManager mapManager, ITileDefinitionManager defManager, int gridID)
{
mapManager.SuppressOnTileChanged = true;
try
{
Logger.Log("Cannot find map. Generating blank map.", LogLevel.Warning);
var floor = defManager["Floor"].TileId;
Debug.Assert(floor > 0);
var map = mapManager.CreateMap(1); //TODO: default map
var grid = map.CreateGrid(1); //TODO: huh wha maybe? check grid ID
for (var y = -32; y <= 32; ++y)
{
for (var x = -32; x <= 32; ++x)
{
grid.SetTile(new LocalCoordinates(x, y, gridID, 1), new Tile(floor)); //TODO: Fix this
}
}
}
finally
{
mapManager.SuppressOnTileChanged = false;
}
}
#endregion File Operations
private void StartLobby()
{
IoCManager.Resolve<IRoundManager>().Initialize(new Gamemode(this));
InitModules();
}
/// <summary>
/// Moves all players to the game.
/// </summary>
private void StartGame()
{
InitModules(RunLevel.Game);
IoCManager.Resolve<IPlayerManager>().SendJoinGameToAll();
}
private void DisposeForRestart()
{
IoCManager.Resolve<IPlayerManager>().DetachAll();
if(Level == RunLevel.Game)
if(_runLevel == ServerRunLevel.Game)
{
var mapMgr = IoCManager.Resolve<IMapManager>();
mapMgr.UnregisterMap(1);
// TODO: Unregister all maps.
mapMgr.UnregisterMap(new MapId(1));
}
_entities.Shutdown();
GC.Collect();
@@ -520,35 +439,16 @@ namespace SS14.Server
IoCManager.Resolve<IServerNetManager>().ProcessPackets();
AssemblyLoader.BroadcastUpdate(AssemblyLoader.UpdateLevel.PreEngine, frameTime);
switch (Level)
{
case RunLevel.Game:
_components.Update(frameTime);
_entities.Update(frameTime);
IoCManager.Resolve<IRoundManager>().CurrentGameMode.Update();
break;
case RunLevel.Lobby:
var countdown = _startAt.Subtract(DateTime.Now);
if (_lastAnnounced != countdown.Seconds)
{
_lastAnnounced = countdown.Seconds;
IoCManager.Resolve<IChatManager>()
.DispatchMessage(ChatChannel.Server, $"Starting in {_lastAnnounced} seconds...");
}
if (countdown.Seconds <= 0)
StartGame();
break;
}
timerManager.UpdateTimers(frameTime);
if (_runLevel >= ServerRunLevel.PreGame)
{
_components.Update(frameTime);
_entities.Update(frameTime);
}
AssemblyLoader.BroadcastUpdate(AssemblyLoader.UpdateLevel.PostEngine, frameTime);
SendGameStateUpdate();
IoCManager.Resolve<IConsoleManager>().Update();
}
private void SendGameStateUpdate()
@@ -635,26 +535,11 @@ namespace SS14.Server
netMsg.ServerWelcomeMessage = Motd;
netMsg.ServerMaxPlayers = MaxPlayers;
netMsg.ServerMapName = MapName;
netMsg.GameMode = IoCManager.Resolve<IRoundManager>().CurrentGameMode.Name;
netMsg.GameMode = GameModeName;
netMsg.ServerPlayerCount = IoCManager.Resolve<IPlayerManager>().PlayerCount;
netMsg.PlayerIndex = session.Index;
message.MsgChannel.SendMessage(netMsg);
}
/// <summary>
/// Player session is fully built, player is an active member of the server. Player is prepaired to start
/// receiving states when they join the lobby.
/// </summary>
/// <param name="session">Fully built session</param>
public void PlayerJoinedServer(IPlayerSession session)
{
//TODO: There should be a way to notify the content
// send the player to the lobby screen
session.JoinLobby();
}
private void HandleAdminMessage(MsgAdmin msg)
@@ -705,7 +590,7 @@ namespace SS14.Server
// client session is complete
var session = plyMgr.GetSessionByChannel(channel);
PlayerJoinedServer(session);
session.Status = SessionStatus.Connected;
}
private static void HandleClientGreet(MsgClGreet msg)
@@ -724,22 +609,70 @@ namespace SS14.Server
IoCManager.Resolve<IGameStateManager>().Ack(msg.MsgChannel.ConnectionId, msg.Sequence);
}
// The size of the map being sent is almost exactly 1 byte per tile.
// The default 30x30 map is 900 bytes, a 100x100 one is 10,000 bytes (10kb).
private static void SendMap(INetChannel client)
//TODO: Chunk requests need to be handled in MapManager
private void SendMap(INetChannel client)
{
// Send Tiles
IoCManager.Resolve<IMapManager>().SendMap(client);
// TODO: Lets also send them all the items and mobs.
// TODO: Send atmos state to player
// Todo: Preempt this with the lobby.
IoCManager.Resolve<IRoundManager>().SpawnPlayer(
IoCManager.Resolve<IPlayerManager>().GetSessionByChannel(client)); //SPAWN PLAYER
}
#endregion MessageProcessing
}
/// <summary>
/// Enumeration of the run levels of the BaseServer.
/// </summary>
public enum ServerRunLevel
{
Error = 0,
Init,
PreGame,
Game,
PostGame,
MapChange,
}
/// <summary>
/// Event arguments for when something changed with the player.
/// </summary>
public class PlayerEventArgs : EventArgs
{
/// <summary>
/// The session that triggered the event.
/// </summary>
public IPlayerSession Session { get; }
/// <summary>
/// Constructs a new instance of the class.
/// </summary>
public PlayerEventArgs(IPlayerSession session)
{
Session = session;
}
}
/// <summary>
/// Event arguments for when the RunLevel has changed in the BaseClient.
/// </summary>
public class RunLevelChangedEventArgs : EventArgs
{
/// <summary>
/// RunLevel that the BaseClient switched from.
/// </summary>
public ServerRunLevel OldLevel { get; }
/// <summary>
/// RunLevel that the BaseClient switched to.
/// </summary>
public ServerRunLevel NewLevel { get; }
/// <summary>
/// Constructs a new instance of the class.
/// </summary>
public RunLevelChangedEventArgs(ServerRunLevel oldLevel, ServerRunLevel newLevel)
{
OldLevel = oldLevel;
NewLevel = newLevel;
}
}
}

View File

@@ -1,20 +0,0 @@
using System;
using SS14.Server.Interfaces.ClientConsoleHost;
using SS14.Server.Interfaces.Player;
using SS14.Shared;
namespace SS14.Server.ClientConsoleHost.Commands
{
class JoinGameCommand : IClientCommand
{
public string Command => "joingame";
public string Description => "Moves the player from the lobby to the game.";
public string Help => String.Empty;
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
if (player.Status == SessionStatus.InLobby)
player.JoinGame();
}
}
}

View File

@@ -0,0 +1,52 @@
using SS14.Server.Interfaces.ClientConsoleHost;
using SS14.Server.Interfaces.Player;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.IoC;
using SS14.Shared.Map;
namespace SS14.Server.ClientConsoleHost.Commands
{
class AddMapCommand : IClientCommand
{
public string Command => "addmap";
public string Description => "Adds a new map to the round. If the mapID already exists, this command does nothing.";
public string Help => "addmap <mapID>";
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
if (args.Length < 1)
return;
var mapId = new MapId(int.Parse(args[0]));
var mapMgr = IoCManager.Resolve<IMapManager>();
if (!mapMgr.MapExists(mapId))
{
mapMgr.CreateMap(mapId);
host.SendConsoleReply(player.ConnectedClient, $"Map with ID {mapId} created.");
return;
}
host.SendConsoleReply(player.ConnectedClient, $"Map with ID {mapId} already exists!");
}
}
class LocationCommand : IClientCommand
{
public string Command => "loc";
public string Description => "Prints the absolute location of the player's entity to console.";
public string Help => "loc";
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
if(player.attachedEntity == null)
return;
var pos = player.attachedEntity.GetComponent<ITransformComponent>().LocalPosition;
host.SendConsoleReply(player.ConnectedClient, $"MapID:{pos.MapID} GridID:{pos.GridID} X:{pos.X:N2} Y:{pos.Y:N2}");
}
}
}

View File

@@ -0,0 +1,45 @@
using SS14.Server.Interfaces.ClientConsoleHost;
using SS14.Server.Interfaces.GameObjects;
using SS14.Server.Interfaces.Player;
using SS14.Shared;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.IoC;
using SS14.Shared.Map;
using SS14.Shared.Maths;
namespace SS14.Server.ClientConsoleHost.Commands
{
internal class TeleportCommand : IClientCommand
{
public string Command => "tp";
public string Description => "Teleports a player to any location in the round.";
public string Help => "tp <x> <y> [<mapID>]";
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
if (player.Status != SessionStatus.InGame || player.attachedEntity == null)
return;
if (args.Length < 2 || !float.TryParse(args[0], out var posX) || !float.TryParse(args[1], out var posY))
return;
var mapMgr = IoCManager.Resolve<IMapManager>();
var position = new Vector2(posX, posY);
var entity = player.attachedEntity;
var transform = entity.GetComponent<IServerTransformComponent>();
transform.DetachParent();
IMapGrid grid;
if (args.Length == 3 && int.TryParse(args[2], out var mapId) && mapMgr.TryGetMap(new MapId(mapId), out var map))
grid = map.FindGridAt(position);
else
grid = transform.LocalPosition.Map.FindGridAt(position);
transform.LocalPosition = new LocalCoordinates(position, grid);
host.SendConsoleReply(player.ConnectedClient, $"Teleported {player} to {grid.MapID}:{posX},{posY}.");
}
}
}

View File

@@ -0,0 +1,86 @@
using System;
using SS14.Server.Interfaces;
using SS14.Server.Interfaces.ClientConsoleHost;
using SS14.Server.Interfaces.Player;
using SS14.Shared;
using SS14.Shared.IoC;
namespace SS14.Server.ClientConsoleHost.Commands
{
class JoinGameCommand : IClientCommand
{
public string Command => "joingame";
public string Description => "Moves the player from the lobby to the game.";
public string Help => String.Empty;
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
if (player.Status == SessionStatus.InLobby)
player.JoinGame();
}
}
class JoinLobbyCommand : IClientCommand
{
public string Command => "joinlobby";
public string Description => "Moves the player from the game to the lobby.";
public string Help => String.Empty;
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
if (player.Status == SessionStatus.InGame)
player.JoinLobby();
}
}
class StartRoundCommand : IClientCommand
{
public string Command => "startround";
public string Description => "Ends PreGame state and starts the round.";
public string Help => String.Empty;
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
var baseServer = IoCManager.Resolve<IBaseServer>();
if (baseServer.RunLevel == ServerRunLevel.PreGame)
{
baseServer.RunLevel = ServerRunLevel.Game;
}
}
}
class EndRoundCommand : IClientCommand
{
public string Command => "endround";
public string Description => "Ends the round and moves the server to PostGame.";
public string Help => String.Empty;
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
var baseServer = IoCManager.Resolve<IBaseServer>();
if (baseServer.RunLevel == ServerRunLevel.Game)
{
baseServer.RunLevel = ServerRunLevel.PostGame;
}
}
}
class NewRoundCommand : IClientCommand
{
public string Command => "newround";
public string Description => "Moves the server from PostRound to a new PreRound.";
public string Help => String.Empty;
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
var baseServer = IoCManager.Resolve<IBaseServer>();
if (baseServer.RunLevel == ServerRunLevel.PostGame)
{
baseServer.RunLevel = ServerRunLevel.MapChange;
}
}
}
}

View File

@@ -1,21 +0,0 @@
using SS14.Server.Interfaces.Chat;
using SS14.Server.Interfaces.ClientConsoleHost;
using SS14.Server.Interfaces.Player;
using SS14.Shared.Console;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.IoC;
namespace SS14.Server.ClientConsoleHost.Commands
{
public class Test : IClientCommand
{
public string Command => "test";
public string Description => "It's just a test bro.";
public string Help => "This thing tests stuff. If you got this message that means it worked. Hooray!";
public void Execute(IClientConsoleHost host, IPlayerSession player, params string[] args)
{
IoCManager.Resolve<IChatManager>().DispatchMessage(player.ConnectedClient, ChatChannel.Server, "Test worked!");
}
}
}

View File

@@ -1,9 +1,6 @@
using SS14.Server.Interfaces.GameObjects;
using SS14.Server.Interfaces.Player;
using SS14.Server.Interfaces.Round;
using SS14.Shared;
using SS14.Shared.GameObjects;
using SS14.Shared.IoC;
namespace SS14.Server.GameObjects
{
@@ -29,11 +26,6 @@ namespace SS14.Server.GameObjects
case ComponentMessageType.GetActorSession:
reply = new ComponentReplyMessage(ComponentMessageType.ReturnActorSession, playerSession);
break;
case ComponentMessageType.Die:
playerSession.AddPostProcessingEffect(PostProcessingEffectType.Death, -1);
IoCManager.Resolve<IRoundManager>().CurrentGameMode.PlayerDied(playerSession);
// Tell the current game mode a player just died
break;
}
return reply;

View File

@@ -7,6 +7,7 @@ using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Interfaces.Physics;
using SS14.Shared.IoC;
using SS14.Shared.Map;
using SS14.Shared.Maths;
using Vector2 = SS14.Shared.Maths.Vector2;
@@ -25,7 +26,7 @@ namespace SS14.Server.GameObjects
public override uint? NetID => NetIDs.COLLIDABLE;
/// <inheritdoc />
public int MapID => Owner.GetComponent<ITransformComponent>().MapID;
public MapId MapID => Owner.GetComponent<ITransformComponent>().MapID;
/// <inheritdoc />
public override void HandleNetworkMessage(IncomingEntityComponentMessage message, NetConnection client)

View File

@@ -22,8 +22,8 @@ namespace SS14.Server.GameObjects
ITransformComponent ITransformComponent.Parent => Parent;
private Vector2 _position;
public int MapID { get; private set; } = MapManager.NULLSPACE;
public int GridID { get; private set; } = 0;
public MapId MapID { get; private set; }
public GridId GridID { get; private set; }
/// <summary>
/// Current rotation offset of the entity.
@@ -42,20 +42,9 @@ namespace SS14.Server.GameObjects
/// <inheritdoc />
public LocalCoordinates LocalPosition
{
get
{
if (Parent != null)
{
return GetMapTransform().LocalPosition; //Search up the tree for the true map position
}
else
{
return new LocalCoordinates(_position, GridID, MapID);
}
}
get => Parent != null ? GetMapTransform().LocalPosition : new LocalCoordinates(_position, GridID, MapID);
set
{
var oldPosition = LocalPosition;
_position = value.Position;
MapID = value.MapID;
@@ -65,22 +54,12 @@ namespace SS14.Server.GameObjects
}
}
/// <inheritdoc />
public Vector2 WorldPosition
{
get
{
if (Parent != null)
{
return GetMapTransform().WorldPosition; //Search up the tree for the true map position
}
else
{
return IoCManager.Resolve<IMapManager>().GetMap(MapID).GetGrid(GridID).ConvertToWorld(_position);
}
}
get => Parent != null ? GetMapTransform().WorldPosition : IoCManager.Resolve<IMapManager>().GetMap(MapID).GetGrid(GridID).ConvertToWorld(_position);
set
{
var oldPosition = LocalPosition;
_position = value;
GridID = IoCManager.Resolve<IMapManager>().GetMap(MapID).FindGridAt(_position).Index;

View File

@@ -1,19 +1,8 @@
using SS14.Server.Interfaces.GameObjects;
using SS14.Shared;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.IoC;
using SS14.Shared.Utility;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using OpenTK;
using SS14.Shared.ContentPack;
using SS14.Shared.Maths;
using SS14.Shared.Prototypes;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.Map;
@@ -29,15 +18,15 @@ namespace SS14.Server.GameObjects
#region IEntityManager Members
[Dependency]
readonly private IPrototypeManager _protoManager;
private readonly IPrototypeManager _protoManager;
/// <inheritdoc />
public bool TrySpawnEntityAt(string EntityType, LocalCoordinates coordinates, out IEntity entity)
public bool TrySpawnEntityAt(string entityType, LocalCoordinates coordinates, out IEntity entity)
{
var prototype = _protoManager.Index<EntityPrototype>(EntityType);
var prototype = _protoManager.Index<EntityPrototype>(entityType);
if (prototype.CanSpawnAt(coordinates.Grid, coordinates.Position))
{
entity = SpawnEntity(EntityType);
entity = SpawnEntity(entityType);
entity.GetComponent<TransformComponent>().LocalPosition = coordinates;
entity.Initialize();
return true;
@@ -47,28 +36,33 @@ namespace SS14.Server.GameObjects
}
/// <inheritdoc />
public bool TrySpawnEntityAt(string EntityType, Vector2 position, int argMap, out IEntity entity)
public bool TrySpawnEntityAt(string entityType, Vector2 position, MapId argMap, out IEntity entity)
{
var mapmanager = IoCManager.Resolve<IMapManager>();
var coordinates = new LocalCoordinates(position, mapmanager.GetMap(argMap).FindGridAt(position));
return TrySpawnEntityAt(EntityType, coordinates, out entity);
var mapManager = IoCManager.Resolve<IMapManager>();
var coordinates = new LocalCoordinates(position, mapManager.GetMap(argMap).FindGridAt(position));
return TrySpawnEntityAt(entityType, coordinates, out entity);
}
/// <inheritdoc />
public IEntity ForceSpawnEntityAt(string EntityType, LocalCoordinates coordinates)
public IEntity ForceSpawnEntityAt(string entityType, LocalCoordinates coordinates)
{
IEntity entity = SpawnEntity(EntityType);
IEntity entity = SpawnEntity(entityType);
entity.GetComponent<TransformComponent>().LocalPosition = coordinates;
entity.Initialize();
return entity;
}
/// <inheritdoc />
public IEntity ForceSpawnEntityAt(string EntityType, Vector2 position, int argMap)
public IEntity ForceSpawnEntityAt(string entityType, Vector2 position, MapId argMap)
{
var mapmanager = IoCManager.Resolve<IMapManager>();
var coordinates = new LocalCoordinates(position, mapmanager.GetMap(argMap).FindGridAt(position));
return ForceSpawnEntityAt(EntityType, coordinates);
var mapManager = IoCManager.Resolve<IMapManager>();
if (!mapManager.TryGetMap(argMap, out var map))
{
map = mapManager.DefaultMap;
}
return ForceSpawnEntityAt(entityType, new LocalCoordinates(position, map.FindGridAt(position)));
}
public List<EntityState> GetEntityStates()

View File

@@ -1,33 +0,0 @@
using SS14.Server.Interfaces.Player;
namespace SS14.Server.Interfaces.GameMode
{
public delegate void GameBeginHandler(IGameMode origin);
public delegate void GameUpdateHandler(IGameMode origin);
public delegate void GameEndHandler(IGameMode origin);
public interface IGameMode
{
string Name { get; set; }
string Description { get; set; }
event GameEndHandler OnGameBegin; //Raised when the Game begins.
event GameUpdateHandler OnGameUpdate; //Raised when the Game updates.
event GameEndHandler OnGameEnd; //Raised when the Game ends.
void PlayerJoined(IPlayerSession player); //Called when a player joins the round.
void PlayerLeft(IPlayerSession player); //Called when a player leaves the round.
void PlayerDied(IPlayerSession player); //Called when a player dies.
void StartGame(); //Starts the gamemode. But not the actual round.
//StartGame() -> WarmUp time or something -> OnGameBegin.
void SpawnPlayer(IPlayerSession player); //Spawn a Player.
void Begin(); //Called after StartGame(). Raises OnGameBegin. Assign objectives etc here.
void Update(); //Called regulary. Raises OnGameUpdate. Update Gamemode logic here.
void End(); //Called when round ends. Raises OnGameEnd. Should be called from the logic in Update().
}
}

View File

@@ -21,8 +21,9 @@ namespace SS14.Server.Interfaces.GameObjects
/// <param name="EntityType"></param>
/// <param name="position"></param>
/// <param name="argMap"></param>
/// <param name="entity"></param>
/// <returns></returns>
bool TrySpawnEntityAt(string EntityType, Vector2 position, int argMap, out IEntity entity);
bool TrySpawnEntityAt(string EntityType, Vector2 position, MapId argMap, out IEntity entity);
/// <summary>
/// Spawns an entity at a specific position
@@ -45,8 +46,9 @@ namespace SS14.Server.Interfaces.GameObjects
/// </summary>
/// <param name="EntityType"></param>
/// <param name="position"></param>
/// <param name="argMap"></param>
/// <returns></returns>
IEntity ForceSpawnEntityAt(string EntityType, Vector2 position, int argMap);
IEntity ForceSpawnEntityAt(string EntityType, Vector2 position, MapId argMap);
List<EntityState> GetEntityStates();
}

View File

@@ -1,60 +1,73 @@
namespace SS14.Server.Interfaces
using System;
using SS14.Server.Player;
namespace SS14.Server.Interfaces
{
/// <summary>
/// The base server that controls the engine. This is managed by the GameServer.
/// Top level class that controls the game logic of the server.
/// </summary>
public interface IBaseServer
{
/// <summary>
/// The name of the current running map.
/// Current RunLevel that the server is at.
/// </summary>
ServerRunLevel RunLevel { get; set; }
/// <summary>
/// The name of the current running map.
/// </summary>
string MapName { get; }
/// <summary>
/// The maximum number of players allowed in the server.
/// The maximum number of players allowed in the server.
/// </summary>
int MaxPlayers { get; }
/// <summary>
/// The displayed name of our server.
/// The displayed name of our server.
/// </summary>
string ServerName { get; }
/// <summary>
/// The MOTD displayed when joining the server.
/// The MOTD displayed when joining the server.
/// </summary>
string Motd { get; }
/// <summary>
/// Saves the current running game to disk.
/// The name of the game mode displayed to clients.
/// </summary>
string GameModeName { get; set; }
/// <summary>
/// Saves the current running game to disk.
/// </summary>
void SaveGame();
/// <summary>
/// Sets up the server, loads the game, gets ready for client connections.
/// Sets up the server, loads the game, gets ready for client connections.
/// </summary>
/// <returns></returns>
bool Start();
/// <summary>
/// Hard restarts the server, shutting it down, kicking all players, and starting the server again.
/// Hard restarts the server, shutting it down, kicking all players, and starting the server again.
/// </summary>
void Restart();
/// <summary>
/// Shuts down the server, and ends the process.
/// Shuts down the server, and ends the process.
/// </summary>
/// <param name="reason">Reason why the server was shut down.</param>
void Shutdown(string reason = null);
/// <summary>
/// Enters the main loop of the server. This functions blocks until the server is shut down.
/// Enters the main loop of the server. This functions blocks until the server is shut down.
/// </summary>
void MainLoop();
/// <summary>
/// The Run Level of the server has changed.
/// Raised when the server RunLevel is changed.
/// </summary>
event EventRunLevelChanged OnRunLevelChanged;
event EventHandler<RunLevelChangedEventArgs> RunLevelChanged;
}
}

View File

@@ -1,10 +1,11 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using SS14.Server.Player;
using SS14.Shared;
using SS14.Shared.GameStates;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Map;
using SS14.Shared.Network.Messages;
using SS14.Shared.Players;
using SS14.Shared.ServerEnums;
namespace SS14.Server.Interfaces.Player
{
@@ -13,9 +14,6 @@ namespace SS14.Server.Interfaces.Player
/// </summary>
public interface IPlayerManager
{
//TODO: What is this? Should it be in BaseServer?
RunLevel RunLevel { get; set; }
/// <summary>
/// Number of players currently connected to this server.
/// </summary>
@@ -26,6 +24,16 @@ namespace SS14.Server.Interfaces.Player
/// </summary>
int MaxPlayers { get; }
/// <summary>
/// Fallback spawn point to use if map does not provide it.
/// </summary>
LocalCoordinates FallbackSpawnPoint { get; set; }
/// <summary>
/// Raised when the <see cref="SessionStatus"/> of a <see cref="IPlayerSession"/> is changed.
/// </summary>
event EventHandler<SessionStatusEventArgs> PlayerStatusChanged;
/// <summary>
/// Initializes the manager.
/// </summary>
@@ -39,14 +47,10 @@ namespace SS14.Server.Interfaces.Player
//TODO: Move to IPlayerSession
void SpawnPlayerMob(IPlayerSession session);
//TODO: These go in BaseServer
void SendJoinGameToAll();
void SendJoinLobbyToAll();
//TODO: Use new networking system.
void HandleNetworkMessage(MsgSession msg);
void DetachAll();
List<IPlayerSession> GetPlayersInLobby();
List<IPlayerSession> GetPlayersInRange(LocalCoordinates worldPos, int range);

View File

@@ -1,8 +1,8 @@
using System;
using SS14.Server.Player;
using SS14.Shared;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Network.Messages;
using SS14.Shared.Players;
namespace SS14.Server.Interfaces.Player
@@ -18,15 +18,15 @@ namespace SS14.Server.Interfaces.Player
PlayerIndex Index { get; }
event EventHandler<SessionStatusEventArgs> PlayerStatusChanged;
void JoinLobby();
void JoinGame();
void SetName(string name);
void AttachToEntity(IEntity a);
void HandleNetworkMessage(MsgSession message);
void DetachFromEntity();
void OnConnect();
void OnDisconnect();

View File

@@ -1,15 +0,0 @@
using SS14.Server.Interfaces.GameMode;
using SS14.Server.Interfaces.Player;
using SS14.Shared.IoC;
namespace SS14.Server.Interfaces.Round
{
public interface IRoundManager
{
IGameMode CurrentGameMode { get; }
void Initialize(IGameMode gamemode);
void SpawnPlayer(IPlayerSession player);
}
}

View File

@@ -10,7 +10,6 @@ using SS14.Shared.Map;
using SS14.Shared.Maths;
using SS14.Shared.Prototypes;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Xml.Linq;
@@ -53,7 +52,7 @@ namespace SS14.Server.Maps
IEntity entity;
try
{
entity = entityManager.ForceSpawnEntityAt(prototype, new LocalCoordinates(X, Y, 1, map.Index));
entity = entityManager.ForceSpawnEntityAt(prototype, new LocalCoordinates(X, Y, GridId.DefaultGrid, map.Index));
}
catch (UnknownPrototypeException)
{

View File

@@ -1,25 +1,17 @@
using SS14.Server.GameObjects;
using SS14.Server.Interfaces;
using SS14.Server.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Map;
using SS14.Server.Interfaces.Placement;
using SS14.Server.Interfaces.Player;
using SS14.Shared;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.Map;
using System;
using System.Collections.Generic;
using System.Linq;
using OpenTK;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Maths;
using SS14.Shared.Network;
using SS14.Shared.Network.Messages;
using SS14.Shared.Utility;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Server.Placement
@@ -56,7 +48,6 @@ namespace SS14.Server.Placement
{
var alignRcv = msg.Align;
var isTile = msg.IsTile;
var mapMgr = IoCManager.Resolve<IMapManager>();
ushort tileType = 0;
var entityTemplateName = "";
@@ -64,61 +55,52 @@ namespace SS14.Server.Placement
if (isTile) tileType = msg.TileType;
else entityTemplateName = msg.EntityTemplateName;
float XValue = msg.XValue;
float YValue = msg.YValue;
int GridIndex = msg.GridIndex;
int MapIndex = msg.MapIndex;
var coordinates = new LocalCoordinates(XValue, YValue, GridIndex, MapIndex);
var xValue = msg.XValue;
var yValue = msg.YValue;
var gridIndex = msg.GridIndex;
var mapIndex = msg.MapIndex;
var coordinates = new LocalCoordinates(xValue, yValue, gridIndex, mapIndex);
var dirRcv = msg.DirRcv;
IPlayerSession session = IoCManager.Resolve<IPlayerManager>().GetSessionByChannel(msg.MsgChannel);
var session = IoCManager.Resolve<IPlayerManager>().GetSessionByChannel(msg.MsgChannel);
if (session.attachedEntity == null)
return; //Don't accept placement requests from nobodys
return; //Don't accept placement requests from nobody
PlacementInformation permission = GetPermission(session.attachedEntity.Uid, alignRcv);
/* TODO: Redesign permission system, or document what this is supposed to be doing
var permission = GetPermission(session.attachedEntity.Uid, alignRcv);
if (permission == null)
return;
float a = (float)Math.Floor(XValue);
float b = (float)Math.Floor(YValue);
Vector2 tilePos = new Vector2(a, b);
if (permission != null || true)
//isAdmin) Temporarily disable actual permission check / admin check. REENABLE LATER
if (permission.Uses > 0)
{
if (permission != null)
permission.Uses--;
if (permission.Uses <= 0)
{
if (permission.Uses > 0)
{
permission.Uses--;
if (permission.Uses <= 0)
{
BuildPermissions.Remove(permission);
SendPlacementCancel(session.attachedEntity);
}
}
else
{
BuildPermissions.Remove(permission);
SendPlacementCancel(session.attachedEntity);
return;
}
BuildPermissions.Remove(permission);
SendPlacementCancel(session.attachedEntity);
}
}
else
{
BuildPermissions.Remove(permission);
SendPlacementCancel(session.attachedEntity);
return;
}
*/
if (!isTile)
{
var manager = IoCManager.Resolve<IServerEntityManager>();
if (!manager.TrySpawnEntityAt(entityTemplateName, coordinates, out IEntity created))
return;
if (!isTile)
{
var manager = IoCManager.Resolve<IServerEntityManager>();
if(manager.TrySpawnEntityAt(entityTemplateName, coordinates, out IEntity created))
{
created.GetComponent<TransformComponent>().WorldPosition =
new Vector2(XValue, YValue);
if (created.TryGetComponent<TransformComponent>(out var component))
component.Rotation = dirRcv.ToAngle();
}
}
else
{
coordinates.Grid.SetTile(coordinates, new Tile(tileType));
}
created.GetComponent<TransformComponent>().WorldPosition = new Vector2(xValue, yValue);
if (created.TryGetComponent<TransformComponent>(out var component))
component.Rotation = dirRcv.ToAngle();
}
else
{
coordinates.Grid.SetTile(coordinates, new Tile(tileType));
}
}
@@ -276,9 +258,9 @@ namespace SS14.Server.Placement
/// </summary>
public void RevokeAllBuildPermissions(IEntity mob)
{
IEnumerable<PlacementInformation> mobPermissions = from PlacementInformation permission in BuildPermissions
where permission.MobUid == mob.Uid
select permission;
var mobPermissions = BuildPermissions
.Where(permission => permission.MobUid == mob.Uid)
.ToList();
if (mobPermissions.Any())
BuildPermissions.RemoveAll(x => mobPermissions.Contains(x));
@@ -288,12 +270,11 @@ namespace SS14.Server.Placement
private PlacementInformation GetPermission(int uid, string alignOpt)
{
IEnumerable<PlacementInformation> permission = from p in BuildPermissions
where p.MobUid == uid && p.PlacementOption.Equals(alignOpt)
select p;
var permission = BuildPermissions
.Where(p => p.MobUid == uid && p.PlacementOption.Equals(alignOpt))
.ToList();
if (permission.Any()) return permission.First();
else return null;
return permission.Any() ? permission.First() : null;
}
}
}

View File

@@ -1,28 +1,19 @@
using System;
using OpenTK;
using SS14.Server.Interfaces;
using SS14.Server.Interfaces.GameObjects;
using SS14.Server.Interfaces.Player;
using SS14.Shared;
using SS14.Shared.GameObjects;
using SS14.Shared.GameStates;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.Maths;
using SS14.Shared.Prototypes;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Network;
using SS14.Shared.Network.Messages;
using SS14.Shared.ServerEnums;
using SS14.Shared.Utility;
using SS14.Shared.Map;
using SS14.Shared.Players;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Server.Player
{
@@ -34,10 +25,12 @@ namespace SS14.Server.Player
/// <summary>
/// The server that instantiated this manager.
/// </summary>
public IBaseServer Server { get; set; }
private IBaseServer _server;
public string PlayerPrototypeName { get; set; } = "__engine_human";
public LocalCoordinates FallbackSpawnPoint { get; set; }
/// <summary>
/// Number of active sessions.
/// This is the cached value of _sessions.Count(s => s != null);
@@ -52,16 +45,19 @@ namespace SS14.Server.Player
[Dependency]
private readonly IServerEntityManager _entityManager;
[Dependency]
private readonly IPrototypeManager _prototypeManager;
/// <inheritdoc />
public int PlayerCount => _sessionCount;
/// <inheritdoc />
public int MaxPlayers => _sessions.Length;
/// <inheritdoc />
public event EventHandler<SessionStatusEventArgs> PlayerStatusChanged;
/// <inheritdoc />
public void Initialize(BaseServer server, int maxPlayers)
{
Server = server;
Server.OnRunLevelChanged += RunLevelChanged;
_server = server;
_sessions = new PlayerSession[maxPlayers];
@@ -72,16 +68,9 @@ namespace SS14.Server.Player
netMan.Disconnect += EndSession;
}
private void RunLevelChanged(RunLevel oldLevel, RunLevel newLevel)
{
RunLevel = newLevel;
}
#region IPlayerManager Members
private void OnConnecting(object sender, NetConnectingArgs args)
{
if (PlayerCount >= Server.MaxPlayers)
if (PlayerCount >= _server.MaxPlayers)
args.Deny = true;
}
@@ -100,18 +89,25 @@ namespace SS14.Server.Player
var index = new PlayerIndex(pos);
var session = new PlayerSession(this, args.Channel, index);
session.PlayerStatusChanged += (obj, sessionArgs) => OnPlayerStatusChanged(session, sessionArgs.OldStatus, sessionArgs.NewStatus);
Debug.Assert(_sessions[pos] == null);
_sessionCount++;
_sessions[pos] = session;
}
private void OnPlayerStatusChanged(IPlayerSession session, SessionStatus oldStatus, SessionStatus newStatus)
{
PlayerStatusChanged?.Invoke(this, new SessionStatusEventArgs(session, oldStatus, newStatus));
}
/// <summary>
/// Spawns the players entity.
/// </summary>
/// <param name="session"></param>
public void SpawnPlayerMob(IPlayerSession session)
{
IEntity entity = _entityManager.ForceSpawnEntityAt(PlayerPrototypeName, new Vector2(0, 0), 1); //TODO: Fix this
IEntity entity = _entityManager.ForceSpawnEntityAt(PlayerPrototypeName, FallbackSpawnPoint);
session.AttachToEntity(entity);
}
@@ -124,25 +120,14 @@ namespace SS14.Server.Player
/// <summary>
/// Returns the client session of the networkId.
/// </summary>
/// <param name="networkId">The network id of the client.</param>
/// <param name="index">The id of the client.</param>
/// <returns></returns>
public IPlayerSession GetSessionById(PlayerIndex index)
{
Debug.Assert(0 <= index && index <= MaxPlayers);
return _sessions[index];
}
public RunLevel RunLevel { get; set; }
/// <summary>
/// Processes an incoming network message.
/// </summary>
/// <param name="msg">Incoming message.</param>
public void HandleNetworkMessage(MsgSession msg)
{
GetSessionByChannel(msg.MsgChannel)?.HandleNetworkMessage(msg);
}
/// <summary>
/// Ends a clients session, and disconnects them.
/// </summary>
@@ -263,7 +248,19 @@ namespace SS14.Server.Player
Debug.Assert(true, "Why was a slot not found? There should be one.");
return -1;
}
}
#endregion IPlayerManager Members
public class SessionStatusEventArgs : EventArgs
{
public IPlayerSession Session { get; }
public SessionStatus OldStatus { get; }
public SessionStatus NewStatus { get; }
public SessionStatusEventArgs(IPlayerSession session, SessionStatus oldStatus, SessionStatus newStatus)
{
Session = session;
OldStatus = oldStatus;
NewStatus = newStatus;
}
}
}

View File

@@ -1,14 +1,13 @@
using SS14.Server.Interfaces.GameObjects;
using SS14.Server.Interfaces.Player;
using SS14.Server.Interfaces.Round;
using SS14.Shared;
using SS14.Shared.GameStates;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.ServerEnums;
using SS14.Server.GameObjects;
using System;
using SS14.Server.Interfaces;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Network.Messages;
using SS14.Shared.Players;
@@ -22,41 +21,71 @@ namespace SS14.Server.Player
{
private readonly PlayerManager _playerManager;
public readonly PlayerState PlayerState;
public PlayerSession(PlayerManager playerManager, INetChannel client, PlayerIndex index)
{
_playerManager = playerManager;
Index = index;
PlayerState = new PlayerState()
PlayerState = new PlayerState
{
Uuid = client.ConnectionId,
Index = index,
};
ConnectedClient = client;
OnConnect();
UpdatePlayerState();
}
public INetChannel ConnectedClient { get; }
public IEntity attachedEntity { get; set; }
public int? AttachedEntityUid => attachedEntity?.Uid;
private string _name;
private string _name = "<TERU-SAMA>";
private SessionStatus _status = SessionStatus.Connecting;
/// <inheritdoc />
public string Name
{
get => string.IsNullOrWhiteSpace(_name) ? "Unknown" : _name;
set => _name = value;
get => _name;
set
{
if(string.IsNullOrWhiteSpace(value))
return;
_name = value;
}
}
public SessionStatus Status { get; set; }
/// <inheritdoc />
public SessionStatus Status
{
get => _status;
set => OnPlayerStatusChanged(_status, value);
}
/// <inheritdoc />
public DateTime ConnectedTime { get; private set; }
/// <inheritdoc />
public PlayerIndex Index { get; }
/// <inheritdoc />
public event EventHandler<SessionStatusEventArgs> PlayerStatusChanged;
private void OnPlayerStatusChanged(SessionStatus oldStatus, SessionStatus newStatus)
{
if(oldStatus == newStatus)
return;
_status = newStatus;
UpdatePlayerState();
PlayerStatusChanged?.Invoke(this, new SessionStatusEventArgs(this, oldStatus, newStatus));
}
/// <inheritdoc />
public void AttachToEntity(IEntity a)
{
DetachFromEntity();
@@ -80,6 +109,7 @@ namespace SS14.Server.Player
UpdatePlayerState();
}
/// <inheritdoc />
public void DetachFromEntity()
{
if (attachedEntity == null) return;
@@ -90,18 +120,8 @@ namespace SS14.Server.Player
attachedEntity = null;
UpdatePlayerState();
}
public void HandleNetworkMessage(MsgSession message)
{
var messageType = message.MsgType;
switch (messageType)
{
case PlayerSessionMessage.JoinLobby:
JoinLobby();
break;
}
}
/// <inheritdoc />
public void SetName(string name)
{
Name = name;
@@ -110,6 +130,7 @@ namespace SS14.Server.Player
UpdatePlayerState();
}
/// <inheritdoc />
public void OnConnect()
{
ConnectedTime = DateTime.Now;
@@ -117,14 +138,18 @@ namespace SS14.Server.Player
UpdatePlayerState();
}
/// <inheritdoc />
public void OnDisconnect()
{
Status = SessionStatus.Disconnected;
IoCManager.Resolve<IRoundManager>().CurrentGameMode.PlayerLeft(this);
// TODO: PlayerLeaveServer event
DetachFromEntity();
UpdatePlayerState();
}
/// <inheritdoc />
public void AddPostProcessingEffect(PostProcessingEffectType type, float duration)
{
var net = IoCManager.Resolve<IServerNetManager>();
@@ -159,12 +184,7 @@ namespace SS14.Server.Player
}
}
private void ResetAttachedEntityName()
{
if (attachedEntity != null)
attachedEntity.Name = attachedEntity.Prototype.ID;
}
/// <inheritdoc />
public void JoinLobby()
{
DetachFromEntity();
@@ -177,7 +197,9 @@ namespace SS14.Server.Player
/// </summary>
public void JoinGame()
{
if (ConnectedClient == null || Status == SessionStatus.InGame || _playerManager.RunLevel != RunLevel.Game)
var baseServer = IoCManager.Resolve<IBaseServer>();
if (ConnectedClient == null || Status == SessionStatus.InGame || baseServer.RunLevel != ServerRunLevel.Game)
return;
Status = SessionStatus.InGame;
@@ -204,5 +226,11 @@ namespace SS14.Server.Player
else
PlayerState.ControlledEntity = attachedEntity.Uid;
}
/// <inheritdoc />
public override string ToString()
{
return $"[{Index}]{Name}";
}
}
}

View File

@@ -10,14 +10,12 @@ using SS14.Server.Interfaces.Log;
using SS14.Server.Interfaces.Maps;
using SS14.Server.Interfaces.Placement;
using SS14.Server.Interfaces.Player;
using SS14.Server.Interfaces.Round;
using SS14.Server.Interfaces.ServerConsole;
using SS14.Server.Log;
using SS14.Server.Maps;
using SS14.Server.Placement;
using SS14.Server.Player;
using SS14.Server.Reflection;
using SS14.Server.Round;
using SS14.Server.ServerConsole;
using SS14.Shared.Configuration;
using SS14.Shared.ContentPack;
@@ -119,7 +117,6 @@ namespace SS14.Server
IoCManager.Register<IPlacementManager, PlacementManager>();
IoCManager.Register<IConsoleManager, ConsoleManager>();
IoCManager.Register<ITileDefinitionManager, TileDefinitionManager>();
IoCManager.Register<IRoundManager, RoundManager>();
IoCManager.Register<IBaseServer, BaseServer>();
IoCManager.Register<ISS14Serializer, SS14Serializer>();
IoCManager.Register<IEntityNetworkManager, ServerEntityNetworkManager>();

View File

@@ -1,83 +0,0 @@
using SS14.Server.Interfaces;
using SS14.Server.Interfaces.Chat;
using SS14.Server.Interfaces.GameMode;
using SS14.Server.Interfaces.Player;
using SS14.Shared.Console;
using SS14.Shared.IoC;
namespace SS14.Server.Round
{
public class Gamemode : IGameMode
{
private IBaseServer _server;
private string description = "";
private string name = "";
public Gamemode(IBaseServer server)
{
_server = server;
Name = "Gamemode";
Description = "This is an empty Gamemode";
}
#region IGameMode Members
public string Name
{
get { return name; }
set { name = value; }
}
public string Description
{
get { return description; }
set { description = value; }
}
public event GameEndHandler OnGameBegin;
public event GameUpdateHandler OnGameUpdate;
public event GameEndHandler OnGameEnd;
public virtual void SpawnPlayer(IPlayerSession player) //Called by SendMap() after sending everything.
{
//This should be handled differently!!!.
IoCManager.Resolve<IPlayerManager>().SpawnPlayerMob(player);
}
public virtual void StartGame() //Called by InitModules() for Game state.
{
Begin();
}
public virtual void PlayerJoined(IPlayerSession player)
{
}
public virtual void PlayerLeft(IPlayerSession player)
{
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Player left!", player.Index);
}
public virtual void PlayerDied(IPlayerSession player)
{
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Player died!", player.Index);
}
public virtual void Begin()
{
if (OnGameBegin != null) OnGameBegin(this);
}
public virtual void Update()
{
if (OnGameUpdate != null) OnGameUpdate(this);
}
public virtual void End()
{
if (OnGameEnd != null) OnGameEnd(this);
}
#endregion
}
}

View File

@@ -1,31 +0,0 @@
using SS14.Server.Interfaces.GameMode;
using SS14.Server.Interfaces.Player;
using SS14.Server.Interfaces.Round;
using SS14.Shared.IoC;
namespace SS14.Server.Round
{
public class RoundManager : IRoundManager
{
private bool _ready;
#region IRoundManager Members
public IGameMode CurrentGameMode { get; private set; }
public void Initialize(IGameMode gamemode) //Called by StartLobby() before InitModules.
{
CurrentGameMode = gamemode;
_ready = true;
}
public void SpawnPlayer(IPlayerSession player)
{
if (!_ready) return;
CurrentGameMode.SpawnPlayer(player);
CurrentGameMode.PlayerJoined(player);
}
#endregion IRoundManager Members
}
}

View File

@@ -125,7 +125,9 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ClientConsoleHost\Commands\ChatCommands.cs" />
<Compile Include="ClientConsoleHost\Commands\JoinGameCommand.cs" />
<Compile Include="ClientConsoleHost\Commands\MapCommands.cs" />
<Compile Include="ClientConsoleHost\Commands\PlayerCommands.cs" />
<Compile Include="ClientConsoleHost\Commands\RoundCommands.cs" />
<Compile Include="ClientConsoleHost\Commands\SysCommands.cs" />
<Compile Include="GameObjects\Components\Container\Container.cs" />
<Compile Include="GameObjects\Components\Container\ContainerManagerComponent.cs" />
@@ -156,7 +158,6 @@
<Compile Include="CommandLineArgs.cs" />
<Compile Include="Chat\ChatManager.cs" />
<Compile Include="ClientConsoleHost\Commands\ListCommands.cs" />
<Compile Include="ClientConsoleHost\Commands\Test.cs" />
<Compile Include="ClientConsoleHost\ClientConsoleHost.cs" />
<Compile Include="ClientConsoleHost\Commands\DrugsCommand.cs" />
<Compile Include="GameObjects\ServerComponentFactory.cs" />
@@ -189,7 +190,6 @@
<Compile Include="Interfaces\Chat\IChatManager.cs" />
<Compile Include="Interfaces\ClientConsoleHost\IClientCommand.cs" />
<Compile Include="Interfaces\ClientConsoleHost\IClientConsoleHost.cs" />
<Compile Include="Interfaces\GameMode\IGameMode.cs" />
<Compile Include="Interfaces\GameObjects\IActorComponent.cs" />
<Compile Include="Interfaces\GameObjects\IMoverComponent.cs" />
<Compile Include="Interfaces\GameObjects\IServerEntityManager.cs" />
@@ -200,14 +200,11 @@
<Compile Include="Interfaces\Placement\IPlacementManager.cs" />
<Compile Include="Interfaces\Player\IPlayerManager.cs" />
<Compile Include="Interfaces\Player\IPlayerSession.cs" />
<Compile Include="Interfaces\Round\IRoundManager.cs" />
<Compile Include="Interfaces\ServerConsole\IConsoleCommand.cs" />
<Compile Include="Interfaces\ServerConsole\IConsoleManager.cs" />
<Compile Include="Placement\PlacementManager.cs" />
<Compile Include="Player\PlayerManager.cs" />
<Compile Include="Player\PlayerSession.cs" />
<Compile Include="Round\Gamemodes.cs" />
<Compile Include="Round\RoundManager.cs" />
<Compile Include="ServerConsole\ConsoleManager.cs" />
<Compile Include="ServerConsole\Commands\HelpCommand.cs" />
<Compile Include="ServerConsole\Commands\ListCommands.cs" />

View File

@@ -6,6 +6,7 @@ using SS14.Shared.Interfaces.Map;
using SS14.Shared.IoC;
using System;
using System.IO;
using SS14.Shared.Map;
namespace SS14.Server.ServerConsole.Commands
{
@@ -48,7 +49,7 @@ namespace SS14.Server.ServerConsole.Commands
mapName = args[0];
}
var mapManager = IoCManager.Resolve<IMapManager>();
IoCManager.Resolve<IMapLoader>().Save(mapName, mapManager.GetMap(1));
IoCManager.Resolve<IMapLoader>().Save(mapName, mapManager.GetMap(new MapId(1)));
}
}
}

View File

@@ -1,7 +1,6 @@
using SS14.Server.Interfaces;
using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.ServerEnums;
using System;
using System.Reflection;
using System.Threading;
@@ -83,4 +82,4 @@ namespace SS14.Server
return Assembly.Load("../Mono.Posix.dll");
}
}
}
}

View File

@@ -1,9 +1,11 @@
namespace SS14.Shared.ContentPack
using System;
namespace SS14.Shared.ContentPack
{
/// <summary>
/// Common entry point for Content assemblies.
/// </summary>
public abstract class GameShared
public abstract class GameShared : IDisposable
{
public virtual void Init()
{
@@ -12,5 +14,9 @@
public virtual void Update(AssemblyLoader.UpdateLevel level, float frameTime)
{
}
public virtual void Dispose()
{
}
}
}

View File

@@ -32,7 +32,10 @@ namespace SS14.Shared.GameObjects
private IEnumerable<IComponent> GetComponents(Type type)
{
return _components[type].Where(c => !c.Deleted);
if (_components.TryGetValue(type, out var compList))
return compList.Where(c => !c.Deleted);
return Enumerable.Empty<IComponent>();
}
public IEnumerable<T> GetComponents<T>() where T : IComponent

View File

@@ -1,7 +1,5 @@
using System;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Maths;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.Map;
namespace SS14.Shared.GameObjects
@@ -21,8 +19,8 @@ namespace SS14.Shared.GameObjects
/// Current position offset of the entity.
/// </summary>
public readonly Vector2 Position;
public readonly int MapID;
public readonly int GridID;
public readonly MapId MapID;
public readonly GridId GridID;
/// <summary>
/// Current rotation offset of the entity.

View File

@@ -52,11 +52,11 @@ namespace SS14.Shared.Interfaces.GameObjects.Components
/// <summary>
/// Returns the index of the map which this object is on
/// </summary>
int MapID { get; }
MapId MapID { get; }
/// <summary>
/// Returns the index of the grid which this object is on
/// </summary>
int GridID { get; }
GridId GridID { get; }
}
}

View File

@@ -1,18 +1,13 @@
using OpenTK;
using SS14.Shared.Map;
using SS14.Shared.Maths;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SS14.Shared.Interfaces.Map
{
public interface IMap
{
int Index { get; }
MapId Index { get; }
#region GridAccess
/// <summary>
@@ -23,21 +18,21 @@ namespace SS14.Shared.Interfaces.Map
/// <param name="chunkSize">Optional chunk size of the new grid.</param>
/// <param name="snapSize">Optional size of the snap grid</param>
/// <returns></returns>
IMapGrid CreateGrid(int gridId, ushort chunkSize = 16, float snapSize = 1);
IMapGrid CreateGrid(GridId gridId, ushort chunkSize = 16, float snapSize = 1);
/// <summary>
/// Checks if a grid exists with the given ID.
/// </summary>
/// <param name="gridId">The ID of the grid to check.</param>
/// <returns></returns>
bool GridExists(int gridId);
bool GridExists(GridId gridId);
/// <summary>
/// Gets the grid associated with the given grid ID. If the grid with the given ID does not exist, return null.
/// </summary>
/// <param name="gridId">The id of the grid to get.</param>
/// <returns></returns>
IMapGrid GetGrid(int gridId);
IMapGrid GetGrid(GridId gridId);
/// <summary>
/// Alias of IMapManager.GetGrid(IMapManager.DefaultGridId);
@@ -49,7 +44,7 @@ namespace SS14.Shared.Interfaces.Map
/// Deletes the grid associated with the given grid ID.
/// </summary>
/// <param name="gridId">The grid to remove.</param>
void RemoveGrid(int gridId);
void RemoveGrid(GridId gridId);
/// <summary>
/// Finds all of the grids at this position in the world.

View File

@@ -14,9 +14,9 @@ namespace SS14.Shared.Interfaces.Map
/// <summary>
/// The integer ID of the map this grid is located within
/// </summary>
int MapID { get; }
MapId MapID { get; }
int Index { get; }
GridId Index { get; }
/// <summary>
/// The length of the side of a square tile in world units.

View File

@@ -1,9 +1,6 @@
using System.Collections.Generic;
using System;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Map;
using SS14.Shared.Maths;
using OpenTK;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Shared.Interfaces.Map
{
@@ -13,18 +10,25 @@ namespace SS14.Shared.Interfaces.Map
/// <param name="gridId">The ID of the grid being changed.</param>
/// <param name="tileRef">A reference to the new tile being inserted.</param>
/// <param name="oldTile">The old tile that is being replaced.</param>
public delegate void TileChangedEventHandler(int gridId, TileRef tileRef, Tile oldTile);
public delegate void TileChangedEventHandler(GridId gridId, TileRef tileRef, Tile oldTile);
/// <summary>
/// This manages all of the grids in the world.
/// </summary>
public interface IMapManager
{
void UnregisterMap(int mapID);
/// <summary>
/// The default <see cref="IMap"/> that is always available. Equivalent to SS13 Null space.
/// </summary>
IMap DefaultMap { get; }
IMap CreateMap(int mapID);
void UnregisterMap(MapId mapID);
IMap GetMap(int mapID);
IMap CreateMap(MapId mapID, bool overwrite = false);
IMap GetMap(MapId mapID);
bool MapExists(MapId mapID);
/// <summary>
/// Should the OnTileChanged event be suppressed? This is useful for initially loading the map
@@ -37,6 +41,16 @@ namespace SS14.Shared.Interfaces.Map
/// </summary>
event TileChangedEventHandler OnTileChanged;
/// <summary>
/// A new map has been created.
/// </summary>
event EventHandler<MapEventArgs> MapCreated;
/// <summary>
/// An existing map has been destroyed.
/// </summary>
event EventHandler<MapEventArgs> MapDestroyed;
/// <summary>
/// Starts up the map system.
/// </summary>
@@ -44,6 +58,6 @@ namespace SS14.Shared.Interfaces.Map
void SendMap(INetChannel channel);
bool TryGetMap(int mapID, out IMap map);
bool TryGetMap(MapId mapID, out IMap map);
}
}

View File

@@ -1,5 +1,6 @@
using OpenTK;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Map;
namespace SS14.Shared.Interfaces.Physics
{
@@ -28,6 +29,6 @@ namespace SS14.Shared.Interfaces.Physics
/// <summary>
/// The map index this collidable is located upon
/// </summary>
int MapID { get; }
MapId MapID { get; }
}
}

View File

@@ -2,18 +2,14 @@
using SS14.Shared.IoC;
using SS14.Shared.Maths;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SS14.Shared.Map
{
[Serializable]
public struct LocalCoordinates
{
public readonly int GridID;
public readonly int MapID;
public readonly GridId GridID;
public readonly MapId MapID;
public readonly Vector2 Position;
public float X => Position.X;
@@ -32,7 +28,7 @@ namespace SS14.Shared.Map
MapID = argGrid.MapID;
}
public LocalCoordinates(Vector2 argPosition, int argGrid, int argMap)
public LocalCoordinates(Vector2 argPosition, GridId argGrid, MapId argMap)
{
Position = argPosition;
GridID = argGrid;
@@ -46,7 +42,7 @@ namespace SS14.Shared.Map
MapID = argGrid.MapID;
}
public LocalCoordinates(float X, float Y, int argGrid, int argMap)
public LocalCoordinates(float X, float Y, GridId argGrid, MapId argMap)
{
Position = new Vector2(X, Y);
GridID = argGrid;
@@ -60,9 +56,10 @@ namespace SS14.Shared.Map
public LocalCoordinates ToWorld()
{
if (MapID == MapManager.DEFAULTGRID)
if (MapID == MapId.Nullspace)
return this;
var defaultgrid = IoCManager.Resolve<IMapManager>().GetMap(MapID).GetGrid(MapManager.DEFAULTGRID);
var defaultgrid = IoCManager.Resolve<IMapManager>().GetMap(MapID).GetGrid(GridId.DefaultGrid);
return new LocalCoordinates(Position + Grid.WorldPosition - defaultgrid.WorldPosition, defaultgrid);
}
@@ -81,20 +78,20 @@ namespace SS14.Shared.Map
public struct ScreenCoordinates
{
public readonly int MapID;
public readonly MapId MapID;
public readonly Vector2 Position;
public float X => Position.X;
public float Y => Position.Y;
public ScreenCoordinates(Vector2 argPosition, int argMap)
public ScreenCoordinates(Vector2 argPosition, MapId argMap)
{
Position = argPosition;
MapID = argMap;
}
public ScreenCoordinates(float X, float Y, int argMap)
public ScreenCoordinates(float X, float Y, MapId argMap)
{
Position = new Vector2(X, Y);
MapID = argMap;

51
SS14.Shared/Map/GridId.cs Normal file
View File

@@ -0,0 +1,51 @@
using System;
namespace SS14.Shared.Map
{
[Serializable]
public struct GridId : IEquatable<GridId>
{
public static readonly GridId DefaultGrid = new GridId(0);
private readonly int _value;
public GridId(int value)
{
_value = value;
}
/// <inheritdoc />
public bool Equals(GridId other)
{
return _value == other._value;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
return obj is GridId id && Equals(id);
}
/// <inheritdoc />
public override int GetHashCode()
{
return _value;
}
public static bool operator ==(GridId a, GridId b)
{
return a._value == b._value;
}
public static bool operator !=(GridId a, GridId b)
{
return !(a == b);
}
public static explicit operator int(GridId self)
{
return self._value;
}
}
}

View File

@@ -10,19 +10,17 @@ namespace SS14.Shared.Map
{
public class Map : IMap
{
public int Index { get; private set; } = 0;
public MapId Index { get; }
private readonly MapManager _mapManager;
private readonly Dictionary<int, MapGrid> _grids = new Dictionary<int, MapGrid>();
private readonly Dictionary<GridId, MapGrid> _grids = new Dictionary<GridId, MapGrid>();
public Map(MapManager mapManager, int mapID)
public Map(MapManager mapManager, MapId mapID)
{
Index = mapID;
_mapManager = mapManager;
CreateGrid(MapManager.DEFAULTGRID);
CreateGrid(GridId.DefaultGrid);
}
#region GridAccess
/// <summary>
/// Creates a new empty grid with the given ID and optional chunk size. If a grid already
/// exists with the gridID, it is overwritten with the new grid.
@@ -31,7 +29,7 @@ namespace SS14.Shared.Map
/// <param name="chunkSize">Optional chunk size of the new grid.</param>
/// <param name="snapSize">Optional size of the snap grid</param>
/// <returns></returns>
public IMapGrid CreateGrid(int gridId, ushort chunkSize = 32, float snapSize = 1)
public IMapGrid CreateGrid(GridId gridId, ushort chunkSize = 16, float snapSize = 1)
{
var newGrid = new MapGrid(_mapManager, gridId, chunkSize, snapSize, Index);
_grids.Add(gridId, newGrid);
@@ -43,7 +41,7 @@ namespace SS14.Shared.Map
/// </summary>
/// <param name="gridId">The ID of the grid to check.</param>
/// <returns></returns>
public bool GridExists(int gridId)
public bool GridExists(GridId gridId)
{
return _grids.ContainsKey(gridId);
}
@@ -53,7 +51,7 @@ namespace SS14.Shared.Map
/// </summary>
/// <param name="gridId">The id of the grid to get.</param>
/// <returns></returns>
public IMapGrid GetGrid(int gridId)
public IMapGrid GetGrid(GridId gridId)
{
MapGrid output;
_grids.TryGetValue(gridId, out output);
@@ -66,7 +64,7 @@ namespace SS14.Shared.Map
/// <returns></returns>
public IMapGrid GetDefaultGrid()
{
return GetGrid(MapManager.DEFAULTGRID);
return GetGrid(GridId.DefaultGrid);
}
public IEnumerable<IMapGrid> GetAllGrids()
@@ -81,7 +79,7 @@ namespace SS14.Shared.Map
/// Deletes the grid associated with the given grid ID.
/// </summary>
/// <param name="gridId">The grid to remove.</param>
public void RemoveGrid(int gridId)
public void RemoveGrid(GridId gridId)
{
MapGrid output;
if (!_grids.TryGetValue(gridId, out output))
@@ -97,7 +95,7 @@ namespace SS14.Shared.Map
var pos = worldPos.ToWorld().Position;
IMapGrid grid = GetDefaultGrid();
foreach (var kvGrid in _grids)
if (kvGrid.Value.AABBWorld.Contains(pos) && kvGrid.Value.Index != MapManager.DEFAULTGRID)
if (kvGrid.Value.AABBWorld.Contains(pos) && kvGrid.Value.Index != GridId.DefaultGrid)
grid = kvGrid.Value;
return grid;
}
@@ -107,7 +105,7 @@ namespace SS14.Shared.Map
{
IMapGrid grid = GetDefaultGrid();
foreach (var kvGrid in _grids)
if (kvGrid.Value.AABBWorld.Contains(worldPos) && kvGrid.Value.Index != MapManager.DEFAULTGRID)
if (kvGrid.Value.AABBWorld.Contains(worldPos) && kvGrid.Value.Index != GridId.DefaultGrid)
grid = kvGrid.Value;
return grid;
}
@@ -125,7 +123,5 @@ namespace SS14.Shared.Map
gridList.Add(kvGrid.Value);
return gridList;
}
#endregion GridAccess
}
}

View File

@@ -9,7 +9,7 @@ namespace SS14.Shared.Map
{
public class MapGrid : IMapGrid
{
public int MapID { get; private set; } = 0;
public MapId MapID { get; private set; }
private readonly MapManager _mapManager;
private readonly Dictionary<Indices, Chunk> _chunks = new Dictionary<Indices, Chunk>();
@@ -56,7 +56,7 @@ namespace SS14.Shared.Map
}
}
internal MapGrid(MapManager mapManager, int gridIndex, ushort chunkSize, float snapsize, int mapID)
internal MapGrid(MapManager mapManager, GridId gridIndex, ushort chunkSize, float snapsize, MapId mapID)
{
_mapManager = mapManager;
Index = gridIndex;
@@ -82,7 +82,7 @@ namespace SS14.Shared.Map
/// <inheritdoc />
public float SnapSize { get; }
public int Index { get; }
public GridId Index { get; }
/// <summary>
/// The length of the side of a square tile in world units.
@@ -272,7 +272,7 @@ namespace SS14.Shared.Map
/// <inheritdoc />
public LocalCoordinates LocalToWorld(LocalCoordinates local)
{
return new LocalCoordinates(local.Position + WorldPosition, 0, local.MapID);
return new LocalCoordinates(local.Position + WorldPosition, GridId.DefaultGrid, local.MapID);
}
public Vector2 ConvertToWorld(Vector2 localpos)

51
SS14.Shared/Map/MapId.cs Normal file
View File

@@ -0,0 +1,51 @@
using System;
namespace SS14.Shared.Map
{
[Serializable]
public struct MapId : IEquatable<MapId>
{
public static readonly MapId Nullspace = new MapId(0);
private readonly int _value;
public MapId(int value)
{
_value = value;
}
/// <inheritdoc />
public bool Equals(MapId other)
{
return _value == other._value;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
return obj is MapId id && Equals(id);
}
/// <inheritdoc />
public override int GetHashCode()
{
return _value;
}
public static bool operator ==(MapId a, MapId b)
{
return a._value == b._value;
}
public static bool operator !=(MapId a, MapId b)
{
return !(a == b);
}
public static explicit operator int(MapId self)
{
return self._value;
}
}
}

View File

@@ -49,7 +49,7 @@ namespace SS14.Shared.Map
}
/// <inheritdoc />
public void HandleNetworkMessage(MsgMap message)
private void HandleNetworkMessage(MsgMap message)
{
switch (message.MessageType)
{
@@ -65,6 +65,16 @@ namespace SS14.Shared.Map
case MapMessage.SendMapInfo:
CollectMapInfo(message);
break;
case MapMessage.CreateMap:
{
CreateMap(message.MapIndex);
}
break;
case MapMessage.UnregisterMap:
{
UnregisterMap(message.MapIndex);
}
break;
default:
throw new ArgumentOutOfRangeException(nameof(message));
}
@@ -139,7 +149,7 @@ namespace SS14.Shared.Map
/// <param name="gridId">The id of the grid being modified.</param>
/// <param name="tileRef">A reference to the new tile.</param>
/// <param name="oldTile">The old tile being modified.</param>
private void MapMgrOnTileChanged(int gridId, TileRef tileRef, Tile oldTile)
private void MapMgrOnTileChanged(GridId gridId, TileRef tileRef, Tile oldTile)
{
Debug.Assert(_netManager.IsServer, "Why is the client calling this?");
@@ -152,6 +162,8 @@ namespace SS14.Shared.Map
Y = tileRef.Y,
Tile = (uint) tileRef.Tile
};
message.GridIndex = tileRef.LocalPos.GridID;
message.MapIndex = tileRef.LocalPos.MapID;
_netManager.ServerSendToAll(message);
}
@@ -248,7 +260,7 @@ namespace SS14.Shared.Map
var tile = (Tile) message.SingleTurf.Tile;
LocalCoordinates coords = new LocalCoordinates(x, y, message.GridIndex, message.MapIndex);
coords.Grid.SetTile(coords, tile); //TODO: Fix this
coords.Grid.SetTile(coords, tile);
}
private void CollectMapInfo(MsgMap message)
@@ -262,5 +274,37 @@ namespace SS14.Shared.Map
IoCManager.Resolve<IEntityManager>().MapsInitialized = true;
}
}
/// <summary>
/// Notifies all connected clients that a new map has been created.
/// </summary>
private void BroadcastCreateMap(Map map)
{
if(_netManager.IsClient)
return;
var msg = _netManager.CreateNetMessage<MsgMap>();
msg.MessageType = MapMessage.CreateMap;
msg.MapIndex = map.Index;
_netManager.ServerSendToAll(msg);
}
/// <summary>
/// Notifies all connected clients that an existing map has been destroyed.
/// </summary>
private void BroadcastUnregisterMap(MapId mapID)
{
if(_netManager.IsClient)
return;
var msg = _netManager.CreateNetMessage<MsgMap>();
msg.MessageType = MapMessage.UnregisterMap;
msg.MapIndex = mapID;
_netManager.ServerSendToAll(msg);
}
}
}

View File

@@ -1,31 +1,30 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using OpenTK;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.Maths;
using Vector2 = SS14.Shared.Maths.Vector2;
namespace SS14.Shared.Map
{
public partial class MapManager : IMapManager
{
public const int NULLSPACE = 0;
public const int DEFAULTGRID = 0;
private const ushort DefaultTileSize = 1;
/// <inheritdoc />
public IMap DefaultMap => GetMap(MapId.Nullspace);
/// <inheritdoc />
public void Initialize()
{
NetSetup();
CreateMap(MapManager.NULLSPACE);
CreateMap(MapId.Nullspace);
}
/// <inheritdoc />
public event TileChangedEventHandler OnTileChanged;
public event EventHandler<MapEventArgs> MapCreated;
public event EventHandler<MapEventArgs> MapDestroyed;
/// <summary>
/// Should the OnTileChanged event be suppressed? This is useful for initially loading the map
/// so that you don't spam an event for each of the million station tiles.
@@ -38,7 +37,7 @@ namespace SS14.Shared.Map
/// <param name="gridId">The ID of the grid that was modified.</param>
/// <param name="tileRef">A reference to the new tile.</param>
/// <param name="oldTile">The old tile that got replaced.</param>
public void RaiseOnTileChanged(int gridId, TileRef tileRef, Tile oldTile)
public void RaiseOnTileChanged(GridId gridId, TileRef tileRef, Tile oldTile)
{
if (SuppressOnTileChanged)
return;
@@ -46,46 +45,59 @@ namespace SS14.Shared.Map
OnTileChanged?.Invoke(gridId, tileRef, oldTile);
}
#region Networking
#endregion Networking
#region MapAccess
/// <summary>
/// Holds an indexed collection of map grids.
/// </summary>
private readonly Dictionary<int, Map> _Maps = new Dictionary<int, Map>();
private readonly Dictionary<MapId, Map> _maps = new Dictionary<MapId, Map>();
public void UnregisterMap(int mapID)
public void UnregisterMap(MapId mapID)
{
if (_Maps.ContainsKey(mapID))
if (_maps.ContainsKey(mapID))
{
_Maps.Remove(mapID);
BroadcastUnregisterMap(mapID);
MapDestroyed?.Invoke(this, new MapEventArgs(_maps[mapID]));
_maps.Remove(mapID);
}
else
{
Logger.Warning("Attempted to unregister nonexistent map");
Logger.Warning("[MAP] Attempted to unregister nonexistent map.");
}
}
public IMap CreateMap(int mapID)
public IMap CreateMap(MapId mapID, bool overwrite = false)
{
if(!overwrite && _maps.ContainsKey(mapID))
{
Logger.Warning("[MAP] Attempted to overwrite existing map.");
return null;
}
var newMap = new Map(this, mapID);
_Maps.Add(mapID, newMap);
_maps.Add(mapID, newMap);
MapCreated?.Invoke(this, new MapEventArgs(newMap));
BroadcastCreateMap(newMap);
return newMap;
}
public IMap GetMap(int mapID)
public IMap GetMap(MapId mapID)
{
return _Maps[mapID];
return _maps[mapID];
}
public bool TryGetMap(int mapID, out IMap map)
public bool MapExists(MapId mapID)
{
if (_Maps.ContainsKey(mapID))
return _maps.ContainsKey(mapID);
}
public bool TryGetMap(MapId mapID, out IMap map)
{
if (_maps.ContainsKey(mapID))
{
map = _Maps[mapID];
map = _maps[mapID];
return true;
}
map = null;
@@ -94,7 +106,7 @@ namespace SS14.Shared.Map
public IEnumerable<IMap> GetAllMaps()
{
foreach(var kmap in _Maps)
foreach(var kmap in _maps)
{
yield return kmap.Value;
}
@@ -102,4 +114,14 @@ namespace SS14.Shared.Map
#endregion MapAccess
}
public class MapEventArgs : EventArgs
{
public IMap Map { get; }
public MapEventArgs(IMap map)
{
Map = map;
}
}
}

View File

@@ -1,7 +1,6 @@
using SS14.Shared.Interfaces.Map;
using SS14.Shared.IoC;
using SS14.Shared.Maths;
using Vector2f = OpenTK.Vector2;
namespace SS14.Shared.Map
{
@@ -10,12 +9,12 @@ namespace SS14.Shared.Map
/// </summary>
public struct TileRef
{
private readonly int _mapIndex;
private readonly int _gridIndex;
private readonly MapId _mapIndex;
private readonly GridId _gridIndex;
private readonly Tile _tile;
private readonly MapGrid.Indices _gridTile;
internal TileRef(int argMap, int gridIndex, int xIndex, int yIndex, Tile tile)
internal TileRef(MapId argMap, GridId gridIndex, int xIndex, int yIndex, Tile tile)
{
_mapIndex = argMap;
_gridTile = new MapGrid.Indices(xIndex, yIndex);
@@ -23,7 +22,7 @@ namespace SS14.Shared.Map
_tile = tile;
}
internal TileRef(int argMap, int gridIndex, MapGrid.Indices gridTile, Tile tile)
internal TileRef(MapId argMap, GridId gridIndex, MapGrid.Indices gridTile, Tile tile)
{
_mapIndex = argMap;
_gridTile = gridTile;

View File

@@ -1,6 +1,6 @@
using System;
using Lidgren.Network;
using Lidgren.Network;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Map;
namespace SS14.Shared.Network.Messages
{
@@ -15,8 +15,8 @@ namespace SS14.Shared.Network.Messages
#endregion
public MapMessage MessageType { get; set; }
public int MapIndex { get; set; }
public int GridIndex { get; set; }
public MapId MapIndex { get; set; }
public GridId GridIndex { get; set; }
public Turf SingleTurf { get; set; }
@@ -54,6 +54,8 @@ namespace SS14.Shared.Network.Messages
switch (MessageType)
{
case MapMessage.TurfUpdate:
MapIndex = new MapId(buffer.ReadInt32());
GridIndex = new GridId(buffer.ReadInt32());
SingleTurf = new Turf()
{
X = buffer.ReadInt32(),
@@ -62,8 +64,8 @@ namespace SS14.Shared.Network.Messages
};
break;
case MapMessage.SendTileMap:
GridIndex = buffer.ReadInt32();
MapIndex = buffer.ReadInt32();
GridIndex = new GridId(buffer.ReadInt32());
MapIndex = new MapId(buffer.ReadInt32());
//tile defs
var numTileDefs = buffer.ReadInt32();
@@ -103,6 +105,10 @@ namespace SS14.Shared.Network.Messages
case MapMessage.SendMapInfo:
MapGridsToSend = buffer.ReadInt32();
break;
case MapMessage.CreateMap:
case MapMessage.UnregisterMap:
MapIndex = new MapId(buffer.ReadInt32());
break;
}
}
@@ -112,13 +118,15 @@ namespace SS14.Shared.Network.Messages
switch (MessageType)
{
case MapMessage.TurfUpdate:
buffer.Write((int)MapIndex);
buffer.Write((int)GridIndex);
buffer.Write(SingleTurf.X);
buffer.Write(SingleTurf.Y);
buffer.Write(SingleTurf.Tile);
break;
case MapMessage.SendTileMap:
buffer.Write(GridIndex);
buffer.Write(MapIndex);
buffer.Write((int)GridIndex);
buffer.Write((int)MapIndex);
// Tile defs, ordered list
buffer.Write(TileDefs.Length);
@@ -142,6 +150,10 @@ namespace SS14.Shared.Network.Messages
case MapMessage.SendMapInfo:
buffer.Write(MapGridsToSend);
break;
case MapMessage.CreateMap:
case MapMessage.UnregisterMap:
buffer.Write((int)MapIndex);
break;
}
}
}

View File

@@ -1,6 +1,7 @@
using System;
using Lidgren.Network;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Map;
using SS14.Shared.Maths;
namespace SS14.Shared.Network.Messages
@@ -22,8 +23,8 @@ namespace SS14.Shared.Network.Messages
public string EntityTemplateName { get; set; }
public float XValue { get; set; }
public float YValue { get; set; }
public int GridIndex { get; set; }
public int MapIndex { get; set; }
public GridId GridIndex { get; set; }
public MapId MapIndex { get; set; }
public Direction DirRcv { get; set; }
public int Range { get; set; }
@@ -43,8 +44,8 @@ namespace SS14.Shared.Network.Messages
XValue = buffer.ReadFloat();
YValue = buffer.ReadFloat();
GridIndex = buffer.ReadInt32();
MapIndex = buffer.ReadInt32();
GridIndex = new GridId(buffer.ReadInt32());
MapIndex = new MapId(buffer.ReadInt32());
DirRcv = (Direction)buffer.ReadByte();
}
else if (PlaceType == PlacementManagerMessage.StartPlacement)
@@ -75,8 +76,8 @@ namespace SS14.Shared.Network.Messages
buffer.Write(XValue);
buffer.Write(YValue);
buffer.Write(GridIndex);
buffer.Write(MapIndex);
buffer.Write((int)GridIndex);
buffer.Write((int)MapIndex);
buffer.Write((byte)DirRcv);
break;
case PlacementManagerMessage.StartPlacement:

View File

@@ -93,7 +93,10 @@
//TurfRemoveDecal,
//SendTileIndex,
SendTileMap,
SendMapInfo
SendMapInfo,
CreateMap,
UnregisterMap,
}
public enum MobHand

View File

@@ -110,7 +110,7 @@
<ProjectReference Include="..\Lidgren.Network\Lidgren.Network.csproj">
<Name>Lidgren.Network</Name>
<Project>{59250BAF-0000-0000-0000-000000000000}</Project>
<Private>False</Private>
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
@@ -173,8 +173,10 @@
<Compile Include="Log\LogLevel.cs" />
<Compile Include="Log\Logger.cs" />
<Compile Include="Log\LogManager.cs" />
<Compile Include="Map\GridId.cs" />
<Compile Include="Map\Map.cs" />
<Compile Include="Map\Coordinates.cs" />
<Compile Include="Map\MapId.cs" />
<Compile Include="Maths\Angle.cs" />
<Compile Include="Maths\Box2i.cs" />
<Compile Include="Map\Chunk.cs" />
@@ -233,7 +235,6 @@
<Compile Include="Reflection\ReflectAttribute.cs" />
<Compile Include="Serialization\NetSerializableAttribute.cs" />
<Compile Include="Serialization\SS14Serializer.cs" />
<Compile Include="ServerEnums\RunLevel.cs" />
<Compile Include="SessionStatusEnum.cs" />
<Compile Include="Timers\Timer.cs" />
<Compile Include="Timers\TimerManager.cs" />
@@ -318,14 +319,6 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<WarningLevel>4</WarningLevel>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<!-- Can't just include everything inside Resources because of build tools and intermediate files. -->
<Resources Include="..\Resources\Fonts\**\*.*">

View File

@@ -1,9 +0,0 @@
namespace SS14.Shared.ServerEnums
{
public enum RunLevel
{
Init,
Lobby,
Game
}
}

View File

@@ -3,6 +3,7 @@
public enum SessionStatus : byte
{
Zombie = 0,
Connecting,
Connected,
InLobby,
InGame,

View File

@@ -14,7 +14,7 @@ namespace SS14.Shared.Timers
public void UpdateTimers(float frameTime)
{
_timers.ForEach(timer => timer.Update(frameTime));
new List<Timer>(_timers).ForEach(timer => timer.Update(frameTime));
_timers.RemoveAll(timer => !timer.IsActive);
}
}

View File

@@ -29,13 +29,11 @@ using SS14.Server.Interfaces.GameState;
using SS14.Server.Interfaces.Log;
using SS14.Server.Interfaces.Placement;
using SS14.Server.Interfaces.Player;
using SS14.Server.Interfaces.Round;
using SS14.Server.Interfaces.ServerConsole;
using SS14.Server.Log;
using SS14.Server.Placement;
using SS14.Server.Player;
using SS14.Server.Reflection;
using SS14.Server.Round;
using SS14.Server.ServerConsole;
using SS14.Shared.Configuration;
using SS14.Shared.GameObjects;
@@ -237,7 +235,6 @@ namespace SS14.UnitTesting
IoCManager.Register<IPlacementManager, PlacementManager>();
IoCManager.Register<IConsoleManager, ConsoleManager>();
IoCManager.Register<ITileDefinitionManager, TileDefinitionManager>();
IoCManager.Register<IRoundManager, RoundManager>();
IoCManager.Register<IEntityNetworkManager, ServerEntityNetworkManager>();
IoCManager.Register<ICommandLineArgs, CommandLineArgs>();
IoCManager.Register<IGameStateManager, GameStateManager>();

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SS14.Shared.ContentPack;
namespace Sandbox.Client
{
public class EntryPoint : GameClient
{
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sandbox.Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sandbox.Client")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bc6cd011-c070-4382-97aa-ea90959fbf85")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BC6CD011-C070-4382-97AA-EA90959FBF85}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sandbox.Client</RootNamespace>
<AssemblyName>Sandbox.Client</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\bin\Client\Resources\Assemblies\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\Client\Resources\Assemblies\</OutputPath>
<DefineConstants>TRACE;RELEASE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\bin\Client\Resources\Assemblies\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\bin\Client\Resources\Assemblies\</OutputPath>
<DefineConstants>TRACE;RELEASE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sandbox.Shared\Sandbox.Shared.csproj">
<Project>{cc29cec3-98f8-467d-8a70-bfb520ef0f45}</Project>
<Name>Sandbox.Shared</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\SS14.Client\SS14.Client.csproj">
<Project>{0c31dfdf-0000-0000-0000-000000000000}</Project>
<Name>SS14.Client</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\SS14.Shared\SS14.Shared.csproj">
<Project>{0529f740-0000-0000-0000-000000000000}</Project>
<Name>SS14.Shared</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,152 @@
using System;
using System.Diagnostics;
using SS14.Server;
using SS14.Server.Interfaces;
using SS14.Server.Interfaces.Chat;
using SS14.Server.Interfaces.Maps;
using SS14.Server.Interfaces.Player;
using SS14.Server.Player;
using SS14.Shared;
using SS14.Shared.Console;
using SS14.Shared.ContentPack;
using SS14.Shared.Interfaces.Map;
using SS14.Shared.Interfaces.Timers;
using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.Map;
using SS14.Shared.Timers;
namespace Sandbox.Server
{
/// <inheritdoc />
public class EntryPoint : GameServer
{
private IBaseServer _server;
private IPlayerManager _players;
private bool _countdownStarted;
/// <inheritdoc />
public override void Init()
{
base.Init();
_server = IoCManager.Resolve<IBaseServer>();
_players = IoCManager.Resolve<IPlayerManager>();
_server.RunLevelChanged += HandleRunLevelChanged;
_players.PlayerStatusChanged += HandlePlayerStatusChanged;
}
/// <inheritdoc />
public override void Dispose()
{
_server.RunLevelChanged -= HandleRunLevelChanged;
_players.PlayerStatusChanged -= HandlePlayerStatusChanged;
base.Dispose();
}
private void HandleRunLevelChanged(object sender, RunLevelChangedEventArgs args)
{
switch (args.NewLevel)
{
case ServerRunLevel.PreGame:
IoCManager.Resolve<IPlayerManager>().FallbackSpawnPoint = new LocalCoordinates(0, 0, GridId.DefaultGrid, new MapId(1));
NewDemoGrid(new GridId(1), new MapId(1));
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Round loaded!");
break;
case ServerRunLevel.Game:
IoCManager.Resolve<IPlayerManager>().SendJoinGameToAll();
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Round started!");
break;
case ServerRunLevel.PostGame:
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Round over!");
break;
}
}
private void HandlePlayerStatusChanged(object sender, SessionStatusEventArgs args)
{
switch (args.NewStatus)
{
case SessionStatus.Connected:
{
// timer time must be > tick length
IoCManager.Resolve<ITimerManager>().AddTimer(new Timer(250, false, () =>
{
args.Session.JoinLobby();
}));
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Player joined server!", args.Session.Index);
}
break;
case SessionStatus.InLobby:
{
// auto start game when first player joins
if (_server.RunLevel == ServerRunLevel.PreGame && !_countdownStarted)
{
_countdownStarted = true;
IoCManager.Resolve<ITimerManager>().AddTimer(new Timer(2000, false, () =>
{
_server.RunLevel = ServerRunLevel.Game;
_countdownStarted = false;
}));
}
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Player joined Lobby!", args.Session.Index);
}
break;
case SessionStatus.InGame:
{
//TODO: Check for existing mob and re-attach
IoCManager.Resolve<IPlayerManager>().SpawnPlayerMob(args.Session);
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Player joined Game!", args.Session.Index);
}
break;
case SessionStatus.Disconnected:
{
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Player left!", args.Session.Index);
}
break;
}
}
//TODO: This whole method should be removed once file loading/saving works, and replaced with a 'Demo' map.
/// <summary>
/// Generates 'Demo' grid and inserts it into the map manager.
/// </summary>
private void NewDemoGrid(GridId gridId, MapId mapId)
{
var mapManager = IoCManager.Resolve<IMapManager>();
var defManager = IoCManager.Resolve<ITileDefinitionManager>();
mapManager.SuppressOnTileChanged = true;
Logger.Log("Cannot find map. Generating blank map.", LogLevel.Warning);
var floor = defManager["Floor"].TileId;
Debug.Assert(floor > 0);
var map = mapManager.CreateMap(mapId);
var grid = map.CreateGrid(gridId);
for (var y = -32; y <= 32; ++y)
{
for (var x = -32; x <= 32; ++x)
{
grid.SetTile(new LocalCoordinates(x, y, gridId, mapId), new Tile(floor));
}
}
// load entities
IoCManager.Resolve<IMapLoader>().Load(_server.MapName, map);
mapManager.SuppressOnTileChanged = false;
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sandbox.Server")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sandbox.Server")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3b6d19c8-3531-4658-bd53-c68f51d96a98")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3B6D19C8-3531-4658-BD53-C68F51D96A98}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sandbox.Server</RootNamespace>
<AssemblyName>Sandbox.Server</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\bin\Server\Resources\Assemblies\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\Server\Resources\Assemblies\</OutputPath>
<DefineConstants>TRACE;RELEASE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\bin\Server\Resources\Assemblies\</OutputPath>
<DefineConstants>TRACE;RELEASE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sandbox.Shared\Sandbox.Shared.csproj">
<Project>{cc29cec3-98f8-467d-8a70-bfb520ef0f45}</Project>
<Name>Sandbox.Shared</Name>
</ProjectReference>
<ProjectReference Include="..\SS14.Server\SS14.Server.csproj">
<Project>{b04aae71-0000-0000-0000-000000000000}</Project>
<Name>SS14.Server</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\SS14.Shared\SS14.Shared.csproj">
<Project>{0529f740-0000-0000-0000-000000000000}</Project>
<Name>SS14.Shared</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SS14.Shared.ContentPack;
namespace Sandbox.Shared
{
class EntryPoint : GameShared
{
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sandbox.Shared")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sandbox.Shared")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cc29cec3-98f8-467d-8a70-bfb520ef0f45")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sandbox.Shared</RootNamespace>
<AssemblyName>Sandbox.Shared</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;RELEASE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;RELEASE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SS14.Shared\SS14.Shared.csproj">
<Project>{0529f740-0000-0000-0000-000000000000}</Project>
<Name>SS14.Shared</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2005
VisualStudioVersion = 15.0.27130.2020
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "Lidgren.Network\Lidgren.Network.csproj", "{59250BAF-0000-0000-0000-000000000000}"
EndProject
@@ -26,94 +26,154 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SFML", "SFML", "{600F7C3B-7
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{795D76AB-19B5-4682-B51F-6DB148024A0C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sandbox", "Sandbox", "{C0BDFCEF-B85A-4251-9B32-F676E28E34B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.Client", "Sandbox.Client\Sandbox.Client.csproj", "{BC6CD011-C070-4382-97AA-EA90959FBF85}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.Server", "Sandbox.Server\Sandbox.Server.csproj", "{3B6D19C8-3531-4658-BD53-C68F51D96A98}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox.Shared", "Sandbox.Shared\Sandbox.Shared.csproj", "{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{59250BAF-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|x86
{59250BAF-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|x64
{59250BAF-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|x64
{59250BAF-0000-0000-0000-000000000000}.Debug|x86.ActiveCfg = Debug|x86
{59250BAF-0000-0000-0000-000000000000}.Debug|x86.Build.0 = Debug|x86
{59250BAF-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|x86
{59250BAF-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|x64
{59250BAF-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64
{59250BAF-0000-0000-0000-000000000000}.Release|x86.ActiveCfg = Release|x86
{59250BAF-0000-0000-0000-000000000000}.Release|x86.Build.0 = Release|x86
{0C31DFDF-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|x86
{0C31DFDF-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|x64
{0C31DFDF-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|x64
{0C31DFDF-0000-0000-0000-000000000000}.Debug|x86.ActiveCfg = Debug|x86
{0C31DFDF-0000-0000-0000-000000000000}.Debug|x86.Build.0 = Debug|x86
{0C31DFDF-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|x86
{0C31DFDF-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|x64
{0C31DFDF-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64
{0C31DFDF-0000-0000-0000-000000000000}.Release|x86.ActiveCfg = Release|x86
{0C31DFDF-0000-0000-0000-000000000000}.Release|x86.Build.0 = Release|x86
{B04AAE71-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|x86
{B04AAE71-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|x64
{B04AAE71-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|x64
{B04AAE71-0000-0000-0000-000000000000}.Debug|x86.ActiveCfg = Debug|x86
{B04AAE71-0000-0000-0000-000000000000}.Debug|x86.Build.0 = Debug|x86
{B04AAE71-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|x86
{B04AAE71-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|x64
{B04AAE71-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64
{B04AAE71-0000-0000-0000-000000000000}.Release|x86.ActiveCfg = Release|x86
{B04AAE71-0000-0000-0000-000000000000}.Release|x86.Build.0 = Release|x86
{0529F740-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|x86
{0529F740-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|x64
{0529F740-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|x64
{0529F740-0000-0000-0000-000000000000}.Debug|x86.ActiveCfg = Debug|x86
{0529F740-0000-0000-0000-000000000000}.Debug|x86.Build.0 = Debug|x86
{0529F740-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|x86
{0529F740-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|x64
{0529F740-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64
{0529F740-0000-0000-0000-000000000000}.Release|x86.ActiveCfg = Release|x86
{0529F740-0000-0000-0000-000000000000}.Release|x86.Build.0 = Release|x86
{302B877E-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|x86
{302B877E-0000-0000-0000-000000000000}.Debug|x64.ActiveCfg = Debug|x64
{302B877E-0000-0000-0000-000000000000}.Debug|x64.Build.0 = Debug|x64
{302B877E-0000-0000-0000-000000000000}.Debug|x86.ActiveCfg = Debug|x86
{302B877E-0000-0000-0000-000000000000}.Debug|x86.Build.0 = Debug|x86
{302B877E-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|x86
{302B877E-0000-0000-0000-000000000000}.Release|x64.ActiveCfg = Release|x64
{302B877E-0000-0000-0000-000000000000}.Release|x64.Build.0 = Release|x64
{302B877E-0000-0000-0000-000000000000}.Release|x86.ActiveCfg = Release|x86
{302B877E-0000-0000-0000-000000000000}.Release|x86.Build.0 = Release|x86
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Debug|Any CPU.ActiveCfg = Debug|x86
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Debug|x64.ActiveCfg = Debug|x64
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Debug|x64.Build.0 = Debug|x64
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Debug|x86.ActiveCfg = Debug|x86
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Debug|x86.Build.0 = Debug|x86
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Release|Any CPU.ActiveCfg = Release|x86
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Release|x64.ActiveCfg = Release|x64
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Release|x64.Build.0 = Release|x64
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Release|x86.ActiveCfg = Release|x86
{F0ADA779-40B8-4F7E-BA6C-CDB19F3065D9}.Release|x86.Build.0 = Release|x86
{D0DA124B-5580-4345-A02B-9F051F78915F}.Debug|Any CPU.ActiveCfg = Debug|x86
{D0DA124B-5580-4345-A02B-9F051F78915F}.Debug|x64.ActiveCfg = Debug|x64
{D0DA124B-5580-4345-A02B-9F051F78915F}.Debug|x64.Build.0 = Debug|x64
{D0DA124B-5580-4345-A02B-9F051F78915F}.Debug|x86.ActiveCfg = Debug|x86
{D0DA124B-5580-4345-A02B-9F051F78915F}.Debug|x86.Build.0 = Debug|x86
{D0DA124B-5580-4345-A02B-9F051F78915F}.Release|Any CPU.ActiveCfg = Release|x86
{D0DA124B-5580-4345-A02B-9F051F78915F}.Release|x64.ActiveCfg = Release|x64
{D0DA124B-5580-4345-A02B-9F051F78915F}.Release|x64.Build.0 = Release|x64
{D0DA124B-5580-4345-A02B-9F051F78915F}.Release|x86.ActiveCfg = Release|x86
{D0DA124B-5580-4345-A02B-9F051F78915F}.Release|x86.Build.0 = Release|x86
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Debug|Any CPU.ActiveCfg = Debug|x86
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Debug|x64.ActiveCfg = Debug|x64
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Debug|x64.Build.0 = Debug|x64
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Debug|x86.ActiveCfg = Debug|x86
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Debug|x86.Build.0 = Debug|x86
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Release|Any CPU.ActiveCfg = Release|x86
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Release|x64.ActiveCfg = Release|x64
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Release|x64.Build.0 = Release|x64
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Release|x86.ActiveCfg = Release|x86
{31D24303-F6A9-4D53-BB03-A73EDCB3186D}.Release|x86.Build.0 = Release|x86
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|Any CPU.ActiveCfg = Debug|x86
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|x64.ActiveCfg = Debug|x64
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|x64.Build.0 = Debug|x64
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|x86.ActiveCfg = Debug|x86
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Debug|x86.Build.0 = Debug|x86
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|Any CPU.ActiveCfg = Release|x86
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|x64.ActiveCfg = Release|x64
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|x64.Build.0 = Release|x64
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|x86.ActiveCfg = Release|x86
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F}.Release|x86.Build.0 = Release|x86
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|Any CPU.ActiveCfg = Debug|x86
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|x64.ActiveCfg = Debug|x64
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|x64.Build.0 = Debug|x64
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|x86.ActiveCfg = Debug|x86
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Debug|x86.Build.0 = Debug|x86
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|Any CPU.ActiveCfg = Release|x86
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|x64.ActiveCfg = Release|x64
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|x64.Build.0 = Release|x64
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|x86.ActiveCfg = Release|x86
{46786269-57B9-48E7-AA4F-8F4D84609FE6}.Release|x86.Build.0 = Release|x86
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Debug|Any CPU.ActiveCfg = Debug|x86
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Debug|x64.ActiveCfg = Debug|x64
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Debug|x64.Build.0 = Debug|x64
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Debug|x86.ActiveCfg = Debug|x86
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Debug|x86.Build.0 = Debug|x86
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Release|Any CPU.ActiveCfg = Release|x86
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Release|x64.ActiveCfg = Release|x64
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Release|x64.Build.0 = Release|x64
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Release|x86.ActiveCfg = Release|x86
{BC6CD011-C070-4382-97AA-EA90959FBF85}.Release|x86.Build.0 = Release|x86
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Debug|Any CPU.ActiveCfg = Debug|x86
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Debug|x64.ActiveCfg = Debug|x64
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Debug|x64.Build.0 = Debug|x64
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Debug|x86.ActiveCfg = Debug|x86
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Debug|x86.Build.0 = Debug|x86
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Release|Any CPU.ActiveCfg = Release|x86
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Release|x64.ActiveCfg = Release|x64
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Release|x64.Build.0 = Release|x64
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Release|x86.ActiveCfg = Release|x86
{3B6D19C8-3531-4658-BD53-C68F51D96A98}.Release|x86.Build.0 = Release|x86
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Debug|Any CPU.ActiveCfg = Debug|x86
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Debug|x64.ActiveCfg = Debug|x64
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Debug|x64.Build.0 = Debug|x64
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Debug|x86.ActiveCfg = Debug|x86
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Debug|x86.Build.0 = Debug|x86
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Release|Any CPU.ActiveCfg = Release|x86
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Release|x64.ActiveCfg = Release|x64
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Release|x64.Build.0 = Release|x64
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Release|x86.ActiveCfg = Release|x86
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -123,6 +183,9 @@ Global
{31D24303-F6A9-4D53-BB03-A73EDCB3186D} = {600F7C3B-7142-4EEF-BE13-824BC4548D0D}
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F} = {600F7C3B-7142-4EEF-BE13-824BC4548D0D}
{46786269-57B9-48E7-AA4F-8F4D84609FE6} = {600F7C3B-7142-4EEF-BE13-824BC4548D0D}
{BC6CD011-C070-4382-97AA-EA90959FBF85} = {C0BDFCEF-B85A-4251-9B32-F676E28E34B5}
{3B6D19C8-3531-4658-BD53-C68F51D96A98} = {C0BDFCEF-B85A-4251-9B32-F676E28E34B5}
{CC29CEC3-98F8-467D-8A70-BFB520EF0F45} = {C0BDFCEF-B85A-4251-9B32-F676E28E34B5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {57757344-0FF4-4842-8A68-141CAA18A35D}