Mobstate Refactor (#13389)
Refactors mobstate and moves mob health thresholds to their own component Co-authored-by: DrSmugleaf <drsmugleaf@gmail.com>
This commit is contained in:
@@ -25,8 +25,9 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
- type: Body
|
||||
prototype: Human
|
||||
- type: MobState
|
||||
thresholds:
|
||||
0: Alive
|
||||
allowedStates:
|
||||
- Alive
|
||||
- type: Damageable
|
||||
- type: ThermalRegulator
|
||||
metabolismHeat: 5000
|
||||
radiatedHeat: 400
|
||||
|
||||
@@ -3,7 +3,8 @@ using Content.Server.Administration.Commands;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
@@ -23,6 +24,7 @@ namespace Content.IntegrationTests.Tests.Commands
|
||||
- type: Damageable
|
||||
damageContainer: Biological
|
||||
- type: MobState
|
||||
- type: MobThresholds
|
||||
thresholds:
|
||||
0: Alive
|
||||
100: Critical
|
||||
@@ -37,7 +39,7 @@ 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 mobStateSystem = entManager.EntitySysManager.GetEntitySystem<MobStateSystem>();
|
||||
var damSystem = entManager.EntitySysManager.GetEntitySystem<DamageableSystem>();
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
// Heal the entity for 40 damage, down to 60
|
||||
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*-4, true);
|
||||
|
||||
// Thresholds don't work backwards
|
||||
// ThresholdsLookup don't work backwards
|
||||
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
|
||||
|
||||
// Damage for 10, up to 70
|
||||
@@ -145,7 +145,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
// Heal by 30, down to 40
|
||||
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*-3, true);
|
||||
|
||||
// Thresholds don't work backwards
|
||||
// ThresholdsLookup don't work backwards
|
||||
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
|
||||
|
||||
// Damage up to 50 again
|
||||
|
||||
@@ -79,6 +79,11 @@ namespace Content.IntegrationTests.Tests.Disposal
|
||||
- type: Body
|
||||
prototype: Human
|
||||
- type: MobState
|
||||
- type: MobThresholds
|
||||
thresholds:
|
||||
0: Alive
|
||||
100: Critical
|
||||
200: Dead
|
||||
- type: Damageable
|
||||
damageContainer: Biological
|
||||
- type: Physics
|
||||
|
||||
Reference in New Issue
Block a user