forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from ss14Starlight/sl-abductor
Revamp Abductor System and Add New Organ Functionality
- Loading branch information
Showing
93 changed files
with
3,249 additions
and
718 deletions.
There are no files selected for viewing
17 changes: 1 addition & 16 deletions
17
Content.Client/_Starlight/Antags/Abductor/AbductorCameraConsoleBui.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
Content.Client/_Starlight/Antags/Abductor/AbductorConsoleBui.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
using Content.Shared.Starlight.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._Starlight.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
26
Content.Client/_Starlight/Antags/Abductor/AbductorConsoleWindow.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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._Starlight.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 Color="#A04B81" /> | ||
<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> |
10 changes: 10 additions & 0 deletions
10
Content.Client/_Starlight/Antags/Abductor/AbductorConsoleWindow.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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._Starlight.Antags.Abductor; | ||
[GenerateTypedNameReferences] | ||
public sealed partial class AbductorConsoleWindow : DefaultWindow | ||
{ | ||
public AbductorConsoleWindow() => RobustXamlLoader.Load(this); | ||
} |
11 changes: 11 additions & 0 deletions
11
Content.Client/_Starlight/Antags/Abductor/AbductorSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Content.Shared.Starlight.Antags.Abductor; | ||
|
||
namespace Content.Client._Starlight.Antags.Abductor; | ||
|
||
public sealed class AbductorSystem : SharedAbductorSystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.