mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-24 00:58:01 +03:00
* Shoukou from Nyanotrasen. Adds Shoko to the rebase. TO-DO: Ensure that everything is actualy in order in the uh... (reads paper) 79.... thousand lines of yml. Make it work. * Updating it to the "acceptable state" Incase i need to go back if i frick it up. * Updated the map a bit. * Changed Shoko further. * Final changes to departments. * Final changes to Shoukou, ready to be reviewed. * Whoops, Now its done~ * Changed the requested things. * Gave logistics working telecoms. * Update shoukou.yml * . * Added finer details. * Adjusted alot. Adjusted pipes in new department places. Adjusted fire alarms. Adjusted mistakes of mine. Fixed the the ingame map. * Added shutters to lawyers office for private talks. * Updates * Adjustments (check desc) Adjusted cables in salvage's room so they are not under the damn wall while also chaging normal wall for reinforced one. Added tiles under cargo's substation, LO's office, CE's office. Got rid of tiny fan in salvage's airlock and atmo's TEG burn chamber. Added airlocks to cargo. Made more room in cargo's loading bay. Expanded doors and added blast doors for cargo shuttle's entrance. Exchanged some windows in LO's office to reinforced walls and added shutters. Changed switche's location of detective's office shutters Added MV cables in security so prisoners have actual power. Fire alarm has been moved 2 tiles to right and reconnected in command's meeting room. Moved some engineering hardsuits to the back The atmos fax should have been named.... hopefully. Did the obligatory tilewindows, tilewalls, fixrotations,fixgridatmos commands * Adjustments part 2 Added light at the end of extension of shuttle. Repaired conveyor belts in cargo. Exchanged corpsman locker filled to corpsman filled with hardsuit. Added tiny fan and reversed airlocks in cargo to actualy be able to dock. Changed the entire area which used to be a side kitchen with eating area and flipping it. Added a window where now resides eating area that looks upon cargo's shuttle. Changed food in command to be more consistent Adjusted arrival docks to be more closer aka 5 tiles between eachother instead of 7 so that shuttle can dock properly incase the evac gets destroyed. * Added mystagogue hardsuit locker. A quick fix. * Adjustments to adjustments. Shady cigs instead of vendomat in the new eating area. Removed a light on a window. Added a glass firelock in the new side kitchen and linked it. Readjusted docking in cargo for cargo's shuttle. Changed location of the salvage shuttle CONSOLE to be nearby of the magnet. Got rid of the conveyor belt since there really is no point for it to be there anymore, replaced the airtight with an another door and firelock that was linked. Adjusted LV cable so it doesnt go thro a wall and reaches the autolathe and airlock doors that have been placed for cargo shuttle Changed location of the magnet. (God im tired and depressed, not specificly from this. Hope you are having a fantastic day whoever is reading this) * Updated SMES's and Substations names. Updated name of substations near service, in engineering, nearby of epistemics., in command, both security substations, Camera's one, medicals, logistics, upper solars. Updated SMES's name in engineering of AME, in TEG, on both solars. Removed 6 MV cables in security because they were causin 2 substations to be connected to eachother * Anchored the station Any bump will be meaningless as the station holds still as the big station it is. --------- Signed-off-by: Adrian16199 <144424013+Adrian16199@users.noreply.github.com> Signed-off-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com> Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com>
380 lines
14 KiB
C#
380 lines
14 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using Content.Server.GameTicking;
|
|
using Content.Server.Maps;
|
|
using Content.Server.Shuttles.Components;
|
|
using Content.Server.Shuttles.Systems;
|
|
using Content.Server.Spawners.Components;
|
|
using Content.Server.Station.Components;
|
|
using Content.Shared.CCVar;
|
|
using Content.Shared.Roles;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.ContentPack;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Map.Components;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Utility;
|
|
using YamlDotNet.RepresentationModel;
|
|
|
|
namespace Content.IntegrationTests.Tests
|
|
{
|
|
[TestFixture]
|
|
public sealed class PostMapInitTest
|
|
{
|
|
private const bool SkipTestMaps = true;
|
|
private const string TestMapsPath = "/Maps/Test/";
|
|
|
|
private static readonly string[] NoSpawnMaps =
|
|
{
|
|
"CentComm",
|
|
"Dart",
|
|
};
|
|
|
|
private static readonly string[] Grids =
|
|
{
|
|
"/Maps/centcomm.yml",
|
|
"/Maps/Shuttles/cargo.yml",
|
|
"/Maps/Shuttles/emergency.yml",
|
|
"/Maps/infiltrator.yml",
|
|
};
|
|
|
|
private static readonly string[] GameMaps =
|
|
{
|
|
"Dev",
|
|
"TestTeg",
|
|
//"Fland",
|
|
//"Meta",
|
|
//"Packed",
|
|
//"Aspid",
|
|
//"Cluster",
|
|
//"Omega",
|
|
//"Bagel",
|
|
//"Origin",
|
|
"CentComm",
|
|
//"Box",
|
|
//"Europa",
|
|
//"Barratry",
|
|
//"Saltern",
|
|
//"Core",
|
|
//"Marathon",
|
|
//"Kettle",
|
|
"MeteorArena",
|
|
"Pebble", //DeltaV
|
|
"Edge", //DeltaV
|
|
"Shoukou", //DeltaV
|
|
"Tortuga", //DeltaV
|
|
"Arena", //DeltaV
|
|
"Asterisk", //DeltaV
|
|
"TheHive" //DeltaV
|
|
};
|
|
|
|
/// <summary>
|
|
/// Asserts that specific files have been saved as grids and not maps.
|
|
/// </summary>
|
|
[Test, TestCaseSource(nameof(Grids))]
|
|
public async Task GridsLoadableTest(string mapFile)
|
|
{
|
|
await using var pair = await PoolManager.GetServerClient();
|
|
var server = pair.Server;
|
|
|
|
var entManager = server.ResolveDependency<IEntityManager>();
|
|
var mapLoader = entManager.System<MapLoaderSystem>();
|
|
var mapManager = server.ResolveDependency<IMapManager>();
|
|
var cfg = server.ResolveDependency<IConfigurationManager>();
|
|
Assert.That(cfg.GetCVar(CCVars.GridFill), Is.False);
|
|
|
|
await server.WaitPost(() =>
|
|
{
|
|
var mapId = mapManager.CreateMap();
|
|
try
|
|
{
|
|
#pragma warning disable NUnit2045
|
|
Assert.That(mapLoader.TryLoad(mapId, mapFile, out var roots));
|
|
Assert.That(roots.Where(uid => entManager.HasComponent<MapGridComponent>(uid)), Is.Not.Empty);
|
|
#pragma warning restore NUnit2045
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception($"Failed to load map {mapFile}, was it saved as a map instead of a grid?", ex);
|
|
}
|
|
|
|
try
|
|
{
|
|
mapManager.DeleteMap(mapId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception($"Failed to delete map {mapFile}", ex);
|
|
}
|
|
});
|
|
await server.WaitRunTicks(1);
|
|
|
|
await pair.CleanReturnAsync();
|
|
}
|
|
|
|
[Test]
|
|
public async Task NoSavedPostMapInitTest()
|
|
{
|
|
await using var pair = await PoolManager.GetServerClient();
|
|
var server = pair.Server;
|
|
|
|
var resourceManager = server.ResolveDependency<IResourceManager>();
|
|
var mapFolder = new ResPath("/Maps");
|
|
var maps = resourceManager
|
|
.ContentFindFiles(mapFolder)
|
|
.Where(filePath => filePath.Extension == "yml" && !filePath.Filename.StartsWith(".", StringComparison.Ordinal))
|
|
.ToArray();
|
|
|
|
foreach (var map in maps)
|
|
{
|
|
var rootedPath = map.ToRootedPath();
|
|
|
|
// ReSharper disable once RedundantLogicalConditionalExpressionOperand
|
|
if (SkipTestMaps && rootedPath.ToString().StartsWith(TestMapsPath, StringComparison.Ordinal))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (!resourceManager.TryContentFileRead(rootedPath, out var fileStream))
|
|
{
|
|
Assert.Fail($"Map not found: {rootedPath}");
|
|
}
|
|
|
|
using var reader = new StreamReader(fileStream);
|
|
var yamlStream = new YamlStream();
|
|
|
|
yamlStream.Load(reader);
|
|
|
|
var root = yamlStream.Documents[0].RootNode;
|
|
var meta = root["meta"];
|
|
var postMapInit = meta["postmapinit"].AsBool();
|
|
|
|
Assert.That(postMapInit, Is.False, $"Map {map.Filename} was saved postmapinit");
|
|
}
|
|
await pair.CleanReturnAsync();
|
|
}
|
|
|
|
[Test, TestCaseSource(nameof(GameMaps))]
|
|
public async Task GameMapsLoadableTest(string mapProto)
|
|
{
|
|
await using var pair = await PoolManager.GetServerClient();
|
|
var server = pair.Server;
|
|
|
|
var mapManager = server.ResolveDependency<IMapManager>();
|
|
var entManager = server.ResolveDependency<IEntityManager>();
|
|
var mapLoader = entManager.System<MapLoaderSystem>();
|
|
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
|
var ticker = entManager.EntitySysManager.GetEntitySystem<GameTicker>();
|
|
var shuttleSystem = entManager.EntitySysManager.GetEntitySystem<ShuttleSystem>();
|
|
var xformQuery = entManager.GetEntityQuery<TransformComponent>();
|
|
var cfg = server.ResolveDependency<IConfigurationManager>();
|
|
Assert.That(cfg.GetCVar(CCVars.GridFill), Is.False);
|
|
|
|
await server.WaitPost(() =>
|
|
{
|
|
var mapId = mapManager.CreateMap();
|
|
try
|
|
{
|
|
ticker.LoadGameMap(protoManager.Index<GameMapPrototype>(mapProto), mapId, null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception($"Failed to load map {mapProto}", ex);
|
|
}
|
|
|
|
var shuttleMap = mapManager.CreateMap();
|
|
var largest = 0f;
|
|
EntityUid? targetGrid = null;
|
|
var memberQuery = entManager.GetEntityQuery<StationMemberComponent>();
|
|
|
|
var grids = mapManager.GetAllGrids(mapId).ToList();
|
|
var gridUids = grids.Select(o => o.Owner).ToList();
|
|
targetGrid = gridUids.First();
|
|
|
|
foreach (var grid in grids)
|
|
{
|
|
var gridEnt = grid.Owner;
|
|
if (!memberQuery.HasComponent(gridEnt))
|
|
continue;
|
|
|
|
var area = grid.Comp.LocalAABB.Width * grid.Comp.LocalAABB.Height;
|
|
|
|
if (area > largest)
|
|
{
|
|
largest = area;
|
|
targetGrid = gridEnt;
|
|
}
|
|
}
|
|
|
|
// Test shuttle can dock.
|
|
// This is done inside gamemap test because loading the map takes ages and we already have it.
|
|
var station = entManager.GetComponent<StationMemberComponent>(targetGrid!.Value).Station;
|
|
if (entManager.TryGetComponent<StationEmergencyShuttleComponent>(station, out var stationEvac))
|
|
{
|
|
var shuttlePath = stationEvac.EmergencyShuttlePath;
|
|
#pragma warning disable NUnit2045
|
|
Assert.That(mapLoader.TryLoad(shuttleMap, shuttlePath.ToString(), out var roots));
|
|
EntityUid shuttle = default!;
|
|
Assert.DoesNotThrow(() =>
|
|
{
|
|
shuttle = roots.First(uid => entManager.HasComponent<MapGridComponent>(uid));
|
|
}, $"Failed to load {shuttlePath}");
|
|
Assert.That(
|
|
shuttleSystem.TryFTLDock(shuttle,
|
|
entManager.GetComponent<ShuttleComponent>(shuttle), targetGrid.Value),
|
|
$"Unable to dock {shuttlePath} to {mapProto}");
|
|
#pragma warning restore NUnit2045
|
|
}
|
|
|
|
mapManager.DeleteMap(shuttleMap);
|
|
|
|
if (entManager.HasComponent<StationJobsComponent>(station))
|
|
{
|
|
// Test that the map has valid latejoin spawn points
|
|
if (!NoSpawnMaps.Contains(mapProto))
|
|
{
|
|
var lateSpawns = 0;
|
|
|
|
var query = entManager.AllEntityQueryEnumerator<SpawnPointComponent>();
|
|
while (query.MoveNext(out var uid, out var comp))
|
|
{
|
|
if (comp.SpawnType != SpawnPointType.LateJoin
|
|
|| !xformQuery.TryGetComponent(uid, out var xform)
|
|
|| xform.GridUid == null
|
|
|| !gridUids.Contains(xform.GridUid.Value))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
lateSpawns++;
|
|
break;
|
|
}
|
|
|
|
Assert.That(lateSpawns, Is.GreaterThan(0), $"Found no latejoin spawn points on {mapProto}");
|
|
}
|
|
|
|
// Test all availableJobs have spawnPoints
|
|
// This is done inside gamemap test because loading the map takes ages and we already have it.
|
|
var jobList = entManager.GetComponent<StationJobsComponent>(station).RoundStartJobList
|
|
.Where(x => x.Value != 0)
|
|
.Select(x => x.Key);
|
|
var spawnPoints = entManager.EntityQuery<SpawnPointComponent>()
|
|
.Where(spawnpoint => spawnpoint.SpawnType == SpawnPointType.Job)
|
|
.Select(spawnpoint => spawnpoint.Job.ID)
|
|
.Distinct();
|
|
List<string> missingSpawnPoints = new();
|
|
foreach (var spawnpoint in jobList.Except(spawnPoints))
|
|
{
|
|
if (protoManager.Index<JobPrototype>(spawnpoint).SetPreference)
|
|
missingSpawnPoints.Add(spawnpoint);
|
|
}
|
|
|
|
Assert.That(missingSpawnPoints, Has.Count.EqualTo(0),
|
|
$"There is no spawnpoint for {string.Join(", ", missingSpawnPoints)} on {mapProto}.");
|
|
}
|
|
|
|
try
|
|
{
|
|
mapManager.DeleteMap(mapId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception($"Failed to delete map {mapProto}", ex);
|
|
}
|
|
});
|
|
await server.WaitRunTicks(1);
|
|
|
|
await pair.CleanReturnAsync();
|
|
}
|
|
|
|
[Test]
|
|
public async Task AllMapsTested()
|
|
{
|
|
await using var pair = await PoolManager.GetServerClient();
|
|
var server = pair.Server;
|
|
var protoMan = server.ResolveDependency<IPrototypeManager>();
|
|
|
|
var gameMaps = protoMan.EnumeratePrototypes<GameMapPrototype>()
|
|
.Where(x => !pair.IsTestPrototype(x))
|
|
.Select(x => x.ID)
|
|
.ToHashSet();
|
|
|
|
Assert.That(gameMaps.Remove(PoolManager.TestMap));
|
|
|
|
CollectionAssert.AreEquivalent(GameMaps.ToHashSet(), gameMaps, "Game map prototype missing from test cases.");
|
|
|
|
await pair.CleanReturnAsync();
|
|
}
|
|
|
|
[Test]
|
|
public async Task NonGameMapsLoadableTest()
|
|
{
|
|
await using var pair = await PoolManager.GetServerClient();
|
|
var server = pair.Server;
|
|
|
|
var mapLoader = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MapLoaderSystem>();
|
|
var mapManager = server.ResolveDependency<IMapManager>();
|
|
var resourceManager = server.ResolveDependency<IResourceManager>();
|
|
var protoManager = server.ResolveDependency<IPrototypeManager>();
|
|
var cfg = server.ResolveDependency<IConfigurationManager>();
|
|
Assert.That(cfg.GetCVar(CCVars.GridFill), Is.False);
|
|
|
|
var gameMaps = protoManager.EnumeratePrototypes<GameMapPrototype>().Select(o => o.MapPath).ToHashSet();
|
|
|
|
var mapFolder = new ResPath("/Maps");
|
|
var maps = resourceManager
|
|
.ContentFindFiles(mapFolder)
|
|
.Where(filePath => filePath.Extension == "yml" && !filePath.Filename.StartsWith(".", StringComparison.Ordinal))
|
|
.ToArray();
|
|
|
|
var mapNames = new List<string>();
|
|
foreach (var map in maps)
|
|
{
|
|
if (gameMaps.Contains(map))
|
|
continue;
|
|
|
|
var rootedPath = map.ToRootedPath();
|
|
if (SkipTestMaps && rootedPath.ToString().StartsWith(TestMapsPath, StringComparison.Ordinal))
|
|
{
|
|
continue;
|
|
}
|
|
mapNames.Add(rootedPath.ToString());
|
|
}
|
|
|
|
await server.WaitPost(() =>
|
|
{
|
|
Assert.Multiple(() =>
|
|
{
|
|
foreach (var mapName in mapNames)
|
|
{
|
|
var mapId = mapManager.CreateMap();
|
|
try
|
|
{
|
|
Assert.That(mapLoader.TryLoad(mapId, mapName, out _));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception($"Failed to load map {mapName}", ex);
|
|
}
|
|
|
|
try
|
|
{
|
|
mapManager.DeleteMap(mapId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception($"Failed to delete map {mapName}", ex);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
await server.WaitRunTicks(1);
|
|
await pair.CleanReturnAsync();
|
|
}
|
|
}
|
|
}
|