Skip to content

Commit

Permalink
Merge pull request #278 from Rxup/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
KayzelW authored Oct 19, 2023
2 parents 51e8411 + 9a52a11 commit af340f8
Show file tree
Hide file tree
Showing 309 changed files with 15,114 additions and 13,123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private int Compare(PlayerInfo x, PlayerInfo y)
Header.Character => Compare(x.CharacterName, y.CharacterName),
Header.Job => Compare(x.StartingJob, y.StartingJob),
Header.Antagonist => x.Antag.CompareTo(y.Antag),
Header.Playtime => Compare(x.PlaytimeString, y.PlaytimeString),
Header.Playtime => TimeSpan.Compare(x.OverallPlaytime ?? default, y.OverallPlaytime ?? default),
_ => 1
};
}
Expand Down
20 changes: 17 additions & 3 deletions Content.Client/Ame/UI/AmeWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<DefaultWindow xmlns="https://spacestation14.io"
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'ame-window-title'}"
MinSize="250 250">
<BoxContainer Orientation="Vertical">
<GridContainer Columns="2">
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ame-window-engine-status-label'}" />
<Label Text=" " />
Expand Down Expand Up @@ -42,5 +42,19 @@
<Label Text=" " />
<Label Name="CoreCount" Text="0" />
</BoxContainer>
</BoxContainer>
<BoxContainer></BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ame-window-power-currentsupply-label'}" />
<Label Text=" " />
<Label Name="CurrentPowerSupply" Text="0" />
<Label Text=" kW" />
</BoxContainer>
<BoxContainer></BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ame-window-power-targetsupply-label'}" />
<Label Text=" " />
<Label Name="TargetedPowerSupply" Text="0" />
<Label Text=" kW" />
</BoxContainer>
</GridContainer>
</DefaultWindow>
3 changes: 3 additions & 0 deletions Content.Client/Ame/UI/AmeWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public void UpdateState(BoundUserInterfaceState state)

CoreCount.Text = $"{castState.CoreCount}";
InjectionAmount.Text = $"{castState.InjectionAmount}";
// format power statistics to pretty numbers
CurrentPowerSupply.Text = $"{castState.CurrentPowerSupply.ToString("N1")}";
TargetedPowerSupply.Text = $"{castState.TargetedPowerSupply.ToString("N1")}";
}
}
}
6 changes: 3 additions & 3 deletions Content.Client/Antag/AntagStatusIconSystem.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using Content.Shared.Ghost;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;
using Content.Shared.Ghost;
using Robust.Client.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Antag;

/// <summary>
/// Used for assigning specified icons for antags.
/// </summary>
public abstract class AntagStatusIconSystem<T> : SharedStatusIconSystem
where T : Component
where T : IComponent
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _player = default!;
Expand Down
32 changes: 18 additions & 14 deletions Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
<Button Name="DispenseButton100" Access="Public" Text="100" StyleClasses="OpenLeft"/>
</BoxContainer>
<Control MinSize="0 10"/>
<GridContainer Name="ChemicalList" Access="Public" Columns="4">
</GridContainer>
<ScrollContainer HScrollEnabled="False" HorizontalExpand="True" MinSize="0 170">
<GridContainer Name="ChemicalList" Access="Public" Columns="4">
</GridContainer>
</ScrollContainer>
<Control MinSize="0 10"/>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'reagent-dispenser-window-container-label'}"/>
Expand All @@ -33,17 +35,19 @@
StyleClasses="OpenLeft"/>
</BoxContainer>
<Control MinSize="0 10"/>
<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 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>
</DefaultWindow>
2 changes: 1 addition & 1 deletion Content.Client/Eye/EyeLerpingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private Vector2 UpdateZoom(EntityUid uid, float frameTime, EyeComponent? eye = n
return content.TargetZoom;
}

var change = diff * 8f * frameTime;
var change = diff * Math.Min(8f * frameTime, 1);

return eye.Zoom + change;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<BoxContainer xmlns="https://spacestation14.io"
Orientation="Vertical">
<BoxContainer Name="DisciplineContainer" Orientation="Vertical"/>
</BoxContainer>
60 changes: 60 additions & 0 deletions Content.Client/Guidebook/Controls/GuideTechDisciplineEmbed.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Client.Guidebook.Richtext;
using Content.Shared.Research.Prototypes;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;

namespace Content.Client.Guidebook.Controls;

/// <summary>
/// Control for embedding all the technologies in a discipline into a guidebook.
/// </summary>
[UsedImplicitly, GenerateTypedNameReferences]
public sealed partial class GuideTechDisciplineEmbed : BoxContainer, IDocumentTag
{
[Dependency] private readonly IPrototypeManager _prototype = default!;

public GuideTechDisciplineEmbed()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
MouseFilter = MouseFilterMode.Stop;
}

public GuideTechDisciplineEmbed(string group) : this()
{
var prototypes = _prototype.EnumeratePrototypes<TechnologyPrototype>()
.Where(p => p.Discipline.Equals(group)).OrderBy(p => p.Tier).ThenBy(p => Loc.GetString(p.Name));
foreach (var tech in prototypes)
{
var embed = new GuideTechnologyEmbed(tech);
DisciplineContainer.AddChild(embed);
}
}

public bool TryParseTag(Dictionary<string, string> args, [NotNullWhen(true)] out Control? control)
{
control = null;
if (!args.TryGetValue("Discipline", out var group))
{
Logger.Error("Technology discipline embed tag is missing discipline argument");
return false;
}

var prototypes = _prototype.EnumeratePrototypes<TechnologyPrototype>()
.Where(p => p.Discipline.Equals(group)).OrderBy(p => p.Tier).ThenBy(p => Loc.GetString(p.Name));
foreach (var tech in prototypes)
{
var embed = new GuideTechnologyEmbed(tech);
DisciplineContainer.AddChild(embed);
}

control = this;
return true;
}
}
22 changes: 22 additions & 0 deletions Content.Client/Guidebook/Controls/GuideTechnologyEmbed.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Orientation="Vertical"
Margin="5 5 5 5">
<PanelContainer HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BorderThickness="1" BorderColor="#777777"/>
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical">
<PanelContainer Name="DisciplineColorBackground" HorizontalExpand="True" VerticalExpand="False" MinHeight="15"/>
<BoxContainer Orientation="Vertical" Margin="5 5 5 5">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<RichTextLabel Name="NameLabel" VerticalAlignment="Bottom" HorizontalExpand="True"/>
<TextureRect Name="TechTexture" VerticalAlignment="Center" HorizontalAlignment="Right"/>
</BoxContainer>
<customControls:HSeparator Margin="10 5 10 10"/>
<RichTextLabel Name="DescriptionLabel"/>
</BoxContainer>
</BoxContainer>
</PanelContainer>
</BoxContainer>
93 changes: 93 additions & 0 deletions Content.Client/Guidebook/Controls/GuideTechnologyEmbed.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System.Diagnostics.CodeAnalysis;
using Content.Client.Guidebook.Richtext;
using Content.Client.Message;
using Content.Client.Research;
using Content.Client.UserInterface.ControlExtensions;
using Content.Shared.Research.Prototypes;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;

namespace Content.Client.Guidebook.Controls;

/// <summary>
/// Control for embedding a research technology into a guidebook.
/// </summary>
[UsedImplicitly, GenerateTypedNameReferences]
public sealed partial class GuideTechnologyEmbed : BoxContainer, IDocumentTag, ISearchableControl
{
[Dependency] private readonly IEntitySystemManager _systemManager = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;

private readonly ResearchSystem _research;
private readonly SpriteSystem _sprite;

public GuideTechnologyEmbed()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_research = _systemManager.GetEntitySystem<ResearchSystem>();
_sprite = _systemManager.GetEntitySystem<SpriteSystem>();
MouseFilter = MouseFilterMode.Stop;
}

public GuideTechnologyEmbed(string technology) : this()
{
GenerateControl(_prototype.Index<TechnologyPrototype>(technology));
}

public GuideTechnologyEmbed(TechnologyPrototype technology) : this()
{
GenerateControl(technology);
}

public bool CheckMatchesSearch(string query)
{
return this.ChildrenContainText(query);
}

public void SetHiddenState(bool state, string query)
{
Visible = CheckMatchesSearch(query) ? state : !state;
}

public bool TryParseTag(Dictionary<string, string> args, [NotNullWhen(true)] out Control? control)
{
control = null;
if (!args.TryGetValue("Technology", out var id))
{
Logger.Error("Technology embed tag is missing technology prototype argument");
return false;
}

if (!_prototype.TryIndex<TechnologyPrototype>(id, out var technology))
{
Logger.Error($"Specified technology prototype \"{id}\" is not a valid technology prototype");
return false;
}

GenerateControl(technology);

control = this;
return true;
}

private void GenerateControl(TechnologyPrototype technology)
{
var discipline = _prototype.Index(technology.Discipline);

NameLabel.SetMarkup($"[bold]{Loc.GetString(technology.Name)}[/bold]");
DescriptionLabel.SetMessage(_research.GetTechnologyDescription(technology, includePrereqs: true, disciplinePrototype: discipline));
TechTexture.Texture = _sprite.Frame0(technology.Icon);

DisciplineColorBackground.PanelOverride = new StyleBoxFlat
{
BackgroundColor = discipline.Color
};
}
}
58 changes: 58 additions & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Numerics;
using Content.Client.Stylesheets;
using Content.Shared.CCVar;
using Content.Shared.Input;
using Robust.Client.AutoGenerated;
using Robust.Client.Input;
Expand Down Expand Up @@ -41,6 +42,61 @@ private void HandleToggleUSQWERTYCheckbox(BaseButton.ButtonToggledEventArgs args
_cfg.SaveToFile();
}

private void InitToggleWalk()
{
if (_cfg.GetCVar(CCVars.ToggleWalk))
{
ToggleFunctions.Add(EngineKeyFunctions.Walk);
}
else
{
ToggleFunctions.Remove(EngineKeyFunctions.Walk);
}
}

private void HandleToggleWalk(BaseButton.ButtonToggledEventArgs args)
{
_cfg.SetCVar(CCVars.ToggleWalk, args.Pressed);
_cfg.SaveToFile();
InitToggleWalk();

if (!_keyControls.TryGetValue(EngineKeyFunctions.Walk, out var keyControl))
{
return;
}

var bindingType = args.Pressed ? KeyBindingType.Toggle : KeyBindingType.State;
for (var i = 0; i <= 1; i++)
{
var binding = (i == 0 ? keyControl.BindButton1 : keyControl.BindButton2).Binding;
if (binding == null)
{
continue;
}

var registration = new KeyBindingRegistration
{
Function = EngineKeyFunctions.Walk,
BaseKey = binding.BaseKey,
Mod1 = binding.Mod1,
Mod2 = binding.Mod2,
Mod3 = binding.Mod3,
Priority = binding.Priority,
Type = bindingType,
CanFocus = binding.CanFocus,
CanRepeat = binding.CanRepeat,
};

_deferCommands.Add(() =>
{
_inputManager.RemoveBinding(binding);
_inputManager.RegisterBinding(registration);
});
}

_deferCommands.Add(_inputManager.SaveToUserData);
}

public KeyRebindTab()
{
IoCManager.InjectDependencies(this);
Expand Down Expand Up @@ -98,6 +154,8 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(EngineKeyFunctions.MoveDown);
AddButton(EngineKeyFunctions.MoveRight);
AddButton(EngineKeyFunctions.Walk);
AddCheckBox("ui-options-hotkey-toggle-walk", _cfg.GetCVar(CCVars.ToggleWalk), HandleToggleWalk);
InitToggleWalk();

AddHeader("ui-options-header-camera");
AddButton(EngineKeyFunctions.CameraRotateLeft);
Expand Down
Loading

0 comments on commit af340f8

Please sign in to comment.