Skip to content

Commit

Permalink
Merge pull request #395 from Rxup/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Rxup authored Dec 24, 2023
2 parents f47e79c + 871e223 commit 95e7cc0
Show file tree
Hide file tree
Showing 678 changed files with 172,780 additions and 163,742 deletions.
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Client (Compatibility renderer)",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/bin/Content.Client/Content.Client.dll",
"args": "--cvar display.compat=true",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Server",
"type": "coreclr",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Linq;
using Content.Client.Administration.Systems;
using Content.Client.UserInterface.Controls;
using Content.Client.Verbs;
using Content.Client.Verbs.UI;
using Content.Shared.Administration;
using Content.Shared.Input;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
Expand Down Expand Up @@ -39,6 +37,7 @@ public PlayerListControl()
RobustXamlLoader.Load(this);
// Fill the Option data
PlayerListContainer.ItemPressed += PlayerListItemPressed;
PlayerListContainer.ItemKeyBindDown += PlayerListItemKeyBindDown;
PlayerListContainer.GenerateItem += GenerateButton;
PopulateList(_adminSystem.PlayerList);
FilterLineEdit.OnTextChanged += _ => FilterList();
Expand All @@ -50,18 +49,27 @@ private void PlayerListItemPressed(BaseButton.ButtonEventArgs? args, ListData? d
{
if (args == null || data is not PlayerListData {Info: var selectedPlayer})
return;
if (args.Event.Function == EngineKeyFunctions.UIClick)
{
OnSelectionChanged?.Invoke(selectedPlayer);

// update label text. Only required if there is some override (e.g. unread bwoink count).
if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
label.Text = GetText(selectedPlayer);
}
else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.NetEntity != null)
{
_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.NetEntity.Value, true);
}
if (args.Event.Function != EngineKeyFunctions.UIClick)
return;

OnSelectionChanged?.Invoke(selectedPlayer);

// update label text. Only required if there is some override (e.g. unread bwoink count).
if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
label.Text = GetText(selectedPlayer);
}

private void PlayerListItemKeyBindDown(GUIBoundKeyEventArgs? args, ListData? data)
{
if (args == null || data is not PlayerListData { Info: var selectedPlayer })
return;

if (args.Function != EngineKeyFunctions.UIRightClick || selectedPlayer.NetEntity == null)
return;

_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.NetEntity.Value, true);
args.Handle();
}

public void StopFiltering()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Content.Client.Station;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Map.Components;

Expand All @@ -15,7 +14,7 @@ public sealed partial class ObjectsTab : Control
private readonly List<ObjectsTabEntry> _objects = new();
private List<ObjectsTabSelection> _selections = new();

public event Action<BaseButton.ButtonEventArgs>? OnEntryPressed;
public event Action<ObjectsTabEntry, GUIBoundKeyEventArgs>? OnEntryKeyBindDown;

public ObjectsTab()
{
Expand Down Expand Up @@ -82,7 +81,7 @@ private void RefreshObjectList(ObjectsTabSelection selection)
var ctrl = new ObjectsTabEntry(name, entity);
_objects.Add(ctrl);
ObjectList.AddChild(ctrl);
ctrl.OnPressed += args => OnEntryPressed?.Invoke(args);
ctrl.OnKeyBindDown += args => OnEntryKeyBindDown?.Invoke(ctrl, args);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public sealed partial class PlayerTab : Control
private bool _ascending = true;
private bool _showDisconnected;

public event Action<ButtonEventArgs>? OnEntryPressed;
public event Action<PlayerTabEntry, GUIBoundKeyEventArgs>? OnEntryKeyBindDown;

public PlayerTab()
{
Expand Down Expand Up @@ -123,7 +123,7 @@ private void RefreshPlayerList(IReadOnlyList<PlayerInfo> players)
player.Connected,
player.PlaytimeString);
entry.PlayerEntity = player.NetEntity;
entry.OnPressed += args => OnEntryPressed?.Invoke(args);
entry.OnKeyBindDown += args => OnEntryKeyBindDown?.Invoke(entry, args);
entry.ToolTip = Loc.GetString("player-tab-entry-tooltip");
PlayerList.AddChild(entry);

Expand Down
34 changes: 30 additions & 4 deletions Content.Client/Atmos/UI/GasAnalyzerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ private void GenerateGasDisplay(GasMixEntry gasMix, Control parent)
{
Orientation = BoxContainer.LayoutOrientation.Vertical
};
var tablePercent = new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Vertical
};
dataContainer.AddChild(new BoxContainer
{
Orientation = BoxContainer.LayoutOrientation.Horizontal,
Expand All @@ -252,14 +256,21 @@ private void GenerateGasDisplay(GasMixEntry gasMix, Control parent)
MinSize = new Vector2(10, 0),
HorizontalExpand = true
},
tableVal
tableVal,
new Control
{
MinSize = new Vector2(10, 0),
HorizontalExpand = true
},
tablePercent
}
});
// This is the gas bar thingy
var height = 30;
var gasBar = new SplitBar
{
MinHeight = height,
MinBarSize = new Vector2(12, 0)
};
// Separator
dataContainer.AddChild(new Control
Expand All @@ -274,6 +285,17 @@ private void GenerateGasDisplay(GasMixEntry gasMix, Control parent)
totalGasAmount += gas.Amount;
}

tableKey.AddChild(new Label
{ Text = Loc.GetString("gas-analyzer-window-gas-column-name"), Align = Label.AlignMode.Center });
tableVal.AddChild(new Label
{ Text = Loc.GetString("gas-analyzer-window-molarity-column-name"), Align = Label.AlignMode.Center });
tablePercent.AddChild(new Label
{ Text = Loc.GetString("gas-analyzer-window-percentage-column-name"), Align = Label.AlignMode.Center });

tableKey.AddChild(new StripeBack());
tableVal.AddChild(new StripeBack());
tablePercent.AddChild(new StripeBack());

for (var j = 0; j < gasMix.Gases.Length; j++)
{
var gas = gasMix.Gases[j];
Expand All @@ -286,10 +308,14 @@ private void GenerateGasDisplay(GasMixEntry gasMix, Control parent)
tableVal.AddChild(new Label
{
Text = Loc.GetString("gas-analyzer-window-molarity-text",
("mol", $"{gas.Amount:0.##}"),
("percentage", $"{(gas.Amount / totalGasAmount * 100):0.#}")),
("mol", $"{gas.Amount:0.00}")),
Align = Label.AlignMode.Right,
HorizontalExpand = true
});
tablePercent.AddChild(new Label
{
Text = Loc.GetString("gas-analyzer-window-percentage-text",
("percentage", $"{(gas.Amount / totalGasAmount * 100):0.0}")),
Align = Label.AlignMode.Right
});

// Add to the gas bar //TODO: highlight the currently hover one
Expand Down
14 changes: 4 additions & 10 deletions Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void InitializeAmbientMusic()
_nextAudio = TimeSpan.MaxValue;

SetupAmbientSounds();
_proto.PrototypesReloaded += OnProtoReload;
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnProtoReload);
_state.OnStateChanged += OnStateChange;
// On round end summary OR lobby cut audio.
SubscribeNetworkEvent<RoundEndMessageEvent>(OnRoundEndMessage);
Expand All @@ -86,21 +86,14 @@ private void AmbienceCVarChanged(float obj)
private void ShutdownAmbientMusic()
{
_configManager.UnsubValueChanged(CCVars.AmbientMusicVolume, AmbienceCVarChanged);
_proto.PrototypesReloaded -= OnProtoReload;
_state.OnStateChanged -= OnStateChange;
_ambientMusicStream = _audio.Stop(_ambientMusicStream);
}

private void OnProtoReload(PrototypesReloadedEventArgs obj)
{
if (!obj.ByType.ContainsKey(typeof(AmbientMusicPrototype)) &&
!obj.ByType.ContainsKey(typeof(RulesPrototype)))
{
return;
}

_ambientSounds.Clear();
SetupAmbientSounds();
if (obj.WasModified<AmbientMusicPrototype>() || obj.WasModified<RulesPrototype>())
SetupAmbientSounds();
}

private void OnStateChange(StateChangedEventArgs obj)
Expand All @@ -114,6 +107,7 @@ private void OnStateChange(StateChangedEventArgs obj)

private void SetupAmbientSounds()
{
_ambientSounds.Clear();
foreach (var ambience in _proto.EnumeratePrototypes<AmbientMusicPrototype>())
{
var tracks = _ambientSounds.GetOrNew(ambience.ID);
Expand Down
13 changes: 4 additions & 9 deletions Content.Client/Clothing/Systems/ChameleonClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,13 @@ public override void Initialize()
SubscribeLocalEvent<ChameleonClothingComponent, AfterAutoHandleStateEvent>(HandleState);

PrepareAllVariants();
_proto.PrototypesReloaded += OnProtoReloaded;
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnProtoReloaded);
}

public override void Shutdown()
private void OnProtoReloaded(PrototypesReloadedEventArgs args)
{
base.Shutdown();
_proto.PrototypesReloaded -= OnProtoReloaded;
}

private void OnProtoReloaded(PrototypesReloadedEventArgs _)
{
PrepareAllVariants();
if (args.WasModified<EntityPrototype>())
PrepareAllVariants();
}

private void HandleState(EntityUid uid, ChameleonClothingComponent component, ref AfterAutoHandleStateEvent args)
Expand Down
18 changes: 6 additions & 12 deletions Content.Client/CrewManifest/CrewManifestSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Content.Client.GameTicking.Managers;
using Content.Shared.CrewManifest;
using Content.Shared.Roles;
using Robust.Shared.Prototypes;
Expand All @@ -19,12 +18,7 @@ public override void Initialize()
base.Initialize();

BuildDepartmentLookup();
_prototypeManager.PrototypesReloaded += OnPrototypesReload;
}

public override void Shutdown()
{
_prototypeManager.PrototypesReloaded -= OnPrototypesReload;
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypesReload);
}

/// <summary>
Expand All @@ -36,16 +30,16 @@ public void RequestCrewManifest(NetEntity netEntity)
RaiseNetworkEvent(new RequestCrewManifestMessage(netEntity));
}

private void OnPrototypesReload(PrototypesReloadedEventArgs _)
private void OnPrototypesReload(PrototypesReloadedEventArgs args)
{
_jobDepartmentLookup.Clear();
_departments.Clear();

BuildDepartmentLookup();
if (args.WasModified<DepartmentPrototype>())
BuildDepartmentLookup();
}

private void BuildDepartmentLookup()
{
_jobDepartmentLookup.Clear();
_departments.Clear();
foreach (var department in _prototypeManager.EnumeratePrototypes<DepartmentPrototype>())
{
_departments.Add(department.ID);
Expand Down
9 changes: 9 additions & 0 deletions Content.Client/Items/Systems/ItemToggleSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Content.Shared.Item.ItemToggle;

namespace Content.Shared.Item;

/// <inheritdoc/>
public sealed class ItemToggleSystem : SharedItemToggleSystem
{

}
11 changes: 11 additions & 0 deletions Content.Client/MagicMirror/MagicMirrorBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,16 @@ protected override void ReceiveMessage(BoundUserInterfaceMessage message)

_window.UpdateState(data);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;

if (_window != null)
_window.OnClose -= Close;

_window?.Dispose();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
xmlns:ui="clr-namespace:Content.Client.Medical.CrewMonitoring"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'crew-monitoring-user-interface-title'}"
SetSize="1200 700"
MinSize="1200 700">
SetSize="1210 700"
MinSize="1210 700">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Horizontal" VerticalExpand="True" HorizontalExpand="True">
<ui:CrewMonitoringNavMapControl Name="NavMap" HorizontalExpand="True" VerticalExpand="True" Margin="5 20"/>
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Vertical" Margin="0 0 10 0">
<controls:StripeBack>
<PanelContainer>
<Label Name="StationName" Text="Unknown station" Align="Center" />
<Label Name="StationName" Text="Unknown station" Align="Center" Margin="0 5 0 3"/>
</PanelContainer>
</controls:StripeBack>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,6 @@ public void ClearAllOverlays()
_overlay.RemoveOverlay(overlay);
}

// hacky solution related to mapping
public void SetActiveDeviceList(EntityUid tool, EntityUid list, NetworkConfiguratorComponent? component = null)
{
if (!Resolve(tool, ref component))
{
return;
}

component.ActiveDeviceList = list;
}

private sealed class StatusControl : Control
{
private readonly RichTextLabel _label;
Expand Down
10 changes: 0 additions & 10 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
<Control MinSize="4 0" />
<OptionButton Name="UIScaleOption" />
</BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ui-options-hud-theme'}" />
<Control MinSize="4 0" />
<OptionButton Name="HudThemeOption" />
</BoxContainer>
<BoxContainer Orientation="Horizontal">
<CheckBox Name="ViewportStretchCheckBox" Text="{Loc 'ui-options-vp-stretch'}" />
<BoxContainer Name="ViewportScaleBox" Orientation="Horizontal">
Expand All @@ -38,11 +33,6 @@
Rounded="True"
MinWidth="200" />
</BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'ui-options-hud-layout'}" />
<Control MinSize="4 0" />
<OptionButton Name="HudLayoutOption" />
</BoxContainer>
<CheckBox Name="IntegerScalingCheckBox"
Text="{Loc 'ui-options-vp-integer-scaling'}"
ToolTip="{Loc 'ui-options-vp-integer-scaling-tooltip'}" />
Expand Down
Loading

0 comments on commit 95e7cc0

Please sign in to comment.