Skip to content

Commit

Permalink
Merge pull request #420 from Rxup/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Rxup authored Jan 18, 2024
2 parents 7eaf750 + d02c6eb commit 2852889
Show file tree
Hide file tree
Showing 506 changed files with 280,809 additions and 263,952 deletions.
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 @@ -15,7 +15,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 @@ -146,10 +146,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 @@ -217,8 +217,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
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>
54 changes: 54 additions & 0 deletions Content.Client/Bed/Cryostorage/CryostorageMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System.Linq;
using Content.Client.UserInterface.Controls;
using Content.Shared.Bed.Cryostorage;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Collections;
using Robust.Shared.Utility;

namespace Content.Client.Bed.Cryostorage;

[GenerateTypedNameReferences]
public sealed partial class CryostorageMenu : FancyWindow
{
public event Action<NetEntity, string>? SlotRemoveButtonPressed;
public event Action<NetEntity, string>? HandRemoveButtonPressed;

public CryostorageMenu()
{
RobustXamlLoader.Load(this);
}

public void UpdateState(CryostorageBuiState state)
{
var data = state.PlayerData;
var nonexistentEntries = new ValueList<CryostorageContainedPlayerData>(data);

var children = new ValueList<Control>(EntriesContainer.Children);
foreach (var control in children)
{
if (control is not CryostorageEntryControl entryControl)
continue;

if (data.Where(p => p.PlayerEnt == entryControl.Entity).FirstOrNull() is not { } datum)
{
EntriesContainer.Children.Remove(entryControl);
continue;
}

nonexistentEntries.Remove(datum);
entryControl.Update(datum);
}

foreach (var player in nonexistentEntries)
{
var control = new CryostorageEntryControl(player);
control.SlotRemoveButtonPressed += a => SlotRemoveButtonPressed?.Invoke(player.PlayerEnt, a);
control.HandRemoveButtonPressed += a => HandRemoveButtonPressed?.Invoke(player.PlayerEnt, a);
EntriesContainer.Children.Add(control);
}

EmptyLabel.Visible = data.Count == 0;
}
}
13 changes: 13 additions & 0 deletions Content.Client/Bed/Cryostorage/CryostorageSlotControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<BoxContainer
xmlns="https://spacestation14.io"
Orientation="Horizontal"
HorizontalExpand="True"
Margin="5">
<RichTextLabel Name="SlotLabel" HorizontalAlignment="Left"/>
<Control HorizontalExpand="True"/>
<BoxContainer Orientation="Horizontal"
HorizontalAlignment="Right">
<Label Name="ItemLabel" Margin="0 0 5 0"/>
<Button Name="Button" Access="Public" Text="{Loc 'cryostorage-ui-button-remove'}"></Button>
</BoxContainer>
</BoxContainer>
18 changes: 18 additions & 0 deletions Content.Client/Bed/Cryostorage/CryostorageSlotControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Content.Client.Message;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Bed.Cryostorage;

[GenerateTypedNameReferences]
public sealed partial class CryostorageSlotControl : BoxContainer
{
public CryostorageSlotControl(string name, string itemName)
{
RobustXamlLoader.Load(this);

SlotLabel.SetMarkup(Loc.GetString("cryostorage-ui-label-slot-name", ("slot", name)));
ItemLabel.Text = itemName;
}
}
9 changes: 9 additions & 0 deletions Content.Client/Bed/Cryostorage/CryostorageSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Content.Shared.Bed.Cryostorage;

namespace Content.Client.Bed.Cryostorage;

/// <inheritdoc/>
public sealed class CryostorageSystem : SharedCryostorageSystem
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,23 @@ protected override void Open()
_window.OnDispenseReagentButtonMouseEntered += (args, button) =>
{
if (_lastState is not null)
_window.UpdateContainerInfo(_lastState, button.ReagentId);
_window.UpdateContainerInfo(_lastState);
};
_window.OnDispenseReagentButtonMouseExited += (args, button) =>
{
if (_lastState is not null)
_window.UpdateContainerInfo(_lastState);
};

_window.OnEjectJugButtonPressed += (args, button) => SendMessage(new ItemSlotButtonPressedEvent(button.ReagentId));
_window.OnEjectJugButtonMouseEntered += (args, button) => {
if (_lastState is not null)
_window.UpdateContainerInfo(_lastState);
};
_window.OnEjectJugButtonMouseExited += (args, button) => {
if (_lastState is not null)
_window.UpdateContainerInfo(_lastState);
};
}

/// <summary>
Expand Down
11 changes: 4 additions & 7 deletions Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<DefaultWindow xmlns="https://spacestation14.io"
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="{Loc 'reagent-dispenser-bound-user-interface-title'}"
SetSize="620 450"
MinSize="620 450">
MinSize="680 450">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'reagent-dispenser-window-amount-to-dispense-label'}"/>
Expand All @@ -18,10 +17,8 @@
<Button Name="DispenseButton100" Access="Public" Text="100" StyleClasses="OpenLeft"/>
</BoxContainer>
<Control MinSize="0 10"/>
<ScrollContainer HScrollEnabled="False" HorizontalExpand="True" MinSize="0 170">
<GridContainer Name="ChemicalList" Access="Public" Columns="4">
</GridContainer>
</ScrollContainer>
<GridContainer Name="ChemicalList" HorizontalExpand="True" VerticalExpand="True" Access="Public" Columns="6">
</GridContainer>
<Control MinSize="0 10"/>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'reagent-dispenser-window-container-label'}"/>
Expand Down
Loading

0 comments on commit 2852889

Please sign in to comment.