From 73c730d06c20eaaace6ee637d52d43cacefc29e0 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 10 Oct 2020 23:44:30 +1100 Subject: [PATCH] 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 --- .../Tests/AI/SpriteTest.cs | 62 +++++++++++++++++++ .../Clothing/Earpieces/headsets_alt.yml | 26 -------- .../Constructible/Power/power_base.yml | 1 - .../Mobs/body_system_dropped_abstract.yml | 2 +- .../Guns/Ammunition/ClRifle/cartridges.yml | 8 ++- .../Guns/Ammunition/LRifle/cartridges.yml | 8 ++- .../Guns/Ammunition/Magnum/cartridges.yml | 8 ++- .../Guns/Ammunition/Pistol/cartridges.yml | 3 - .../Guns/Ammunition/SRifle/cartridges.yml | 8 ++- .../Guns/Ammunition/Toy/cartridges.yml | 4 +- .../gravity_generator_core.rsi/meta.json | 52 +++++++++++++++- RobustToolbox | 2 +- 12 files changed, 140 insertions(+), 44 deletions(-) create mode 100644 Content.IntegrationTests/Tests/AI/SpriteTest.cs diff --git a/Content.IntegrationTests/Tests/AI/SpriteTest.cs b/Content.IntegrationTests/Tests/AI/SpriteTest.cs new file mode 100644 index 0000000000..4c93b4bfa4 --- /dev/null +++ b/Content.IntegrationTests/Tests/AI/SpriteTest.cs @@ -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 + { + /// + /// Test RSIs and textures are valid + /// + [Test] + public async Task TestSpritePaths() + { + var (client, server) = await StartConnectedServerClientPair(); + await client.WaitIdleAsync(); + await server.WaitIdleAsync(); + + var resc = client.ResolveDependency(); + var entityManager = client.ResolveDependency(); + var mapManager = client.ResolveDependency(); + var prototypeManager = client.ResolveDependency(); + + await client.WaitIdleAsync(); + + client.Assert(() => + { + var mapId = mapManager.CreateMap(); + string filePath; + var map = mapManager.GetMapEntity(mapId); + + foreach (var proto in prototypeManager.EnumeratePrototypes()) + { + if (proto.Abstract || !proto.Components.ContainsKey("Sprite")) + continue; + + var entity = entityManager.SpawnEntity(proto.ID, map.Transform.MapPosition); + var spriteComponent = entity.GetComponent(); + + 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(); + } + } +} \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Clothing/Earpieces/headsets_alt.yml b/Resources/Prototypes/Entities/Clothing/Earpieces/headsets_alt.yml index d188fcdc8d..063c66561f 100644 --- a/Resources/Prototypes/Entities/Clothing/Earpieces/headsets_alt.yml +++ b/Resources/Prototypes/Entities/Clothing/Earpieces/headsets_alt.yml @@ -8,19 +8,6 @@ - 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 parent: HeadsetBaseAlt id: HeadsetCommandAlt @@ -34,19 +21,6 @@ - ears 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 parent: HeadsetBaseAlt id: HeadsetMedicalAlt diff --git a/Resources/Prototypes/Entities/Constructible/Power/power_base.yml b/Resources/Prototypes/Entities/Constructible/Power/power_base.yml index 6f9ecef441..298696d580 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/power_base.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/power_base.yml @@ -126,7 +126,6 @@ - type: Sprite drawdepth: WallMountedItems netsync: false - texture: "" sprite: "Constructible/Power/apc.rsi" state: apc0 - type: Appearance diff --git a/Resources/Prototypes/Entities/Mobs/body_system_dropped_abstract.yml b/Resources/Prototypes/Entities/Mobs/body_system_dropped_abstract.yml index c29258741e..53d16d4d35 100644 --- a/Resources/Prototypes/Entities/Mobs/body_system_dropped_abstract.yml +++ b/Resources/Prototypes/Entities/Mobs/body_system_dropped_abstract.yml @@ -20,7 +20,7 @@ components: - type: DroppedMechanism - type: Sprite - texture: Mobs/Parts/Organs/eyeballs.png + texture: Mobs/Species/Human/parts.rsi/torso_m.png - type: UserInterface interfaces: - key: enum.GenericSurgeryUiKey.Key diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/ClRifle/cartridges.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/ClRifle/cartridges.yml index 4e59016d8f..51bdc78ec2 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/ClRifle/cartridges.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/ClRifle/cartridges.yml @@ -10,9 +10,13 @@ netsync: false directional: false sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi - state: spent + layers: + - state: base + map: ["enum.AmmoVisualLayers.Base"] drawdepth: FloorObjects - + - type: Appearance + visuals: + - type: SpentAmmoVisualizer - type: entity id: CartridgeClRifle diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/LRifle/cartridges.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/LRifle/cartridges.yml index 2bb579b266..b1f4c0c90a 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/LRifle/cartridges.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/LRifle/cartridges.yml @@ -10,9 +10,13 @@ netsync: false directional: false sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi - state: spent + layers: + - state: base + map: ["enum.AmmoVisualLayers.Base"] drawdepth: FloorObjects - + - type: Appearance + visuals: + - type: SpentAmmoVisualizer - type: entity id: CartridgeLRifle diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magnum/cartridges.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magnum/cartridges.yml index 6cd75c9df5..860c5c5963 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magnum/cartridges.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magnum/cartridges.yml @@ -10,9 +10,13 @@ netsync: false directional: false sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi - state: spent + layers: + - state: base + map: ["enum.AmmoVisualLayers.Base"] drawdepth: FloorObjects - + - type: Appearance + visuals: + - type: SpentAmmoVisualizer - type: entity id: CartridgeMagnum diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Pistol/cartridges.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Pistol/cartridges.yml index 573b980b1d..a25265204e 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Pistol/cartridges.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Pistol/cartridges.yml @@ -14,9 +14,6 @@ - state: base map: ["enum.AmmoVisualLayers.Base"] drawdepth: FloorObjects - - type: Icon - sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi - state: base - type: Appearance visuals: - type: SpentAmmoVisualizer diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/SRifle/cartridges.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/SRifle/cartridges.yml index 4afeb3251d..9b80a637cf 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/SRifle/cartridges.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/SRifle/cartridges.yml @@ -10,9 +10,13 @@ netsync: false directional: false sprite: Objects/Weapons/Guns/Ammunition/Casings/ammo_casing.rsi - state: spent + layers: + - state: base + map: ["enum.AmmoVisualLayers.Base"] drawdepth: FloorObjects - + - type: Appearance + visuals: + - type: SpentAmmoVisualizer - type: entity id: CartridgeSRifle diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Toy/cartridges.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Toy/cartridges.yml index b1073733ee..df4d93be2f 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Toy/cartridges.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Toy/cartridges.yml @@ -10,7 +10,9 @@ netsync: false directional: true sprite: Objects/Consumable/Trash/ash.rsi - state: icon + layers: + - state: base + map: ["enum.AmmoVisualLayers.Base"] drawdepth: FloorObjects - type: entity diff --git a/Resources/Textures/Constructible/Power/gravity_generator_core.rsi/meta.json b/Resources/Textures/Constructible/Power/gravity_generator_core.rsi/meta.json index db482cdb7d..383938bbde 100644 --- a/Resources/Textures/Constructible/Power/gravity_generator_core.rsi/meta.json +++ b/Resources/Textures/Constructible/Power/gravity_generator_core.rsi/meta.json @@ -11,9 +11,55 @@ "name": "activated", "directions": 1, "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 + ] ] } ] diff --git a/RobustToolbox b/RobustToolbox index e2b97d3eac..6b769d814e 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit e2b97d3eacfc5a699c3b73a33c04a53e2d378867 +Subproject commit 6b769d814eb3183404c3886b6f84adb0571a3d4e