Add heat conduction (#1653)

This commit is contained in:
Víctor Aguilera Puerto
2020-08-13 14:18:26 +02:00
committed by GitHub
parent 619386a04a
commit ca68fbe818
8 changed files with 301 additions and 9 deletions

View File

@@ -26,6 +26,7 @@ namespace Content.Shared.Maps
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 void AssignTileId(ushort id)
@@ -68,6 +69,15 @@ namespace Content.Shared.Maps
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();

View File

@@ -12,6 +12,34 @@ namespace Content.Shared.Maps
{
public static class TurfHelpers
{
/// <summary>
/// Returns the content tile definition for a tile.
/// </summary>
public static ContentTileDefinition GetContentTileDefinition(this Tile tile)
{
var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
return (ContentTileDefinition)tileDefinitionManager[tile.TypeId];
}
/// <summary>
/// Attempts to get the turf at map indices with grid id or null if no such turf is found.
/// </summary>
public static TileRef? GetTileRef(this MapIndices mapIndices, GridId gridId)
{
if (!gridId.IsValid())
return null;
var mapManager = IoCManager.Resolve<IMapManager>();
if (!mapManager.TryGetGrid(gridId, out var grid))
return null;
if (!grid.TryGetTileRef(mapIndices, out var tile))
return null;
return tile;
}
/// <summary>
/// Attempts to get the turf at a certain coordinates or null if no such turf is found.
/// </summary>