* ogh * i should save my work * ogh * hhcdfhjbghshbxdfhghshc - lots of bugs in parsing still - invocation is a stub * expr parsing works * awawa * Saving work * Improve APIs a bit all around, add shortcuts. * awa * awa * AAAAAA * save work * Move shit to engine * lord * bql is kill * forgot the fucking bike rack * bql is kill for real * pjb will kill me * aughfhbdj * adgddf * gdsgvfvxshngfgh * b * hfsjhghj * a * tf you mean i have to document it * follow C# standards * Assorted cleanup and documentation pass, minor bugfix in ValueRefParser. * Start porting old commands, remove that pesky prefix in favor of integrating with the shell. * bw * Fix valueref up a bit, improve autocomplete for it. * awa * fix tests * git shut up * Arithmetic commands. * parse improvements * Update engine. --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
100 lines
3.9 KiB
C#
100 lines
3.9 KiB
C#
using Content.Server.Administration.Commands;
|
|
using Content.Server.Administration.Systems;
|
|
using Content.Shared.Damage;
|
|
using Content.Shared.Damage.Prototypes;
|
|
using Content.Shared.FixedPoint;
|
|
using Content.Shared.Mobs.Components;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.IntegrationTests.Tests.Commands
|
|
{
|
|
[TestFixture]
|
|
[TestOf(typeof(RejuvenateSystem))]
|
|
public sealed class RejuvenateTest
|
|
{
|
|
private const string Prototypes = @"
|
|
- type: entity
|
|
name: DamageableDummy
|
|
id: DamageableDummy
|
|
components:
|
|
- type: Damageable
|
|
damageContainer: Biological
|
|
- type: MobState
|
|
- type: MobThresholds
|
|
thresholds:
|
|
0: Alive
|
|
200: Dead
|
|
";
|
|
|
|
[Test]
|
|
public async Task RejuvenateDeadTest()
|
|
{
|
|
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings
|
|
{
|
|
NoClient = true,
|
|
ExtraPrototypes = Prototypes
|
|
});
|
|
var server = pairTracker.Pair.Server;
|
|
var entManager = server.ResolveDependency<IEntityManager>();
|
|
var mapManager = server.ResolveDependency<IMapManager>();
|
|
var prototypeManager = server.ResolveDependency<IPrototypeManager>();
|
|
var mobStateSystem = entManager.EntitySysManager.GetEntitySystem<MobStateSystem>();
|
|
var damSystem = entManager.EntitySysManager.GetEntitySystem<DamageableSystem>();
|
|
var rejuvenateSystem = entManager.EntitySysManager.GetEntitySystem<RejuvenateSystem>();
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
var human = entManager.SpawnEntity("DamageableDummy", MapCoordinates.Nullspace);
|
|
DamageableComponent damageable = null;
|
|
MobStateComponent mobState = null;
|
|
|
|
// Sanity check
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(entManager.TryGetComponent(human, out damageable));
|
|
Assert.That(entManager.TryGetComponent(human, out mobState));
|
|
});
|
|
Assert.Multiple(() =>
|
|
{
|
|
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));
|
|
|
|
damSystem.TryChangeDamage(human, damage, true);
|
|
|
|
// Check that it is dead
|
|
Assert.Multiple(() =>
|
|
{
|
|
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
|
|
rejuvenateSystem.PerformRejuvenate(human);
|
|
|
|
// Check that it is alive and with no damage
|
|
Assert.Multiple(() =>
|
|
{
|
|
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));
|
|
});
|
|
});
|
|
await pairTracker.CleanReturnAsync();
|
|
}
|
|
}
|
|
}
|