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
48 changes: 38 additions & 10 deletions Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,16 @@ protected override void Draw(DrawingHandleScreen handle)
// Lua decrypt mod start
var allowBlip = !hideLabel;
if (effectiveHideLabelShuttle) allowBlip = true;

const float FullScaleDistance = 512f;
const float MinDistanceScale = 0.35f;
var maxScaleRange = MathF.Max(WorldMaxRange, FullScaleDistance + 1f);
var scaledMousePos = GetMouseCoordinatesFromCenter().Position * UIScale;
var isHovered = Vector2.Distance(scaledMousePos, uiPosition * UIScale) < 30f;
var distanceScale = isHovered || worldDist <= FullScaleDistance
? 1f
: MathF.Max(MinDistanceScale, 1f - (worldDist - FullScaleDistance) / (maxScaleRange - FullScaleDistance) * (1f - MinDistanceScale));

Texture? vesselIcon = null;
var blipScale = 1f;
if (EntManager.TryGetComponent<VesselComponent>(gUid, out var vesselComp))
Expand Down Expand Up @@ -488,7 +498,7 @@ protected override void Draw(DrawingHandleScreen handle)
if (cache.TryGetResource<TextureResource>(blipComp.Icon, out var texRes))
{
var tex = texRes.Texture;
var s = (RadarBlipSize * UIScale) * blipComp.Scale;
var s = (RadarBlipSize * UIScale) * blipComp.Scale * distanceScale;
var half = new Vector2(s / 2f, s / 2f);
var box = new UIBox2(uiPosition * UIScale - half, uiPosition * UIScale + half);
handle.DrawTextureRect(tex, box, labelColor);
Expand All @@ -500,7 +510,7 @@ protected override void Draw(DrawingHandleScreen handle)
}
else if (allowBlip && vesselIcon != null)
{
var s = (RadarBlipSize * UIScale) * blipScale;
var s = (RadarBlipSize * UIScale) * blipScale * distanceScale;
var half = new Vector2(s / 2f, s / 2f);
var box = new UIBox2(uiPosition * UIScale - half, uiPosition * UIScale + half);
handle.DrawTextureRect(vesselIcon, box, labelColor);
Expand Down Expand Up @@ -528,15 +538,16 @@ protected override void Draw(DrawingHandleScreen handle)
// Calculate unscaled offsets. + Lua decrypt md start
var lines = labelText.Split('\n');
var mainLabel = lines[0];
var mainDim = cipherName ? GetCipherDimensions(handle, mainLabel, 1f) : handle.GetDimensions(Font, mainLabel, 1f);
var dimScale = 0.9f * distanceScale;
var mainDim = cipherName ? GetCipherDimensions(handle, mainLabel, dimScale) : handle.GetDimensions(Font, mainLabel, dimScale);
var labelDimensions = mainDim;
if (lines.Length > 1)
{
var otherDim = handle.GetDimensions(Font, lines[1], 1f);
var otherDim = handle.GetDimensions(Font, lines[1], dimScale);
labelDimensions = new Vector2(Math.Max(labelDimensions.X, otherDim.X), labelDimensions.Y + otherDim.Y);
}
// Lua decrypt mod end
var blipSize = RadarBlipSize * 0.7f;
var blipSize = RadarBlipSize * 0.7f * distanceScale;
var labelOffset = new Vector2()
{
X = uiPosition.X > Width / 2f
Expand All @@ -560,19 +571,20 @@ protected override void Draw(DrawingHandleScreen handle)
displayColor = compColor;
}

if (cipherName) DrawCipherString(handle, (uiPosition + labelOffset) * UIScale, mainLabel, UIScale * 0.9f, displayColor); //Lua decrypt mod
else handle.DrawString(Font, (uiPosition + labelOffset) * UIScale, mainLabel, UIScale * 0.9f, displayColor); //Lua decrypt mod
var textScale = UIScale * 0.9f * distanceScale;
if (cipherName) DrawCipherString(handle, (uiPosition + labelOffset) * UIScale, mainLabel, textScale, displayColor); //Lua decrypt mod
else handle.DrawString(Font, (uiPosition + labelOffset) * UIScale, mainLabel, textScale, displayColor); //Lua decrypt mod

// Draw company label if present
if (lines.Length > 1)
{
var companyLabel = lines[1];
var companyLabelOffset = new Vector2(
labelOffset.X,
labelOffset.Y + handle.GetDimensions(Font, mainLabel, 0.9f).Y
labelOffset.Y + handle.GetDimensions(Font, mainLabel, textScale).Y
);

handle.DrawString(Font, (uiPosition + companyLabelOffset) * UIScale, companyLabel, UIScale * 0.9f, displayColor);
handle.DrawString(Font, (uiPosition + companyLabelOffset) * UIScale, companyLabel, textScale, displayColor);
}

if (isMouseOver && !HideCoords)
Expand Down Expand Up @@ -746,7 +758,23 @@ protected override void Draw(DrawingHandleScreen handle)
var handledByLuaStyle = false;
DrawLuaRadarBlip(handle, blip.NetUid, blip.SonarEcho, blipPosInView, blip.Scale * 3f, blip.Color.WithAlpha(0.8f), blip.Shape, ref handledByLuaStyle);
if (!handledByLuaStyle)
DrawBlipShape(handle, blipPosInView, blip.Scale * 3f, blip.Color.WithAlpha(0.8f), blip.Shape);
{
var blipEnt = EntManager.GetEntity(blip.NetUid);
if (blipEnt != EntityUid.Invalid && EntManager.TryGetComponent<RadarBlipIconComponent>(blipEnt, out var blipIcon) && blipIcon.Icon != default)
{
var cache = IoCManager.Resolve<IResourceCache>();
if (cache.TryGetResource<TextureResource>(blipIcon.Icon, out var texRes))
{
var s = blip.Scale * 3.5f * blipIcon.Scale;
var half = new Vector2(s / 2f, s / 2f);
var box = new UIBox2(blipPosInView - half, blipPosInView + half);
handle.DrawTextureRect(texRes.Texture, box);
handledByLuaStyle = true;
}
}
if (!handledByLuaStyle)
DrawBlipShape(handle, blipPosInView, blip.Scale * 3f, blip.Color.WithAlpha(0.8f), blip.Shape);
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions Content.Client/_Mono/FireControl/UI/FireControlWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
<Button Name="RefreshButton" Access="Public" Text="{Loc admin-logs-refresh}"
StyleClasses="ButtonSquare" Margin="2 2 2 2"/>
</PanelContainer>
<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>

<!-- Weapons Control Section -->
<controls:StripeBack MinSize="48 48" Margin="0 0 0 0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public FireControlWindow()
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
RefreshButton.OnPressed += _ => OnServerRefresh?.Invoke();
ShowIFFCheckbox.OnToggled += args => NavRadar.ShowIFF = args.Pressed;
SelectAllButton.OnPressed += SelectAllWeapons;
UnselectAllButton.OnPressed += UnselectAllWeapons;
SelectBallisticButton.OnPressed += SelectBallisticWeapons;
Expand Down
2 changes: 0 additions & 2 deletions Content.Server/Fluids/EntitySystems/SpraySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Content.Server.Fluids.Components;
using Content.Server.Gravity;
using Content.Server.Popups;
using Content.Shared._Mono.Radar;
using Content.Shared.CCVar;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.FixedPoint;
Expand Down Expand Up @@ -159,7 +158,6 @@ public void Spray(Entity<SprayComponent> entity, EntityUid user, MapCoordinates
var ent = (vapor, vaporComponent);
_vapor.TryAddSolution(ent, newSolution);

EnsureComp<RadarBlipComponent>(vapor);
// impulse direction is defined in world-coordinates, not local coordinates
var impulseDirection = rotation.ToVec();
var time = diffLength / entity.Comp.SprayVelocity;
Expand Down
19 changes: 0 additions & 19 deletions Content.Server/Movement/Systems/JetpackSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared._Mono.Radar;
using Content.Shared.Atmos.Components;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
Expand All @@ -19,9 +18,6 @@ public override void Initialize()
{
base.Initialize();

// Subscribe to ActiveJetpackComponent events
SubscribeLocalEvent<ActiveJetpackComponent, ComponentStartup>(OnJetpackActivated);
SubscribeLocalEvent<ActiveJetpackComponent, ComponentShutdown>(OnJetpackDeactivated);
}

protected override bool CanEnable(EntityUid uid, JetpackComponent component)
Expand All @@ -31,21 +27,6 @@ protected override bool CanEnable(EntityUid uid, JetpackComponent component)
!(gasTank.Air.TotalMoles < component.MoleUsage);
}

/// <summary>
/// Adds radar blip to jetpacks when they are activated
/// </summary>
private void OnJetpackActivated(EntityUid uid, ActiveJetpackComponent component, ComponentStartup args)
{
if (TryComp<RadarBlipComponent>(uid, out var blip))
blip.Enabled = true;
}

private void OnJetpackDeactivated(EntityUid uid, ActiveJetpackComponent component, ComponentShutdown args)
{
if (TryComp<RadarBlipComponent>(uid, out var blip))
blip.Enabled = false;
}

public override void Update(float frameTime)
{
base.Update(frameTime);
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Shuttles/Systems/ShuttleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server._NF.Shuttles.Components; // Frontier
using Content.Shared._Lua.ShipCpu.Components; // Lua
using Content.Server.Administration.Logs;
using Content.Server.Body.Systems;
using Content.Server.Buckle.Systems;
Expand Down Expand Up @@ -116,6 +117,7 @@ private void OnGridInit(GridInitializeEvent ev)

EnsureComp<ShuttleComponent>(ev.EntityUid);
EnsureComp<ImplicitRoofComponent>(ev.EntityUid);
EnsureComp<ShipCpuLimitComponent>(ev.EntityUid); // Lua: лимит тайлов CPU
}

private void OnShuttleStartup(EntityUid uid, ShuttleComponent component, ComponentStartup args)
Expand Down
18 changes: 2 additions & 16 deletions Content.Server/_Goobstation/Vehicles/VehicleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
using Content.Shared.Buckle.Components;
using Content.Shared._Goobstation.Vehicles; // Frontier: migrate under _Goobstation
using Content.Shared._Mono.Radar; // Frontier

namespace Content.Server._Goobstation.Vehicles; // Frontier: migrate under _Goobstation

public sealed class VehicleSystem : SharedVehicleSystem
{
/// <summary>
/// Configures the radar blip for a vehicle entity.
/// </summary>
protected override void OnStrapped(Entity<VehicleComponent> ent, ref StrappedEvent args)
{
base.OnStrapped(ent, ref args);
EnsureComp<RadarBlipComponent>(ent);
}

protected override void OnUnstrapped(Entity<VehicleComponent> ent, ref UnstrappedEvent args)
{
if (ent.Comp.Driver == args.Buckle.Owner)
{ RemComp<RadarBlipComponent>(ent); }
base.OnUnstrapped(ent, ref args);
}

protected override void HandleEmag(Entity<VehicleComponent> ent)
{
RemComp<RadarBlipComponent>(ent);
}
protected override void HandleEmag(Entity<VehicleComponent> ent) { }

protected override void HandleUnemag(Entity<VehicleComponent> ent)
{
if (ent.Comp.Driver != null)
EnsureComp<RadarBlipComponent>(ent);
}
protected override void HandleUnemag(Entity<VehicleComponent> ent) { }
}
74 changes: 74 additions & 0 deletions Content.Server/_Lua/ShipCpu/ShipCpuSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// LuaCorp - This file is licensed under AGPLv3
// Copyright (c) 2026 LuaCorp
// See AGPLv3.txt for details.

using Content.Shared._Lua.ShipCpu.Components;
using Robust.Shared.Map.Components;

namespace Content.Server._Lua.ShipCpu;

public sealed class ShipCpuSystem : EntitySystem
{
[Dependency] private readonly SharedTransformSystem _transform = default!;
public const int DefaultMaxTiles = 81;
public const int DefaultMaxSide = 9;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ShipCpuComponent, AnchorStateChangedEvent>(OnAnchorChanged);
SubscribeLocalEvent<ShipCpuComponent, ComponentShutdown>(OnCpuShutdown);
}

private void OnAnchorChanged(Entity<ShipCpuComponent> cpu, ref AnchorStateChangedEvent args)
{
var xform = Transform(cpu.Owner);
var gridUid = _transform.GetGrid((cpu.Owner, xform));
if (gridUid == null || !HasComp<MapGridComponent>(gridUid.Value))
return;

RecalculateCpuLimit(gridUid.Value);
}

private void OnCpuShutdown(Entity<ShipCpuComponent> cpu, ref ComponentShutdown args)
{
var xform = Transform(cpu.Owner);
var gridUid = _transform.GetGrid((cpu.Owner, xform));
if (gridUid == null || !HasComp<MapGridComponent>(gridUid.Value))
return;

RecalculateCpuLimitExcluding(gridUid.Value, cpu.Owner);
}

public void RecalculateCpuLimit(EntityUid gridUid)
{
RecalculateCpuLimitExcluding(gridUid, EntityUid.Invalid);
}

private void RecalculateCpuLimitExcluding(EntityUid gridUid, EntityUid excludeEntity)
{
var maxTiles = DefaultMaxTiles;
var maxSide = DefaultMaxSide;
var unlimited = false;
var cpuQuery = AllEntityQuery<ShipCpuComponent, TransformComponent>();
while (cpuQuery.MoveNext(out var uid, out var cpu, out var xform))
{
if (uid == excludeEntity) continue;
if (!xform.Anchored) continue;
if (_transform.GetGrid((uid, xform)) != gridUid) continue;
if (cpu.Unlimited)
{
unlimited = true;
break;
}
if (cpu.MaxTiles > maxTiles) maxTiles = cpu.MaxTiles;
if (cpu.MaxSide > maxSide) maxSide = cpu.MaxSide;
}
var limit = EnsureComp<ShipCpuLimitComponent>(gridUid);
limit.MaxTiles = maxTiles;
limit.MaxSide = maxSide;
limit.Unlimited = unlimited;
Dirty(gridUid, limit);
}
}
5 changes: 5 additions & 0 deletions Content.Server/_Lua/Stargate/PlanetaryRCDSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public override void Initialize()

private void OnAttemptPlanetaryRCDUse(AttemptPlanetaryRCDUseEvent ev)
{
if (HasComp<StargateDestinationComponent>(ev.GridUid))
{
ev.Allowed = true;
return;
}
var mapUid = _transform.GetParentUid(ev.GridUid);
ev.Allowed = HasComp<StargateDestinationComponent>(mapUid);
}
Expand Down
Loading
Loading