Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…on-14 into 2024earlyjanuarysync
  • Loading branch information
deathride58 committed Jan 18, 2024
2 parents e419c77 + 7a7d001 commit 9f42983
Show file tree
Hide file tree
Showing 600 changed files with 511,435 additions and 498,554 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
resharper_braces_for_ifelse = required_for_multiline
resharper_keep_existing_attribute_arrangement = true

[*.{csproj,xml,yml,yaml,dll.config,msbuildproj,targets}]
[*.{csproj,xml,yml,yaml,dll.config,msbuildproj,targets,props}]
indent_size = 2

[nuget.config]
indent_size = 2

[{*.yaml,*.yml}]
Expand Down
2 changes: 1 addition & 1 deletion Content.Benchmarks/Content.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<LangVersion>12</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="BenchmarkDotNet" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Content.Client\Content.Client.csproj" />
Expand Down
47 changes: 31 additions & 16 deletions Content.Client/Administration/QuickDialogSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

namespace Content.Client.Administration;

// mfw they ported input() from BYOND

/// <summary>
/// This handles the client portion of quick dialogs.
/// </summary>
Expand All @@ -32,39 +34,48 @@ private void OpenDialog(QuickDialogOpenEvent ev)

var promptsDict = new Dictionary<string, LineEdit>();

foreach (var entry in ev.Prompts)
for (var index = 0; index < ev.Prompts.Count; index++)
{
var entry = ev.Prompts[index];
var entryBox = new BoxContainer()
{
Orientation = BoxContainer.LayoutOrientation.Horizontal
};

entryBox.AddChild(new Label { Text = entry.Prompt, HorizontalExpand = true, SizeFlagsStretchRatio = 0.5f });
var edit = new LineEdit() { HorizontalExpand = true};
var edit = new LineEdit() { HorizontalExpand = true };
entryBox.AddChild(edit);
switch (entry.Type)
{
case QuickDialogEntryType.Integer:
edit.IsValid += VerifyInt;
edit.PlaceHolder = "Integer..";
edit.PlaceHolder = Loc.GetString("quick-dialog-ui-integer");
break;
case QuickDialogEntryType.Float:
edit.IsValid += VerifyFloat;
edit.PlaceHolder = "Float..";
edit.PlaceHolder = Loc.GetString("quick-dialog-ui-float");
break;
case QuickDialogEntryType.ShortText:
edit.IsValid += VerifyShortText;
edit.PlaceHolder = "Short text..";
edit.PlaceHolder = Loc.GetString("quick-dialog-ui-short-text");
break;
case QuickDialogEntryType.LongText:
edit.IsValid += VerifyLongText;
edit.PlaceHolder = "Long text..";
edit.PlaceHolder = Loc.GetString("quick-dialog-ui-long-text");
break;
default:
throw new ArgumentOutOfRangeException();
}

promptsDict.Add(entry.FieldId, edit);
entryContainer.AddChild(entryBox);

if (index == ev.Prompts.Count - 1)
{
// Last text box gets enter confirmation.
// Only the last so you don't accidentally confirm early.
edit.OnTextEntered += _ => Confirm();
}
}

var buttonsBox = new BoxContainer()
Expand All @@ -79,17 +90,10 @@ private void OpenDialog(QuickDialogOpenEvent ev)
{
var okButton = new Button()
{
Text = "Ok",
Text = Loc.GetString("quick-dialog-ui-ok"),
};

okButton.OnPressed += _ =>
{
RaiseNetworkEvent(new QuickDialogResponseEvent(ev.DialogId,
promptsDict.Select(x => (x.Key, x.Value.Text)).ToDictionary(x => x.Key, x => x.Text),
QuickDialogButtonFlag.OkButton));
alreadyReplied = true;
window.Close();
};
okButton.OnPressed += _ => Confirm();

buttonsBox.AddChild(okButton);
}
Expand All @@ -98,7 +102,7 @@ private void OpenDialog(QuickDialogOpenEvent ev)
{
var cancelButton = new Button()
{
Text = "Cancel",
Text = Loc.GetString("quick-dialog-ui-cancel"),
};

cancelButton.OnPressed += _ =>
Expand Down Expand Up @@ -130,6 +134,17 @@ private void OpenDialog(QuickDialogOpenEvent ev)
window.MinWidth *= 2; // Just double it.

window.OpenCentered();

return;

void Confirm()
{
RaiseNetworkEvent(new QuickDialogResponseEvent(ev.DialogId,
promptsDict.Select(x => (x.Key, x.Value.Text)).ToDictionary(x => x.Key, x => x.Text),
QuickDialogButtonFlag.OkButton));
alreadyReplied = true;
window.Close();
}
}

private bool VerifyInt(string input)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Button Visible="False" Name="Kick" Text="{Loc 'admin-player-actions-kick'}" StyleClasses="OpenBoth" />
<Button Visible="False" Name="Ban" Text="{Loc 'admin-player-actions-ban'}" StyleClasses="OpenBoth" />
<Button Visible="False" Name="Respawn" Text="{Loc 'admin-player-actions-respawn'}" StyleClasses="OpenBoth" />
<Button Visible="False" Name="Teleport" Text="{Loc 'admin-player-actions-teleport'}" StyleClasses="OpenLeft" />
<Button Visible="False" Name="Follow" Text="{Loc 'admin-player-actions-follow'}" StyleClasses="OpenLeft" />
</BoxContainer>
</BoxContainer>
</SplitContainer>
Expand Down
8 changes: 4 additions & 4 deletions Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ public BwoinkControl()
_console.ExecuteCommand($"kick \"{_currentPlayer.Username}\"");
};

Teleport.OnPressed += _ =>
Follow.OnPressed += _ =>
{
if (_currentPlayer is not null)
_console.ExecuteCommand($"tpto \"{_currentPlayer.Username}\"");
_console.ExecuteCommand($"follow \"{_currentPlayer.NetEntity}\"");
};

Respawn.OnPressed += _ =>
Expand Down Expand Up @@ -204,8 +204,8 @@ public void UpdateButtons()
Respawn.Visible = _adminManager.CanCommand("respawn");
Respawn.Disabled = !Respawn.Visible || disabled;

Teleport.Visible = _adminManager.CanCommand("tpto");
Teleport.Disabled = !Teleport.Visible || disabled;
Follow.Visible = _adminManager.CanCommand("follow");
Follow.Disabled = !Follow.Visible || disabled;
}

private string FormatTabTitle(ItemList.Item li, PlayerInfo? pl = default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ public override void Closed()
public override void HandleState(EuiStateBase baseState)
{
var state = (EditSolutionsEuiState) baseState;
_window.SetTargetEntity(state.Target);
_window.UpdateSolutions(state.Solutions);
_window.UpdateReagents();
_window.SetState(state);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using Content.Shared.Administration;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.Timing;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;

namespace Content.Client.Administration.UI.ManageSolutions
{
Expand All @@ -16,11 +19,13 @@ public sealed partial class EditSolutionsWindow : DefaultWindow
{
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IClientGameTiming _timing = default!;

private NetEntity _target = NetEntity.Invalid;
private string? _selectedSolution;
private AddReagentWindow? _addReagentWindow;
private Dictionary<string, EntityUid>? _solutions;
private EditSolutionsEuiState? _nextState;

public EditSolutionsWindow()
{
Expand Down Expand Up @@ -327,5 +332,27 @@ public void UpdateSolutions(List<(string, NetEntity)>? solutions)
SolutionOption.Select(selectedIndex);
_selectedSolution = (string?) SolutionOption.SelectedMetadata;
}

protected override void FrameUpdate(FrameEventArgs args)
{
// TODO: THIS IS FUCKING TERRIBLE.
// Ok so the problem is that this shouldn't be via an EUI at all. Why?
// The EUI update notification comes in *before* the game state it updates from.
// So the UI doesn't update properly. Heck.
// I didn't wanna completely rewrite this thing to work properly so instead you get terrible hacks.

if (_nextState != null && _timing.LastRealTick >= _nextState.Tick)
{
SetTargetEntity(_nextState.Target);
UpdateSolutions(_nextState.Solutions);
UpdateReagents();
_nextState = null;
}
}

public void SetState(EditSolutionsEuiState state)
{
_nextState = state;
}
}
}
7 changes: 7 additions & 0 deletions Content.Client/Atmos/Rotting/RottingSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Content.Shared.Atmos.Rotting;

namespace Content.Client.Atmos.Rotting;

public sealed class RottingSystem : SharedRottingSystem
{
}
56 changes: 56 additions & 0 deletions Content.Client/Bed/Cryostorage/CryostorageBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Content.Shared.Bed.Cryostorage;
using JetBrains.Annotations;

namespace Content.Client.Bed.Cryostorage;

[UsedImplicitly]
public sealed class CryostorageBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private CryostorageMenu? _menu;

public CryostorageBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
base.Open();

_menu = new();

_menu.OnClose += Close;

_menu.SlotRemoveButtonPressed += (ent, slot) =>
{
SendMessage(new CryostorageRemoveItemBuiMessage(ent, slot, CryostorageRemoveItemBuiMessage.RemovalType.Inventory));
};

_menu.HandRemoveButtonPressed += (ent, hand) =>
{
SendMessage(new CryostorageRemoveItemBuiMessage(ent, hand, CryostorageRemoveItemBuiMessage.RemovalType.Hand));
};

_menu.OpenCentered();
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);

switch (state)
{
case CryostorageBuiState msg:
_menu?.UpdateState(msg);
break;
}
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_menu?.Dispose();
}
}
21 changes: 21 additions & 0 deletions Content.Client/Bed/Cryostorage/CryostorageEntryControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<BoxContainer
xmlns="https://spacestation14.io"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:xNamespace="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:style="clr-namespace:Content.Client.Stylesheets"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Orientation="Vertical"
HorizontalExpand="True"
Margin="0 0 0 5">
<PanelContainer>
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="{xNamespace:Static style:StyleNano.ButtonColorDisabled}" />
</PanelContainer.PanelOverride>
<Collapsible Orientation="Vertical" Name="Collapsible">
<CollapsibleHeading Name="Heading" MinHeight="35"/>
<CollapsibleBody Name="Body">
<BoxContainer Name="ItemsContainer" Orientation="Vertical" HorizontalExpand="True"/>
</CollapsibleBody>
</Collapsible>
</PanelContainer>
</BoxContainer>
46 changes: 46 additions & 0 deletions Content.Client/Bed/Cryostorage/CryostorageEntryControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Shared.Bed.Cryostorage;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Bed.Cryostorage;

[GenerateTypedNameReferences]
public sealed partial class CryostorageEntryControl : BoxContainer
{
public event Action<string>? SlotRemoveButtonPressed;
public event Action<string>? HandRemoveButtonPressed;

public NetEntity Entity;
public bool LastOpenState;

public CryostorageEntryControl(CryostorageContainedPlayerData data)
{
RobustXamlLoader.Load(this);
Entity = data.PlayerEnt;
Update(data);
}

public void Update(CryostorageContainedPlayerData data)
{
LastOpenState = Collapsible.BodyVisible;
Heading.Title = data.PlayerName;
Body.Visible = data.ItemSlots.Count != 0 && data.HeldItems.Count != 0;

ItemsContainer.Children.Clear();
foreach (var (name, itemName) in data.ItemSlots)
{
var control = new CryostorageSlotControl(name, itemName);
control.Button.OnPressed += _ => SlotRemoveButtonPressed?.Invoke(name);
ItemsContainer.AddChild(control);
}

foreach (var (name, held) in data.HeldItems)
{
var control = new CryostorageSlotControl(Loc.GetString("cryostorage-ui-filler-hand"), held);
control.Button.OnPressed += _ => HandRemoveButtonPressed?.Invoke(name);
ItemsContainer.AddChild(control);
}
Collapsible.BodyVisible = LastOpenState;
}
}
33 changes: 33 additions & 0 deletions Content.Client/Bed/Cryostorage/CryostorageMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<controls:FancyWindow
xmlns="https://spacestation14.io"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:xNamespace="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:style="clr-namespace:Content.Client.Stylesheets"
Title="{Loc 'cryostorage-ui-window-title'}"
MinSize="350 350"
SetSize="450 400">
<BoxContainer
Orientation="Vertical"
VerticalExpand="True"
HorizontalExpand="True">
<PanelContainer
VerticalExpand="True"
HorizontalExpand="True"
Margin="15">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="{xNamespace:Static style:StyleNano.PanelDark}" />
</PanelContainer.PanelOverride>
<ScrollContainer VerticalExpand="True" HorizontalExpand="True">
<Control>
<Label Text="{Loc 'cryostorage-ui-label-no-bodies'}" Name="EmptyLabel" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<BoxContainer Name="EntriesContainer"
Orientation="Vertical"
Margin="10"
VerticalExpand="True"
HorizontalExpand="True"/>
</Control>
</ScrollContainer>
</PanelContainer>
</BoxContainer>
</controls:FancyWindow>
Loading

0 comments on commit 9f42983

Please sign in to comment.