Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds more utilities to the weapon pad #189

Merged
merged 2 commits into from
Nov 9, 2023
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
21 changes: 18 additions & 3 deletions Content.Client/Shuttles/UI/RadarControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public sealed class RadarControl : MapGridControl

private Dictionary<EntityUid, List<DockingInterfaceState>> _docks = new();

private EntityCoordinates? _clickedCoordinates = null;

public bool ShowIFF { get; set; } = true;
public bool ShowDocks { get; set; } = true;

Expand All @@ -60,6 +62,10 @@ public sealed class RadarControl : MapGridControl
public RadarControl() : base(64f, 256f, 256f)
{
_transform = _entManager.System<SharedTransformSystem>();
OnRadarClick += coordinates =>
{
_clickedCoordinates = coordinates;
};
}

public void SetMatrix(EntityCoordinates? coordinates, Angle? angle)
Expand Down Expand Up @@ -189,12 +195,21 @@ protected override void Draw(DrawingHandleScreen handle)
DrawDocks(handle, ourGridId.Value, matrix);
}

var invertedPosition = _coordinates.Value.Position - offset;
invertedPosition.Y = -invertedPosition.Y;
var padPosition = _coordinates.Value.Position;
var consolePosition = _coordinates.Value.Position - padPosition;
padPosition.Y = -padPosition.Y;
consolePosition.Y = -consolePosition.Y;
// Don't need to transform the InvWorldMatrix again as it's already offset to its position.

// Draw radar position on the station
handle.DrawCircle(ScalePosition(invertedPosition), 5f, Color.Lime);
handle.DrawCircle(ScalePosition(padPosition), 5f, Color.Blue);
handle.DrawCircle(ScalePosition(consolePosition), 5f, Color.BlueViolet);
if (_clickedCoordinates.HasValue)
{
var cc = _clickedCoordinates.Value.Position - offset;
cc.Y = -cc.Y;
handle.DrawCircle(ScalePosition(cc), 5f, Color.Orange);
}

var shown = new HashSet<EntityUid>();

Expand Down
7 changes: 6 additions & 1 deletion Content.Client/_FTL/ShipWeapons/GunnerConsoleWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ public void SetMatrix(EntityCoordinates? coordinates, Angle? angle)
public void UpdateState(GunnerConsoleBoundInterfaceState scc)
{
// update the radar
var radarState = new RadarConsoleBoundInterfaceState(scc.MaxRange, scc.Coordinates, scc.Angle, scc.Weapons);
var radarState = new RadarConsoleBoundInterfaceState(
scc.MaxRange,
scc.Coordinates,
scc.Angle,
scc.Weapons
);
RadarScreen.UpdateState(radarState);

// update ammo text
Expand Down
10 changes: 8 additions & 2 deletions Content.Server/_FTL/ShipWeapons/ShipWeaponsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ private void OnPerformActionWeapon(EntityUid uid, GunnerConsoleComponent compone
case ShipWeaponAction.Chamber:
break;
}

}
}
UpdateUserInterface(uid, component);
Expand Down Expand Up @@ -146,7 +145,14 @@ private void UpdateUserInterface(EntityUid uid, GunnerConsoleComponent? componen
}

var range = radar?.MaxRange ?? SharedRadarConsoleSystem.DefaultMaxRange;
var state = new GunnerConsoleBoundInterfaceState(remainingAmmo, totalAmmo, range, weapons, _entityManager.GetNetCoordinates(consoleTransform.Coordinates), consoleTransform.LocalRotation);
var state = new GunnerConsoleBoundInterfaceState(
remainingAmmo,
totalAmmo,
range,
weapons,
_entityManager.GetNetCoordinates(consoleTransform.Coordinates),
consoleTransform.LocalRotation
);
_userInterface.TrySetUiState(uid, ShipWeaponTargetingUiKey.Key, state);
}

Expand Down
4 changes: 2 additions & 2 deletions Resources/Locale/en-US/_ftl/ship-weapons.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ gunner-console-button-fire-text = Fire
gunner-console-button-chamber-text = Chamber Guns
gunner-console-button-eject-text = Eject Mags

signal-port-name-weapons-output = Weapon Output Port
signal-port-name-weapons-output = Pad Control Port
signal-port-name-weapons-output-description = Link the output port to the input port here.

signal-port-name-weapons-input = Weapon Input Port
signal-port-name-weapons-input = Weapon Control Port
signal-port-name-weapons-input-description = Link the input port to the output port here.
Loading