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

@@ -263,7 +263,7 @@ namespace Content.Shared.Interaction.Helpers
bool ignoreInsideBlocker = false)
{
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
var otherPosition = other.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).MapPosition;
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
predicate, ignoreInsideBlocker);
@@ -278,7 +278,7 @@ namespace Content.Shared.Interaction.Helpers
bool ignoreInsideBlocker = false)
{
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
var otherPosition = other.Owner.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner.Uid).MapPosition;
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
predicate, ignoreInsideBlocker);
@@ -293,7 +293,7 @@ namespace Content.Shared.Interaction.Helpers
bool ignoreInsideBlocker = false)
{
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
var otherPosition = other.Owner.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner.Uid).MapPosition;
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
predicate, ignoreInsideBlocker);
@@ -344,7 +344,7 @@ namespace Content.Shared.Interaction.Helpers
Ignored? predicate = null,
bool ignoreInsideBlocker = false)
{
var otherPosition = other.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).MapPosition;
return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate,
ignoreInsideBlocker);
@@ -358,7 +358,7 @@ namespace Content.Shared.Interaction.Helpers
Ignored? predicate = null,
bool ignoreInsideBlocker = false)
{
var otherPosition = other.Owner.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner.Uid).MapPosition;
return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate,
ignoreInsideBlocker);
@@ -372,7 +372,7 @@ namespace Content.Shared.Interaction.Helpers
Ignored? predicate = null,
bool ignoreInsideBlocker = false)
{
var otherPosition = other.Owner.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner.Uid).MapPosition;
return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate,
ignoreInsideBlocker);

View File

@@ -204,7 +204,7 @@ namespace Content.Shared.Interaction.Helpers
bool ignoreInsideBlocker = true)
{
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
var otherPosition = other.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).MapPosition;
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
predicate, ignoreInsideBlocker);
@@ -218,7 +218,7 @@ namespace Content.Shared.Interaction.Helpers
bool ignoreInsideBlocker = true)
{
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
var otherPosition = other.Owner.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner.Uid).MapPosition;
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
predicate, ignoreInsideBlocker);
@@ -232,7 +232,7 @@ namespace Content.Shared.Interaction.Helpers
bool ignoreInsideBlocker = true)
{
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
var otherPosition = other.Owner.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner.Uid).MapPosition;
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
predicate, ignoreInsideBlocker);
@@ -280,7 +280,7 @@ namespace Content.Shared.Interaction.Helpers
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
{
var otherPosition = other.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).MapPosition;
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
ignoreInsideBlocker);
@@ -293,7 +293,7 @@ namespace Content.Shared.Interaction.Helpers
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
{
var otherPosition = other.Owner.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner.Uid).MapPosition;
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
ignoreInsideBlocker);
@@ -306,7 +306,7 @@ namespace Content.Shared.Interaction.Helpers
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
{
var otherPosition = other.Owner.Transform.MapPosition;
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner.Uid).MapPosition;
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
ignoreInsideBlocker);

View File

@@ -36,7 +36,7 @@ namespace Content.Shared.Interaction
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
public bool TryFaceCoordinates(IEntity user, Vector2 coordinates)
{
var diff = coordinates - user.Transform.MapPosition.Position;
var diff = coordinates - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).MapPosition.Position;
if (diff.LengthSquared <= 0.01f)
return true;
var diffAngle = Angle.FromWorldVec(diff);
@@ -47,7 +47,7 @@ namespace Content.Shared.Interaction
{
if (_actionBlockerSystem.CanChangeDirection(user.Uid))
{
user.Transform.WorldRotation = diffAngle;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user.Uid).WorldRotation = diffAngle;
return true;
}
else
@@ -64,7 +64,7 @@ namespace Content.Shared.Interaction
// (Since the user being buckled to it holds it down with their weight.)
// This is logically equivalent to RotateWhileAnchored.
// Barstools and office chairs have independent wheels, while regular chairs don't.
rotatable.Owner.Transform.WorldRotation = diffAngle;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(rotatable.Owner.Uid).WorldRotation = diffAngle;
return true;
}
}

View File

@@ -213,7 +213,7 @@ namespace Content.Shared.Interaction
bool popup = false)
{
predicate ??= e => e == origin || e == other;
return InRangeUnobstructed(origin, other.Transform.MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup);
return InRangeUnobstructed(origin, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Uid).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup);
}
/// <summary>
@@ -345,7 +345,7 @@ namespace Content.Shared.Interaction
bool ignoreInsideBlocker = false,
bool popup = false)
{
var originPosition = origin.Transform.MapPosition;
var originPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin.Uid).MapPosition;
predicate ??= e => e == origin;
var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, predicate, ignoreInsideBlocker);
@@ -678,7 +678,7 @@ namespace Content.Shared.Interaction
return;
}
item.Transform.LocalRotation = Angle.Zero;
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(item.Uid).LocalRotation = Angle.Zero;
var comps = IoCManager.Resolve<IEntityManager>().GetComponents<IDropped>(item.Uid).ToList();