mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
34 lines
966 B
C#
34 lines
966 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Robust.UnitTesting.Shared.EntitySerialization;
|
|
|
|
public static class SerializationTestHelper
|
|
{
|
|
public static void LoadTileDefs(IPrototypeManager protoMan, ITileDefinitionManager tileMan, string? spaceId = "Space")
|
|
{
|
|
var prototypeList = new List<TileDef>();
|
|
foreach (var tileDef in protoMan.EnumeratePrototypes<TileDef>())
|
|
{
|
|
if (tileDef.ID == spaceId)
|
|
{
|
|
// Filter out the space tile def and register it first
|
|
tileMan.Register(tileDef);
|
|
continue;
|
|
}
|
|
|
|
prototypeList.Add(tileDef);
|
|
}
|
|
|
|
prototypeList.Sort((a, b) => string.Compare(a.ID, b.ID, StringComparison.Ordinal));
|
|
|
|
// Register the rest
|
|
foreach (var tileDef in prototypeList)
|
|
{
|
|
tileMan.Register(tileDef);
|
|
}
|
|
}
|
|
}
|