Make more uids nullable (#5794)

This commit is contained in:
Leon Friedrich
2021-12-26 15:32:45 +13:00
committed by GitHub
parent 83114de0e4
commit afc3ae6335
42 changed files with 161 additions and 204 deletions

View File

@@ -51,7 +51,7 @@ namespace Content.Client.Popups
PopupMessage(message, _eyeManager.CoordinatesToScreen(transform.Coordinates));
}
public void PopupMessage(string message, ScreenCoordinates coordinates, EntityUid entity = default)
public void PopupMessage(string message, ScreenCoordinates coordinates, EntityUid? entity = null)
{
var label = new PopupLabel(_eyeManager, EntityManager)
{
@@ -146,7 +146,7 @@ namespace Content.Client.Popups
public float TimeLeft { get; private set; }
public Vector2 InitialPos { get; set; }
public EntityUid Entity { get; set; }
public EntityUid? Entity { get; set; }
public PopupLabel(IEyeManager eyeManager, IEntityManager entityManager)
{
@@ -161,9 +161,9 @@ namespace Content.Client.Popups
{
TimeLeft += eventArgs.DeltaSeconds;
var position = Entity == default
var position = Entity == null
? InitialPos
: (_eyeManager.CoordinatesToScreen(_entityManager.GetComponent<TransformComponent>(Entity).Coordinates).Position / UIScale) - DesiredSize / 2;
: (_eyeManager.CoordinatesToScreen(_entityManager.GetComponent<TransformComponent>(Entity.Value).Coordinates).Position / UIScale) - DesiredSize / 2;
LayoutContainer.SetPosition(this, position - (0, 20 * (TimeLeft * TimeLeft + TimeLeft)));