Files
tbd-station-14/Content.Shared/Maps/ContentTileDefinition.cs
Víctor Aguilera Puerto b18ee3ec49 SIMD-accelerated gas mixtures. (SIMD atmos) (#2479)
* SIMD atmos

* Moles will always be a multiple of four.

* Component dependencies for grid atmos.

* Let's optimize allocations while we're at it!

* Inline this

* A bunch of atmos optimizations

* Fix crimes against atmos

* Microsoft moment

* Remove nuget.config

* do not reference Robust.UnitTests in Content.Benchmarks as it's unneeded.

* Revert "Remove nuget.config"

This reverts commit 872604ae6a51365af4075bb23687bd005befd8ac.

* Gas overlay optimization and fixes

* Lattice is now spess

* minor atmos tweaks
2020-11-25 10:48:49 +01:00

96 lines
2.9 KiB
C#

using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Shared.Maps
{
[UsedImplicitly]
[Prototype("tile")]
public sealed class ContentTileDefinition : IPrototype, IIndexedPrototype, ITileDefinition
{
string IIndexedPrototype.ID => Name;
public string Name { get; private set; }
public ushort TileId { get; private set; }
public string DisplayName { get; private set; }
public string SpriteName { get; private set; }
public bool IsSubFloor { get; private set; }
public List<string> BaseTurfs { get; private set; }
public bool CanCrowbar { get; private set; }
public string FootstepSounds { get; private set; }
public float Friction { get; set; }
public float ThermalConductivity { get; set; }
public string ItemDropPrototypeName { get; private set; }
public bool IsSpace { get; private set; }
public void AssignTileId(ushort id)
{
TileId = id;
}
public void LoadFrom(YamlMappingNode mapping)
{
Name = mapping.GetNode("name").ToString();
DisplayName = mapping.GetNode("display_name").ToString();
SpriteName = mapping.GetNode("texture").ToString();
if (mapping.TryGetNode("is_subfloor", out var node))
{
IsSubFloor = node.AsBool();
}
if (mapping.TryGetNode("base_turfs", out YamlSequenceNode baseTurfNode))
BaseTurfs = baseTurfNode.Select(i => i.ToString()).ToList();
else
BaseTurfs = new List<string>();
if (mapping.TryGetNode("is_space", out node))
{
IsSpace = node.AsBool();
}
if (mapping.TryGetNode("can_crowbar", out node))
{
CanCrowbar = node.AsBool();
}
if (mapping.TryGetNode("footstep_sounds", out node))
{
FootstepSounds = node.AsString();
}
if (mapping.TryGetNode("friction", out node))
{
Friction = node.AsFloat();
}
else
{
Friction = 0;
}
if (mapping.TryGetNode("thermalConductivity", out node))
{
ThermalConductivity = node.AsFloat();
}
else
{
ThermalConductivity = 0.05f;
}
if (mapping.TryGetNode("item_drop", out node))
{
ItemDropPrototypeName = node.ToString();
}
else
{
ItemDropPrototypeName = "FloorTileItemSteel";
}
}
}
}