Inline UID
This commit is contained in:
@@ -48,8 +48,8 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var human = entityManager.SpawnEntity("HumanBodyAndAppearanceDummy", new MapCoordinates(Vector2.Zero, mapId));
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out SharedBodyComponent body));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out appearance));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out SharedBodyComponent body));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out appearance));
|
||||
|
||||
Assert.That(!appearance.TryGetData(RotationVisuals.RotationState, out RotationState _));
|
||||
|
||||
|
||||
@@ -66,11 +66,11 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
var bodySys = EntitySystem.Get<BodySystem>();
|
||||
var lungSys = EntitySystem.Get<LungSystem>();
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out SharedBodyComponent body));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out SharedBodyComponent body));
|
||||
|
||||
var lungs = bodySys.GetComponentsOnMechanisms<LungComponent>(human.Uid, body).ToArray();
|
||||
var lungs = bodySys.GetComponentsOnMechanisms<LungComponent>(human, body).ToArray();
|
||||
Assert.That(lungs.Count, Is.EqualTo(1));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out BloodstreamComponent bloodstream));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out BloodstreamComponent bloodstream));
|
||||
|
||||
var gas = new GasMixture(1);
|
||||
|
||||
@@ -171,8 +171,8 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
var coordinates = new EntityCoordinates(grid.GridEntityId, center);
|
||||
human = entityManager.SpawnEntity("HumanBodyAndBloodstreamDummy", coordinates);
|
||||
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(human.Uid));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out respirator));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(human));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out respirator));
|
||||
Assert.False(respirator.Suffocating);
|
||||
});
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Content.IntegrationTests.Tests.Body
|
||||
await server.WaitRunTicks(increment);
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.False(respirator.Suffocating, $"Entity {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(human.Uid).EntityName} is suffocating on tick {tick}");
|
||||
Assert.False(respirator.Suffocating, $"Entity {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(human).EntityName} is suffocating on tick {tick}");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -78,17 +78,17 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
chair = entityManager.SpawnEntity(StrapDummyId, coordinates);
|
||||
|
||||
// Default state, unbuckled
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out buckle));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out buckle));
|
||||
Assert.NotNull(buckle);
|
||||
Assert.Null(buckle.BuckledTo);
|
||||
Assert.False(buckle.Buckled);
|
||||
Assert.True(actionBlocker.CanMove(human.Uid));
|
||||
Assert.True(actionBlocker.CanChangeDirection(human.Uid));
|
||||
Assert.True(standingState.Down(human.Uid));
|
||||
Assert.True(standingState.Stand(human.Uid));
|
||||
Assert.True(actionBlocker.CanMove(human));
|
||||
Assert.True(actionBlocker.CanChangeDirection(human));
|
||||
Assert.True(standingState.Down((EntityUid) human));
|
||||
Assert.True(standingState.Stand((EntityUid) human));
|
||||
|
||||
// Default state, no buckled entities, strap
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(chair.Uid, out strap));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(chair, out strap));
|
||||
Assert.NotNull(strap);
|
||||
Assert.IsEmpty(strap.BuckledEntities);
|
||||
Assert.Zero(strap.OccupiedSize);
|
||||
@@ -100,10 +100,10 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
|
||||
var player = IoCManager.Resolve<IPlayerManager>().Sessions.Single();
|
||||
Assert.True(((BuckleComponentState) buckle.GetComponentState()).Buckled);
|
||||
Assert.False(actionBlocker.CanMove(human.Uid));
|
||||
Assert.False(actionBlocker.CanChangeDirection(human.Uid));
|
||||
Assert.False(standingState.Down(human.Uid));
|
||||
Assert.That((IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(chair.Uid).WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length));
|
||||
Assert.False(actionBlocker.CanMove(human));
|
||||
Assert.False(actionBlocker.CanChangeDirection(human));
|
||||
Assert.False(standingState.Down((EntityUid) human));
|
||||
Assert.That((IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human).WorldPosition - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(chair).WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length));
|
||||
|
||||
// Side effects of buckling for the strap
|
||||
Assert.That(strap.BuckledEntities, Does.Contain(human));
|
||||
@@ -134,9 +134,9 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.True(buckle.TryUnbuckle(human));
|
||||
Assert.Null(buckle.BuckledTo);
|
||||
Assert.False(buckle.Buckled);
|
||||
Assert.True(actionBlocker.CanMove(human.Uid));
|
||||
Assert.True(actionBlocker.CanChangeDirection(human.Uid));
|
||||
Assert.True(standingState.Down(human.Uid));
|
||||
Assert.True(actionBlocker.CanMove(human));
|
||||
Assert.True(actionBlocker.CanChangeDirection(human));
|
||||
Assert.True(standingState.Down((EntityUid) human));
|
||||
|
||||
// Unbuckle, strap
|
||||
Assert.IsEmpty(strap.BuckledEntities);
|
||||
@@ -171,7 +171,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.False(buckle.Buckled);
|
||||
|
||||
// Move away from the chair
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition += (1000, 1000);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human).WorldPosition += (1000, 1000);
|
||||
|
||||
// Out of range
|
||||
Assert.False(buckle.TryBuckle(human, chair));
|
||||
@@ -179,7 +179,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.False(buckle.ToggleBuckle(human, chair));
|
||||
|
||||
// Move near the chair
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(chair.Uid).WorldPosition + (0.5f, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(chair).WorldPosition + (0.5f, 0);
|
||||
|
||||
// In range
|
||||
Assert.True(buckle.TryBuckle(human, chair));
|
||||
@@ -192,15 +192,15 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
// Force unbuckle
|
||||
Assert.True(buckle.TryUnbuckle(human, true));
|
||||
Assert.False(buckle.Buckled);
|
||||
Assert.True(actionBlocker.CanMove(human.Uid));
|
||||
Assert.True(actionBlocker.CanChangeDirection(human.Uid));
|
||||
Assert.True(standingState.Down(human.Uid));
|
||||
Assert.True(actionBlocker.CanMove(human));
|
||||
Assert.True(actionBlocker.CanChangeDirection(human));
|
||||
Assert.True(standingState.Down((EntityUid) human));
|
||||
|
||||
// Re-buckle
|
||||
Assert.True(buckle.TryBuckle(human, chair));
|
||||
|
||||
// Move away from the chair
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition += (1, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human).WorldPosition += (1, 0);
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
@@ -239,10 +239,10 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
IEntity chair = entityManager.SpawnEntity(StrapDummyId, coordinates);
|
||||
|
||||
// Component sanity check
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out buckle));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<StrapComponent>(chair.Uid));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out hands));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out body));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out buckle));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<StrapComponent>(chair));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out hands));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out body));
|
||||
|
||||
// Buckle
|
||||
Assert.True(buckle.TryBuckle(human, chair));
|
||||
@@ -255,7 +255,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
var akms = entityManager.SpawnEntity(ItemDummyId, coordinates);
|
||||
|
||||
// Equip items
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(akms.Uid, out ItemComponent item));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(akms, out ItemComponent item));
|
||||
Assert.True(hands.PutInHand(item));
|
||||
}
|
||||
});
|
||||
@@ -324,8 +324,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
chair = entityManager.SpawnEntity(StrapDummyId, coordinates);
|
||||
|
||||
// Component sanity check
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out buckle));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<StrapComponent>(chair.Uid));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out buckle));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<StrapComponent>(chair));
|
||||
|
||||
// Buckle
|
||||
Assert.True(buckle.TryBuckle(human, chair));
|
||||
@@ -333,7 +333,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.True(buckle.Buckled);
|
||||
|
||||
// Move the buckled entity away
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition += (100, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human).WorldPosition += (100, 0);
|
||||
});
|
||||
|
||||
await WaitUntil(server, () => !buckle.Buckled, 10);
|
||||
@@ -343,7 +343,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Move the now unbuckled entity back onto the chair
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition -= (100, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human).WorldPosition -= (100, 0);
|
||||
|
||||
// Buckle
|
||||
Assert.True(buckle.TryBuckle(human, chair));
|
||||
|
||||
@@ -50,11 +50,11 @@ namespace Content.IntegrationTests.Tests.Chemistry
|
||||
{
|
||||
beaker = entityManager.SpawnEntity("TestSolutionContainer", coordinates);
|
||||
Assert.That(EntitySystem.Get<SolutionContainerSystem>()
|
||||
.TryGetSolution(beaker.Uid, "beaker", out component));
|
||||
.TryGetSolution(beaker, "beaker", out component));
|
||||
foreach (var (id, reactant) in reactionPrototype.Reactants)
|
||||
{
|
||||
Assert.That(EntitySystem.Get<SolutionContainerSystem>()
|
||||
.TryAddReagent(beaker.Uid, component, id, reactant.Amount, out var quantity));
|
||||
.TryAddReagent(beaker, component, id, reactant.Amount, out var quantity));
|
||||
Assert.That(reactant.Amount, Is.EqualTo(quantity));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -78,12 +78,12 @@ namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
var gridEnt = mapManager.GetAllGrids().First().GridEntityId;
|
||||
IEntity tempQualifier = serverEntManager.GetEntity(gridEnt);
|
||||
worldPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Uid).WorldPosition;
|
||||
worldPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier).WorldPosition;
|
||||
|
||||
var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ent.Uid).LocalRotation = angle;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ent.Uid).Scale = (scale, scale);
|
||||
entity = ent.Uid;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ent).LocalRotation = angle;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ent).Scale = (scale, scale);
|
||||
entity = ent;
|
||||
});
|
||||
|
||||
// Let client sync up.
|
||||
@@ -94,7 +94,7 @@ namespace Content.IntegrationTests.Tests
|
||||
await _client.WaitPost(() =>
|
||||
{
|
||||
var ent = clientEntManager.GetEntity(entity);
|
||||
var clickable = IoCManager.Resolve<IEntityManager>().GetComponent<ClickableComponent>(ent.Uid);
|
||||
var clickable = IoCManager.Resolve<IEntityManager>().GetComponent<ClickableComponent>(ent);
|
||||
|
||||
hit = clickable.CheckClick((clickPosX, clickPosY) + worldPos!.Value, out _, out _);
|
||||
});
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace Content.IntegrationTests.Tests.Commands
|
||||
var human = entityManager.SpawnEntity("DamageableDummy", MapCoordinates.Nullspace);
|
||||
|
||||
// Sanity check
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out DamageableComponent damageable));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out MobStateComponent mobState));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out DamageableComponent damageable));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out MobStateComponent mobState));
|
||||
mobState.UpdateState(0);
|
||||
Assert.That(mobState.IsAlive, Is.True);
|
||||
Assert.That(mobState.IsCritical, Is.False);
|
||||
@@ -59,7 +59,7 @@ namespace Content.IntegrationTests.Tests.Commands
|
||||
// Kill the entity
|
||||
DamageSpecifier damage = new(prototypeManager.Index<DamageGroupPrototype>("Toxin"),
|
||||
FixedPoint2.New(10000000));
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(human.Uid, damage, true);
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(human, damage, true);
|
||||
|
||||
// Check that it is dead
|
||||
Assert.That(mobState.IsAlive, Is.False);
|
||||
|
||||
@@ -81,9 +81,9 @@ namespace Content.IntegrationTests.Tests
|
||||
var ent = IoCManager.Resolve<IEntityManager>();
|
||||
var container = ent.SpawnEntity("ContainerOcclusionA", pos);
|
||||
var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||
dummyUid = dummy.Uid;
|
||||
dummyUid = dummy;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(container.Uid).Insert(dummy);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(container).Insert(dummy);
|
||||
});
|
||||
|
||||
await RunTicksSync(c, s, 5);
|
||||
@@ -91,8 +91,8 @@ namespace Content.IntegrationTests.Tests
|
||||
c.Assert(() =>
|
||||
{
|
||||
var dummy = IoCManager.Resolve<IEntityManager>().GetEntity(dummyUid);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(dummy.Uid);
|
||||
var light = IoCManager.Resolve<IEntityManager>().GetComponent<PointLightComponent>(dummy.Uid);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(dummy);
|
||||
var light = IoCManager.Resolve<IEntityManager>().GetComponent<PointLightComponent>(dummy);
|
||||
Assert.True(sprite.ContainerOccluded);
|
||||
Assert.True(light.ContainerOccluded);
|
||||
});
|
||||
@@ -112,9 +112,9 @@ namespace Content.IntegrationTests.Tests
|
||||
var ent = IoCManager.Resolve<IEntityManager>();
|
||||
var container = ent.SpawnEntity("ContainerOcclusionB", pos);
|
||||
var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||
dummyUid = dummy.Uid;
|
||||
dummyUid = dummy;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(container.Uid).Insert(dummy);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(container).Insert(dummy);
|
||||
});
|
||||
|
||||
await RunTicksSync(c, s, 5);
|
||||
@@ -122,8 +122,8 @@ namespace Content.IntegrationTests.Tests
|
||||
c.Assert(() =>
|
||||
{
|
||||
var dummy = IoCManager.Resolve<IEntityManager>().GetEntity(dummyUid);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(dummy.Uid);
|
||||
var light = IoCManager.Resolve<IEntityManager>().GetComponent<PointLightComponent>(dummy.Uid);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(dummy);
|
||||
var light = IoCManager.Resolve<IEntityManager>().GetComponent<PointLightComponent>(dummy);
|
||||
Assert.False(sprite.ContainerOccluded);
|
||||
Assert.False(light.ContainerOccluded);
|
||||
});
|
||||
@@ -144,10 +144,10 @@ namespace Content.IntegrationTests.Tests
|
||||
var containerA = ent.SpawnEntity("ContainerOcclusionA", pos);
|
||||
var containerB = ent.SpawnEntity("ContainerOcclusionB", pos);
|
||||
var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||
dummyUid = dummy.Uid;
|
||||
dummyUid = dummy;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(containerA.Uid).Insert(containerB);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(containerB.Uid).Insert(dummy);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(containerA).Insert(containerB);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(containerB).Insert(dummy);
|
||||
});
|
||||
|
||||
await RunTicksSync(c, s, 5);
|
||||
@@ -155,8 +155,8 @@ namespace Content.IntegrationTests.Tests
|
||||
c.Assert(() =>
|
||||
{
|
||||
var dummy = IoCManager.Resolve<IEntityManager>().GetEntity(dummyUid);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(dummy.Uid);
|
||||
var light = IoCManager.Resolve<IEntityManager>().GetComponent<PointLightComponent>(dummy.Uid);
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(dummy);
|
||||
var light = IoCManager.Resolve<IEntityManager>().GetComponent<PointLightComponent>(dummy);
|
||||
Assert.True(sprite.ContainerOccluded);
|
||||
Assert.True(light.ContainerOccluded);
|
||||
});
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Content.IntegrationTests.Tests.Damageable
|
||||
sMapManager.CreateMap(mapId);
|
||||
|
||||
sDamageableEntity = sEntityManager.SpawnEntity("TestDamageableEntityId", coordinates);
|
||||
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDamageableEntity.Uid);
|
||||
sDamageableComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DamageableComponent>(sDamageableEntity);
|
||||
sDamageableSystem = sEntitySystemManager.GetEntitySystem<DamageableSystem>();
|
||||
|
||||
group1 = sPrototypeManager.Index<DamageGroupPrototype>("TestGroup1");
|
||||
@@ -138,7 +138,7 @@ namespace Content.IntegrationTests.Tests.Damageable
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var uid = sDamageableEntity.Uid;
|
||||
var uid = (EntityUid) sDamageableEntity;
|
||||
|
||||
// Check that the correct types are supported.
|
||||
Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type1.ID), Is.False);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.IntegrationTests.Tests
|
||||
Assert.That(inv.Equip(Slots.HEAD, item, false), Is.True);
|
||||
|
||||
// Delete parent.
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(container.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) container);
|
||||
|
||||
// Assert that child item was also deleted.
|
||||
Assert.That(item.Deleted, Is.True);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -82,19 +82,19 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
|
||||
|
||||
device1 = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1.Uid, out networkComponent1), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1, out networkComponent1), Is.True);
|
||||
Assert.That(networkComponent1.Open, Is.True);
|
||||
Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
|
||||
|
||||
device2 = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device2.Uid, out networkComponent2), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device2, out networkComponent2), Is.True);
|
||||
Assert.That(networkComponent2.Open, Is.True);
|
||||
Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty));
|
||||
|
||||
Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address));
|
||||
|
||||
deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
@@ -145,20 +145,20 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
|
||||
|
||||
device1 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", MapCoordinates.Nullspace);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1.Uid, out networkComponent1), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1.Uid, out wirelessNetworkComponent), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1, out networkComponent1), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1, out wirelessNetworkComponent), Is.True);
|
||||
Assert.That(networkComponent1.Open, Is.True);
|
||||
Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
|
||||
|
||||
device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0,50), MapId.Nullspace));
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device2.Uid, out networkComponent2), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device2, out networkComponent2), Is.True);
|
||||
Assert.That(networkComponent2.Open, Is.True);
|
||||
Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty));
|
||||
|
||||
Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address));
|
||||
|
||||
deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
@@ -174,7 +174,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
|
||||
|
||||
wirelessNetworkComponent.Range = 0;
|
||||
|
||||
deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
@@ -232,20 +232,20 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
|
||||
|
||||
device1 = entityManager.SpawnEntity("DummyWiredNetworkDevice", MapCoordinates.Nullspace);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1.Uid, out networkComponent1), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1.Uid, out wiredNetworkComponent), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1, out networkComponent1), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device1, out wiredNetworkComponent), Is.True);
|
||||
Assert.That(networkComponent1.Open, Is.True);
|
||||
Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty));
|
||||
|
||||
device2 = entityManager.SpawnEntity("DummyWiredNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0, 2), MapId.Nullspace));
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device2.Uid, out networkComponent2), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(device2, out networkComponent2), Is.True);
|
||||
Assert.That(networkComponent2.Open, Is.True);
|
||||
Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty));
|
||||
|
||||
Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address));
|
||||
|
||||
deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
@@ -256,7 +256,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork
|
||||
|
||||
entityManager.SpawnEntity("CableApcExtension", grid.MapToGrid(new MapCoordinates(new Robust.Shared.Maths.Vector2(0, 1), MapId.Nullspace)));
|
||||
|
||||
deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload);
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
Assert.That(system.CanInsert(unit, entity), Is.EqualTo(result));
|
||||
system.TryInsert(unit.Owner.Uid, entity.Uid, entity.Uid);
|
||||
system.TryInsert(unit.Owner, entity, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,22 +143,22 @@ namespace Content.IntegrationTests.Tests.Disposal
|
||||
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
||||
wrench = entityManager.SpawnEntity("WrenchDummy", coordinates);
|
||||
disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates);
|
||||
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalUnit.Uid).MapPosition);
|
||||
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalUnit).MapPosition);
|
||||
|
||||
// Test for components existing
|
||||
ref DisposalUnitComponent? comp = ref unit!;
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(disposalUnit.Uid, out comp));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<DisposalEntryComponent>(disposalTrunk.Uid));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(disposalUnit, out comp));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<DisposalEntryComponent>(disposalTrunk));
|
||||
|
||||
// Can't insert, unanchored and unpowered
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(unit.Owner.Uid).Anchored = false;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(unit.Owner).Anchored = false;
|
||||
UnitInsertContains(unit, false, human, wrench, disposalUnit, disposalTrunk);
|
||||
});
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Anchor the disposal unit
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(unit.Owner.Uid).Anchored = true;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(unit.Owner).Anchored = true;
|
||||
|
||||
// No power
|
||||
Assert.False(unit.Powered);
|
||||
@@ -173,7 +173,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Move the disposal trunk away
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalTrunk.Uid).WorldPosition += (1, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalTrunk).WorldPosition += (1, 0);
|
||||
|
||||
// Fail to flush with a mob and an item
|
||||
Flush(unit, false, human, wrench);
|
||||
@@ -182,7 +182,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Move the disposal trunk back
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalTrunk.Uid).WorldPosition -= (1, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalTrunk).WorldPosition -= (1, 0);
|
||||
|
||||
// Fail to flush with a mob and an item, no power
|
||||
Flush(unit, false, human, wrench);
|
||||
@@ -191,7 +191,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Remove power need
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(disposalUnit.Uid, out ApcPowerReceiverComponent power));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(disposalUnit, out ApcPowerReceiverComponent power));
|
||||
power!.NeedsPower = false;
|
||||
Assert.True(unit.Powered);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
|
||||
airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace);
|
||||
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(airlock.Uid, out doorComponent));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(airlock, out doorComponent));
|
||||
Assert.That(doorComponent.State, Is.EqualTo(SharedDoorComponent.DoorState.Closed));
|
||||
});
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
{
|
||||
Assert.DoesNotThrow(() =>
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(airlock.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) airlock);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -136,9 +136,9 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
|
||||
airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates((0, 0), mapId));
|
||||
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(physicsDummy.Uid, out physBody));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(physicsDummy, out physBody));
|
||||
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(airlock.Uid, out doorComponent));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(airlock, out doorComponent));
|
||||
Assert.That(doorComponent.State, Is.EqualTo(SharedDoorComponent.DoorState.Closed));
|
||||
});
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
for (var i = 0; i < 240; i += 10)
|
||||
{
|
||||
// Keep the airlock awake so they collide
|
||||
server.Post(() => IoCManager.Resolve<IEntityManager>().GetComponent<IPhysBody>(airlock.Uid).WakeBody());
|
||||
server.Post(() => IoCManager.Resolve<IEntityManager>().GetComponent<IPhysBody>(airlock).WakeBody());
|
||||
|
||||
await server.WaitRunTicks(10);
|
||||
await server.WaitIdleAsync();
|
||||
@@ -164,7 +164,7 @@ namespace Content.IntegrationTests.Tests.Doors
|
||||
// Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX));
|
||||
|
||||
// Blocked by the airlock
|
||||
await server.WaitAssertion(() => Assert.That(Math.Abs(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(physicsDummy.Uid).MapPosition.X - 1) > 0.01f));
|
||||
await server.WaitAssertion(() => Assert.That(Math.Abs(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(physicsDummy).MapPosition.X - 1) > 0.01f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ namespace Content.IntegrationTests.Tests
|
||||
Logger.LogS(LogLevel.Debug, "EntityTest", $"Testing: {prototype.ID}");
|
||||
testEntity = entityMan.SpawnEntity(prototype.ID, testLocation);
|
||||
server.RunTicks(2);
|
||||
Assert.That((!IoCManager.Resolve<IEntityManager>().EntityExists(testEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(testEntity.Uid).EntityLifeStage) >= EntityLifeStage.Initialized);
|
||||
entityMan.DeleteEntity(testEntity.Uid);
|
||||
Assert.That((!IoCManager.Resolve<IEntityManager>().EntityExists(testEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(testEntity).EntityLifeStage) >= EntityLifeStage.Initialized);
|
||||
entityMan.DeleteEntity((EntityUid) testEntity);
|
||||
}, "Entity '{0}' threw an exception.",
|
||||
prototype.ID);
|
||||
}
|
||||
@@ -173,11 +173,11 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
var entity = entityManager.SpawnEntity("AllComponentsOneToOneDeleteTestEntity", testLocation);
|
||||
|
||||
Assert.That((!IoCManager.Resolve<IEntityManager>().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityLifeStage) >= EntityLifeStage.Initialized);
|
||||
Assert.That((!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Initialized);
|
||||
|
||||
// The component may already exist if it is a mandatory component
|
||||
// such as MetaData or Transform
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent(entity.Uid, type))
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent(entity, type))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
server.RunTicks(2);
|
||||
|
||||
entityManager.DeleteEntity(entity.Uid);
|
||||
entityManager.DeleteEntity((EntityUid) entity);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -302,14 +302,14 @@ namespace Content.IntegrationTests.Tests
|
||||
var testLocation = grid.ToCoordinates();
|
||||
var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation);
|
||||
|
||||
Assert.That((!IoCManager.Resolve<IEntityManager>().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityLifeStage) >= EntityLifeStage.Initialized);
|
||||
Assert.That((!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Initialized);
|
||||
|
||||
foreach (var type in distinct.components)
|
||||
{
|
||||
var component = (Component) componentFactory.GetComponent(type);
|
||||
|
||||
// If the entity already has this component, if it was ensured or added by another
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent(entity.Uid, component.GetType()))
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent(entity, component.GetType()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ namespace Content.IntegrationTests.Tests
|
||||
}
|
||||
|
||||
server.RunTicks(2);
|
||||
entityManager.DeleteEntity(entity.Uid);
|
||||
entityManager.DeleteEntity((EntityUid) entity);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
sGrid = sMapManager.CreateGrid(sMapId);
|
||||
sGridId = sGrid.Index;
|
||||
sGridEntity = sEntityManager.GetEntity(sGrid.GridEntityId);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(sGridEntity.Uid).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1444
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(sGridEntity).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1444
|
||||
|
||||
var tileDefinition = sTileDefinitionManager["underplating"];
|
||||
var tile = new Tile(tileDefinition.TileId);
|
||||
@@ -115,7 +115,7 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
{
|
||||
Assert.True(sPauseManager.IsGridPaused(sGridId));
|
||||
Assert.True(sPauseManager.IsMapPaused(sMapId));
|
||||
Assert.True((!IoCManager.Resolve<IEntityManager>().EntityExists(sGridEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(sGridEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(sGridEntity.Uid).EntityPaused);
|
||||
Assert.True((!IoCManager.Resolve<IEntityManager>().EntityExists(sGridEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(sGridEntity).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(sGridEntity).EntityPaused);
|
||||
});
|
||||
|
||||
float evaporateTime = default;
|
||||
@@ -132,11 +132,11 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
// Check that the puddle was created
|
||||
Assert.NotNull(puddle);
|
||||
|
||||
evaporation = IoCManager.Resolve<IEntityManager>().GetComponent<EvaporationComponent>(puddle.Owner.Uid);
|
||||
evaporation = IoCManager.Resolve<IEntityManager>().GetComponent<EvaporationComponent>(puddle.Owner);
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1445
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1445
|
||||
|
||||
Assert.True((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityPaused);
|
||||
Assert.True((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner).EntityPaused);
|
||||
|
||||
// Check that the puddle is going to evaporate
|
||||
Assert.Positive(evaporation.EvaporateTime);
|
||||
@@ -154,10 +154,10 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
// No evaporation due to being paused
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.True((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityPaused);
|
||||
Assert.True((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner).EntityPaused);
|
||||
|
||||
// Check that the puddle still exists
|
||||
Assert.False((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted);
|
||||
Assert.False((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted);
|
||||
});
|
||||
|
||||
// Unpause the map
|
||||
@@ -168,10 +168,10 @@ namespace Content.IntegrationTests.Tests.Fluids
|
||||
{
|
||||
Assert.False(sPauseManager.IsMapPaused(sMapId));
|
||||
Assert.False(sPauseManager.IsGridPaused(sGridId));
|
||||
Assert.False((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityPaused);
|
||||
Assert.False((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner).EntityPaused);
|
||||
|
||||
// Check that the puddle still exists
|
||||
Assert.False((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted);
|
||||
Assert.False((!IoCManager.Resolve<IEntityManager>().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted);
|
||||
});
|
||||
|
||||
// Wait enough time for it to evaporate
|
||||
|
||||
@@ -63,16 +63,16 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
cuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates);
|
||||
secondCuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates);
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(otherHuman.Uid).WorldPosition;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(otherHuman).WorldPosition;
|
||||
|
||||
// Test for components existing
|
||||
ref CuffableComponent? comp = ref cuffed!;
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out comp), $"Human has no {nameof(CuffableComponent)}");
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out comp), $"Human has no {nameof(CuffableComponent)}");
|
||||
ref HandsComponent? comp1 = ref hands!;
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out comp1), $"Human has no {nameof(HandsComponent)}");
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out SharedBodyComponent? _), $"Human has no {nameof(SharedBodyComponent)}");
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(cuffs.Uid, out HandcuffComponent? _), $"Handcuff has no {nameof(HandcuffComponent)}");
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(secondCuffs.Uid, out HandcuffComponent? _), $"Second handcuffs has no {nameof(HandcuffComponent)}");
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out comp1), $"Human has no {nameof(HandsComponent)}");
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out SharedBodyComponent? _), $"Human has no {nameof(SharedBodyComponent)}");
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(cuffs, out HandcuffComponent? _), $"Handcuff has no {nameof(HandcuffComponent)}");
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(secondCuffs, out HandcuffComponent? _), $"Second handcuffs has no {nameof(HandcuffComponent)}");
|
||||
|
||||
// Test to ensure cuffed players register the handcuffs
|
||||
cuffed.TryAddNewCuffs(human, cuffs);
|
||||
@@ -97,7 +97,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
private void AddHand(IEntity to)
|
||||
{
|
||||
var host = IoCManager.Resolve<IServerConsoleHost>();
|
||||
host.ExecuteCommand(null, $"addhand {to.Uid}");
|
||||
host.ExecuteCommand(null, $"addhand {to}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt!.Uid);
|
||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt!);
|
||||
|
||||
// player should begin with their innate actions granted
|
||||
innateActions.AddRange(actionsComponent.InnateActions);
|
||||
@@ -99,7 +99,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
{
|
||||
var local = clientPlayerMgr.LocalPlayer;
|
||||
var controlled = local!.ControlledEntity;
|
||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!.Uid);
|
||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!);
|
||||
|
||||
// we should have our innate actions and debug1.
|
||||
foreach (var innateAction in innateActions)
|
||||
@@ -154,7 +154,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt!.Uid);
|
||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(playerEnt!);
|
||||
actionsComponent.Revoke(ActionType.DebugInstant);
|
||||
});
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
{
|
||||
var local = clientPlayerMgr.LocalPlayer;
|
||||
var controlled = local!.ControlledEntity;
|
||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!.Uid);
|
||||
var actionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!);
|
||||
|
||||
// we should have our innate actions, but debug1 should be revoked
|
||||
foreach (var innateAction in innateActions)
|
||||
@@ -246,12 +246,12 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
serverPlayerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||
serverActionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(serverPlayerEnt!.Uid);
|
||||
serverActionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerActionsComponent>(serverPlayerEnt!);
|
||||
|
||||
// spawn and give them an item that has actions
|
||||
serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight",
|
||||
new EntityCoordinates(serverPlayerEnt.Uid, (0, 0)));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(serverFlashlight.Uid, out var itemActions));
|
||||
new EntityCoordinates(serverPlayerEnt, (0, 0)));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(serverFlashlight, out var itemActions));
|
||||
// we expect this only to have a toggle light action initially
|
||||
var actionConfigs = itemActions.ActionConfigs.ToList();
|
||||
Assert.That(actionConfigs.Count == 1);
|
||||
@@ -260,11 +260,11 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
|
||||
// grant an extra item action, before pickup, initially disabled
|
||||
itemActions.GrantOrUpdate(ItemActionType.DebugToggle, false);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt.Uid).PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(serverFlashlight.Uid), false);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt).PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(serverFlashlight), false);
|
||||
// grant an extra item action, after pickup, with a cooldown
|
||||
itemActions.GrantOrUpdate(ItemActionType.DebugInstant, cooldown: cooldown);
|
||||
|
||||
Assert.That(serverActionsComponent.TryGetItemActionStates(serverFlashlight.Uid, out var state));
|
||||
Assert.That(serverActionsComponent.TryGetItemActionStates((EntityUid) serverFlashlight, out var state));
|
||||
// they should have been granted all 3 actions
|
||||
Assert.That(state.Count == 3);
|
||||
Assert.That(state.TryGetValue(ItemActionType.ToggleLight, out var toggleLightState));
|
||||
@@ -286,7 +286,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
{
|
||||
var local = clientPlayerMgr.LocalPlayer;
|
||||
var controlled = local!.ControlledEntity;
|
||||
clientActionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!.Uid);
|
||||
clientActionsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientActionsComponent>(controlled!);
|
||||
|
||||
var lightEntry = clientActionsComponent.ItemActionStates()
|
||||
.Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight))
|
||||
@@ -318,7 +318,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
// server should see the action toggled on
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight.Uid, out var lightStates));
|
||||
Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight, out var lightStates));
|
||||
Assert.That(lightStates.TryGetValue(ItemActionType.ToggleLight, out var lightState));
|
||||
Assert.That(lightState, Is.EqualTo(new ActionState(true, toggledOn: true)));
|
||||
});
|
||||
@@ -334,9 +334,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// drop the item, and the item actions should go away
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt.Uid)
|
||||
.TryDropEntity(serverFlashlight, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(serverPlayerEnt.Uid).Coordinates, false);
|
||||
Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight.Uid), Is.False);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt)
|
||||
.TryDropEntity(serverFlashlight, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(serverPlayerEnt).Coordinates, false);
|
||||
Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight), Is.False);
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(5);
|
||||
@@ -352,8 +352,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
{
|
||||
// pick the item up again, the states should be back to what they were when dropped,
|
||||
// as the states "stick" with the item
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt.Uid).PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(serverFlashlight.Uid), false);
|
||||
Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight.Uid, out var lightStates));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt).PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(serverFlashlight), false);
|
||||
Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight, out var lightStates));
|
||||
Assert.That(lightStates.TryGetValue(ItemActionType.ToggleLight, out var lightState));
|
||||
Assert.That(lightState.Equals(new ActionState(true, toggledOn: true)));
|
||||
Assert.That(lightStates.TryGetValue(ItemActionType.DebugInstant, out var debugInstantState));
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
{
|
||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||
Assert.NotNull(playerEnt);
|
||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt.Uid);
|
||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt);
|
||||
Assert.NotNull(alertsComponent);
|
||||
|
||||
// show 2 alerts
|
||||
@@ -51,7 +51,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
Assert.NotNull(local);
|
||||
var controlled = local.ControlledEntity;
|
||||
Assert.NotNull(controlled);
|
||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientAlertsComponent>(controlled.Uid);
|
||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientAlertsComponent>(controlled);
|
||||
Assert.NotNull(alertsComponent);
|
||||
|
||||
// find the alertsui
|
||||
@@ -71,7 +71,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
{
|
||||
var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity;
|
||||
Assert.NotNull(playerEnt);
|
||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt.Uid);
|
||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ServerAlertsComponent>(playerEnt);
|
||||
Assert.NotNull(alertsComponent);
|
||||
|
||||
alertsComponent.ClearAlert(AlertType.Debug1);
|
||||
@@ -86,7 +86,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
Assert.NotNull(local);
|
||||
var controlled = local.ControlledEntity;
|
||||
Assert.NotNull(controlled);
|
||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientAlertsComponent>(controlled.Uid);
|
||||
var alertsComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ClientAlertsComponent>(controlled);
|
||||
Assert.NotNull(alertsComponent);
|
||||
|
||||
// find the alertsui
|
||||
|
||||
@@ -55,13 +55,13 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
||||
// Test for climb components existing
|
||||
// Players and tables should have these in their prototypes.
|
||||
ref ClimbingComponent? comp = ref climbing!;
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out comp), "Human has no climbing");
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(table.Uid, out ClimbableComponent? _), "Table has no climbable");
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out comp), "Human has no climbing");
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(table, out ClimbableComponent? _), "Table has no climbable");
|
||||
|
||||
// Now let's make the player enter a climbing transitioning state.
|
||||
climbing.IsClimbing = true;
|
||||
climbing.TryMoveTo(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(table.Uid).WorldPosition);
|
||||
var body = IoCManager.Resolve<IEntityManager>().GetComponent<IPhysBody>(human.Uid);
|
||||
climbing.TryMoveTo(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human).WorldPosition, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(table).WorldPosition);
|
||||
var body = IoCManager.Resolve<IEntityManager>().GetComponent<IPhysBody>(human);
|
||||
// TODO: Check it's climbing
|
||||
|
||||
// Force the player out of climb state. It should immediately remove the ClimbController.
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
||||
var coordinates = grid.ToCoordinates();
|
||||
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
||||
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human.Uid, out alerts));
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().TryGetComponent(human, out alerts));
|
||||
});
|
||||
|
||||
// Let WeightlessSystem and GravitySystem tick
|
||||
@@ -64,7 +64,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
||||
// No gravity without a gravity generator
|
||||
Assert.True(alerts.IsShowingAlert(AlertType.Weightless));
|
||||
|
||||
entityManager.SpawnEntity("GravityGeneratorDummy", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).Coordinates);
|
||||
entityManager.SpawnEntity("GravityGeneratorDummy", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human).Coordinates);
|
||||
});
|
||||
|
||||
// Let WeightlessSystem and GravitySystem tick
|
||||
|
||||
@@ -50,18 +50,18 @@ namespace Content.IntegrationTests.Tests
|
||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
generator = entityMan.SpawnEntity("GravityGeneratorDummy", grid2.ToCoordinates());
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().HasComponent<GravityGeneratorComponent>(generator.Uid));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().HasComponent<ApcPowerReceiverComponent>(generator.Uid));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().HasComponent<GravityGeneratorComponent>(generator));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().HasComponent<ApcPowerReceiverComponent>(generator));
|
||||
|
||||
var powerComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(generator.Uid);
|
||||
var powerComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(generator);
|
||||
powerComponent.NeedsPower = false;
|
||||
});
|
||||
server.RunTicks(1);
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
var generatorComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GravityGeneratorComponent>(generator.Uid);
|
||||
var powerComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(generator.Uid);
|
||||
var generatorComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GravityGeneratorComponent>(generator);
|
||||
var powerComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(generator);
|
||||
|
||||
Assert.That(generatorComponent.GravityActive, Is.True);
|
||||
|
||||
@@ -69,8 +69,8 @@ namespace Content.IntegrationTests.Tests
|
||||
var grid1Entity = entityMan.GetEntity(grid1.GridEntityId);
|
||||
var grid2Entity = entityMan.GetEntity(grid2.GridEntityId);
|
||||
|
||||
Assert.That(!IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(grid1Entity.Uid).Enabled);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(grid2Entity.Uid).Enabled);
|
||||
Assert.That(!IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(grid1Entity).Enabled);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(grid2Entity).Enabled);
|
||||
|
||||
// Re-enable needs power so it turns off again.
|
||||
// Charge rate is ridiculously high so it finishes in one tick.
|
||||
@@ -79,14 +79,14 @@ namespace Content.IntegrationTests.Tests
|
||||
server.RunTicks(1);
|
||||
server.Assert(() =>
|
||||
{
|
||||
var generatorComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GravityGeneratorComponent>(generator.Uid);
|
||||
var generatorComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GravityGeneratorComponent>(generator);
|
||||
|
||||
Assert.That(generatorComponent.GravityActive, Is.False);
|
||||
|
||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||
var grid2Entity = entityMan.GetEntity(grid2.GridEntityId);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(grid2Entity.Uid).Enabled, Is.False);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<GravityComponent>(grid2Entity).Enabled, Is.False);
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Content.IntegrationTests.Tests
|
||||
pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace);
|
||||
var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace);
|
||||
|
||||
inventory = IoCManager.Resolve<IEntityManager>().GetComponent<InventoryComponent>(human.Uid);
|
||||
inventory = IoCManager.Resolve<IEntityManager>().GetComponent<InventoryComponent>(human);
|
||||
|
||||
Assert.That(inventory.CanEquip(Slots.INNERCLOTHING, uniform));
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
private static bool IsDescendant(IEntity descendant, IEntity parent)
|
||||
{
|
||||
var tmpParent = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(descendant.Uid).Parent;
|
||||
var tmpParent = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(descendant).Parent;
|
||||
while (tmpParent != null)
|
||||
{
|
||||
if (tmpParent.Owner == parent)
|
||||
|
||||
@@ -85,20 +85,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
var interactHand = false;
|
||||
server.Assert(() =>
|
||||
{
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target.Uid)); attack = true; };
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target)); attack = true; };
|
||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
||||
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, false, target);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(attack);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item)));
|
||||
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(interactUsing);
|
||||
});
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
target = entityManager.SpawnEntity(null, new MapCoordinates((1.9f, 0), mapId));
|
||||
item = entityManager.SpawnEntity(null, coords);
|
||||
item.EnsureComponent<ItemComponent>();
|
||||
wall = entityManager.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).MapID));
|
||||
wall = entityManager.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).MapID));
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
@@ -157,20 +157,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
var interactHand = false;
|
||||
server.Assert(() =>
|
||||
{
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target.Uid)); attack = true; };
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target)); attack = true; };
|
||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
||||
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, false, target);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(attack, Is.False);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand, Is.False);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item)));
|
||||
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
});
|
||||
|
||||
@@ -226,20 +226,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
var interactHand = false;
|
||||
server.Assert(() =>
|
||||
{
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target.Uid)); attack = true; };
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target)); attack = true; };
|
||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
||||
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, false, target);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(attack);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item)));
|
||||
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(interactUsing);
|
||||
});
|
||||
|
||||
@@ -296,20 +296,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
var interactHand = false;
|
||||
server.Assert(() =>
|
||||
{
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target.Uid)); attack = true; };
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target)); attack = true; };
|
||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; };
|
||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; };
|
||||
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, false, target);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(attack, Is.False);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand, Is.False);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item)));
|
||||
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
});
|
||||
|
||||
@@ -373,31 +373,31 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
server.Assert(() =>
|
||||
{
|
||||
Assert.That(container.Insert(user));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).Parent.Owner, Is.EqualTo(containerEntity));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).Parent.Owner, Is.EqualTo(containerEntity));
|
||||
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity.Uid)); attack = true; };
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); attack = true; };
|
||||
testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactUsing = true; };
|
||||
testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactHand = true; };
|
||||
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, false, target);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(attack, Is.False);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand, Is.False);
|
||||
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity.Uid).Coordinates, false, containerEntity.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity.Uid).Coordinates, containerEntity.Uid);
|
||||
interactionSystem.DoAttack(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity).Coordinates, false, containerEntity);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity).Coordinates, containerEntity);
|
||||
Assert.That(attack);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item)));
|
||||
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity.Uid).Coordinates, containerEntity.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity).Coordinates, containerEntity);
|
||||
Assert.That(interactUsing, Is.True);
|
||||
});
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
origin = entityManager.SpawnEntity(HumanId, coordinates);
|
||||
other = entityManager.SpawnEntity(HumanId, coordinates);
|
||||
container = ContainerHelpers.EnsureContainer<Container>(other, "InRangeUnobstructedTestOtherContainer");
|
||||
component = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid);
|
||||
entityCoordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).Coordinates;
|
||||
mapCoordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).MapPosition;
|
||||
component = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other);
|
||||
entityCoordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).Coordinates;
|
||||
mapCoordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition;
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
@@ -83,7 +83,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
|
||||
|
||||
// Move them slightly apart
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin.Uid).LocalPosition += _interactionRangeDivided15X;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).LocalPosition += _interactionRangeDivided15X;
|
||||
|
||||
// Entity <-> Entity
|
||||
Assert.True(origin.InRangeUnobstructed(other));
|
||||
@@ -107,7 +107,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
|
||||
|
||||
// Move them out of range
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin.Uid).LocalPosition += _interactionRangeDivided15X;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).LocalPosition += _interactionRangeDivided15X;
|
||||
|
||||
// Entity <-> Entity
|
||||
Assert.False(origin.InRangeUnobstructed(other));
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Content.IntegrationTests.Tests
|
||||
var entityMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
human = entityMan.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace);
|
||||
inventory = IoCManager.Resolve<IEntityManager>().GetComponent<InventoryComponent>(human.Uid);
|
||||
inventory = IoCManager.Resolve<IEntityManager>().GetComponent<InventoryComponent>(human);
|
||||
|
||||
// Can't do the test if this human doesn't have the slots for it.
|
||||
Assert.That(inventory.HasSlot(Slots.INNERCLOTHING));
|
||||
@@ -72,9 +72,9 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
// Do we actually have the uniform equipped?
|
||||
Assert.That(inventory.TryGetSlotItem(Slots.INNERCLOTHING, out ItemComponent uniform));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(uniform.Owner.Uid).EntityPrototype != null && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(uniform.Owner.Uid).EntityPrototype.ID == "InventoryJumpsuitJanitorDummy");
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(uniform.Owner).EntityPrototype != null && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(uniform.Owner).EntityPrototype.ID == "InventoryJumpsuitJanitorDummy");
|
||||
|
||||
EntitySystem.Get<StunSystem>().TryStun(human.Uid, TimeSpan.FromSeconds(1f));
|
||||
EntitySystem.Get<StunSystem>().TryStun(human, TimeSpan.FromSeconds(1f));
|
||||
|
||||
// Since the mob is stunned, they can't equip this.
|
||||
Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "InventoryIDCardDummy", true), Is.False);
|
||||
@@ -85,7 +85,7 @@ namespace Content.IntegrationTests.Tests
|
||||
// Let's try skipping the interaction check and see if it equips it!
|
||||
Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "InventoryIDCardDummy"));
|
||||
Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent id));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(id.Owner.Uid).EntityPrototype != null && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(id.Owner.Uid).EntityPrototype.ID == "InventoryIDCardDummy");
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(id.Owner).EntityPrototype != null && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(id.Owner).EntityPrototype.ID == "InventoryIDCardDummy");
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.IntegrationTests.Tests
|
||||
mind = new Mind(player.UserId);
|
||||
mind.ChangeOwningPlayer(player.UserId);
|
||||
|
||||
mind.TransferTo(playerEnt.Uid);
|
||||
mind.TransferTo(playerEnt);
|
||||
mind.Visit(visitEnt);
|
||||
|
||||
Assert.That(player.AttachedEntity, Is.EqualTo(visitEnt));
|
||||
@@ -49,12 +49,12 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(visitEnt.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) visitEnt);
|
||||
|
||||
Assert.That(mind.VisitingEntity, Is.Null);
|
||||
|
||||
// This used to throw so make sure it doesn't.
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(playerEnt.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) playerEnt);
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
@@ -82,7 +82,7 @@ namespace Content.IntegrationTests.Tests
|
||||
mind = new Mind(player.UserId);
|
||||
mind.ChangeOwningPlayer(player.UserId);
|
||||
|
||||
mind.TransferTo(playerEnt.Uid);
|
||||
mind.TransferTo(playerEnt);
|
||||
|
||||
Assert.That(mind.CurrentEntity, Is.EqualTo(playerEnt));
|
||||
});
|
||||
@@ -91,14 +91,14 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
server.Post(() =>
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(playerEnt.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) playerEnt);
|
||||
});
|
||||
|
||||
server.RunTicks(1);
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().EntityExists(mind.CurrentEntity.Uid), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().EntityExists(mind.CurrentEntity), Is.True);
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
@@ -131,7 +131,7 @@ namespace Content.IntegrationTests.Tests
|
||||
mind = new Mind(player.UserId);
|
||||
mind.ChangeOwningPlayer(player.UserId);
|
||||
|
||||
mind.TransferTo(playerEnt.Uid);
|
||||
mind.TransferTo(playerEnt);
|
||||
|
||||
Assert.That(mind.CurrentEntity, Is.EqualTo(playerEnt));
|
||||
});
|
||||
@@ -149,7 +149,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
server.Assert(() =>
|
||||
{
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().EntityExists(mind.CurrentEntity.Uid), Is.True);
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().EntityExists(mind.CurrentEntity), Is.True);
|
||||
Assert.That(mind.CurrentEntity, Is.Not.EqualTo(playerEnt));
|
||||
});
|
||||
|
||||
|
||||
@@ -55,7 +55,8 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
var clEntityManager = client.ResolveDependency<IEntityManager>();
|
||||
var svEntityManager = server.ResolveDependency<IEntityManager>();
|
||||
|
||||
var lastSvEntity = svEntityManager.GetEntities().Last().Uid;
|
||||
IEntity tempQualifier = svEntityManager.GetEntities().Last();
|
||||
var lastSvEntity = (EntityUid) tempQualifier;
|
||||
|
||||
Assert.That(clEntityManager.GetComponent<TransformComponent>(lastSvEntity).Coordinates,
|
||||
Is.EqualTo(svEntityManager.GetComponent<TransformComponent>(lastSvEntity).Coordinates));
|
||||
|
||||
@@ -112,8 +112,8 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
IEntity tempQualifier = cEntityManager.GetEntity(serverEnt.Uid);
|
||||
clientComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PredictionTestComponent>(tempQualifier.Uid);
|
||||
IEntity tempQualifier = cEntityManager.GetEntity(serverEnt);
|
||||
clientComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PredictionTestComponent>(tempQualifier);
|
||||
});
|
||||
|
||||
Assert.That(clientComponent.Foo, Is.False);
|
||||
@@ -137,7 +137,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
{
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt.Uid, true));
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, true));
|
||||
|
||||
Assert.That(clientComponent.Foo, Is.True);
|
||||
});
|
||||
@@ -209,7 +209,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
// Send event to server to change flag again, this time to disable it..
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt.Uid, false));
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, false));
|
||||
|
||||
Assert.That(clientComponent.Foo, Is.False);
|
||||
});
|
||||
@@ -280,7 +280,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
// Send first event to disable the flag (reminder: it never got accepted by the server).
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt.Uid, false));
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, false));
|
||||
|
||||
Assert.That(clientComponent.Foo, Is.False);
|
||||
});
|
||||
@@ -308,7 +308,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
// Send another event, to re-enable it.
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt.Uid, true));
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, true));
|
||||
|
||||
Assert.That(clientComponent.Foo, Is.True);
|
||||
});
|
||||
@@ -457,7 +457,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
private void HandleMessage(SetFooMessage message, EntitySessionEventArgs args)
|
||||
{
|
||||
var entity = EntityManager.GetEntity(message.Uid);
|
||||
var component = IoCManager.Resolve<IEntityManager>().GetComponent<PredictionTestComponent>(entity.Uid);
|
||||
var component = IoCManager.Resolve<IEntityManager>().GetComponent<PredictionTestComponent>(entity);
|
||||
var old = component.Foo;
|
||||
if (Allow)
|
||||
{
|
||||
|
||||
@@ -70,16 +70,16 @@ namespace Content.IntegrationTests.Tests.PDA
|
||||
Assert.NotNull(id);
|
||||
|
||||
// Put PDA in hand
|
||||
var dummyPda = sEntityManager.SpawnEntity(PdaDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).MapPosition);
|
||||
var pdaItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(dummyPda.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid).PutInHand(pdaItemComponent);
|
||||
var dummyPda = sEntityManager.SpawnEntity(PdaDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player).MapPosition);
|
||||
var pdaItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(dummyPda);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player).PutInHand(pdaItemComponent);
|
||||
|
||||
var pdaComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PDAComponent>(dummyPda.Uid);
|
||||
var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).MapPosition);
|
||||
var pdaComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PDAComponent>(dummyPda);
|
||||
var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player).MapPosition);
|
||||
|
||||
var itemSlots = IoCManager.Resolve<IEntityManager>().GetComponent<ItemSlotsComponent>(dummyPda.Uid);
|
||||
var itemSlots = IoCManager.Resolve<IEntityManager>().GetComponent<ItemSlotsComponent>(dummyPda);
|
||||
sEntityManager.EntitySysManager.GetEntitySystem<ItemSlotsSystem>()
|
||||
.TryInsert(dummyPda.Uid, pdaComponent.IdSlot, pdaIdCard);
|
||||
.TryInsert(dummyPda, pdaComponent.IdSlot, pdaIdCard);
|
||||
var pdaContainedId = pdaComponent.ContainedID;
|
||||
|
||||
// The PDA in the hand should be found first
|
||||
@@ -90,11 +90,11 @@ namespace Content.IntegrationTests.Tests.PDA
|
||||
Assert.That(id, Is.EqualTo(pdaContainedId));
|
||||
|
||||
// Put ID card in hand
|
||||
var idDummy = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).MapPosition);
|
||||
var idItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(idDummy.Uid);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid).PutInHand(idItemComponent);
|
||||
var idDummy = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player).MapPosition);
|
||||
var idItemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(idDummy);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player).PutInHand(idItemComponent);
|
||||
|
||||
var idCardComponent = IoCManager.Resolve<IEntityManager>().GetComponent<IdCardComponent>(idDummy.Uid);
|
||||
var idCardComponent = IoCManager.Resolve<IEntityManager>().GetComponent<IdCardComponent>(idDummy);
|
||||
|
||||
// The ID in the hand should be found first
|
||||
Assert.NotNull(player.GetHeldId());
|
||||
@@ -103,7 +103,7 @@ namespace Content.IntegrationTests.Tests.PDA
|
||||
Assert.That(id, Is.EqualTo(idCardComponent));
|
||||
|
||||
// Remove all IDs and PDAs
|
||||
var inventory = IoCManager.Resolve<IEntityManager>().GetComponent<InventoryComponent>(player.Uid);
|
||||
var inventory = IoCManager.Resolve<IEntityManager>().GetComponent<InventoryComponent>(player);
|
||||
|
||||
foreach (var slot in inventory.Slots)
|
||||
{
|
||||
@@ -114,13 +114,13 @@ namespace Content.IntegrationTests.Tests.PDA
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<PDAComponent>(item.Owner.Uid))
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<PDAComponent>(item.Owner))
|
||||
{
|
||||
inventory.ForceUnequip(slot);
|
||||
}
|
||||
}
|
||||
|
||||
var hands = IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player.Uid);
|
||||
var hands = IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(player);
|
||||
|
||||
hands.Drop(dummyPda, false);
|
||||
hands.Drop(idDummy, false);
|
||||
|
||||
@@ -205,9 +205,9 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1));
|
||||
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
||||
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1.Uid);
|
||||
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2.Uid);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt);
|
||||
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1);
|
||||
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2);
|
||||
|
||||
// Plenty of surplus and tolerance
|
||||
supplier.MaxSupply = loadPower * 4;
|
||||
@@ -259,9 +259,9 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1));
|
||||
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
||||
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1.Uid);
|
||||
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2.Uid);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt);
|
||||
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1);
|
||||
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2);
|
||||
|
||||
// Too little supply, both consumers should get 33% power.
|
||||
supplier.MaxSupply = loadPower;
|
||||
@@ -306,8 +306,8 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
|
||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
||||
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt);
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt);
|
||||
|
||||
// Supply has enough total power but needs to ramp up to match.
|
||||
supplier.MaxSupply = 400;
|
||||
@@ -376,9 +376,9 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var generatorEnt = _entityManager.SpawnEntity("DischargingBatteryDummy", grid.ToCoordinates());
|
||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2));
|
||||
|
||||
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(generatorEnt.Uid);
|
||||
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(generatorEnt.Uid);
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(generatorEnt);
|
||||
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(generatorEnt);
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt);
|
||||
|
||||
battery.MaxCharge = startingCharge;
|
||||
battery.CurrentCharge = startingCharge;
|
||||
@@ -454,9 +454,9 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates());
|
||||
var batteryEnt = _entityManager.SpawnEntity("ChargingBatteryDummy", grid.ToCoordinates(0, 2));
|
||||
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||
var netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt.Uid);
|
||||
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt.Uid);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt);
|
||||
var netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt);
|
||||
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt);
|
||||
|
||||
supplier.MaxSupply = 500;
|
||||
supplier.SupplyRampTolerance = 500;
|
||||
@@ -499,16 +499,16 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
}
|
||||
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3));
|
||||
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt.Uid);
|
||||
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt.Uid);
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt);
|
||||
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt);
|
||||
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt);
|
||||
|
||||
// Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200.
|
||||
consumer.DrawRate = 1000;
|
||||
@@ -567,16 +567,16 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
}
|
||||
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3));
|
||||
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt.Uid);
|
||||
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt.Uid);
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt);
|
||||
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt);
|
||||
battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt);
|
||||
|
||||
// Consumer needs 1000 W, supply and battery can only provide 400 each.
|
||||
// BUT the battery has 50% input efficiency, so 50% of the power of the supply gets lost.
|
||||
@@ -643,7 +643,7 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
|
||||
_entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
||||
var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
||||
@@ -651,13 +651,13 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0));
|
||||
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4));
|
||||
|
||||
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1.Uid);
|
||||
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2.Uid);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||
var netBattery1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt1.Uid);
|
||||
var netBattery2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt2.Uid);
|
||||
var battery1 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt1.Uid);
|
||||
var battery2 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt2.Uid);
|
||||
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1);
|
||||
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt);
|
||||
var netBattery1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt1);
|
||||
var netBattery2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt2);
|
||||
var battery1 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt1);
|
||||
var battery2 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt2);
|
||||
|
||||
// There are two loads, 500 W and 1000 W respectively.
|
||||
// The 500 W load is behind a 50% efficient battery,
|
||||
@@ -730,7 +730,7 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
|
||||
_entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
||||
var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
||||
@@ -738,13 +738,13 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0));
|
||||
var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4));
|
||||
|
||||
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1.Uid);
|
||||
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2.Uid);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||
var netBattery1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt1.Uid);
|
||||
var netBattery2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt2.Uid);
|
||||
var battery1 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt1.Uid);
|
||||
var battery2 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt2.Uid);
|
||||
consumer1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt1);
|
||||
consumer2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt2);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt);
|
||||
var netBattery1 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt1);
|
||||
var netBattery2 = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt2);
|
||||
var battery1 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt1);
|
||||
var battery2 = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt2);
|
||||
|
||||
consumer1.DrawRate = 500;
|
||||
consumer2.DrawRate = 1000;
|
||||
@@ -800,16 +800,16 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
}
|
||||
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||
var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3));
|
||||
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt.Uid);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt.Uid);
|
||||
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt.Uid);
|
||||
var battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt.Uid);
|
||||
consumer = IoCManager.Resolve<IEntityManager>().GetComponent<PowerConsumerComponent>(consumerEnt);
|
||||
supplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(supplyEnt);
|
||||
netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(batteryEnt);
|
||||
var battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(batteryEnt);
|
||||
|
||||
// Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200.
|
||||
consumer.DrawRate = 1000;
|
||||
@@ -879,13 +879,13 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var rightEnt = _entityManager.SpawnEntity("CableHV", grid.ToCoordinates(0, 3));
|
||||
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var battery = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||
var batteryNodeContainer = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(battery.Uid);
|
||||
var batteryNodeContainer = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(battery);
|
||||
|
||||
leftNode = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(leftEnt.Uid).GetNode<CableNode>("power");
|
||||
rightNode = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(rightEnt.Uid).GetNode<CableNode>("power");
|
||||
leftNode = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(leftEnt).GetNode<CableNode>("power");
|
||||
rightNode = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(rightEnt).GetNode<CableNode>("power");
|
||||
|
||||
batteryInput = batteryNodeContainer.GetNode<Node>("input");
|
||||
batteryOutput = batteryNodeContainer.GetNode<Node>("output");
|
||||
@@ -931,9 +931,9 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var substationEnt = _entityManager.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1));
|
||||
var apcEnt = _entityManager.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2));
|
||||
|
||||
var generatorSupplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt.Uid);
|
||||
substationNetBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(substationEnt.Uid);
|
||||
apcBattery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(apcEnt.Uid);
|
||||
var generatorSupplier = IoCManager.Resolve<IEntityManager>().GetComponent<PowerSupplierComponent>(generatorEnt);
|
||||
substationNetBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(substationEnt);
|
||||
apcBattery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(apcEnt);
|
||||
|
||||
generatorSupplier.MaxSupply = 1000;
|
||||
generatorSupplier.SupplyRampTolerance = 1000;
|
||||
@@ -973,12 +973,12 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var apcExtensionEnt = _entityManager.SpawnEntity("CableApcExtension", grid.ToCoordinates(0, 0));
|
||||
var powerReceiverEnt = _entityManager.SpawnEntity("ApcPowerReceiverDummy", grid.ToCoordinates(0, 2));
|
||||
|
||||
receiver = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(powerReceiverEnt.Uid);
|
||||
var battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(apcEnt.Uid);
|
||||
apcNetBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(apcEnt.Uid);
|
||||
receiver = IoCManager.Resolve<IEntityManager>().GetComponent<ApcPowerReceiverComponent>(powerReceiverEnt);
|
||||
var battery = IoCManager.Resolve<IEntityManager>().GetComponent<BatteryComponent>(apcEnt);
|
||||
apcNetBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(apcEnt);
|
||||
|
||||
_extensionCableSystem.SetProviderTransferRange(apcExtensionEnt.Uid, 5);
|
||||
_extensionCableSystem.SetReceiverReceptionRange(powerReceiverEnt.Uid, 5);
|
||||
_extensionCableSystem.SetProviderTransferRange(apcExtensionEnt, 5);
|
||||
_extensionCableSystem.SetReceiverReceptionRange(powerReceiverEnt, 5);
|
||||
|
||||
battery.MaxCharge = 10000; //arbitrary nonzero amount of charge
|
||||
battery.CurrentCharge = battery.MaxCharge; //fill battery
|
||||
|
||||
@@ -40,13 +40,13 @@ namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
var mapGrid = mapManager.CreateGrid(mapId);
|
||||
var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mapGridEnt.Uid).WorldPosition = new Vector2(10, 10);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mapGridEnt).WorldPosition = new Vector2(10, 10);
|
||||
mapGrid.SetTile(new Vector2i(0,0), new Tile(1, 512));
|
||||
}
|
||||
{
|
||||
var mapGrid = mapManager.CreateGrid(mapId);
|
||||
var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mapGridEnt.Uid).WorldPosition = new Vector2(-8, -8);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mapGridEnt).WorldPosition = new Vector2(-8, -8);
|
||||
mapGrid.SetTile(new Vector2i(0, 0), new Tile(2, 511));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace Content.IntegrationTests.Tests
|
||||
var grid = mapMan.CreateGrid(mapId);
|
||||
gridEnt = entMan.GetEntity(grid.GridEntityId);
|
||||
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt.Uid, out ShuttleComponent? shuttleComponent));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt.Uid, out PhysicsComponent? physicsComponent));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt, out ShuttleComponent? shuttleComponent));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt, out PhysicsComponent? physicsComponent));
|
||||
Assert.That(physicsComponent!.BodyType, Is.EqualTo(BodyType.Dynamic));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt.Uid).LocalPosition, Is.EqualTo(Vector2.Zero));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt).LocalPosition, Is.EqualTo(Vector2.Zero));
|
||||
physicsComponent.ApplyLinearImpulse(Vector2.One);
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.That<Vector2?>((gridEnt != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt.Uid) : null).LocalPosition, Is.Not.EqualTo(Vector2.Zero));
|
||||
Assert.That<Vector2?>((gridEnt != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt) : null).LocalPosition, Is.Not.EqualTo(Vector2.Zero));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Content.IntegrationTests.Tests.Tag
|
||||
{
|
||||
sMapManager.CreateNewMapEntity(MapId.Nullspace);
|
||||
sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace);
|
||||
sTagComponent = IoCManager.Resolve<IEntityManager>().GetComponent<TagComponent>(sTagDummy.Uid);
|
||||
sTagComponent = IoCManager.Resolve<IEntityManager>().GetComponent<TagComponent>(sTagDummy);
|
||||
});
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Utility
|
||||
{
|
||||
var grid = GetMainGrid(sMapManager);
|
||||
var gridEnt = sEntityManager.GetEntity(grid.GridEntityId);
|
||||
var gridPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt.Uid).WorldPosition;
|
||||
var gridPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt).WorldPosition;
|
||||
var entityCoordinates = GetMainEntityCoordinates(sMapManager);
|
||||
|
||||
// Nothing blocking it, only entity is the grid
|
||||
|
||||
@@ -73,11 +73,15 @@ namespace Content.IntegrationTests.Tests.Utility
|
||||
var mapId = GetMainMapId(mapManager);
|
||||
var mapCoordinates = new MapCoordinates(0, 0, mapId);
|
||||
|
||||
var validComponent = entityManager.SpawnEntity("ValidComponentDummy", mapCoordinates).Uid;
|
||||
var validTag = entityManager.SpawnEntity("ValidTagDummy", mapCoordinates).Uid;
|
||||
IEntity tempQualifier = entityManager.SpawnEntity("ValidComponentDummy", mapCoordinates);
|
||||
var validComponent = (EntityUid) tempQualifier;
|
||||
IEntity tempQualifier1 = entityManager.SpawnEntity("ValidTagDummy", mapCoordinates);
|
||||
var validTag = (EntityUid) tempQualifier1;
|
||||
|
||||
var invalidComponent = entityManager.SpawnEntity("InvalidComponentDummy", mapCoordinates).Uid;
|
||||
var invalidTag = entityManager.SpawnEntity("InvalidTagDummy", mapCoordinates).Uid;
|
||||
IEntity tempQualifier2 = entityManager.SpawnEntity("InvalidComponentDummy", mapCoordinates);
|
||||
var invalidComponent = (EntityUid) tempQualifier2;
|
||||
IEntity tempQualifier3 = entityManager.SpawnEntity("InvalidTagDummy", mapCoordinates);
|
||||
var invalidTag = (EntityUid) tempQualifier3;
|
||||
|
||||
// Test instantiated on its own
|
||||
var whitelistInst = new EntityWhitelist
|
||||
@@ -99,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Utility
|
||||
|
||||
// Test from serialized
|
||||
var dummy = entityManager.SpawnEntity("WhitelistDummy", mapCoordinates);
|
||||
var whitelistSer = IoCManager.Resolve<IEntityManager>().GetComponent<ItemSlotsComponent>(dummy.Uid).Slots.Values.First().Whitelist;
|
||||
var whitelistSer = IoCManager.Resolve<IEntityManager>().GetComponent<ItemSlotsComponent>(dummy).Slots.Values.First().Whitelist;
|
||||
Assert.That(whitelistSer, Is.Not.Null);
|
||||
|
||||
Assert.That(whitelistSer.Components, Is.Not.Null);
|
||||
|
||||
Reference in New Issue
Block a user