Kick mines (real) (#8056)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
committed by
GitHub
parent
2f604ce05c
commit
ebfe5e888f
@@ -10,7 +10,6 @@ using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Popups
|
||||
{
|
||||
@@ -19,6 +18,7 @@ namespace Content.Client.Popups
|
||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IMapManager _map = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly ExamineSystemShared _examineSystem = default!;
|
||||
|
||||
@@ -55,7 +55,13 @@ namespace Content.Client.Popups
|
||||
PopupMessage(message, _eyeManager.CoordinatesToScreen(transform.Coordinates), uid);
|
||||
}
|
||||
|
||||
public void PopupMessage(string message, ScreenCoordinates coordinates, EntityUid? entity = null)
|
||||
private void PopupMessage(string message, ScreenCoordinates coordinates, EntityUid? entity = null)
|
||||
{
|
||||
var mapCoords = _eyeManager.ScreenToMap(coordinates);
|
||||
PopupMessage(message, EntityCoordinates.FromMap(_map, mapCoords), entity);
|
||||
}
|
||||
|
||||
private void PopupMessage(string message, EntityCoordinates coordinates, EntityUid? entity = null)
|
||||
{
|
||||
var label = new PopupLabel(_eyeManager, EntityManager)
|
||||
{
|
||||
@@ -67,8 +73,7 @@ namespace Content.Client.Popups
|
||||
_userInterfaceManager.PopupRoot.AddChild(label);
|
||||
label.Measure(Vector2.Infinity);
|
||||
|
||||
var mapCoordinates = _eyeManager.ScreenToMap(coordinates.Position);
|
||||
label.InitialPos = mapCoordinates;
|
||||
label.InitialPos = coordinates;
|
||||
LayoutContainer.SetPosition(label, label.InitialPos.Position);
|
||||
_aliveLabels.Add(label);
|
||||
}
|
||||
@@ -161,7 +166,7 @@ namespace Content.Client.Popups
|
||||
continue;
|
||||
}
|
||||
|
||||
var otherPos = label.Entity != null ? Transform(label.Entity.Value).MapPosition : label.InitialPos;
|
||||
var otherPos = label.Entity != null ? Transform(label.Entity.Value).MapPosition : label.InitialPos.ToMap(EntityManager);
|
||||
|
||||
if (occluded && !ExamineSystemShared.InRangeUnOccluded(
|
||||
playerPos,
|
||||
@@ -188,7 +193,7 @@ namespace Content.Client.Popups
|
||||
/// <remarks>
|
||||
/// Yes that's right it's not technically MapCoordinates.
|
||||
/// </remarks>
|
||||
public MapCoordinates InitialPos { get; set; }
|
||||
public EntityCoordinates InitialPos { get; set; }
|
||||
public EntityUid? Entity { get; set; }
|
||||
|
||||
public PopupLabel(IEyeManager eyeManager, IEntityManager entityManager)
|
||||
@@ -204,11 +209,12 @@ namespace Content.Client.Popups
|
||||
{
|
||||
TotalTime += eventArgs.DeltaSeconds;
|
||||
|
||||
Vector2 position;
|
||||
ScreenCoordinates screenCoords;
|
||||
|
||||
if (Entity == null)
|
||||
position = _eyeManager.WorldToScreen(InitialPos.Position) / UIScale - DesiredSize / 2;
|
||||
screenCoords = _eyeManager.CoordinatesToScreen(InitialPos);
|
||||
else if (_entityManager.TryGetComponent(Entity.Value, out TransformComponent xform))
|
||||
position = (_eyeManager.CoordinatesToScreen(xform.Coordinates).Position / UIScale) - DesiredSize / 2;
|
||||
screenCoords = _eyeManager.CoordinatesToScreen(xform.Coordinates);
|
||||
else
|
||||
{
|
||||
// Entity has probably been deleted.
|
||||
@@ -217,6 +223,7 @@ namespace Content.Client.Popups
|
||||
return;
|
||||
}
|
||||
|
||||
var position = screenCoords.Position / UIScale - DesiredSize / 2;
|
||||
LayoutContainer.SetPosition(this, position - (0, 20 * (TotalTime * TotalTime + TotalTime)));
|
||||
|
||||
if (TotalTime > 0.5f)
|
||||
|
||||
Reference in New Issue
Block a user