Skip to content

Commit

Permalink
Merge branch 'master' into G11
Browse files Browse the repository at this point in the history
  • Loading branch information
DEATHB4DEFEAT authored Jan 18, 2024
2 parents 9620ea8 + cfb41bc commit bbabcaa
Show file tree
Hide file tree
Showing 1,386 changed files with 31,282 additions and 883,455 deletions.
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
26 changes: 26 additions & 0 deletions Content.Client/DeltaV/Biscuit/BiscuitSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Content.Shared.DeltaV.Biscuit;
using Robust.Client.GameObjects;

namespace Content.Client.DeltaV.Biscuit;

public sealed class BiscuitSystem : VisualizerSystem<BiscuitVisualsComponent>
{
[Dependency] private readonly AppearanceSystem _appearance = default!;

protected override void OnAppearanceChange(EntityUid uid, BiscuitVisualsComponent component,
ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;

_appearance.TryGetData(uid, BiscuitStatus.Cracked, out bool cracked);

args.Sprite.LayerSetVisible(BiscuitVisualLayers.Top, !cracked);
}
}

public enum BiscuitVisualLayers : byte
{
Base,
Top
}
5 changes: 5 additions & 0 deletions Content.Client/DeltaV/Biscuit/BiscuitVisualsComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Content.Client.DeltaV.Biscuit;

[RegisterComponent]
public sealed partial class BiscuitVisualsComponent : Component
{}
35 changes: 35 additions & 0 deletions Content.Client/DeltaV/CartridgeLoader/Cartridges/CrimeAssistUi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Robust.Client.UserInterface;
using Content.Client.UserInterface.Fragments;
using Content.Shared.DeltaV.CartridgeLoader.Cartridges;
using Content.Shared.CartridgeLoader;
using Robust.Shared.Prototypes;

namespace Content.Client.DeltaV.CartridgeLoader.Cartridges;

public sealed partial class CrimeAssistUi : UIFragment
{
private CrimeAssistUiFragment? _fragment;

public override Control GetUIFragmentRoot()
{
return _fragment!;
}

public override void Setup(BoundUserInterface userInterface, EntityUid? fragmentOwner)
{
_fragment = new CrimeAssistUiFragment();

_fragment.OnSync += _ => SendSyncMessage(userInterface);
}

private void SendSyncMessage(BoundUserInterface userInterface)
{
var syncMessage = new CrimeAssistSyncMessageEvent();
var message = new CartridgeUiMessage(syncMessage);
userInterface.SendMessage(message);
}

public override void UpdateState(BoundUserInterfaceState state)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<cartridges:CrimeAssistUiFragment xmlns:cartridges="clr-namespace:Content.Client.DeltaV.CartridgeLoader.Cartridges"
xmlns="https://spacestation14.io" Margin="1 0 2 0">
<PanelContainer StyleClasses="BackgroundDark"></PanelContainer>
<BoxContainer Name="ExplanationBox" Orientation="Vertical" MaxWidth="400" VerticalExpand="True" Margin="5">
<RichTextLabel Name ="Title" />
<RichTextLabel Name ="Subtitle"/>
<RichTextLabel Name ="Explanation"/>
<RichTextLabel Name ="Punishment" Margin="0,20"/>
</BoxContainer>
<BoxContainer Name="QuestionBox" Orientation="Horizontal" HorizontalAlignment="Center" HorizontalExpand="True" VerticalExpand="False">
<Button Name="StartButton" Access="Public" Text="Start"/>
<Button Name="HomeButton" Access="Public" Text="Home" Visible="False"/>
<Button Name="YesButton" Access="Public" Text="Yes" Visible="False"/>
<Button Name="NoButton" Access="Public" Text="No" Visible="False"/>
</BoxContainer>
</cartridges:CrimeAssistUiFragment>
Loading

0 comments on commit bbabcaa

Please sign in to comment.