Add a test for rejuvenating dead entities (#2433)
This commit is contained in:
53
Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs
Normal file
53
Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using Content.Server.GlobalVerbs;
|
||||||
|
using Content.Shared.Damage;
|
||||||
|
using Content.Shared.GameObjects.Components.Damage;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
using Robust.Shared.Interfaces.Map;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
|
namespace Content.IntegrationTests.Tests.Commands
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
[TestOf(typeof(RejuvenateVerb))]
|
||||||
|
public class RejuvenateTest : ContentIntegrationTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void RejuvenateDeadTest()
|
||||||
|
{
|
||||||
|
var server = StartServerDummyTicker();
|
||||||
|
|
||||||
|
IEntity human = null;
|
||||||
|
IDamageableComponent damageable = null;
|
||||||
|
|
||||||
|
server.Assert(() =>
|
||||||
|
{
|
||||||
|
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||||
|
|
||||||
|
mapManager.CreateNewMapEntity(MapId.Nullspace);
|
||||||
|
|
||||||
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
|
human = entityManager.SpawnEntity("HumanMob_Content", MapCoordinates.Nullspace);
|
||||||
|
|
||||||
|
// Sanity check
|
||||||
|
Assert.True(human.TryGetComponent(out damageable));
|
||||||
|
Assert.That(damageable.CurrentState, Is.EqualTo(DamageState.Alive));
|
||||||
|
|
||||||
|
// Kill the entity
|
||||||
|
damageable.ChangeDamage(DamageClass.Brute, 10000000, true);
|
||||||
|
|
||||||
|
// Check that it is dead
|
||||||
|
Assert.That(damageable.CurrentState, Is.EqualTo(DamageState.Dead));
|
||||||
|
|
||||||
|
// Rejuvenate them
|
||||||
|
RejuvenateVerb.PerformRejuvenate(human);
|
||||||
|
|
||||||
|
// Check that it is alive and with no damage
|
||||||
|
Assert.That(damageable.CurrentState, Is.EqualTo(DamageState.Alive));
|
||||||
|
Assert.That(damageable.TotalDamage, Is.Zero);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace Content.Server.GlobalVerbs
|
|||||||
/// Completely removes all damage from the DamageableComponent (heals the mob).
|
/// Completely removes all damage from the DamageableComponent (heals the mob).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[GlobalVerb]
|
[GlobalVerb]
|
||||||
class RejuvenateVerb : GlobalVerb
|
public class RejuvenateVerb : GlobalVerb
|
||||||
{
|
{
|
||||||
public override bool RequireInteractionRange => false;
|
public override bool RequireInteractionRange => false;
|
||||||
public override bool BlockedByContainers => false;
|
public override bool BlockedByContainers => false;
|
||||||
|
|||||||
Reference in New Issue
Block a user