-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
A variant of a working capsule of nuke ops #29683
base: master
Are you sure you want to change the base?
Changes from all commits
076338b
22c0f6a
58258a6
8175257
40783a2
6a9cd28
6e5db00
345be53
f60b8db
340e916
dee8a77
d7ea5e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using Content.Shared.DropPod; | ||
using JetBrains.Annotations; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.DropPod.UI; | ||
|
||
[UsedImplicitly] | ||
public sealed class DropPodBoundUi : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
private DropPodConsoleWindow? _window; | ||
|
||
public DropPodBoundUi(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_window = new DropPodConsoleWindow(); | ||
_window.OpenCentered(); | ||
|
||
_window.PointsRefreshButtonPressed += OnPointsRefreshButtonPressed; | ||
_window.StartLandingButtonPressed += OnStartLandingButtonPressed; | ||
_window.PointSelected += OnPointSelected; | ||
_window.OnClose += Close; | ||
} | ||
|
||
private void OnPointsRefreshButtonPressed() | ||
{ | ||
SendMessage(new DropPodRefreshMessage()); | ||
} | ||
|
||
private void OnStartLandingButtonPressed() | ||
{ | ||
SendMessage(new DropPodStartMessage()); | ||
} | ||
|
||
private void OnPointSelected(int point) | ||
{ | ||
SendMessage(new DropPodPointSelectedMessage(point)); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
|
||
if (_window == null || state is not DropPodUiState cast) | ||
return; | ||
|
||
_window.UpdateState(cast); | ||
} | ||
|
||
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,13 @@ | ||
<DefaultWindow xmlns="https://spacestation14.io" | ||
xmlns:viewport="clr-namespace:Content.Client.Viewport" | ||
Title="{Loc 'droppod-console-ui-window'}"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<BoxContainer Orientation="Vertical" MinWidth="350" MinHeight="200" VerticalExpand="True"> | ||
<Button Name="DropPodRefreshPointsButton" Text="{Loc 'droppod-console-ui-refresh-points'}" /> | ||
<ScrollContainer VerticalExpand="True"> | ||
<ItemList Name="SubnetList" /> | ||
</ScrollContainer> | ||
<Button Name="DropPodStartLandingButton" Text="{Loc 'droppod-console-ui-start-landing'}" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</DefaultWindow> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.CustomControls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Content.Shared.DropPod; | ||
|
||
namespace Content.Client.DropPod.UI; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class DropPodConsoleWindow : DefaultWindow | ||
{ | ||
public event Action<int>? PointSelected; | ||
public event Action? PointsRefreshButtonPressed; | ||
public event Action? StartLandingButtonPressed; | ||
|
||
public DropPodConsoleWindow() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
|
||
DropPodRefreshPointsButton.OnPressed += _ => PointsRefreshButtonPressed?.Invoke(); | ||
DropPodStartLandingButton.OnPressed += _ => StartLandingButtonPressed?.Invoke(); | ||
SubnetList.OnItemSelected += OnSubnetListSelect; | ||
} | ||
|
||
public void UpdateState(DropPodUiState state) | ||
{ | ||
DropPodRefreshPointsButton.Disabled = !state.CanRefreshVol; | ||
DropPodStartLandingButton.Disabled = !state.CanStartVol; | ||
AddPointToList(state); | ||
} | ||
|
||
private void AddPointToList(DropPodUiState state) | ||
{ | ||
SubnetList.Clear(); // We clean it so that there are no duplicated buttons | ||
foreach (var point in state.Points) | ||
{ | ||
var item = SubnetList.AddItem($"{point.Value}"); | ||
item.Metadata = point.Key; // The key contains a unique identification number (UIN), which, according to my logic, each landing point has its own | ||
} | ||
} | ||
|
||
private void OnSubnetListSelect(ItemList.ItemListSelectedEventArgs args) | ||
{ | ||
PointSelected!((int) SubnetList[args.ItemIndex].Metadata!); // When selecting the desired object in the SubnetList, we send a unique identification number by which we will search for the desired landing point | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? |
||
|
||
namespace Content.Server.DropPod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. outdated namespace format |
||
{ | ||
[RegisterComponent] | ||
public sealed partial class DropPodBeaconComponent : Component | ||
{ | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,28 @@ | ||||||
using Robust.Shared.Prototypes; | ||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. outdated, remove |
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. outdated |
||||||
using Robust.Shared.Audio; | ||||||
|
||||||
namespace Content.Server.DropPod | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrong namespace format |
||||||
{ | ||||||
[RegisterComponent] | ||||||
public sealed partial class DropPodConsoleComponent : Component | ||||||
{ | ||||||
public bool WarDeclared = false; // This field is needed to prevent players from flying away on a capsule before the declaration of war | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where DataField |
||||||
|
||||||
[DataField("announcement")] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
outdated |
||||||
public bool Announcement = true; | ||||||
|
||||||
[DataField("text")] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
also rename variable, something like |
||||||
public string Text = "Attention! A hostile corporation is trying to move an object to your station... The travel time is 12 seconds. The approximate coordinates of the movement are as follows: "; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These kinds of announcements (e.g. Space Dragon rifts) now use the approximate location, as coordinates don't tell much to most players. Also I think such things usually go into ftl files, but I'm a dilettante in this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So in this ad there will be an approximate location, because the exact coordinates will be determined later by adding a scatter radius There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this should use a LocId string. Also, the time shouldn't be written into the string. It should be passed as a variable that can be placed in the string by the localization system. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. swap to LocId and lovalize string. |
||||||
|
||||||
[DataField("time")] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
public int Time = 12; // if you change the time, then change it in the text /\ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, make it .ftl localization variable |
||||||
|
||||||
[DataField("sound")] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Announcements/war.ogg"); | ||||||
|
||||||
[DataField("color")] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
public Color Color = Color.Red; | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They would do imports before building as these are the sourcegenned ones, I would bet.