Inline Transform
This commit is contained in:
@@ -103,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.False(actionBlocker.CanMove(human.Uid));
|
||||
Assert.False(actionBlocker.CanChangeDirection(human.Uid));
|
||||
Assert.False(standingState.Down(human.Uid));
|
||||
Assert.That((human.Transform.WorldPosition - chair.Transform.WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length));
|
||||
Assert.That((IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(chair.Uid).WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length));
|
||||
|
||||
// Side effects of buckling for the strap
|
||||
Assert.That(strap.BuckledEntities, Does.Contain(human));
|
||||
@@ -171,7 +171,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.False(buckle.Buckled);
|
||||
|
||||
// Move away from the chair
|
||||
human.Transform.WorldPosition += (1000, 1000);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).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
|
||||
human.Transform.WorldPosition = chair.Transform.WorldPosition + (0.5f, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(chair.Uid).WorldPosition + (0.5f, 0);
|
||||
|
||||
// In range
|
||||
Assert.True(buckle.TryBuckle(human, chair));
|
||||
@@ -200,7 +200,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.True(buckle.TryBuckle(human, chair));
|
||||
|
||||
// Move away from the chair
|
||||
human.Transform.WorldPosition += (1, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition += (1, 0);
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
@@ -333,7 +333,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.True(buckle.Buckled);
|
||||
|
||||
// Move the buckled entity away
|
||||
human.Transform.WorldPosition += (100, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).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
|
||||
human.Transform.WorldPosition -= (100, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition -= (100, 0);
|
||||
|
||||
// Buckle
|
||||
Assert.True(buckle.TryBuckle(human, chair));
|
||||
|
||||
@@ -77,10 +77,11 @@ namespace Content.IntegrationTests.Tests
|
||||
await _server.WaitPost(() =>
|
||||
{
|
||||
var gridEnt = mapManager.GetAllGrids().First().GridEntityId;
|
||||
worldPos = serverEntManager.GetEntity(gridEnt).Transform.WorldPosition;
|
||||
IEntity tempQualifier = serverEntManager.GetEntity(gridEnt);
|
||||
worldPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Uid).WorldPosition;
|
||||
|
||||
var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f));
|
||||
ent.Transform.LocalRotation = angle;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ent.Uid).LocalRotation = angle;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(ent.Uid).Scale = (scale, scale);
|
||||
entity = ent.Uid;
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Content.IntegrationTests.Tests.Destructible
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var coordinates = sDestructibleEntity.Transform.Coordinates;
|
||||
var coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(sDestructibleEntity.Uid).Coordinates;
|
||||
var bruteDamageGroup = sPrototypeManager.Index<DamageGroupPrototype>("TestBrute");
|
||||
DamageSpecifier bruteDamage = new(bruteDamageGroup,50);
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Content.IntegrationTests.Tests.Disposal
|
||||
human = entityManager.SpawnEntity("HumanDummy", coordinates);
|
||||
wrench = entityManager.SpawnEntity("WrenchDummy", coordinates);
|
||||
disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates);
|
||||
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", disposalUnit.Transform.MapPosition);
|
||||
disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalUnit.Uid).MapPosition);
|
||||
|
||||
// Test for components existing
|
||||
ref DisposalUnitComponent? comp = ref unit!;
|
||||
@@ -151,14 +151,14 @@ namespace Content.IntegrationTests.Tests.Disposal
|
||||
Assert.True(IoCManager.Resolve<IEntityManager>().HasComponent<DisposalEntryComponent>(disposalTrunk.Uid));
|
||||
|
||||
// Can't insert, unanchored and unpowered
|
||||
unit.Owner.Transform.Anchored = false;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(unit.Owner.Uid).Anchored = false;
|
||||
UnitInsertContains(unit, false, human, wrench, disposalUnit, disposalTrunk);
|
||||
});
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
// Anchor the disposal unit
|
||||
unit.Owner.Transform.Anchored = true;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(unit.Owner.Uid).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
|
||||
disposalTrunk.Transform.WorldPosition += (1, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalTrunk.Uid).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
|
||||
disposalTrunk.Transform.WorldPosition -= (1, 0);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(disposalTrunk.Uid).WorldPosition -= (1, 0);
|
||||
|
||||
// Fail to flush with a mob and an item, no power
|
||||
Flush(unit, false, human, wrench);
|
||||
|
||||
@@ -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(physicsDummy.Transform.MapPosition.X - 1) > 0.01f));
|
||||
await server.WaitAssertion(() => Assert.That(Math.Abs(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(physicsDummy.Uid).MapPosition.X - 1) > 0.01f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
cuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates);
|
||||
secondCuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates);
|
||||
|
||||
human.Transform.WorldPosition = otherHuman.Transform.WorldPosition;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(otherHuman.Uid).WorldPosition;
|
||||
|
||||
// Test for components existing
|
||||
ref CuffableComponent? comp = ref cuffed!;
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs
|
||||
{
|
||||
// drop the item, and the item actions should go away
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<HandsComponent>(serverPlayerEnt.Uid)
|
||||
.TryDropEntity(serverFlashlight, serverPlayerEnt.Transform.Coordinates, false);
|
||||
.TryDropEntity(serverFlashlight, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(serverPlayerEnt.Uid).Coordinates, false);
|
||||
Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight.Uid), Is.False);
|
||||
});
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
|
||||
|
||||
// Now let's make the player enter a climbing transitioning state.
|
||||
climbing.IsClimbing = true;
|
||||
climbing.TryMoveTo(human.Transform.WorldPosition, table.Transform.WorldPosition);
|
||||
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);
|
||||
// TODO: Check it's climbing
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Content.IntegrationTests.Tests.Gravity
|
||||
// No gravity without a gravity generator
|
||||
Assert.True(alerts.IsShowingAlert(AlertType.Weightless));
|
||||
|
||||
entityManager.SpawnEntity("GravityGeneratorDummy", human.Transform.Coordinates);
|
||||
entityManager.SpawnEntity("GravityGeneratorDummy", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(human.Uid).Coordinates);
|
||||
});
|
||||
|
||||
// Let WeightlessSystem and GravitySystem tick
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
private static bool IsDescendant(IEntity descendant, IEntity parent)
|
||||
{
|
||||
var tmpParent = descendant.Transform.Parent;
|
||||
var tmpParent = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(descendant.Uid).Parent;
|
||||
while (tmpParent != null)
|
||||
{
|
||||
if (tmpParent.Owner == parent)
|
||||
|
||||
@@ -89,8 +89,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
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, target.Transform.Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
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);
|
||||
Assert.That(attack);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand);
|
||||
@@ -98,7 +98,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
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), user.Transform.MapID));
|
||||
wall = entityManager.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).MapID));
|
||||
});
|
||||
|
||||
await server.WaitRunTicks(1);
|
||||
@@ -161,8 +161,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
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, target.Transform.Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
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);
|
||||
Assert.That(attack, Is.False);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand, Is.False);
|
||||
@@ -170,7 +170,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
});
|
||||
|
||||
@@ -230,8 +230,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
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, target.Transform.Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
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);
|
||||
Assert.That(attack);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand);
|
||||
@@ -239,7 +239,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
Assert.That(interactUsing);
|
||||
});
|
||||
|
||||
@@ -300,8 +300,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
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, target.Transform.Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
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);
|
||||
Assert.That(attack, Is.False);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand, Is.False);
|
||||
@@ -309,7 +309,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
});
|
||||
|
||||
@@ -373,20 +373,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
server.Assert(() =>
|
||||
{
|
||||
Assert.That(container.Insert(user));
|
||||
Assert.That(user.Transform.Parent.Owner, Is.EqualTo(containerEntity));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).Parent.Owner, Is.EqualTo(containerEntity));
|
||||
|
||||
testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity.Uid)); 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, target.Transform.Coordinates, false, target.Uid);
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
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);
|
||||
Assert.That(attack, Is.False);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand, Is.False);
|
||||
|
||||
interactionSystem.DoAttack(user, containerEntity.Transform.Coordinates, false, containerEntity.Uid);
|
||||
interactionSystem.UserInteraction(user, containerEntity.Transform.Coordinates, containerEntity.Uid);
|
||||
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);
|
||||
Assert.That(attack);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
Assert.That(interactHand);
|
||||
@@ -394,10 +394,10 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent<HandsComponent?>(user.Uid, out var hands));
|
||||
Assert.That(hands.PutInHand(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(item.Uid)));
|
||||
|
||||
interactionSystem.UserInteraction(user, target.Transform.Coordinates, target.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(target.Uid).Coordinates, target.Uid);
|
||||
Assert.That(interactUsing, Is.False);
|
||||
|
||||
interactionSystem.UserInteraction(user, containerEntity.Transform.Coordinates, containerEntity.Uid);
|
||||
interactionSystem.UserInteraction(user, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(containerEntity.Uid).Coordinates, containerEntity.Uid);
|
||||
Assert.That(interactUsing, Is.True);
|
||||
});
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Interaction.Helpers;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -51,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 = other.Transform;
|
||||
entityCoordinates = other.Transform.Coordinates;
|
||||
mapCoordinates = other.Transform.MapPosition;
|
||||
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;
|
||||
});
|
||||
|
||||
await server.WaitIdleAsync();
|
||||
@@ -82,7 +83,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
|
||||
|
||||
// Move them slightly apart
|
||||
origin.Transform.LocalPosition += _interactionRangeDivided15X;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin.Uid).LocalPosition += _interactionRangeDivided15X;
|
||||
|
||||
// Entity <-> Entity
|
||||
Assert.True(origin.InRangeUnobstructed(other));
|
||||
@@ -106,7 +107,7 @@ namespace Content.IntegrationTests.Tests.Interaction
|
||||
|
||||
|
||||
// Move them out of range
|
||||
origin.Transform.LocalPosition += _interactionRangeDivided15X;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin.Uid).LocalPosition += _interactionRangeDivided15X;
|
||||
|
||||
// Entity <-> Entity
|
||||
Assert.False(origin.InRangeUnobstructed(other));
|
||||
|
||||
@@ -70,12 +70,12 @@ namespace Content.IntegrationTests.Tests.PDA
|
||||
Assert.NotNull(id);
|
||||
|
||||
// Put PDA in hand
|
||||
var dummyPda = sEntityManager.SpawnEntity(PdaDummy, player.Transform.MapPosition);
|
||||
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 pdaComponent = IoCManager.Resolve<IEntityManager>().GetComponent<PDAComponent>(dummyPda.Uid);
|
||||
var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition);
|
||||
var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player.Uid).MapPosition);
|
||||
|
||||
var itemSlots = IoCManager.Resolve<IEntityManager>().GetComponent<ItemSlotsComponent>(dummyPda.Uid);
|
||||
sEntityManager.EntitySysManager.GetEntitySystem<ItemSlotsSystem>()
|
||||
@@ -90,7 +90,7 @@ namespace Content.IntegrationTests.Tests.PDA
|
||||
Assert.That(id, Is.EqualTo(pdaContainedId));
|
||||
|
||||
// Put ID card in hand
|
||||
var idDummy = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition);
|
||||
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);
|
||||
|
||||
|
||||
@@ -499,7 +499,7 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
}
|
||||
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||
@@ -567,7 +567,7 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
}
|
||||
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||
@@ -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));
|
||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
||||
var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
||||
@@ -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));
|
||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1));
|
||||
var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3));
|
||||
@@ -800,7 +800,7 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
}
|
||||
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||
var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0));
|
||||
@@ -879,7 +879,7 @@ namespace Content.IntegrationTests.Tests.Power
|
||||
var rightEnt = _entityManager.SpawnEntity("CableHV", grid.ToCoordinates(0, 3));
|
||||
|
||||
var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1));
|
||||
terminal.Transform.LocalRotation = Angle.FromDegrees(180);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(terminal.Uid).LocalRotation = Angle.FromDegrees(180);
|
||||
|
||||
var battery = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2));
|
||||
var batteryNodeContainer = IoCManager.Resolve<IEntityManager>().GetComponent<NodeContainerComponent>(battery.Uid);
|
||||
|
||||
@@ -3,6 +3,7 @@ using NUnit.Framework;
|
||||
using Robust.Server.Maps;
|
||||
using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -39,13 +40,13 @@ namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
var mapGrid = mapManager.CreateGrid(mapId);
|
||||
var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId);
|
||||
mapGridEnt.Transform.WorldPosition = new Vector2(10, 10);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mapGridEnt.Uid).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);
|
||||
mapGridEnt.Transform.WorldPosition = new Vector2(-8, -8);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mapGridEnt.Uid).WorldPosition = new Vector2(-8, -8);
|
||||
mapGrid.SetTile(new Vector2i(0, 0), new Tile(2, 511));
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Content.IntegrationTests.Tests
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt.Uid, out ShuttleComponent? shuttleComponent));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().TryGetComponent(gridEnt.Uid, out PhysicsComponent? physicsComponent));
|
||||
Assert.That(physicsComponent!.BodyType, Is.EqualTo(BodyType.Dynamic));
|
||||
Assert.That(gridEnt.Transform.LocalPosition, Is.EqualTo(Vector2.Zero));
|
||||
Assert.That(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt.Uid).LocalPosition, Is.EqualTo(Vector2.Zero));
|
||||
physicsComponent.ApplyLinearImpulse(Vector2.One);
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
Assert.That(gridEnt?.Transform.LocalPosition, Is.Not.EqualTo(Vector2.Zero));
|
||||
Assert.That<Vector2?>((gridEnt != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt.Uid) : null).LocalPosition, Is.Not.EqualTo(Vector2.Zero));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Physics;
|
||||
using Content.Shared.Spawning;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
@@ -46,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Utility
|
||||
{
|
||||
var grid = GetMainGrid(sMapManager);
|
||||
var gridEnt = sEntityManager.GetEntity(grid.GridEntityId);
|
||||
var gridPos = gridEnt.Transform.WorldPosition;
|
||||
var gridPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridEnt.Uid).WorldPosition;
|
||||
var entityCoordinates = GetMainEntityCoordinates(sMapManager);
|
||||
|
||||
// Nothing blocking it, only entity is the grid
|
||||
|
||||
Reference in New Issue
Block a user