Fix popups appearing at 0,0 (#8221)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -43,7 +43,10 @@ namespace Content.Client.Popups
|
||||
|
||||
public void PopupCoordinates(string message, EntityCoordinates coordinates)
|
||||
{
|
||||
PopupMessage(message, _eyeManager.CoordinatesToScreen(coordinates));
|
||||
var mapCoords = coordinates.ToMap(EntityManager);
|
||||
if (_eyeManager.CurrentMap != mapCoords.MapId)
|
||||
return;
|
||||
PopupMessage(message, _eyeManager.MapToScreen(mapCoords));
|
||||
}
|
||||
|
||||
public void PopupEntity(string message, EntityUid uid)
|
||||
@@ -52,6 +55,9 @@ namespace Content.Client.Popups
|
||||
return;
|
||||
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(uid);
|
||||
if (_eyeManager.CurrentMap != transform.MapID)
|
||||
return; // TODO: entity may be outside of PVS, but enter PVS at a later time. So the pop-up should still get tracked?
|
||||
|
||||
PopupMessage(message, _eyeManager.CoordinatesToScreen(transform.Coordinates), uid);
|
||||
}
|
||||
|
||||
@@ -217,12 +223,13 @@ namespace Content.Client.Popups
|
||||
screenCoords = _eyeManager.CoordinatesToScreen(xform.Coordinates);
|
||||
else
|
||||
{
|
||||
// Entity has probably been deleted.
|
||||
Visible = false;
|
||||
TotalTime += PopupLifetime;
|
||||
if (Entity != null && _entityManager.Deleted(Entity))
|
||||
TotalTime += PopupLifetime;
|
||||
return;
|
||||
}
|
||||
|
||||
Visible = true;
|
||||
var position = screenCoords.Position / UIScale - DesiredSize / 2;
|
||||
LayoutContainer.SetPosition(this, position - (0, 20 * (TotalTime * TotalTime + TotalTime)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user