Fix content test warnings (#9865)

* Fix content test warnings

* while I'm here

* fix

Co-authored-by: wrexbe <wrexbe@protonmail.com>
This commit is contained in:
metalgearsloth
2022-07-20 14:48:44 +10:00
committed by GitHub
parent 7e21b55781
commit b7623b6c08
6 changed files with 36 additions and 38 deletions

View File

@@ -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<IEntityManager>();
var mapManager = server.ResolveDependency<IMapManager>();
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
var mobStateSystem = entManager.EntitySysManager.GetEntitySystem<Server.MobState.MobStateSystem>();
var damSystem = entManager.EntitySysManager.GetEntitySystem<DamageableSystem>();
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<DamageGroupPrototype>("Toxin"),
FixedPoint2.New(10000000));
EntitySystem.Get<DamageableSystem>().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));
});