Skip to content
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
17 changes: 17 additions & 0 deletions Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,23 @@ protected override void Draw(DrawingHandleScreen handle)
}
}

// Draw missile lines from the radar blips system
var missileLines = _blips.GetMissileLines();
foreach (var line in missileLines)
{
var startPos = new Vector2(line.PositionStart.X, line.PositionStart.Y);
var startEnd = new Vector2(line.PositionEnd.X, line.PositionEnd.Y);
var startPosInView = Vector2.Transform(startPos, worldToView);
var endPosInView = Vector2.Transform(startEnd, worldToView);

// Only draw lines if at least one endpoint is within view
if (monoViewBounds.Contains(startPosInView) || monoViewBounds.Contains(endPosInView))
{
// Draw the line with the specified thickness and color
handle.DrawLine(startPosInView, endPosInView, line.Color);
}
}

// Draw hitscan lines from the radar blips system
var hitscanLines = _blips.GetHitscanLines();
foreach (var line in hitscanLines)
Expand Down
43 changes: 36 additions & 7 deletions Content.Client/_Mono/FireControl/UI/FireControlWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,8 @@
<Button Name="RefreshButton" Access="Public" Text="{Loc admin-logs-refresh}"
StyleClasses="ButtonSquare" Margin="2 2 2 2"/>
</PanelContainer>

<!-- Forge-Change-Start -->
<PanelContainer VerticalExpand="False" HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="4" BorderColor="#2e2e2e" BackgroundColor="#1c1c1c" />
</PanelContainer.PanelOverride>
<CheckBox Name="ShowIFFCheckbox" Access="Public" Text="{Loc 'gunnery-show-iff'}"
Margin="4 2 2 2" Pressed="True"/>
</PanelContainer>

<!-- Shield status -->
<PanelContainer Name="ShieldPanel" Visible="False" VerticalExpand="False" HorizontalExpand="True">
Expand All @@ -52,6 +46,7 @@
<shields:ShipShieldBar Name="ShieldBar" HorizontalExpand="True" MinHeight="20"/>
</BoxContainer>
</PanelContainer>

<!-- Forge-Change-End -->

<!-- Weapons Control Section -->
Expand Down Expand Up @@ -93,6 +88,40 @@
</BoxContainer>
</PanelContainer>

<!-- LuaM-Change-Start -->

<!-- IFF-and-Dock-toggles -->
<PanelContainer VerticalExpand="False" HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="4" BorderColor="#262626" BackgroundColor="#111111" />
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Horizontal" MinWidth="256" MaxWidth="256" HorizontalExpand="False" Margin="2 3 2 3">
<PanelContainer VerticalExpand="False" HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="4" BorderColor="#2e2e2e" BackgroundColor="#1c1c1c" />
</PanelContainer.PanelOverride>
<Button Name="IFFToggle" Access="Public" Text="{Loc 'shuttle-console-iff-toggle'}"
StyleClasses="ButtonSquare" HorizontalExpand="True" Margin="4 4" ToggleMode="True"/>
</PanelContainer>
</BoxContainer>
</PanelContainer>
<PanelContainer VerticalExpand="False" HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="4" BorderColor="#262626" BackgroundColor="#111111" />
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Horizontal" MinWidth="256" MaxWidth="256" HorizontalExpand="False" Margin="2 3 2 3">
<PanelContainer VerticalExpand="False" HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="4" BorderColor="#2e2e2e" BackgroundColor="#1c1c1c" />
</PanelContainer.PanelOverride>
<Button Name="DockToggle" Access="Public" Text="{Loc 'shuttle-console-dock-toggle'}"
StyleClasses="ButtonSquare" HorizontalExpand="True" Margin="4 4" ToggleMode="True"/>
</PanelContainer>
</BoxContainer>
</PanelContainer>

<!-- LuaM-Change-End -->

<!-- Weapons List -->
<PanelContainer VerticalExpand="True" Margin="0 3 0 3">
<PanelContainer.PanelOverride>
Expand Down
19 changes: 18 additions & 1 deletion Content.Client/_Mono/FireControl/UI/FireControlWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ public FireControlWindow()
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
RefreshButton.OnPressed += _ => OnServerRefresh?.Invoke();
ShowIFFCheckbox.OnToggled += args => NavRadar.ShowIFF = args.Pressed; // Forge-Change
SelectAllButton.OnPressed += SelectAllWeapons;
Comment thread
Pcolik505 marked this conversation as resolved.
UnselectAllButton.OnPressed += UnselectAllWeapons;
SelectBallisticButton.OnPressed += SelectBallisticWeapons;
SelectEnergyButton.OnPressed += SelectEnergyWeapons;
SelectMissileButton.OnPressed += SelectMissileWeapons;

IFFToggle.OnToggled += OnIFFTogglePressed;
IFFToggle.Pressed = NavRadar.ShowIFF;

DockToggle.OnToggled += OnDockTogglePressed;
DockToggle.Pressed = NavRadar.ShowDocks;
Comment thread
Pcolik505 marked this conversation as resolved.
}

private void SelectAllWeapons(BaseButton.ButtonEventArgs args)
Expand Down Expand Up @@ -139,6 +144,18 @@ private void SelectMissileWeapons(BaseButton.ButtonEventArgs args)
UpdateAllWeaponButtonTexts();
}

private void OnIFFTogglePressed(BaseButton.ButtonEventArgs args)
{
NavRadar.ShowIFF ^= true;
args.Button.Pressed = NavRadar.ShowIFF;
}

private void OnDockTogglePressed(BaseButton.ButtonEventArgs args)
{
NavRadar.ShowDocks ^= true;
args.Button.Pressed = NavRadar.ShowDocks;
}

Comment on lines +147 to +158

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private void OnIFFTogglePressed(BaseButton.ButtonEventArgs args)
{
NavRadar.ShowIFF ^= true;
args.Button.Pressed = NavRadar.ShowIFF;
}
private void OnDockTogglePressed(BaseButton.ButtonEventArgs args)
{
NavRadar.ShowDocks ^= true;
args.Button.Pressed = NavRadar.ShowDocks;
}
# LuaM-start:
private void OnIFFTogglePressed(BaseButton.ButtonEventArgs args)
{
NavRadar.ShowIFF ^= true;
args.Button.Pressed = NavRadar.ShowIFF;
}
private void OnDockTogglePressed(BaseButton.ButtonEventArgs args)
{
NavRadar.ShowDocks ^= true;
args.Button.Pressed = NavRadar.ShowDocks;
}
# LuaM-end.

/// <summary>
/// Updates the text of a weapon button based on its selection state and manual reload status.
/// </summary>
Expand Down
54 changes: 54 additions & 0 deletions Content.Client/_Mono/Radar/RadarBlipsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ public sealed partial class RadarBlipsSystem : EntitySystem

private TimeSpan _lastUpdatedTime;
private List<BlipNetData> _blips = new();
private List<MissileVectorNetData> _missiles = new();
private List<HitscanNetData> _hitscans = new();
private List<BlipConfig> _configPalette = new();

// cached results to avoid allocating on every draw/frame
private readonly List<BlipData> _cachedBlipData = new();
private readonly List<MissileVectorData> _cachedMissileData = new();

public override void Initialize()
{
Expand All @@ -35,6 +37,7 @@ private void HandleReceiveBlips(GiveBlipsEvent ev, EntitySessionEventArgs args)
{
_configPalette = ev.ConfigPalette;
_blips = ev.Blips;
_missiles = ev.Missiles;
_hitscans = ev.HitscanLines;
_lastUpdatedTime = _timing.CurTime;
}
Expand Down Expand Up @@ -101,6 +104,49 @@ public List<BlipData> GetCurrentBlips()
return _cachedBlipData;
}

/// <summary>
/// Gets the missile vectors to be rendered on the radar
/// </summary>
public List<MissileVectorData> GetMissileLines()
{
// clear the cache and bail early if the data is stale
_cachedMissileData.Clear();
if (_timing.CurTime.TotalSeconds - _lastUpdatedTime.TotalSeconds > BlipStaleSeconds)
return _cachedMissileData;

// populate the cached list instead of allocating a new one each frame
foreach (var missile in _missiles)
{
var tiedBlip = _blips.FirstOrDefault(x => x.Uid == missile.Uid);
var coord = tiedBlip.Position;
var color = Color.FromHex("#00AACC");
var colorArcs = Color.FromHex("#FF0040");

var predictedPosStart = new NetCoordinates(missile.Uid, coord.Position + tiedBlip.Vel * (float)(_timing.CurTime - _lastUpdatedTime).TotalSeconds);
var posEnd = Vector2.Create(
predictedPosStart.X + (missile.Range / 2) * (float)Math.Cos(tiedBlip.Rotation + Math.PI * -0.5),
predictedPosStart.Y + (missile.Range / 2) * (float)Math.Sin(tiedBlip.Rotation + Math.PI * -0.5));
var predictedPosEnd = new NetCoordinates(missile.Uid, posEnd);

_cachedMissileData.Add(new(missile.Uid, predictedPosStart, predictedPosEnd, color));
if (missile.ScanArc > 0)
{
var posEndLeft = Vector2.Create(
predictedPosStart.X + (missile.Range) * (float)Math.Cos(tiedBlip.Rotation + Math.PI * -0.5 - (missile.ScanArc * 0.5)),
predictedPosStart.Y + (missile.Range) * (float)Math.Sin(tiedBlip.Rotation + Math.PI * -0.5 - (missile.ScanArc * 0.5)));
var posEndRight = Vector2.Create(
predictedPosStart.X + (missile.Range) * (float)Math.Cos(tiedBlip.Rotation + Math.PI * -0.5 + (missile.ScanArc * 0.5)),
predictedPosStart.Y + (missile.Range) * (float)Math.Sin(tiedBlip.Rotation + Math.PI * -0.5+ (missile.ScanArc * 0.5)));
var predictedPosLeft = new NetCoordinates(missile.Uid, posEndLeft);
var predictedPosRight = new NetCoordinates(missile.Uid, posEndRight);
_cachedMissileData.Add(new(missile.Uid, predictedPosStart, predictedPosLeft, colorArcs));
_cachedMissileData.Add(new(missile.Uid, predictedPosStart, predictedPosRight, colorArcs));
}
}

return _cachedMissileData;
}

/// <summary>
/// Gets the hitscan lines to be rendered on the radar
/// </summary>
Expand All @@ -121,3 +167,11 @@ public record struct BlipData
EntityUid? GridUid,
BlipConfig Config
);

public record struct MissileVectorData
(
NetEntity NetUid,
NetCoordinates PositionStart,
NetCoordinates PositionEnd,
Color Color
);
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Numerics;
using Content.Shared.Interaction;
using Content.Server.Shuttles.Components;
using Content.Shared.Projectiles;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Components;
Expand Down
15 changes: 14 additions & 1 deletion Content.Server/_Mono/Radar/RadarBlipSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Numerics;
using Content.Server._Mono.Projectiles.TargetSeeking;
using Content.Shared._Mono.Radar;
using Content.Shared.Projectiles;
using Content.Shared.Shuttles.Components;
Expand All @@ -15,6 +16,7 @@ public sealed partial class RadarBlipSystem : EntitySystem

// Pooled collections to avoid per-request heap churn
private readonly List<BlipNetData> _tempBlipsCache = new();
private readonly List<MissileVectorNetData> _tempMissileCache = new();
private readonly List<HitscanNetData> _tempHitscansCache = new();
private readonly List<EntityUid> _tempSourcesCache = new();
private readonly List<BlipConfig> _tempPaletteCache = new();
Expand Down Expand Up @@ -48,10 +50,11 @@ private void OnBlipsRequested(RequestBlipsEvent ev, EntitySessionEventArgs args)
AssembleHitscanReport((EntityUid)radarUid, _tempSourcesCache, radar);

// Combine the blips and hitscan lines
var giveEv = new GiveBlipsEvent(_tempPaletteCache, _tempBlipsCache, _tempHitscansCache);
var giveEv = new GiveBlipsEvent(_tempPaletteCache, _tempBlipsCache, _tempMissileCache, _tempHitscansCache);
RaiseNetworkEvent(giveEv, args.SenderSession);

_tempBlipsCache.Clear();
_tempMissileCache.Clear();
_tempHitscansCache.Clear();
_tempSourcesCache.Clear();
_tempPaletteCache.Clear();
Expand Down Expand Up @@ -128,6 +131,16 @@ private void AssembleBlipsReport(EntityUid uid, List<EntityUid> sources, RadarCo
configIdx,
gridConfigIdx));
}

var missileQuery = EntityQueryEnumerator<TargetSeekingComponent, RadarBlipComponent, TransformComponent>();
while (missileQuery.MoveNext(out var missile, out var seeker, out var missileBlip, out var missileBlipXform))
{
var netMissileUid = GetNetEntity(missile);
var missileArc = MathHelper.DegreesToRadians(seeker.ScanArc);
_tempMissileCache.Add(new(netMissileUid,
(float)(seeker.MaxSpeed * 0.2),
missileArc));
}
}

/// <summary>
Expand Down
15 changes: 15 additions & 0 deletions Content.Shared/_Mono/Radar/RadarMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public sealed class GiveBlipsEvent : EntityEventArgs
/// </summary>
public readonly List<BlipNetData> Blips;

/// <summary>
/// Vectors for missile stuff like arcs, current target, etc
/// </summary>
public readonly List<MissileVectorNetData> Missiles;

/// <summary>
/// Hitscan lines to display on the radar as (start position, end position, thickness, color).
/// </summary>
Expand All @@ -40,10 +45,12 @@ public sealed class GiveBlipsEvent : EntityEventArgs
public GiveBlipsEvent(
List<BlipConfig> configPalette,
List<BlipNetData> blips,
List<MissileVectorNetData> missiles,
List<HitscanNetData> hitscans)
{
ConfigPalette = configPalette;
Blips = blips;
Missiles = missiles;
HitscanLines = hitscans;
}
}
Expand Down Expand Up @@ -80,6 +87,14 @@ public record struct BlipNetData
ushort? OnGridConfigIndex
);

[Serializable, NetSerializable]
public record struct MissileVectorNetData
(
NetEntity Uid,
float Range,
Angle ScanArc
);

[Serializable, NetSerializable]
public record struct HitscanNetData(Vector2 Start, Vector2 End, float Thickness, Color Color);

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Resources/Audio/_LuaM/AdminSound/Quixotic.ogg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions Resources/Audio/_LuaM/AdminSound/attributions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Ready or not //

source: https://music.apple.com/ru/album/ready-or-not-original-soundtrack/1755413766

"Ready or Not - Club (Full Set) - OST - Official Supporter Edition Release"

// Hotline Miami //

source: https://light-club-blizzars.skysound7.com

"The Caretaker - Libet's Delay - antichromatic (128k)"
"Quixotic"
"Carpenter Brut - Le Perv 4"

// Unknown //

source: https://light-club-blizzars.skysound7.com/

"The Palm of The Serpent's Hand"
Binary file not shown.
Loading