ITileDefinition now has a Path string that ClydeTileDefinitionManager uses (#1860)

This commit is contained in:
Vera Aguilera Puerto
2021-07-12 10:29:13 +02:00
committed by GitHub
parent d992e47f30
commit b67d24efee
2 changed files with 8 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
@@ -17,7 +18,7 @@ namespace Robust.Client.Map
[Dependency] private readonly IResourceCache _resourceCache = default!;
private Texture? _tileTextureAtlas;
public Texture TileTextureAtlas => _tileTextureAtlas ?? Texture.Transparent;
private readonly Dictionary<ushort, Box2> _tileRegions = new();
@@ -61,7 +62,7 @@ namespace Robust.Client.Map
var row = i / dimensionX;
Image<Rgba32> image;
using (var stream = _resourceCache.ContentFileRead($"/Textures/Constructible/Tiles/{def.SpriteName}.png"))
using (var stream = _resourceCache.ContentFileRead(Path.Join(def.Path, $"{def.SpriteName}.png")))
{
image = Image.Load<Rgba32>(stream);
}

View File

@@ -25,6 +25,11 @@
/// </summary>
string SpriteName { get; }
/// <summary>
/// Path to the folder where the tile sprite is contained.
/// </summary>
string Path { get; }
/// <summary>
/// Physics objects that are interacting on this tile are slowed down by this float.
/// </summary>