diff --git a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs index 4e806e6419..fb163bf13a 100644 --- a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs +++ b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs @@ -1,5 +1,4 @@ using System.Threading.Tasks; -using Content.Client.MobState; using Content.Server.Administration.Commands; using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; @@ -7,7 +6,6 @@ using Content.Shared.FixedPoint; using Content.Shared.MobState.Components; using NUnit.Framework; using Robust.Shared.GameObjects; -using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Prototypes; @@ -39,6 +37,8 @@ namespace Content.IntegrationTests.Tests.Commands var entManager = server.ResolveDependency(); var mapManager = server.ResolveDependency(); var prototypeManager = server.ResolveDependency(); + var mobStateSystem = entManager.EntitySysManager.GetEntitySystem(); + var damSystem = entManager.EntitySysManager.GetEntitySystem(); await server.WaitAssertion(() => { @@ -49,30 +49,31 @@ namespace Content.IntegrationTests.Tests.Commands // Sanity check Assert.True(entManager.TryGetComponent(human, out DamageableComponent damageable)); Assert.True(entManager.TryGetComponent(human, out MobStateComponent mobState)); - Assert.That(mobState.IsAlive, Is.True); - Assert.That(mobState.IsCritical, Is.False); - Assert.That(mobState.IsDead, Is.False); - Assert.That(mobState.IsIncapacitated, Is.False); + Assert.That(mobStateSystem.IsAlive(human, mobState), Is.True); + Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False); + Assert.That(mobStateSystem.IsDead(human, mobState), Is.False); + Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.False); // Kill the entity DamageSpecifier damage = new(prototypeManager.Index("Toxin"), FixedPoint2.New(10000000)); - EntitySystem.Get().TryChangeDamage(human, damage, true); + + damSystem.TryChangeDamage(human, damage, true); // Check that it is dead - Assert.That(mobState.IsAlive, Is.False); - Assert.That(mobState.IsCritical, Is.False); - Assert.That(mobState.IsDead, Is.True); - Assert.That(mobState.IsIncapacitated, Is.True); + Assert.That(mobStateSystem.IsAlive(human, mobState), Is.False); + Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False); + Assert.That(mobStateSystem.IsDead(human, mobState), Is.True); + Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.True); // Rejuvenate them RejuvenateCommand.PerformRejuvenate(human); // Check that it is alive and with no damage - Assert.That(mobState.IsAlive, Is.True); - Assert.That(mobState.IsCritical, Is.False); - Assert.That(mobState.IsDead, Is.False); - Assert.That(mobState.IsIncapacitated, Is.False); + Assert.That(mobStateSystem.IsAlive(human, mobState), Is.True); + Assert.That(mobStateSystem.IsCritical(human, mobState), Is.False); + Assert.That(mobStateSystem.IsDead(human, mobState), Is.False); + Assert.That(mobStateSystem.IsIncapacitated(human, mobState), Is.False); Assert.That(damageable.TotalDamage, Is.EqualTo(FixedPoint2.Zero)); }); diff --git a/Content.IntegrationTests/Tests/EntityTest.cs b/Content.IntegrationTests/Tests/EntityTest.cs index fe0614aaea..da45a7b7b1 100644 --- a/Content.IntegrationTests/Tests/EntityTest.cs +++ b/Content.IntegrationTests/Tests/EntityTest.cs @@ -146,9 +146,10 @@ namespace Content.IntegrationTests.Tests foreach (var type in componentFactory.AllRegisteredTypes) { var component = (Component) componentFactory.GetComponent(type); + var name = componentFactory.GetComponentName(type); // If this component is ignored - if (skipComponents.Contains(component.Name)) + if (skipComponents.Contains(name)) { continue; } @@ -166,13 +167,13 @@ namespace Content.IntegrationTests.Tests component.Owner = entity; - Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}"); + Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {name}"); Assert.DoesNotThrow(() => { entityManager.AddComponent(entity, component); }, "Component '{0}' threw an exception.", - component.Name); + name); entityManager.DeleteEntity(entity); } @@ -282,15 +283,14 @@ namespace Content.IntegrationTests.Tests continue; } + var name = componentFactory.GetComponentName(component.GetType()); + // If this component is ignored - if (skipComponents.Contains(component.Name)) - { + if (skipComponents.Contains(name)) continue; - } component.Owner = entity; - - Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}"); + Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {name}"); // Note for the future coder: if an exception occurs where a component reference // was already occupied it might be because some component is ensuring another // initialize. @@ -300,7 +300,7 @@ namespace Content.IntegrationTests.Tests { entityManager.AddComponent(entity, component); }, "Component '{0}' threw an exception.", - component.Name); + name); } entityManager.DeleteEntity(entity); } diff --git a/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs b/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs index 68eff0ccd9..5db611eb56 100644 --- a/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs +++ b/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs @@ -90,6 +90,7 @@ namespace Content.IntegrationTests.Tests.Fluids var sTileDefinitionManager = server.ResolveDependency(); var sGameTiming = server.ResolveDependency(); var entityManager = server.ResolveDependency(); + var metaSystem = entityManager.EntitySysManager.GetEntitySystem(); MapId sMapId = default; IMapGrid sGrid; @@ -103,7 +104,7 @@ namespace Content.IntegrationTests.Tests.Fluids sMapManager.SetMapPaused(sMapId, true); sGrid = sMapManager.CreateGrid(sMapId); sGridId = sGrid.GridEntityId; - entityManager.GetComponent(sGridId).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1444 + metaSystem.SetEntityPaused(sGridId, true); // See https://github.com/space-wizards/RobustToolbox/issues/1444 var tileDefinition = sTileDefinitionManager["underplating"]; var tile = new Tile(tileDefinition.TileId); @@ -140,8 +141,7 @@ namespace Content.IntegrationTests.Tests.Fluids Assert.NotNull(puddle); evaporation = entityManager.GetComponent(puddle.Owner); - - meta.EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1445 + metaSystem.SetEntityPaused(puddle.Owner, true, meta); // See https://github.com/space-wizards/RobustToolbox/issues/1445 Assert.True(meta.EntityPaused); diff --git a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs index e216f7cce8..be084762cc 100644 --- a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs +++ b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs @@ -307,6 +307,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click var mapManager = server.ResolveDependency(); var sysMan = server.ResolveDependency(); var handSys = sysMan.GetEntitySystem(); + var conSystem = sysMan.GetEntitySystem(); var mapId = MapId.Nullspace; var coords = MapCoordinates.Nullspace; @@ -332,7 +333,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click item = sEntities.SpawnEntity(null, coords); item.EnsureComponent(); containerEntity = sEntities.SpawnEntity(null, coords); - container = containerEntity.EnsureContainer("InteractionTestContainer"); + container = conSystem.EnsureContainer(containerEntity, "InteractionTestContainer"); }); await server.WaitRunTicks(1); diff --git a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs index e3a3befb8a..a2cc176508 100644 --- a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs +++ b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs @@ -30,12 +30,10 @@ namespace Content.IntegrationTests.Tests.Interaction var sEntities = server.ResolveDependency(); var mapManager = server.ResolveDependency(); + var conSystem = sEntities.EntitySysManager.GetEntitySystem(); EntityUid origin = default; EntityUid other = default; - IContainer container = null; - IComponent component = null; - EntityCoordinates entityCoordinates = default; MapCoordinates mapCoordinates = default; await server.WaitAssertion(() => @@ -45,9 +43,7 @@ namespace Content.IntegrationTests.Tests.Interaction origin = sEntities.SpawnEntity(HumanId, coordinates); other = sEntities.SpawnEntity(HumanId, coordinates); - container = other.EnsureContainer("InRangeUnobstructedTestOtherContainer"); - component = sEntities.GetComponent(other); - entityCoordinates = sEntities.GetComponent(other).Coordinates; + conSystem.EnsureContainer(other, "InRangeUnobstructedTestOtherContainer"); mapCoordinates = sEntities.GetComponent(other).MapPosition; }); diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index 14003486eb..b0cdd1e3ec 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -16,8 +16,8 @@ namespace Content.IntegrationTests.Tests [TestFixture] public sealed class PostMapInitTest { - public const bool SkipTestMaps = true; - public const string TestMapsPath = "/Maps/Test/"; + private const bool SkipTestMaps = true; + private const string TestMapsPath = "/Maps/Test/"; [Test] public async Task NoSavedPostMapInitTest() @@ -63,7 +63,7 @@ namespace Content.IntegrationTests.Tests private static string[] GetMapNames() { - Task task = null; + Task task; using (ExecutionContext.SuppressFlow()) { task = Task.Run(static async () => @@ -99,7 +99,7 @@ namespace Content.IntegrationTests.Tests return task.GetAwaiter().GetResult(); } - [Test, TestCaseSource("GetMapNames")] + [Test, TestCaseSource(nameof(GetMapNames))] public async Task MapsLoadableTest(string mapName) { await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});