Inline Transform

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 14:20:34 +01:00
parent 69b270017b
commit a5b57c8e10
283 changed files with 742 additions and 709 deletions

View File

@@ -59,23 +59,23 @@ namespace Content.Client.DoAfter
foreach (var comp in EntityManager.EntityQuery<DoAfterComponent>(true))
{
var doAfters = comp.DoAfters.ToList();
var compPos = comp.Owner.Transform.WorldPosition;
var compPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).WorldPosition;
if (doAfters.Count == 0 ||
comp.Owner.Transform.MapID != _attachedEntity.Transform.MapID ||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).MapID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).MapID ||
!viewbox.Contains(compPos))
{
comp.Disable();
continue;
}
var range = (compPos - _attachedEntity.Transform.WorldPosition).Length +
var range = (compPos - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).WorldPosition).Length +
0.01f;
if (comp.Owner != _attachedEntity &&
!ExamineSystemShared.InRangeUnOccluded(
_attachedEntity.Transform.MapPosition,
comp.Owner.Transform.MapPosition, range,
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity.Uid).MapPosition,
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).MapPosition, range,
entity => entity == comp.Owner || entity == _attachedEntity))
{
comp.Disable();
@@ -84,7 +84,7 @@ namespace Content.Client.DoAfter
comp.Enable();
var userGrid = comp.Owner.Transform.Coordinates;
var userGrid = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner.Uid).Coordinates;
// Check cancellations / finishes
foreach (var (id, doAfter) in doAfters)
@@ -117,7 +117,7 @@ namespace Content.Client.DoAfter
if (doAfter.BreakOnTargetMove)
{
if (EntityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) &&
!targetEntity.Transform.Coordinates.InRange(EntityManager, doAfter.TargetGrid,
!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(targetEntity.Uid).Coordinates.InRange(EntityManager, doAfter.TargetGrid,
doAfter.MovementThreshold))
{
comp.Cancel(id, currentTime);

View File

@@ -166,8 +166,8 @@ namespace Content.Client.DoAfter.UI
return;
}
if (_eyeManager.CurrentMap != AttachedEntity.Transform.MapID ||
!AttachedEntity.Transform.Coordinates.IsValid(_entityManager))
if (_eyeManager.CurrentMap != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(AttachedEntity.Uid).MapID ||
!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(AttachedEntity.Uid).Coordinates.IsValid(_entityManager))
{
Visible = false;
return;
@@ -217,7 +217,7 @@ namespace Content.Client.DoAfter.UI
RemoveDoAfter(id);
}
var screenCoordinates = _eyeManager.CoordinatesToScreen(AttachedEntity.Transform.Coordinates);
var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(AttachedEntity.Uid).Coordinates);
_playerPosition = new ScreenCoordinates(screenCoordinates.Position / UIScale, screenCoordinates.Window);
LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f));
}