Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 44 additions & 28 deletions Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Content.Client.Station; // Frontier
using Content.Client._NF.Radar; // Frontier
using Content.Client._Mono.Radar; // Forge-change: take BlipsSystem from _Mono

namespace Content.Client.Shuttles.UI;

Expand Down Expand Up @@ -56,15 +56,16 @@ public sealed partial class ShuttleNavControl : BaseShuttleControl

private List<Entity<MapGridComponent>> _grids = new();

public ShuttleNavControl() : base(64f, 256f, 256f)
// Forge-change: up distance for ship fights
public ShuttleNavControl() : base(64f, 512f, 512f)
{
RobustXamlLoader.Load(this);
_shuttles = EntManager.System<SharedShuttleSystem>();
_transform = EntManager.System<SharedTransformSystem>();

// Frontier
_station = EntManager.System<StationSystem>();
_blips = EntManager.System<RadarBlipSystem>();//Mono
_blips = EntManager.System<RadarBlipsSystem>(); // Forge-change: take BlipsSystem from _Mono

OnMouseEntered += HandleMouseEntered;
OnMouseExited += HandleMouseExited;
Expand Down Expand Up @@ -340,7 +341,7 @@ protected override void Draw(DrawingHandleScreen handle)
}
}

NFAddBlipToList(blipDataList, isOutsideRadarCircle, uiPosition, uiXCentre, uiYCentre, labelColor); // Frontier code
NFAddBlipToList(blipDataList, isOutsideRadarCircle, uiPosition, uiXCentre, uiYCentre, labelColor, gUid); // Frontier code
// End Frontier: IFF drawing functions
}

Expand Down Expand Up @@ -445,6 +446,8 @@ protected override void Draw(DrawingHandleScreen handle)
NFDrawBlips(handle, blipDataList);
// End Frontier: draw target

DrawShields(handle, xform, worldToShuttle); // Forge-change

// If we've set the controlling console, and it's on a different grid
// to the shuttle itself, then draw an additional marker to help the
// player determine where they are relative to the shuttle.
Expand All @@ -468,44 +471,57 @@ protected override void Draw(DrawingHandleScreen handle)
handle.DrawLine(origin, origin + angle.ToVec() * ScaledMinimapRadius * 1.42f, Color.Red.WithAlpha(0.1f));

// Get raw blips with grid information
var rawBlips = _blips.GetRawBlips();
var rawBlips = _blips.GetCurrentBlips(); // Forge-change: GetCurrentBlips>GetRawBlips

// Prepare view bounds for culling
var blipViewBounds = new Box2(-3f, -3f, Size.X + 3f, Size.Y + 3f);
var blipViewBounds = new Box2(-3f, -3f, Size.X + 3f, Size.Y + 3f); // Forge-change: take BlipsSystem from _Mono

// Draw blips using the same grid-relative transformation approach as docks
foreach (var blip in rawBlips)
{
Vector2 blipPosInView;
var blipPosInView = Vector2.Transform(_transform.ToMapCoordinates(blip.Position).Position, worldToShuttle * shuttleToView);

// Handle differently based on if there's a grid
if (blip.Grid == null)
// Forge-change-start: take BlipsSystem from _Mono
// Check if this blip is within view bounds before drawing
if (blipViewBounds.Contains(blipPosInView))
{
// For world-space blips without a grid, use standard world transformation
blipPosInView = Vector2.Transform(blip.Position, worldToShuttle * shuttleToView);
DrawBlipShape(handle, blipPosInView, blip.Scale * 3f, blip.Color.WithAlpha(0.8f), blip.Shape);
}
else if (EntManager.TryGetEntity(blip.Grid, out var gridEntity))
{
// For grid-relative blips, transform using the grid's transform
var gridToWorld = _transform.GetWorldMatrix(gridEntity.Value);
var gridToView = gridToWorld * worldToShuttle * shuttleToView;
// Forge-change-end
}

// Transform the grid-local position
blipPosInView = Vector2.Transform(blip.Position, gridToView);
}
else
{
// Skip blips with invalid grid references
continue;
}
// Forge-change-start: take BlipsSystem from _Mono
// Draw hitscan lines from the radar blips system
var hitscanLines = _blips.GetHitscanLines();
foreach (var line in hitscanLines)
{
var startPosInView = Vector2.Transform(line.Start, worldToShuttle * shuttleToView);
var endPosInView = Vector2.Transform(line.End, worldToShuttle * shuttleToView);

// Check if this blip is within view bounds before drawing
if (blipViewBounds.Contains(blipPosInView))
// Only draw lines if at least one endpoint is within view
if (blipViewBounds.Contains(startPosInView) || blipViewBounds.Contains(endPosInView))
{
DrawBlipShape(handle, blipPosInView, blip.Scale * 3f, blip.Color.WithAlpha(0.8f), blip.Shape);
// Draw the line with the specified thickness and color
handle.DrawLine(startPosInView, endPosInView, line.Color);

// For thicker lines, draw multiple lines side by side
if (line.Thickness > 1.0f)
{
// Calculate perpendicular vector for thickness
var dir = (endPosInView - startPosInView).Normalized();
var perpendicular = new Vector2(-dir.Y, dir.X) * 0.5f;

// Draw additional lines for thickness
for (float i = 1; i <= line.Thickness; i += 1.0f)
{
var offset = perpendicular * i;
handle.DrawLine(startPosInView + offset, endPosInView + offset, line.Color);
handle.DrawLine(startPosInView - offset, endPosInView - offset, line.Color);
}
}
}
}
// End Frontier
// Forge-change-end
}

private void DrawDocks(DrawingHandleScreen handle, EntityUid uid, Matrix3x2 gridToView)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/UserInterface/Controls/ConfirmButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected override void FrameUpdate(FrameEventArgs args)
DrawModeChanged();
}

if (Disabled && _gameTiming.CurTime > _nextCooldown)
if (IsConfirming && Disabled && _gameTiming.CurTime > _nextCooldown) // Forge-change: take from _Mono:388
Disabled = false;
}

Expand Down
100 changes: 42 additions & 58 deletions Content.Client/_Mono/FireControl/UI/FireControlNavControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Content.Shared.Shuttles.Components;
using Content.Shared.Shuttles.Systems;
using Content.Shared._Crescent.ShipShields;
using Content.Shared._NF.Radar;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
Expand All @@ -24,7 +23,8 @@
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Timing;
using Content.Client._NF.Radar;
using Content.Client._Mono.Radar;
using Content.Shared._Mono.Radar;

namespace Content.Client._Mono.FireControl.UI;

Expand All @@ -33,7 +33,7 @@ public sealed class FireControlNavControl : BaseShuttleControl
[Dependency] private readonly IMapManager _mapManager = default!;
private readonly SharedShuttleSystem _shuttles;
private readonly SharedTransformSystem _transform;
private readonly RadarBlipSystem _blips;
private readonly RadarBlipsSystem _blips;
private readonly SharedPhysicsSystem _physics;

private EntityCoordinates? _coordinates;
Expand Down Expand Up @@ -67,12 +67,13 @@ public sealed class FireControlNavControl : BaseShuttleControl
private float _lastCursorUpdateTime = 0f;
private const float CursorUpdateInterval = 0.1f; // 10 updates per second

public FireControlNavControl() : base(64f, 768f, 768f)
// Forge-change: 512>768
public FireControlNavControl() : base(64f, 512f, 512f)
{
IoCManager.InjectDependencies(this);
_shuttles = EntManager.System<SharedShuttleSystem>();
_transform = EntManager.System<SharedTransformSystem>();
_blips = EntManager.System<RadarBlipSystem>();
_blips = EntManager.System<RadarBlipsSystem>();
_physics = EntManager.System<SharedPhysicsSystem>();

OnMouseEntered += HandleMouseEntered;
Expand Down Expand Up @@ -321,31 +322,33 @@ protected override void Draw(DrawingHandleScreen handle)
var origin = ScalePosition(-new Vector2(Offset.X, -Offset.Y));
handle.DrawLine(origin, origin + angle.ToVec() * ScaledMinimapRadius * 1.42f, Color.Red.WithAlpha(0.1f));

var blips = _blips.GetCurrentBlips();
// Get raw blips with grid information
var rawBlips = _blips.GetCurrentBlips();

foreach (var blip in blips)
// Prepare view bounds for culling
var blipViewBounds = new Box2(-3f, -3f, Size.X + 3f, Size.Y + 3f);

// Draw blips using the same grid-relative transformation approach as docks
foreach (var blip in rawBlips)
{
var blipPos = Vector2.Transform(blip.Item1, worldToShuttle * shuttleToView);
var blipPos = Vector2.Transform(_transform.ToMapCoordinates(blip.Position).Position, worldToShuttle * shuttleToView);

if (blip.Item4 == RadarBlipShape.Ring)
{
DrawShieldRing(handle, blipPos, blip.Item2, blip.Item3.WithAlpha(0.8f));
}
else
// Check if this blip is within view bounds before drawing
if (blipViewBounds.Contains(blipPos))
{
// For other shapes, use the regular drawing method
DrawBlipShape(handle, blipPos, blip.Item2 * 3f, blip.Item3.WithAlpha(0.8f), blip.Item4);
DrawBlipShape(handle, blipPos, blip.Scale * 3f, blip.Color.WithAlpha(0.8f), blip.Shape);
}

// Forge-change
if (_isMouseInside && _controllables != null)
{
var worldPos = blip.Item1;
var worldPos = _transform.ToMapCoordinates(blip.Position).Position;

var isFireControllable = _controllables.Any(c =>
{
var coords = EntManager.GetCoordinates(c.Coordinates);
var entityMapPos = _transform.ToMapCoordinates(coords);
return Vector2.Distance(entityMapPos.Position, worldPos) < 0.1f &&
_selectedWeapons.Contains(c.NetEntity);
_selectedWeapons.Contains(c.NetEntity);
});

if (isFireControllable)
Expand All @@ -363,59 +366,40 @@ protected override void Draw(DrawingHandleScreen handle)

if (!results.Any())
{
handle.DrawLine(blipPos, cursorViewPos, blip.Item3.WithAlpha(0.3f));
handle.DrawLine(blipPos, cursorViewPos, blip.Item4.WithAlpha(0.3f));
}
}
}
}

// Draw hitscan lines from the radar blips system
var hitscanLines = _blips.GetRawHitscanLines();
var hitscanLines = _blips.GetHitscanLines();
foreach (var line in hitscanLines)
{
Vector2 startPosInView;
Vector2 endPosInView;
var startPosInView = Vector2.Transform(line.Start, worldToShuttle * shuttleToView);
var endPosInView = Vector2.Transform(line.End, worldToShuttle * shuttleToView);

// Handle differently based on if there's a grid
if (line.Grid == null)
{
// For world-space lines without a grid, use standard world transformation
startPosInView = Vector2.Transform(line.Start, worldToShuttle * shuttleToView);
endPosInView = Vector2.Transform(line.End, worldToShuttle * shuttleToView);
}
else
// Only draw lines if at least one endpoint is within view
if (blipViewBounds.Contains(startPosInView) || blipViewBounds.Contains(endPosInView))
{
// For grid-relative lines, we need to transform from grid space to world space first
var gridEntity = EntManager.GetEntity(line.Grid.Value);
if (EntManager.TryGetComponent<TransformComponent>(gridEntity, out var gridXform))
{
var gridToWorld = _transform.GetWorldMatrix(gridEntity);
var gridStartWorld = Vector2.Transform(line.Start, gridToWorld);
var gridEndWorld = Vector2.Transform(line.End, gridToWorld);
// Draw the line with the specified thickness and color
handle.DrawLine(startPosInView, endPosInView, line.Color);

startPosInView = Vector2.Transform(gridStartWorld, worldToShuttle * shuttleToView);
endPosInView = Vector2.Transform(gridEndWorld, worldToShuttle * shuttleToView);
}
else
// For thicker lines, draw multiple lines side by side
if (line.Thickness > 1.0f)
{
// Fallback to treating as world coordinates if grid transform is not available
startPosInView = Vector2.Transform(line.Start, worldToShuttle * shuttleToView);
endPosInView = Vector2.Transform(line.End, worldToShuttle * shuttleToView);
}
}

// Check if the line is within the view bounds before drawing
var viewBounds = new Box2(-3f, -3f, Size.X + 3f, Size.Y + 3f);
var lineBounds = new Box2(
Math.Min(startPosInView.X, endPosInView.X),
Math.Min(startPosInView.Y, endPosInView.Y),
Math.Max(startPosInView.X, endPosInView.X),
Math.Max(startPosInView.Y, endPosInView.Y)
);
// Calculate perpendicular vector for thickness
var dir = (endPosInView - startPosInView).Normalized();
var perpendicular = new Vector2(-dir.Y, dir.X) * 0.5f;

if (viewBounds.Intersects(lineBounds))
{
handle.DrawLine(startPosInView, endPosInView, line.Color.WithAlpha(0.8f));
// Draw additional lines for thickness
for (float i = 1; i <= line.Thickness; i += 1.0f)
{
var offset = perpendicular * i;
handle.DrawLine(startPosInView + offset, endPosInView + offset, line.Color);
handle.DrawLine(startPosInView - offset, endPosInView - offset, line.Color);
}
}
}
}

Expand Down
Loading
Loading