Sprite fixes (#2213)
Test still needs more checks that filepaths are valid but I think I got most of the current issues. Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
62
Content.IntegrationTests/Tests/AI/SpriteTest.cs
Normal file
62
Content.IntegrationTests/Tests/AI/SpriteTest.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
|
using Robust.Client.Interfaces.ResourceManagement;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.Map;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
|
namespace Content.IntegrationTests.Tests.AI
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public sealed class SpriteTest : ContentIntegrationTest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Test RSIs and textures are valid
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public async Task TestSpritePaths()
|
||||||
|
{
|
||||||
|
var (client, server) = await StartConnectedServerClientPair();
|
||||||
|
await client.WaitIdleAsync();
|
||||||
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
|
var resc = client.ResolveDependency<IResourceCache>();
|
||||||
|
var entityManager = client.ResolveDependency<IEntityManager>();
|
||||||
|
var mapManager = client.ResolveDependency<IMapManager>();
|
||||||
|
var prototypeManager = client.ResolveDependency<IPrototypeManager>();
|
||||||
|
|
||||||
|
await client.WaitIdleAsync();
|
||||||
|
|
||||||
|
client.Assert(() =>
|
||||||
|
{
|
||||||
|
var mapId = mapManager.CreateMap();
|
||||||
|
string filePath;
|
||||||
|
var map = mapManager.GetMapEntity(mapId);
|
||||||
|
|
||||||
|
foreach (var proto in prototypeManager.EnumeratePrototypes<EntityPrototype>())
|
||||||
|
{
|
||||||
|
if (proto.Abstract || !proto.Components.ContainsKey("Sprite"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var entity = entityManager.SpawnEntity(proto.ID, map.Transform.MapPosition);
|
||||||
|
var spriteComponent = entity.GetComponent<ISpriteComponent>();
|
||||||
|
|
||||||
|
foreach (var layer in spriteComponent.AllLayers)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (layer.RsiState != null && layer.Rsi != null)
|
||||||
|
{
|
||||||
|
filePath = layer.Rsi.Path + "/" + layer.RsiState + ".png";
|
||||||
|
Assert.That(resc.ContentFileExists(filePath), $"Unable to find {filePath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await client.WaitIdleAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,19 +8,6 @@
|
|||||||
- type: Headset
|
- type: Headset
|
||||||
|
|
||||||
|
|
||||||
- type: entity
|
|
||||||
parent: HeadsetBaseAlt
|
|
||||||
id: HeadsetCargoAlt
|
|
||||||
name: cargo overear-headset
|
|
||||||
components:
|
|
||||||
- type: Sprite
|
|
||||||
sprite: Clothing/Ears/Headsets/cargo.rsi
|
|
||||||
state: icon_alt
|
|
||||||
- type: Clothing
|
|
||||||
Slots:
|
|
||||||
- ears
|
|
||||||
sprite: Clothing/Ears/Headsets/cargo.rsi
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: HeadsetBaseAlt
|
parent: HeadsetBaseAlt
|
||||||
id: HeadsetCommandAlt
|
id: HeadsetCommandAlt
|
||||||
@@ -34,19 +21,6 @@
|
|||||||
- ears
|
- ears
|
||||||
sprite: Clothing/Ears/Headsets/command.rsi
|
sprite: Clothing/Ears/Headsets/command.rsi
|
||||||
|
|
||||||
- type: entity
|
|
||||||
parent: HeadsetBaseAlt
|
|
||||||
id: HeadsetEngineeringAlt
|
|
||||||
name: engineering overear-headset
|
|
||||||
components:
|
|
||||||
- type: Sprite
|
|
||||||
sprite: Clothing/Ears/Headsets/engineering.rsi
|
|
||||||
state: icon_alt
|
|
||||||
- type: Clothing
|
|
||||||
Slots:
|
|
||||||
- ears
|
|
||||||
sprite: Clothing/Ears/Headsets/engineering.rsi
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: HeadsetBaseAlt
|
parent: HeadsetBaseAlt
|
||||||
id: HeadsetMedicalAlt
|
id: HeadsetMedicalAlt
|
||||||
|
|||||||
@@ -126,7 +126,6 @@
|
|||||||
- type: Sprite
|
- type: Sprite
|
||||||
drawdepth: WallMountedItems
|
drawdepth: WallMountedItems
|
||||||
netsync: false
|
netsync: false
|
||||||
texture: ""
|
|
||||||
sprite: "Constructible/Power/apc.rsi"
|
sprite: "Constructible/Power/apc.rsi"
|
||||||
state: apc0
|
state: apc0
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
components:
|
components:
|
||||||
- type: DroppedMechanism
|
- type: DroppedMechanism
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
texture: Mobs/Parts/Organs/eyeballs.png
|
texture: Mobs/Species/Human/parts.rsi/torso_m.png
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.GenericSurgeryUiKey.Key
|
- key: enum.GenericSurgeryUiKey.Key
|
||||||
|
|||||||
@@ -10,9 +10,13 @@
|
|||||||
netsync: false
|
netsync: false
|
||||||
directional: false
|
directional: false
|
||||||
sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi
|
sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi
|
||||||
state: spent
|
layers:
|
||||||
|
- state: base
|
||||||
|
map: ["enum.AmmoVisualLayers.Base"]
|
||||||
drawdepth: FloorObjects
|
drawdepth: FloorObjects
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: SpentAmmoVisualizer
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: CartridgeClRifle
|
id: CartridgeClRifle
|
||||||
|
|||||||
@@ -10,9 +10,13 @@
|
|||||||
netsync: false
|
netsync: false
|
||||||
directional: false
|
directional: false
|
||||||
sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi
|
sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi
|
||||||
state: spent
|
layers:
|
||||||
|
- state: base
|
||||||
|
map: ["enum.AmmoVisualLayers.Base"]
|
||||||
drawdepth: FloorObjects
|
drawdepth: FloorObjects
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: SpentAmmoVisualizer
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: CartridgeLRifle
|
id: CartridgeLRifle
|
||||||
|
|||||||
@@ -10,9 +10,13 @@
|
|||||||
netsync: false
|
netsync: false
|
||||||
directional: false
|
directional: false
|
||||||
sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi
|
sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi
|
||||||
state: spent
|
layers:
|
||||||
|
- state: base
|
||||||
|
map: ["enum.AmmoVisualLayers.Base"]
|
||||||
drawdepth: FloorObjects
|
drawdepth: FloorObjects
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: SpentAmmoVisualizer
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: CartridgeMagnum
|
id: CartridgeMagnum
|
||||||
|
|||||||
@@ -14,9 +14,6 @@
|
|||||||
- state: base
|
- state: base
|
||||||
map: ["enum.AmmoVisualLayers.Base"]
|
map: ["enum.AmmoVisualLayers.Base"]
|
||||||
drawdepth: FloorObjects
|
drawdepth: FloorObjects
|
||||||
- type: Icon
|
|
||||||
sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi
|
|
||||||
state: base
|
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
visuals:
|
visuals:
|
||||||
- type: SpentAmmoVisualizer
|
- type: SpentAmmoVisualizer
|
||||||
|
|||||||
@@ -10,9 +10,13 @@
|
|||||||
netsync: false
|
netsync: false
|
||||||
directional: false
|
directional: false
|
||||||
sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi
|
sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi
|
||||||
state: spent
|
layers:
|
||||||
|
- state: base
|
||||||
|
map: ["enum.AmmoVisualLayers.Base"]
|
||||||
drawdepth: FloorObjects
|
drawdepth: FloorObjects
|
||||||
|
- type: Appearance
|
||||||
|
visuals:
|
||||||
|
- type: SpentAmmoVisualizer
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: CartridgeSRifle
|
id: CartridgeSRifle
|
||||||
|
|||||||
@@ -10,7 +10,9 @@
|
|||||||
netsync: false
|
netsync: false
|
||||||
directional: true
|
directional: true
|
||||||
sprite: Objects/Consumable/Trash/ash.rsi
|
sprite: Objects/Consumable/Trash/ash.rsi
|
||||||
state: icon
|
layers:
|
||||||
|
- state: base
|
||||||
|
map: ["enum.AmmoVisualLayers.Base"]
|
||||||
drawdepth: FloorObjects
|
drawdepth: FloorObjects
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
@@ -11,9 +11,55 @@
|
|||||||
"name": "activated",
|
"name": "activated",
|
||||||
"directions": 1,
|
"directions": 1,
|
||||||
"delays": [
|
"delays": [
|
||||||
[0.1,
|
[
|
||||||
0.1,
|
0.1,
|
||||||
0.1]
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "activating",
|
||||||
|
"directions": 1,
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "idle",
|
||||||
|
"directions": 1,
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "startup",
|
||||||
|
"directions": 1,
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Submodule RobustToolbox updated: e2b97d3eac...6b769d814e
Reference in New Issue
Block a user