Skip to content

Commit

Permalink
Ports Abductors from Starlight (Goob-Station#1415)
Browse files Browse the repository at this point in the history
Co-authored-by: Piras314 <[email protected]>
  • Loading branch information
gluesniffler and Piras314 authored Jan 15, 2025
1 parent 008c42e commit 3dbb539
Show file tree
Hide file tree
Showing 350 changed files with 8,110 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public StatusControl(NetworkConfiguratorComponent configurator, string keyBindin
_configurator = configurator;
_keyBindingName = keyBindingName;
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
AddChild(_label);
if (_configurator.ShowLabel) // Shitmed - Starlight Abductors: Allow hiding the label on multitools that dont need List mode.
AddChild(_label);
}

protected override void FrameUpdate(FrameEventArgs args)
Expand All @@ -126,6 +127,9 @@ protected override void FrameUpdate(FrameEventArgs args)

_linkModeActive = _configurator.LinkModeActive;

if (!_configurator.ShowLabel) // Shitmed - Starlight Abductors: Allow hiding the label on multitools that dont need List mode.
return;

var modeLocString = _linkModeActive??false
? "network-configurator-examine-mode-link"
: "network-configurator-examine-mode-list";
Expand Down
9 changes: 9 additions & 0 deletions Content.Client/Silicons/StationAi/StationAiOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Robust.Shared.Physics;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Content.Shared.Movement.Components; // Shitmed - Starlight Abductors Change

namespace Content.Client.Silicons.StationAi;

Expand Down Expand Up @@ -50,6 +51,14 @@ protected override void Draw(in OverlayDrawArgs args)
var worldBounds = args.WorldBounds;

var playerEnt = _player.LocalEntity;

// Shitmed - Starlight Abductors Change Start
if (_entManager.TryGetComponent(playerEnt, out StationAiOverlayComponent? stationAiOverlay)
&& stationAiOverlay.AllowCrossGrid
&& _entManager.TryGetComponent(playerEnt, out RelayInputMoverComponent? relay))
playerEnt = relay.RelayEntity;
// Shitmed Change End

_entManager.TryGetComponent(playerEnt, out TransformComponent? playerXform);
var gridUid = playerXform?.GridUid ?? EntityUid.Invalid;
_entManager.TryGetComponent(gridUid, out MapGridComponent? grid);
Expand Down
130 changes: 130 additions & 0 deletions Content.Client/_Shitmed/Antags/Abductor/AbductorCameraConsoleBui.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
using Content.Shared._Shitmed.Antags.Abductor;
using Content.Client._Shitmed.Choice.UI;
using JetBrains.Annotations;
using static Content.Shared.Pinpointer.SharedNavMapSystem;

namespace Content.Client._Shitmed.Antags.Abductor;

[UsedImplicitly]
public sealed class AbductorCameraConsoleBui : BoundUserInterface
{
[ViewVariables]
private AbductorCameraConsoleWindow? _window;
private int? _station;
public AbductorCameraConsoleBui(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open() => UpdateState(State);
protected override void UpdateState(BoundUserInterfaceState? state)
{
if (state is AbductorCameraConsoleBuiState s)
Update(s);
}

private void Update(AbductorCameraConsoleBuiState state)
{
TryInitWindow();

View(ViewType.Stations);

RefreshUI();

if (!_window!.IsOpen)
_window.OpenCentered();
}

private void TryInitWindow()
{
if (_window != null) return;
_window = new AbductorCameraConsoleWindow();
_window.OnClose += Close;
_window.Title = "Intercepted cameras.";

_window.StationsButton.OnPressed += _ =>
{
_station = null;
View(ViewType.Stations);
};
}

private void OnStationPressed(int station, List<NavMapBeacon> beacons)
{
if (_window == null)
return;

_station = station;

foreach (var beacon in beacons)
{
var beaconButton = new ChoiceControl();

beaconButton.Set(beacon.Text, null);
beaconButton.Button.Modulate = beacon.Color;
beaconButton.Button.OnPressed += _ =>
{
SendMessage(new AbductorBeaconChosenBuiMsg()
{
Beacon = beacon,
});
Close();
};
_window.Beacons.AddChild(beaconButton);
}
View(ViewType.Beacons);
}

private void RefreshUI()
{
if (_window == null || State is not AbductorCameraConsoleBuiState state)
return;

_window!.Stations.DisposeAllChildren();
_window.Beacons.DisposeAllChildren();

foreach (var station in state.Stations)
{
var stationButton = new ChoiceControl();

stationButton.Set(station.Value.Name, null);
stationButton.Button.OnPressed += _ => OnStationPressed(station.Key, station.Value.Beacons);

_window.Stations.AddChild(stationButton);

if (station.Key == _station) OnStationPressed(station.Key, station.Value.Beacons);
}
}

private void View(ViewType type)
{
if (_window == null)
return;

_window.StationsButton.Parent!.Margin = new Thickness(0, 0, 0, 10);

_window.Stations.Visible = type == ViewType.Stations;
_window.StationsButton.Visible = true;

_window.Beacons.Visible = type == ViewType.Beacons;
_window.BeaconsButton.Disabled = type != ViewType.Beacons;

_window.Title = State is not AbductorCameraConsoleBuiState state
|| _station == null
|| !state.Stations.TryGetValue(_station.Value, out var station)
? "Stations"
: $"Station - {station.Name}";
}

private enum ViewType
{
Stations,
Beacons,
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

if (disposing)
_window?.Dispose();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<controls:AbductorCameraConsoleWindow
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client._Shitmed.Antags.Abductor"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
MinSize="400 400">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="0 0 0 10">
<Button Name="StationsButton" Access="Public" Text="&lt; Stations"
HorizontalExpand="True" StyleClasses="OpenBoth" />
<Button Name="BeaconsButton" Access="Public" Text="{Loc 'abductors-ui-beacons'}"
HorizontalExpand="True" StyleClasses="OpenBoth" />
</BoxContainer>
<cc:HSeparator/>
<ScrollContainer VScrollEnabled="True" HorizontalExpand="True" VerticalExpand="True">
<BoxContainer Name="Stations" Access="Public" Orientation="Vertical" Visible="False" />
<BoxContainer Name="Beacons" Access="Public" Orientation="Vertical" Visible="False" />
</ScrollContainer>
</BoxContainer>
</controls:AbductorCameraConsoleWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._Shitmed.Antags.Abductor;
[GenerateTypedNameReferences]
public sealed partial class AbductorCameraConsoleWindow : DefaultWindow
{
public AbductorCameraConsoleWindow() => RobustXamlLoader.Load(this);
}
118 changes: 118 additions & 0 deletions Content.Client/_Shitmed/Antags/Abductor/AbductorConsoleBui.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
using Content.Shared._Shitmed.Antags.Abductor;
using JetBrains.Annotations;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.RichText;
using Robust.Shared.Utility;
using static Content.Shared.Pinpointer.SharedNavMapSystem;

namespace Content.Client._Shitmed.Antags.Abductor;

[UsedImplicitly]
public sealed class AbductorConsoleBui : BoundUserInterface
{
[Dependency] private readonly IEntityManager _entities = default!;

[ViewVariables]
private AbductorConsoleWindow? _window;
public AbductorConsoleBui(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{

}
protected override void Open() => UpdateState(State);
protected override void UpdateState(BoundUserInterfaceState? state)
{
if (state is AbductorConsoleBuiState s)
Update(s);
}

private void Update(AbductorConsoleBuiState state)
{
TryInitWindow();

View(ViewType.Teleport);

RefreshUI();

if (!_window!.IsOpen)
_window.OpenCentered();
}

private void TryInitWindow()
{
if (_window != null) return;
_window = new AbductorConsoleWindow();
_window.OnClose += Close;
_window.Title = "console";

_window.TeleportTabButton.OnPressed += _ => View(ViewType.Teleport);

_window.ExperimentTabButton.OnPressed += _ => View(ViewType.Experiment);
}

private void RefreshUI()
{
if (_window == null || State is not AbductorConsoleBuiState state)
return;

// teleportTab
_window.TargetLabel.Children.Clear();

var padMsg = new FormattedMessage();
padMsg.AddMarkupOrThrow(state.AlienPadFound ? "pad: [color=green]connected[/color]" : "pad: [color=red]not found[/color]");
_window.PadLabel.SetMessage(padMsg);

var msg = new FormattedMessage();
msg.AddMarkupOrThrow(state.Target == null ? "target: [color=red]NONE[/color]" : $"target: [color=green]{state.TargetName}[/color]");
_window.TeleportButton.Disabled = state.Target == null || !state.AlienPadFound;
_window.TeleportButton.OnPressed += _ =>
{
SendMessage(new AbductorAttractBuiMsg());
Close();
};
_window.TargetLabel.SetMessage(msg, new Type[1] { typeof(ColorTag) });

// experiment tab

var experimentatorMsg = new FormattedMessage();
experimentatorMsg.AddMarkupOrThrow(state.AlienPadFound ? "experimentator: [color=green]connected[/color]" : "experimentator: [color=red]not found[/color]");
_window.ExperimentatorLabel.SetMessage(experimentatorMsg);

var victimMsg = new FormattedMessage();
victimMsg.AddMarkupOrThrow(state.VictimName == null ? "victim: [color=red]NONE[/color]" : $"victim: [color=green]{state.VictimName}[/color]");
_window.VictimLabel.SetMessage(victimMsg);

_window.CompleteExperimentButton.Disabled = state.VictimName == null;
_window.CompleteExperimentButton.OnPressed += _ =>
{
SendMessage(new AbductorCompleteExperimentBuiMsg());
Close();
};
}

private void View(ViewType type)
{
if (_window == null)
return;

_window.TeleportTabButton.Parent!.Margin = new Thickness(0, 0, 0, 10);

_window.TeleportTabButton.Disabled = type == ViewType.Teleport;
_window.ExperimentTabButton.Disabled = type == ViewType.Experiment;
_window.TeleportTab.Visible = type == ViewType.Teleport;
_window.ExperimentTab.Visible = type == ViewType.Experiment;
}

private enum ViewType
{
Teleport,
Experiment
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

if (disposing)
_window?.Dispose();
}
}
26 changes: 26 additions & 0 deletions Content.Client/_Shitmed/Antags/Abductor/AbductorConsoleWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<controls:AbductorConsoleWindow
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client._Shitmed.Antags.Abductor"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
MinSize="400 400">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="0 0 0 10">
<Button Name="TeleportTabButton" Access="Public" Text="{Loc 'abductors-ui-teleport'}" HorizontalExpand="True" StyleClasses="OpenBoth" />
<Button Name="ExperimentTabButton" Access="Public" Text="{Loc 'abductors-ui-experiment'}" HorizontalExpand="True" StyleClasses="OpenBoth" />
</BoxContainer>
<cc:HSeparator/>
<ScrollContainer VScrollEnabled="True" HorizontalExpand="True" VerticalExpand="True">
<BoxContainer Name="TeleportTab" Access="Public" Orientation="Vertical" Visible="False">
<RichTextLabel Name="PadLabel" Access="Public"/>
<RichTextLabel Name="TargetLabel" Access="Public" />
<Button Name="TeleportButton" Access="Public" Text="{Loc 'abductors-ui-attract'}" HorizontalExpand="True" StyleClasses="OpenBoth" />
</BoxContainer>
<BoxContainer Name="ExperimentTab" Access="Public" Orientation="Vertical" Visible="False">
<RichTextLabel Name="ExperimentLabel" Access="Public"/>
<RichTextLabel Name="ExperimentatorLabel" Access="Public"/>
<RichTextLabel Name="VictimLabel" Access="Public"/>
<Button Name="CompleteExperimentButton" Access="Public" Text="{Loc 'abductors-ui-complete-experiment'}" HorizontalExpand="True" StyleClasses="OpenBoth" />
</BoxContainer>
</ScrollContainer>
</BoxContainer>
</controls:AbductorConsoleWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._Shitmed.Antags.Abductor;
[GenerateTypedNameReferences]
public sealed partial class AbductorConsoleWindow : DefaultWindow
{
public AbductorConsoleWindow() => RobustXamlLoader.Load(this);
}
11 changes: 11 additions & 0 deletions Content.Client/_Shitmed/Antags/Abductor/AbductorSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Content.Shared._Shitmed.Antags.Abductor;

namespace Content.Client._Shitmed.Antags.Abductor;

public sealed class AbductorSystem : SharedAbductorSystem
{
public override void Initialize()
{
base.Initialize();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ui:XenoChoiceControl
<ui:ChoiceControl
xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client._Shitmed.Xenonids.UI">
xmlns:ui="clr-namespace:Content.Client._Shitmed.Choice.UI">
<BoxContainer Orientation="Horizontal">
<Button Name="Button" Access="Public"
HorizontalExpand="True" VerticalExpand="False"
Expand All @@ -14,4 +14,4 @@
</BoxContainer>
</Button>
</BoxContainer>
</ui:XenoChoiceControl>
</ui:ChoiceControl>
Loading

0 comments on commit 3dbb539

Please sign in to comment.