Skip to content

Commit

Permalink
Merge pull request #1743 from space-syndicate/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Morb0 authored Jan 10, 2024
2 parents 3421695 + 5a25967 commit 71b9b49
Show file tree
Hide file tree
Showing 1,007 changed files with 531,331 additions and 626,172 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
# - name: Install dependencies
# run: sudo apt-get install -y python3-paramiko
# run: sudo apt-get install -y python3-paramiko python3-lxml

- uses: actions/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions Content.Benchmarks/EntityManagerGetAllComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public void Setup()
var componentFactory = new Mock<IComponentFactory>();
componentFactory.Setup(p => p.GetComponent<DummyComponent>()).Returns(new DummyComponent());
componentFactory.Setup(p => p.GetRegistration(It.IsAny<DummyComponent>())).Returns(dummyReg);
componentFactory.Setup(p => p.GetAllRegistrations()).Returns(new[] { dummyReg });
componentFactory.Setup(p => p.GetAllRefTypes()).Returns(new[] { CompIdx.Index<DummyComponent>() });

IoCManager.RegisterInstance<IComponentFactory>(componentFactory.Object);
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Atmos/UI/GasFilterBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Content.Client.Atmos.EntitySystems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Trinary.Components;
using Content.Shared.Localizations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.Atmos.UI
{
Expand Down Expand Up @@ -50,7 +50,7 @@ private void OnToggleStatusButtonPressed()

private void OnFilterTransferRatePressed(string value)
{
float rate = float.TryParse(value, out var parsed) ? parsed : 0f;
var rate = UserInputParser.TryFloat(value, out var parsed) ? parsed : 0f;

SendMessage(new GasFilterChangeRateMessage(rate));
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Atmos/UI/GasFilterWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Label Text="{Loc comp-gas-filter-ui-filter-transfer-rate}"/>
<LineEdit Name="FilterTransferRateInput" MinSize="60 0" />
<LineEdit Name="FilterTransferRateInput" MinSize="70 0" />
<Button Name="SetFilterRate" Text="{Loc comp-gas-filter-ui-filter-set-rate}" Disabled="True"/>
</BoxContainer>

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Atmos/UI/GasFilterWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public GasFilterWindow(IEnumerable<GasPrototype> gases)

public void SetTransferRate(float rate)
{
FilterTransferRateInput.Text = rate.ToString(CultureInfo.InvariantCulture);
FilterTransferRateInput.Text = rate.ToString(CultureInfo.CurrentCulture);
}

public void SetFilterStatus(bool enabled)
Expand Down
5 changes: 3 additions & 2 deletions Content.Client/Atmos/UI/GasMixerBoundUserInteface.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Trinary.Components;
using Content.Shared.Localizations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

Expand Down Expand Up @@ -47,7 +48,7 @@ private void OnToggleStatusButtonPressed()

private void OnMixerOutputPressurePressed(string value)
{
var pressure = float.TryParse(value, out var parsed) ? parsed : 0f;
var pressure = UserInputParser.TryFloat(value, out var parsed) ? parsed : 0f;
if (pressure > MaxPressure)
pressure = MaxPressure;

Expand All @@ -57,7 +58,7 @@ private void OnMixerOutputPressurePressed(string value)
private void OnMixerSetPercentagePressed(string value)
{
// We don't need to send both nodes because it's just 100.0f - node
var node = float.TryParse(value, out var parsed) ? parsed : 1.0f;
var node = UserInputParser.TryFloat(value, out var parsed) ? parsed : 1.0f;

node = Math.Clamp(node, 0f, 100.0f);

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Atmos/UI/GasMixerWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Label Text="{Loc comp-gas-mixer-ui-mixer-output-pressure}"/>
<Control MinSize="5 0" />
<LineEdit Name="MixerPressureOutputInput" MinSize="60 0" />
<LineEdit Name="MixerPressureOutputInput" MinSize="70 0" />
<Control MinSize="5 0" />
<Button Name="SetMaxPressureButton" Text="{Loc comp-gas-mixer-ui-mixer-max}" />
<Control MinSize="5 0" />
Expand Down
8 changes: 4 additions & 4 deletions Content.Client/Atmos/UI/GasMixerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public GasMixerWindow()

SetMaxPressureButton.OnPressed += _ =>
{
MixerPressureOutputInput.Text = Atmospherics.MaxOutputPressure.ToString(CultureInfo.InvariantCulture);
MixerPressureOutputInput.Text = Atmospherics.MaxOutputPressure.ToString(CultureInfo.CurrentCulture);
SetOutputPressureButton.Disabled = false;
};

Expand All @@ -69,16 +69,16 @@ public GasMixerWindow()

public void SetOutputPressure(float pressure)
{
MixerPressureOutputInput.Text = pressure.ToString(CultureInfo.InvariantCulture);
MixerPressureOutputInput.Text = pressure.ToString(CultureInfo.CurrentCulture);
}

public void SetNodePercentages(float nodeOne)
{
nodeOne *= 100.0f;
MixerNodeOneInput.Text = nodeOne.ToString("0.##", CultureInfo.InvariantCulture);
MixerNodeOneInput.Text = nodeOne.ToString("0.##", CultureInfo.CurrentCulture);

float nodeTwo = 100.0f - nodeOne;
MixerNodeTwoInput.Text = nodeTwo.ToString("0.##", CultureInfo.InvariantCulture);
MixerNodeTwoInput.Text = nodeTwo.ToString("0.##", CultureInfo.CurrentCulture);
}

public void SetMixerStatus(bool enabled)
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Atmos/UI/GasPressurePumpBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Binary.Components;
using Content.Shared.Localizations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

Expand Down Expand Up @@ -46,7 +47,7 @@ private void OnToggleStatusButtonPressed()

private void OnPumpOutputPressurePressed(string value)
{
float pressure = float.TryParse(value, out var parsed) ? parsed : 0f;
var pressure = UserInputParser.TryFloat(value, out var parsed) ? parsed : 0f;
if (pressure > MaxPressure) pressure = MaxPressure;

SendMessage(new GasPressurePumpChangeOutputPressureMessage(pressure));
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Atmos/UI/GasPressurePumpWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Label Text="{Loc comp-gas-pump-ui-pump-output-pressure}"/>
<Control MinSize="5 0" />
<LineEdit Name="PumpPressureOutputInput" MinSize="60 0" />
<LineEdit Name="PumpPressureOutputInput" MinSize="70 0" />
<Control MinSize="5 0" />
<Button Name="SetMaxPressureButton" Text="{Loc comp-gas-pump-ui-pump-set-max}" />
<Control MinSize="5 0" />
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Atmos/UI/GasPressurePumpWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public GasPressurePumpWindow()

SetMaxPressureButton.OnPressed += _ =>
{
PumpPressureOutputInput.Text = Atmospherics.MaxOutputPressure.ToString(CultureInfo.InvariantCulture);
PumpPressureOutputInput.Text = Atmospherics.MaxOutputPressure.ToString(CultureInfo.CurrentCulture);
SetOutputPressureButton.Disabled = false;
};
}

public void SetOutputPressure(float pressure)
{
PumpPressureOutputInput.Text = pressure.ToString(CultureInfo.InvariantCulture);
PumpPressureOutputInput.Text = pressure.ToString(CultureInfo.CurrentCulture);
}

public void SetPumpStatus(bool enabled)
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Atmos/UI/GasThermomachineWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public GasThermomachineWindow()
RobustXamlLoader.Load(this);

SpinboxHBox.AddChild(
TemperatureSpinbox = new FloatSpinBox(.1f, 2) { MaxWidth = 150, HorizontalExpand = true }
TemperatureSpinbox = new FloatSpinBox(.1f, 2) { MinWidth = 150, HorizontalExpand = true }
);
}

Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Atmos/UI/GasVolumePumpBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Binary.Components;
using Content.Shared.Localizations;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

Expand Down Expand Up @@ -46,7 +47,7 @@ private void OnToggleStatusButtonPressed()

private void OnPumpTransferRatePressed(string value)
{
var rate = float.TryParse(value, out var parsed) ? parsed : 0f;
var rate = UserInputParser.TryFloat(value, out var parsed) ? parsed : 0f;
if (rate > MaxTransferRate)
rate = MaxTransferRate;

Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Atmos/UI/GasVolumePumpWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Label Text="{Loc comp-gas-pump-ui-pump-transfer-rate}"/>
<Control MinSize="5 0" />
<LineEdit Name="PumpTransferRateInput" MinSize="60 0" />
<LineEdit Name="PumpTransferRateInput" MinSize="70 0" />
<Control MinSize="5 0" />
<Button Name="SetMaxRateButton" Text="{Loc comp-gas-pump-ui-pump-set-max}" />
<Control MinSize="5 0" />
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Atmos/UI/GasVolumePumpWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public GasVolumePumpWindow()

SetMaxRateButton.OnPressed += _ =>
{
PumpTransferRateInput.Text = Atmospherics.MaxTransferRate.ToString(CultureInfo.InvariantCulture);
PumpTransferRateInput.Text = Atmospherics.MaxTransferRate.ToString(CultureInfo.CurrentCulture);
SetTransferRateButton.Disabled = false;
};
}

public void SetTransferRate(float rate)
{
PumpTransferRateInput.Text = rate.ToString(CultureInfo.InvariantCulture);
PumpTransferRateInput.Text = rate.ToString(CultureInfo.CurrentCulture);
}

public void SetPumpStatus(bool enabled)
Expand Down
4 changes: 1 addition & 3 deletions Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public sealed partial class ContentAudioSystem
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IResourceCache _resource = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IStateManager _state = default!;
[Dependency] private readonly RulesSystem _rules = default!;
Expand Down Expand Up @@ -153,8 +152,7 @@ private void UpdateAmbientMusic()
// Update still runs in lobby so just ignore it.
if (_state.CurrentState is not GameplayState)
{
Audio.Stop(_ambientMusicStream);
_ambientMusicStream = null;
_ambientMusicStream = Audio.Stop(_ambientMusicStream);
_musicProto = null;
return;
}
Expand Down
6 changes: 4 additions & 2 deletions Content.Client/Audio/ContentAudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ private void UpdateFades(float frameTime)
}

var volume = component.Volume - change * frameTime;
component.Volume = MathF.Max(MinVolume, volume);
volume = MathF.Max(MinVolume, volume);
_audio.SetVolume(stream, volume, component);

if (component.Volume.Equals(MinVolume))
{
Expand All @@ -145,7 +146,8 @@ private void UpdateFades(float frameTime)
}

var volume = component.Volume + change * frameTime;
component.Volume = MathF.Min(target, volume);
volume = MathF.Max(target, volume);
_audio.SetVolume(stream, volume, component);

if (component.Volume.Equals(target))
{
Expand Down
10 changes: 9 additions & 1 deletion Content.Client/CombatMode/CombatModeIndicatorsOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.Serialization;
using Robust.Client.UserInterface;
using Robust.Shared.Enums;
using Robust.Shared.Graphics;
Expand All @@ -26,6 +27,7 @@ public sealed class CombatModeIndicatorsOverlay : Overlay
private readonly HandsSystem _hands = default!;

private readonly Texture _gunSight;
private readonly Texture _gunBoltSight;
private readonly Texture _meleeSight;

public override OverlaySpace Space => OverlaySpace.ScreenSpace;
Expand All @@ -46,6 +48,8 @@ public CombatModeIndicatorsOverlay(IInputManager input, IEntityManager entMan,
var spriteSys = _entMan.EntitySysManager.GetEntitySystem<SpriteSystem>();
_gunSight = spriteSys.Frame0(new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/crosshair_pointers.rsi"),
"gun_sight"));
_gunBoltSight = spriteSys.Frame0(new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/crosshair_pointers.rsi"),
"gun_bolt_sight"));
_meleeSight = spriteSys.Frame0(new SpriteSpecifier.Rsi(new ResPath("/Textures/Interface/Misc/crosshair_pointers.rsi"),
"melee_sight"));
}
Expand All @@ -67,12 +71,16 @@ protected override void Draw(in OverlayDrawArgs args)

var handEntity = _hands.GetActiveHandEntity();
var isHandGunItem = _entMan.HasComponent<GunComponent>(handEntity);
var isGunBolted = true;
if (_entMan.TryGetComponent(handEntity, out ChamberMagazineAmmoProviderComponent? chamber))
isGunBolted = chamber.BoltClosed ?? true;


var mousePos = mouseScreenPosition.Position;
var uiScale = (args.ViewportControl as Control)?.UIScale ?? 1f;
var limitedScale = uiScale > 1.25f ? 1.25f : uiScale;

var sight = isHandGunItem ? _gunSight : _meleeSight;
var sight = isHandGunItem ? (isGunBolted ? _gunSight : _gunBoltSight) : _meleeSight;
DrawSight(sight, args.ScreenHandle, mousePos, limitedScale * Scale);
}

Expand Down
35 changes: 19 additions & 16 deletions Content.Client/Construction/ConstructionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,30 @@ public override void Shutdown()

private void HandleConstructionGhostExamined(EntityUid uid, ConstructionGhostComponent component, ExaminedEvent args)
{
if (component.Prototype == null) return;
if (component.Prototype == null)
return;

args.PushMarkup(Loc.GetString(
"construction-ghost-examine-message",
("name", component.Prototype.Name)));
using (args.PushGroup(nameof(ConstructionGhostComponent)))
{
args.PushMarkup(Loc.GetString(
"construction-ghost-examine-message",
("name", component.Prototype.Name)));

if (!_prototypeManager.TryIndex(component.Prototype.Graph, out ConstructionGraphPrototype? graph))
return;
if (!_prototypeManager.TryIndex(component.Prototype.Graph, out ConstructionGraphPrototype? graph))
return;

var startNode = graph.Nodes[component.Prototype.StartNode];
var startNode = graph.Nodes[component.Prototype.StartNode];

if (!graph.TryPath(component.Prototype.StartNode, component.Prototype.TargetNode, out var path) ||
!startNode.TryGetEdge(path[0].Name, out var edge))
{
return;
}
if (!graph.TryPath(component.Prototype.StartNode, component.Prototype.TargetNode, out var path) ||
!startNode.TryGetEdge(path[0].Name, out var edge))
{
return;
}

foreach (ConstructionGraphStep step in edge.Steps)
{
args.Message.PushNewline();
step.DoExamine(args);
foreach (var step in edge.Steps)
{
step.DoExamine(args);
}
}
}

Expand Down
9 changes: 5 additions & 4 deletions Content.Client/Construction/UI/FlatpackCreatorMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" VerticalExpand="True" Margin="10">
<BoxContainer SizeFlagsStretchRatio="2" Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
<BoxContainer Orientation="Vertical">
<SpriteView Name="MachineSprite" Scale="4 4" HorizontalAlignment="Center" MinSize="128 128"/>
<SpriteView Name="MachineSprite" Scale="4 4" HorizontalAlignment="Center" VerticalExpand="True" MinSize="128 128"/>
<RichTextLabel Name="MachineNameLabel" HorizontalAlignment="Center" StyleClasses="LabelKeyText"/>
</BoxContainer>
<Control MinHeight="10"/>
<Button Name="PackButton" Text="{Loc 'flatpacker-ui-pack-button'}" MaxWidth="150" Margin="0 0 0 10"/>
<BoxContainer Orientation="Vertical" VerticalExpand="True">
<BoxContainer Orientation="Vertical" VerticalExpand="True" RectClipContent="True">
<Label Name="CostHeaderLabel" Text="{Loc 'flatpacker-ui-cost-label'}" HorizontalAlignment="Left"/>
<PanelContainer VerticalExpand="True"
HorizontalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical" VerticalExpand="True">
<RichTextLabel Name="CostLabel" HorizontalAlignment="Center"/>
<BoxContainer Orientation="Vertical" VerticalAlignment="Center">
<RichTextLabel Name="CostLabel" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<RichTextLabel Name="InsertLabel" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</BoxContainer>
</PanelContainer>
</BoxContainer>
Expand Down
Loading

0 comments on commit 71b9b49

Please sign in to comment.