Replace xform.WorldPosition with xformSystem method for Setting/Getting (#30029)

* GET WORLD POSITON, ROTATION

* Missing parentheses

* ui system depndency

* the issue

* Unused

* Let the function do the transform

---------

Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
Plykiya
2024-08-06 04:02:01 -07:00
committed by GitHub
parent 7b3ff00129
commit a87efd7d01
35 changed files with 89 additions and 59 deletions

View File

@@ -16,6 +16,7 @@ namespace Content.Client.Chat.UI
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] protected readonly IConfigurationManager ConfigManager = default!;
private readonly SharedTransformSystem _transformSystem;
public enum SpeechType : byte
{
@@ -83,6 +84,7 @@ namespace Content.Client.Chat.UI
{
IoCManager.InjectDependencies(this);
_senderEntity = senderEntity;
_transformSystem = _entityManager.System<SharedTransformSystem>();
// Use text clipping so new messages don't overlap old ones being pushed up.
RectClipContent = true;
@@ -140,7 +142,7 @@ namespace Content.Client.Chat.UI
}
var offset = (-_eyeManager.CurrentEye.Rotation).ToWorldVec() * -EntityVerticalOffset;
var worldPos = xform.WorldPosition + offset;
var worldPos = _transformSystem.GetWorldPosition(xform) + offset;
var lowerCenter = _eyeManager.WorldToScreen(worldPos) / UIScale;
var screenPos = lowerCenter - new Vector2(ContentSize.X / 2, ContentSize.Y + _verticalOffsetAchieved);