Add test that mob damage thresholds have alerts (#37307)
* Add test that mob damage thresholds have alerts * Docs * Add BorgDead state to MobSiliconBase
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Mobs.Components;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Damageable;
|
||||
|
||||
public sealed class MobThresholdsTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Inspects every entity prototype with a <see cref="MobThresholdsComponent"/> and makes
|
||||
/// sure that every possible mob state is mapped to an <see cref="AlertPrototype"/>.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task ValidateMobThresholds()
|
||||
{
|
||||
await using var pair = await PoolManager.GetServerClient();
|
||||
var server = pair.Server;
|
||||
|
||||
var entMan = server.EntMan;
|
||||
var protoMan = server.ProtoMan;
|
||||
|
||||
var protos = pair.GetPrototypesWithComponent<MobThresholdsComponent>();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
foreach (var (proto, comp) in protos)
|
||||
{
|
||||
// See which mob states are mapped to alerts
|
||||
var alertStates = comp.StateAlertDict.Keys;
|
||||
// Check each mob state that this mob can be in
|
||||
foreach (var (_, state) in comp.Thresholds)
|
||||
{
|
||||
// Make sure that an alert exists for each possible mob state
|
||||
Assert.That(alertStates, Does.Contain(state), $"{proto.ID} does not have an alert state for mob state {state}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
await pair.CleanReturnAsync();
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,7 @@
|
||||
120: Dead
|
||||
stateAlertDict:
|
||||
Alive: BorgHealth
|
||||
Dead: BorgDead
|
||||
showOverlays: false
|
||||
- type: Stamina
|
||||
critThreshold: 120
|
||||
|
||||
Reference in New Issue
Block a user