Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into upstream-sync
Browse files Browse the repository at this point in the history
# Conflicts:
#	Content.Client/Preferences/ClientPreferencesManager.cs
#	Content.Server/Connection/ConnectionManager.cs
#	Content.Server/Preferences/Managers/ServerPreferencesManager.cs
#	Content.Shared/Preferences/HumanoidCharacterProfile.cs
#	Content.Shared/Preferences/ICharacterProfile.cs
#	Resources/Prototypes/Catalog/VendingMachines/Inventories/janidrobe.yml
#	Resources/Prototypes/Datasets/Names/fortunes.yml
#	Resources/Prototypes/Entities/Clothing/Shoes/specific.yml
#	Resources/Textures/Structures/Wallmounts/posters.rsi/meta.json
#	SpaceStation14.sln
  • Loading branch information
Morb0 committed Feb 26, 2024
2 parents 68b2171 + dffd02a commit fe48e6d
Show file tree
Hide file tree
Showing 323 changed files with 2,465 additions and 2,490 deletions.
15 changes: 15 additions & 0 deletions Content.Client/Chemistry/UI/InjectorStatusControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Client.Stylesheets;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.FixedPoint;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
Expand All @@ -14,6 +15,10 @@ public sealed class InjectorStatusControl : Control
private readonly SharedSolutionContainerSystem _solutionContainers;
private readonly RichTextLabel _label;

private FixedPoint2 PrevVolume;
private FixedPoint2 PrevMaxVolume;
private InjectorToggleMode PrevToggleState;

public InjectorStatusControl(Entity<InjectorComponent> parent, SharedSolutionContainerSystem solutionContainers)
{
_parent = parent;
Expand All @@ -29,6 +34,16 @@ protected override void FrameUpdate(FrameEventArgs args)
if (!_solutionContainers.TryGetSolution(_parent.Owner, InjectorComponent.SolutionName, out _, out var solution))
return;

// only updates the UI if any of the details are different than they previously were
if (PrevVolume == solution.Volume
&& PrevMaxVolume == solution.MaxVolume
&& PrevToggleState == _parent.Comp.ToggleState)
return;

PrevVolume = solution.Volume;
PrevMaxVolume = solution.MaxVolume;
PrevToggleState = _parent.Comp.ToggleState;

// Update current volume and injector state
var modeStringLocalized = Loc.GetString(_parent.Comp.ToggleState switch
{
Expand Down
31 changes: 17 additions & 14 deletions Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,22 @@
StyleClasses="OpenLeft"/>
</BoxContainer>
<Control MinSize="0 10"/>
<ScrollContainer HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True" MinSize="0 160">
<PanelContainer VerticalExpand="True"
SizeFlagsStretchRatio="6"
MinSize="0 150">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1b1b1e" />
</PanelContainer.PanelOverride>
<BoxContainer Name="ContainerInfo"
Orientation="Vertical"
HorizontalExpand="True">
<Label Text="{Loc 'reagent-dispenser-window-no-container-loaded-text'}"/>
</BoxContainer>
</PanelContainer>
</ScrollContainer>
<BoxContainer Orientation="Horizontal">
<SpriteView Name="View" Scale="4 4" MinSize="150 150"/>
<ScrollContainer HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True" MinSize="0 160">
<PanelContainer VerticalExpand="True"
SizeFlagsStretchRatio="6"
MinSize="0 150">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1b1b1e" />
</PanelContainer.PanelOverride>
<BoxContainer Name="ContainerInfo"
Orientation="Vertical"
HorizontalExpand="True">
<Label Text="{Loc 'reagent-dispenser-window-no-container-loaded-text'}"/>
</BoxContainer>
</PanelContainer>
</ScrollContainer>
</BoxContainer>
</BoxContainer>
</DefaultWindow>
13 changes: 8 additions & 5 deletions Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Linq;
using Content.Client.Stylesheets;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
Expand All @@ -19,6 +18,7 @@ namespace Content.Client.Chemistry.UI
public sealed partial class ReagentDispenserWindow : DefaultWindow
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
public event Action<BaseButton.ButtonEventArgs, DispenseReagentButton>? OnDispenseReagentButtonPressed;
public event Action<GUIMouseHoverEventArgs, DispenseReagentButton>? OnDispenseReagentButtonMouseEntered;
public event Action<GUIMouseHoverEventArgs, DispenseReagentButton>? OnDispenseReagentButtonMouseExited;
Expand Down Expand Up @@ -52,7 +52,7 @@ public ReagentDispenserWindow()
/// Update the button grid of reagents which can be dispensed.
/// </summary>
/// <param name="inventory">Reagents which can be dispensed by this dispenser</param>
public void UpdateReagentsList(List<KeyValuePair<string, KeyValuePair<string,string>>> inventory)
public void UpdateReagentsList(List<KeyValuePair<string, KeyValuePair<string, string>>> inventory)
{
if (ChemicalList == null)
return;
Expand Down Expand Up @@ -86,6 +86,9 @@ public void UpdateState(BoundUserInterfaceState state)
UpdateContainerInfo(castState);
UpdateReagentsList(castState.Inventory);

_entityManager.TryGetEntity(castState.OutputContainerEntity, out var outputContainerEnt);
View.SetEntity(outputContainerEnt);

// Disable the Clear & Eject button if no beaker
ClearButton.Disabled = castState.OutputContainer is null;
EjectButton.Disabled = castState.OutputContainer is null;
Expand Down Expand Up @@ -134,7 +137,7 @@ public void UpdateContainerInfo(ReagentDispenserBoundUserInterfaceState state)

if (state.OutputContainer is null)
{
ContainerInfo.Children.Add(new Label {Text = Loc.GetString("reagent-dispenser-window-no-container-loaded-text") });
ContainerInfo.Children.Add(new Label { Text = Loc.GetString("reagent-dispenser-window-no-container-loaded-text") });
return;
}

Expand All @@ -159,11 +162,11 @@ public void UpdateContainerInfo(ReagentDispenserBoundUserInterfaceState state)
? p.LocalizedName
: Loc.GetString("reagent-dispenser-window-reagent-name-not-found-text");

var nameLabel = new Label {Text = $"{localizedName}: "};
var nameLabel = new Label { Text = $"{localizedName}: " };
var quantityLabel = new Label
{
Text = Loc.GetString("reagent-dispenser-window-quantity-label-text", ("quantity", quantity)),
StyleClasses = {StyleNano.StyleClassLabelSecondaryColor},
StyleClasses = { StyleNano.StyleClassLabelSecondaryColor },
};

ContainerInfo.Children.Add(new BoxContainer
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Content.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
<TargetFramework>$(TargetFramework)</TargetFramework>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>..\bin\Content.Client\</OutputPath>
Expand Down
32 changes: 5 additions & 27 deletions Content.Client/CrewManifest/UI/CrewManifestListing.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
using Content.Shared.CCVar;
using Content.Shared.CrewManifest;
using Content.Shared.CrewManifest;
using Content.Shared.Roles;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System.Linq;

namespace Content.Client.CrewManifest.UI;

public sealed class CrewManifestListing : BoxContainer
{
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
private readonly SpriteSystem _spriteSystem;
Expand All @@ -25,7 +21,7 @@ public CrewManifestListing()

public void AddCrewManifestEntries(CrewManifestEntries entries)
{
var entryDict = new Dictionary<string, List<CrewManifestEntry>>();
var entryDict = new Dictionary<DepartmentPrototype, List<CrewManifestEntry>>();

foreach (var entry in entries.Entries)
{
Expand All @@ -34,37 +30,19 @@ public void AddCrewManifestEntries(CrewManifestEntries entries)
// this is a little expensive, and could be better
if (department.Roles.Contains(entry.JobPrototype))
{
entryDict.GetOrNew(department.ID).Add(entry);
entryDict.GetOrNew(department).Add(entry);
}
}
}

var entryList = new List<(string section, List<CrewManifestEntry> entries)>();
var entryList = new List<(DepartmentPrototype section, List<CrewManifestEntry> entries)>();

foreach (var (section, listing) in entryDict)
{
entryList.Add((section, listing));
}

var sortOrder = _configManager.GetCVar(CCVars.CrewManifestOrdering).Split(",").ToList();

entryList.Sort((a, b) =>
{
var ai = sortOrder.IndexOf(a.section);
var bi = sortOrder.IndexOf(b.section);

// this is up here so -1 == -1 occurs first
if (ai == bi)
return 0;

if (ai == -1)
return -1;

if (bi == -1)
return 1;

return ai.CompareTo(bi);
});
entryList.Sort((a, b) => DepartmentUIComparer.Instance.Compare(a.section, b.section));

foreach (var item in entryList)
{
Expand Down
14 changes: 8 additions & 6 deletions Content.Client/CrewManifest/UI/CrewManifestSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Prototypes;
using System.Numerics;
using Content.Shared.Roles;

namespace Content.Client.CrewManifest.UI;

public sealed class CrewManifestSection : BoxContainer
{
public CrewManifestSection(IPrototypeManager prototypeManager, SpriteSystem spriteSystem, string sectionTitle,
public CrewManifestSection(
IPrototypeManager prototypeManager,
SpriteSystem spriteSystem,
DepartmentPrototype section,
List<CrewManifestEntry> entries)
{
Orientation = LayoutOrientation.Vertical;
HorizontalExpand = true;

if (Loc.TryGetString($"department-{sectionTitle}", out var localizedDepart))
sectionTitle = localizedDepart;

AddChild(new Label()
{
StyleClasses = { "LabelBig" },
Text = Loc.GetString(sectionTitle)
Text = Loc.GetString($"department-{section.ID}")
});

var gridContainer = new GridContainer()
Expand Down Expand Up @@ -55,8 +56,9 @@ public CrewManifestSection(IPrototypeManager prototypeManager, SpriteSystem spri
var icon = new TextureRect()
{
TextureScale = new Vector2(2, 2),
Stretch = TextureRect.StretchMode.KeepCentered,
VerticalAlignment = VAlignment.Center,
Texture = spriteSystem.Frame0(jobIcon.Icon),
Margin = new Thickness(0, 0, 4, 0)
};

titleContainer.AddChild(icon);
Expand Down
19 changes: 2 additions & 17 deletions Content.Client/Decals/DecalSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,8 @@ public override void Shutdown()
protected override void OnDecalRemoved(EntityUid gridId, uint decalId, DecalGridComponent component, Vector2i indices, DecalChunk chunk)
{
base.OnDecalRemoved(gridId, decalId, component, indices, chunk);

if (!component.DecalZIndexIndex.Remove(decalId, out var zIndex))
return;

if (!component.DecalRenderIndex.TryGetValue(zIndex, out var renderIndex))
return;

renderIndex.Remove(decalId);
if (renderIndex.Count == 0)
component.DecalRenderIndex.Remove(zIndex);
DebugTools.Assert(chunk.Decals.ContainsKey(decalId));
chunk.Decals.Remove(decalId);
}

private void OnHandleState(EntityUid gridUid, DecalGridComponent gridComp, ref ComponentHandleState args)
Expand Down Expand Up @@ -133,8 +125,6 @@ private void OnChunkUpdate(DecalChunkUpdateEvent ev)
private void UpdateChunks(EntityUid gridId, DecalGridComponent gridComp, Dictionary<Vector2i, DecalChunk> updatedGridChunks)
{
var chunkCollection = gridComp.ChunkCollection.ChunkCollection;
var renderIndex = gridComp.DecalRenderIndex;
var zIndexIndex = gridComp.DecalZIndexIndex;

// Update any existing data / remove decals we didn't receive data for.
foreach (var (indices, newChunkData) in updatedGridChunks)
Expand All @@ -155,11 +145,6 @@ private void UpdateChunks(EntityUid gridId, DecalGridComponent gridComp, Diction

foreach (var (uid, decal) in newChunkData.Decals)
{
if (zIndexIndex.TryGetValue(uid, out var zIndex))
renderIndex[zIndex].Remove(uid);

renderIndex.GetOrNew(decal.ZIndex)[uid] = decal;
zIndexIndex[uid] = decal.ZIndex;
gridComp.DecalIndex[uid] = indices;
}
}
Expand Down
Loading

0 comments on commit fe48e6d

Please sign in to comment.