Files
tbd-station-14/Content.Shared/EntryPoint.cs
ZelteHonor b2e2aef78d Rider static analysis (#433)
* Non-accessed local variable

* Merge cast and type checks.

* StringComparison.Ordinal added for better culture support

* Supposed code improvement in launcher. Remove unused code.

* Update ExplosionHelper.cs

Unintentional change.

* Optimized Import

* Add Robust.Shared.Utility import where it was deleted

* Other random suggestion

* Improve my comment
2019-11-13 23:37:46 +01:00

60 lines
1.7 KiB
C#
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using Content.Shared.Maps;
using Robust.Shared.ContentPack;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.Shared
{
public class EntryPoint : GameShared
{
#pragma warning disable 649
[Dependency] private readonly IPrototypeManager _prototypeManager;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
#pragma warning restore 649
public override void Init()
{
IoCManager.InjectDependencies(this);
}
public override void PostInit()
{
base.PostInit();
_initTileDefinitions();
}
private void _initTileDefinitions()
{
// Register space first because I'm a hard coding hack.
var spaceDef = _prototypeManager.Index<ContentTileDefinition>("space");
_tileDefinitionManager.Register(spaceDef);
var prototypeList = new List<ContentTileDefinition>();
foreach (var tileDef in _prototypeManager.EnumeratePrototypes<ContentTileDefinition>())
{
if (tileDef.Name == "space")
{
continue;
}
prototypeList.Add(tileDef);
}
// Sort ordinal to ensure it's consistent client and server.
// So that tile IDs match up.
prototypeList.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.Ordinal));
foreach (var tileDef in prototypeList)
{
_tileDefinitionManager.Register(tileDef);
}
_tileDefinitionManager.Initialize();
}
}
}