Map Blueprint Save/Loading (#32)

* Change entry point to new system.

* Map saving/loading works.

* Cleans up old code.

* Saving and Loading of blueprints works.

* Saving and Loading of blueprints works.

* Updated the nuget 'YamlDotNet' package to 4.3.0.

* Submodules are trash
This commit is contained in:
Acruid
2018-02-06 19:34:36 -08:00
committed by clusterfack
parent 059832d324
commit 3dfce70fdc
15 changed files with 116 additions and 82 deletions

2
.gitmodules vendored
View File

@@ -1,4 +1,4 @@
[submodule "engine"]
path = engine
url = https://github.com/space-wizards/space-station-14.git
branch = 56508df91937fd456bc5411008575169d93b262b
branch = a8c302eadb516f919df1f751af8a5d2993458b2e

View File

@@ -16,6 +16,13 @@ https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild
<PropertyGroup>
<Python>python3</Python>
<Python Condition="'$(OS)'=='Windows_NT' Or '$(OS)'=='Windows'">py -3</Python>
<ProjectGuid>{C899FCA4-7037-4E49-ABC2-44DE72487110}</ProjectGuid>
</PropertyGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<Target Name="Build">
<Exec Command="$(Python) git_helper.py" CustomErrorRegularExpression="^Error" />

View File

@@ -51,12 +51,12 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="YamlDotNet">
<HintPath>$(SolutionDir)packages\YamlDotNet.4.2.1\lib\net35\YamlDotNet.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)packages\OpenTK.3.0.0-pre\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="YamlDotNet, Version=4.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)packages\YamlDotNet.4.3.0\lib\net45\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
@@ -99,4 +99,8 @@
<ContentAssemblies Include="$(OutputPath)Content.Client.pdb" Condition="'$(Configuration)' == 'Debug'" />
<ContentAssemblies Include="$(OutputPath)Content.Shared.pdb" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
</Project>

View File

@@ -4,32 +4,36 @@ using SS14.Shared.Maths;
namespace Content.Client.Prototypes
{
// Instantiated through reflection by the prototype system.
public class DiscoBall : Entity
{
private PointLightComponent LightComponent;
private float Hue;
private PointLightComponent _lightComponent;
private float _hue;
/// <inheritdoc />
public override void Initialize()
{
base.Initialize();
LightComponent = GetComponent<PointLightComponent>();
_lightComponent = GetComponent<PointLightComponent>();
}
/// <inheritdoc />
public override void Shutdown()
{
base.Shutdown();
LightComponent = null;
_lightComponent = null;
}
/// <inheritdoc />
public override void Update(float frameTime)
{
Hue += frameTime / 10;
if (Hue > 1)
_hue += frameTime / 10;
if (_hue > 1)
{
Hue -= 1;
_hue -= 1;
}
LightComponent.Color = Color4.FromHsl(new Vector4(Hue, 1, 0.5f, 0.5f));
_lightComponent.Color = Color4.FromHsl(new Vector4(_hue, 1, 0.5f, 0.5f));
}
}
}

11
Content.Client/app.config Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.86.0.518" newVersion="0.86.0.518" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="OpenTK" version="3.0.0-pre" targetFramework="net451" />
<package id="YamlDotNet" version="4.2.1" targetFramework="net451" />
<package id="System.ValueTuple" version="4.3.1" targetFramework="net451" />
<package id="YamlDotNet" version="4.3.0" targetFramework="net451" />
</packages>

View File

@@ -47,12 +47,12 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="YamlDotNet">
<HintPath>$(SolutionDir)packages\YamlDotNet.4.2.1\lib\net35\YamlDotNet.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)packages\OpenTK.3.0.0-pre\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="YamlDotNet, Version=4.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)packages\YamlDotNet.4.3.0\lib\net45\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
@@ -115,5 +115,8 @@
<ContentAssemblies Include="$(OutputPath)Content.Server.pdb" Condition="'$(Configuration)' == 'Debug'" />
<ContentAssemblies Include="$(OutputPath)Content.Shared.pdb" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
</Project>

View File

@@ -1,5 +1,4 @@

using Content.Server.GameObjects;
using Content.Server.GameObjects;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Interactable.Tools;
using Content.Server.Interfaces.GameObjects;
@@ -19,7 +18,7 @@ using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.Map;
using SS14.Shared.Timers;
using System.Diagnostics;
using SS14.Shared.Interfaces.Timing;
namespace Content.Server
{
@@ -84,13 +83,26 @@ namespace Content.Server
base.Dispose();
}
private void HandleRunLevelChanged(object sender, RunLevelChangedEventArgs args)
private static 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));
var timing = IoCManager.Resolve<IGameTiming>();
IoCManager.Resolve<IPlayerManager>().FallbackSpawnPoint = new LocalCoordinates(0, 0, GridId.DefaultGrid, new MapId(2));
var mapLoader = IoCManager.Resolve<IMapLoader>();
var mapMan = IoCManager.Resolve<IMapManager>();
var startTime = timing.RealTime;
{
var newMap = mapMan.CreateMap(new MapId(2));
mapLoader.LoadBlueprint(newMap, new GridId(4), "Maps/Demo/DemoGrid.yaml");
}
var timeSpan = timing.RealTime - startTime;
Logger.Info($"Loaded map in {timeSpan.TotalMilliseconds:N2}ms.");
IoCManager.Resolve<IChatManager>().DispatchMessage(ChatChannel.Server, "Gamemode: Round loaded!");
break;
@@ -152,39 +164,5 @@ namespace Content.Server
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;
}
}
}

11
Content.Server/app.config Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.86.0.518" newVersion="0.86.0.518" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="OpenTK" version="3.0.0-pre" targetFramework="net451" />
<package id="YamlDotNet" version="4.2.1" targetFramework="net451" />
<package id="System.ValueTuple" version="4.3.1" targetFramework="net451" />
<package id="YamlDotNet" version="4.3.0" targetFramework="net451" />
</packages>

View File

@@ -46,12 +46,12 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="YamlDotNet">
<HintPath>$(SolutionDir)packages\YamlDotNet.4.2.1\lib\net35\YamlDotNet.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=3.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)packages\OpenTK.3.0.0-pre\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="YamlDotNet, Version=4.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)packages\YamlDotNet.4.3.0\lib\net45\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
@@ -94,6 +94,10 @@
<Prefix>Prototypes\Content\</Prefix>
</Resource>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="CopyResources">
<Copy SourceFiles="@(Resource)" DestinationFiles="..\bin\Client\Resources\%(Prefix)%(RecursiveDir)%(Filename)%(Extension)" />

11
Content.Shared/app.config Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.86.0.518" newVersion="0.86.0.518" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="OpenTK" version="3.0.0-pre" targetFramework="net451" />
<package id="YamlDotNet" version="4.2.1" targetFramework="net451" />
<package id="System.ValueTuple" version="4.3.1" targetFramework="net451" />
<package id="YamlDotNet" version="4.3.0" targetFramework="net451" />
</packages>

View File

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
VisualStudioVersion = 15.0.27130.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Content.Shared", "Content.Shared\Content.Shared.csproj", "{26AEEBB3-DDE7-443A-9F43-7BC7F4ACF6B5}"
ProjectSection(ProjectDependencies) = postProject
@@ -129,14 +129,12 @@ Global
{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
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x64.ActiveCfg = Debug|x86
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x64.Build.0 = Debug|x86
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x86.ActiveCfg = Debug|x86
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x86.Build.0 = Debug|x86
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Release|x64.ActiveCfg = Debug|x86
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Release|x64.Build.0 = Debug|x86
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Release|x86.ActiveCfg = Debug|x86
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Release|x86.Build.0 = Debug|x86
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x64.ActiveCfg = Debug|Any CPU
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x64.Build.0 = Debug|Any CPU
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Debug|x86.ActiveCfg = Debug|Any CPU
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Release|x64.ActiveCfg = Debug|Any CPU
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Release|x64.Build.0 = Debug|Any CPU
{C899FCA4-7037-4E49-ABC2-44DE72487110}.Release|x86.ActiveCfg = Debug|Any CPU
{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
@@ -178,4 +176,7 @@ Global
{D17DE83D-A592-461F-8AF2-53F9E22E1D0F} = {1780DA39-F1EC-4100-8C58-ECD756C68033}
{1780DA39-F1EC-4100-8C58-ECD756C68033} = {B01693E5-CF08-4DB7-8920-407F8D6603A1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AA37ED9F-F8D6-468E-A101-658AD605B09A}
EndGlobalSection
EndGlobal

2
engine

Submodule engine updated: 56508df919...a8c302eadb