Fix decal crash (#7484)
This commit is contained in:
@@ -56,7 +56,7 @@ namespace Content.Client.Decals
|
||||
{
|
||||
if (!cachedTextures.TryGetValue(decal.Id, out var texture))
|
||||
{
|
||||
var sprite = _prototypeManager.Index<DecalPrototype>(decal.Id).Sprite;
|
||||
var sprite = GetDecalSprite(decal.Id);
|
||||
texture = _sprites.Frame0(sprite);
|
||||
cachedTextures[decal.Id] = texture;
|
||||
}
|
||||
@@ -69,5 +69,16 @@ namespace Content.Client.Decals
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SpriteSpecifier GetDecalSprite(string id)
|
||||
{
|
||||
if (_prototypeManager.TryIndex<DecalPrototype>(id, out var proto))
|
||||
return proto.Sprite;
|
||||
else
|
||||
{
|
||||
Logger.Error($"Unknown decal prototype: {id}");
|
||||
return new SpriteSpecifier.Texture(new ResourcePath("/Textures/noSprite.png"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user