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:
Jezithyr
2023-01-13 16:57:10 -08:00
committed by GitHub
parent 97e4c477bd
commit eeb5b17b34
148 changed files with 1517 additions and 1290 deletions

View File

@@ -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

View File

@@ -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(() =>

View File

@@ -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

View File

@@ -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