Inline UID

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 15:53:09 +01:00
parent 2654775bf0
commit 5cd42c9ad6
803 changed files with 3613 additions and 3577 deletions

View File

@@ -43,7 +43,7 @@ namespace Content.IntegrationTests.Tests.Destructible
var coordinates = new EntityCoordinates(gridId, 0, 0);
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageGroupEntityId, coordinates);
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity.Uid);
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity);
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -67,19 +67,19 @@ namespace Content.IntegrationTests.Tests.Destructible
DamageSpecifier burnDamage = new(burnDamageGroup, FixedPoint2.New(5));
// Raise brute damage to 5
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage, true);
// No thresholds reached yet, the earliest one is at 10 damage
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise brute damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage, true);
// No threshold reached, burn needs to be 10 as well
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise burn damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, burnDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true);
// One threshold reached, brute 10 + burn 10
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -102,26 +102,26 @@ namespace Content.IntegrationTests.Tests.Destructible
sTestThresholdListenerSystem.ThresholdsReached.Clear();
// Raise brute damage to 20
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true);
// No new thresholds reached
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise burn damage to 20
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, burnDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true);
// No new thresholds reached
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Lower brute damage to 0
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * -10);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * -10);
Assert.That(sDamageableComponent.TotalDamage,Is.EqualTo(FixedPoint2.New(20)));
// No new thresholds reached, healing should not trigger it
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise brute damage back up to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true);
// 10 brute + 10 burn threshold reached, brute was healed and brought back to its threshold amount and slash stayed the same
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -135,13 +135,13 @@ namespace Content.IntegrationTests.Tests.Destructible
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise brute damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true);
// No new thresholds reached
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise burn damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, burnDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true);
// Both classes of damage were healed and then raised again, the threshold should have been reached as triggers once is default false
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -173,13 +173,13 @@ namespace Content.IntegrationTests.Tests.Destructible
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise brute damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true);
// No new thresholds reached
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise burn damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, burnDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true);
// No new thresholds reached as triggers once is set to true and it already triggered before
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);

View File

@@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests.Destructible
var coordinates = new EntityCoordinates(gridId, 0, 0);
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageTypeEntityId, coordinates);
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity.Uid);
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity);
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
});
@@ -62,19 +62,19 @@ namespace Content.IntegrationTests.Tests.Destructible
var slashDamage = new DamageSpecifier(slashDamageType,5);
// Raise blunt damage to 5
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// No thresholds reached yet, the earliest one is at 10 damage
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise blunt damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// No threshold reached, slash needs to be 10 as well
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise slash damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true);
// One threshold reached, blunt 10 + slash 10
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -97,25 +97,25 @@ namespace Content.IntegrationTests.Tests.Destructible
sTestThresholdListenerSystem.ThresholdsReached.Clear();
// Raise blunt damage to 20
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true);
// No new thresholds reached
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise slash damage to 20
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true);
// No new thresholds reached
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Lower blunt damage to 0
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * -4, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -4, true);
// No new thresholds reached, healing should not trigger it
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise blunt damage back up to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true);
// 10 blunt + 10 slash threshold reached, blunt was healed and brought back to its threshold amount and slash stayed the same
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -123,20 +123,20 @@ namespace Content.IntegrationTests.Tests.Destructible
sTestThresholdListenerSystem.ThresholdsReached.Clear();
// Heal both types of damage to 0
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * -2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * -4, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * -4, true);
// No new thresholds reached, healing should not trigger it
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise blunt damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true);
// No new thresholds reached
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise slash damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true);
// Both types of damage were healed and then raised again, the threshold should have been reached as triggers once is default false
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -162,20 +162,20 @@ namespace Content.IntegrationTests.Tests.Destructible
threshold.TriggersOnce = true;
// Heal blunt and slash back to 0
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * -2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * -2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * -2, true);
// No new thresholds reached from healing
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise blunt damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true);
// No new thresholds reached
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
// Raise slash damage to 10
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * 2, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true);
// No new thresholds reached as triggers once is set to true and it already triggered before
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);

View File

@@ -40,19 +40,19 @@ namespace Content.IntegrationTests.Tests.Destructible
var coordinates = new EntityCoordinates(gridId, 0, 0);
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates);
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity.Uid);
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity);
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
});
await server.WaitAssertion(() =>
{
var coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sDestructibleEntity.Uid).Coordinates;
var coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sDestructibleEntity).Coordinates;
var bruteDamageGroup = sPrototypeManager.Index<DamageGroupPrototype>("TestBrute");
DamageSpecifier bruteDamage = new(bruteDamageGroup,50);
Assert.DoesNotThrow(() =>
{
EntitySystem.Get<DamageableSystem>().TryChangeDamage(sDestructibleEntity.Uid, bruteDamage, true);
EntitySystem.Get<DamageableSystem>().TryChangeDamage(sDestructibleEntity, bruteDamage, true);
});
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -73,12 +73,12 @@ namespace Content.IntegrationTests.Tests.Destructible
foreach (var entity in entitiesInRange)
{
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype == null)
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityPrototype == null)
{
continue;
}
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype.Name != SpawnedEntityId)
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityPrototype.Name != SpawnedEntityId)
{
continue;
}

View File

@@ -48,8 +48,8 @@ namespace Content.IntegrationTests.Tests.Destructible
var coordinates = new EntityCoordinates(gridId, 0, 0);
sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleEntityId, coordinates);
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity.Uid);
sDestructibleComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DestructibleComponent>(sDestructibleEntity.Uid);
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDestructibleEntity);
sDestructibleComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DestructibleComponent>(sDestructibleEntity);
sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem<TestDestructibleListenerSystem>();
sTestThresholdListenerSystem.ThresholdsReached.Clear();
@@ -68,12 +68,12 @@ namespace Content.IntegrationTests.Tests.Destructible
{
var bluntDamage = new DamageSpecifier(sPrototypeManager.Index<DamageTypePrototype>("TestBlunt"), 10);
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// No thresholds reached yet, the earliest one is at 20 damage
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// Only one threshold reached, 20
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -89,7 +89,7 @@ namespace Content.IntegrationTests.Tests.Destructible
sTestThresholdListenerSystem.ThresholdsReached.Clear();
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*3, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*3, true);
// One threshold reached, 50, since 20 already triggered before and it has not been healed below that amount
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -118,7 +118,7 @@ namespace Content.IntegrationTests.Tests.Destructible
sTestThresholdListenerSystem.ThresholdsReached.Clear();
// Damage for 50 again, up to 100 now
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*5, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*5, true);
// No thresholds reached as they weren't healed below the trigger amount
Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached);
@@ -127,7 +127,7 @@ namespace Content.IntegrationTests.Tests.Destructible
sDamageableSystem.SetAllDamage(sDamageableComponent, 0);
// Damage for 100, up to 100
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*10, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*10, true);
// Two thresholds reached as damage increased past the previous, 20 and 50
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(2));
@@ -135,25 +135,25 @@ namespace Content.IntegrationTests.Tests.Destructible
sTestThresholdListenerSystem.ThresholdsReached.Clear();
// Heal the entity for 40 damage, down to 60
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*-4, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*-4, true);
// Thresholds don't work backwards
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Damage for 10, up to 70
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// Not enough healing to de-trigger a threshold
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Heal by 30, down to 40
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*-3, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*-3, true);
// Thresholds don't work backwards
Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty);
// Damage up to 50 again
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true);
// The 50 threshold should have triggered again, after being healed
Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1));
@@ -186,7 +186,7 @@ namespace Content.IntegrationTests.Tests.Destructible
sDamageableSystem.SetAllDamage(sDamageableComponent, 0);
// Damage up to 50
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*5, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*5, true);
// Check that the total damage matches
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50)));
@@ -247,7 +247,7 @@ namespace Content.IntegrationTests.Tests.Destructible
}
// Damage the entity up to 50 damage again
sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*5, true);
sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*5, true);
// Check that the total damage matches
Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50)));