Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Content.Client/Audio/Jukebox/JukeboxBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public void SetTime(float time)
{
var sentTime = time;

// You may be wondering, what the fuck is this
// Well we want to be able to predict the playback slider change, of which there are many ways to do it
// You may be wondering: "What is this?"
// Well, we want to be able to predict the playback slider change, of which there are many ways to do it
// We can't just use SendPredictedMessage because it will reset every tick and audio updates every frame
// so it will go BRRRRT
// so it will go BRR
// Using ping gets us close enough that it SHOULD, MOST OF THE TIME, fall within the 0.1 second tolerance
// that's still on engine so our playback position never gets corrected.
if (EntMan.TryGetComponent(Owner, out JukeboxComponent? jukebox) &&
Expand Down
15 changes: 11 additions & 4 deletions Content.Client/Audio/Jukebox/JukeboxMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System.Linq;
using Content.Shared.Audio.Jukebox;
using Robust.Client.Audio;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Audio.Components;
using Robust.Shared.Input;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using FancyWindow = Content.Client.UserInterface.Controls.FancyWindow;
Expand All @@ -27,6 +26,7 @@ public sealed partial class JukeboxMenu : FancyWindow
/// True if playing, false if paused.
/// </summary>
public event Action<bool>? OnPlayPressed;

public event Action? OnStopPressed;
public event Action<ProtoId<JukeboxPrototype>>? OnSongSelected;
public event Action<float>? SetTime;
Expand Down Expand Up @@ -88,7 +88,13 @@ public void Populate(IEnumerable<JukeboxPrototype> jukeboxProtos)
{
MusicList.Clear();

foreach (var entry in jukeboxProtos)
// Sort songs by entry name, ignoring any special characters by targeting letters and digits first.
var sortedSongs = jukeboxProtos
.OrderBy(e => new string(e.Name.Where(char.IsLetterOrDigit).ToArray()))
.ToList();

// Add the sorted entries into the available roster.
foreach (var entry in sortedSongs)
{
MusicList.AddItem(entry.Name, metadata: entry.ID);
}
Expand Down Expand Up @@ -130,7 +136,8 @@ protected override void FrameUpdate(FrameEventArgs args)

if (_entManager.TryGetComponent(_audio, out AudioComponent? audio))
{
DurationLabel.Text = $@"{TimeSpan.FromSeconds(audio.PlaybackPosition):mm\:ss} / {_audioSystem.GetAudioLength(audio.FileName):mm\:ss}";
DurationLabel.Text =
$@"{TimeSpan.FromSeconds(audio.PlaybackPosition):mm\:ss} / {_audioSystem.GetAudioLength(audio.FileName):mm\:ss}";
}
else
{
Expand Down
45 changes: 27 additions & 18 deletions Content.Client/Audio/Jukebox/JukeboxSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

namespace Content.Client.Audio.Jukebox;


public sealed class JukeboxSystem : SharedJukeboxSystem
{
[Dependency] private readonly IPrototypeManager _protoManager = default!;
Expand Down Expand Up @@ -34,9 +33,9 @@ private void OnProtoReload(PrototypesReloadedEventArgs obj)
if (!obj.WasModified<JukeboxPrototype>())
return;

var query = AllEntityQuery<JukeboxComponent, UserInterfaceComponent>();
var jukeboxQuery = AllEntityQuery<JukeboxComponent, UserInterfaceComponent>();

while (query.MoveNext(out var uid, out _, out var ui))
while (jukeboxQuery.MoveNext(out var uid, out _, out var ui))
{
if (!_uiSystem.TryGetOpenUi<JukeboxBoundUserInterface>((uid, ui), JukeboxUiKey.Key, out var bui))
continue;
Expand All @@ -59,7 +58,10 @@ private void OnAnimationCompleted(EntityUid uid, JukeboxComponent component, Ani
return;

if (!TryComp<AppearanceComponent>(uid, out var appearance) ||
!_appearanceSystem.TryGetData<JukeboxVisualState>(uid, JukeboxVisuals.VisualState, out var visualState, appearance))
!_appearanceSystem.TryGetData<JukeboxVisualState>(uid,
JukeboxVisuals.VisualState,
out var visualState,
appearance))
{
visualState = JukeboxVisualState.On;
}
Expand All @@ -81,7 +83,10 @@ private void OnAppearanceChange(EntityUid uid, JukeboxComponent component, ref A
UpdateAppearance(uid, visualState, component, args.Sprite);
}

private void UpdateAppearance(EntityUid uid, JukeboxVisualState visualState, JukeboxComponent component, SpriteComponent sprite)
private void UpdateAppearance(EntityUid uid,
JukeboxVisualState visualState,
JukeboxComponent component,
SpriteComponent sprite)
{
SetLayerState(JukeboxVisualLayers.Base, component.OffState, sprite);

Expand All @@ -101,17 +106,21 @@ private void UpdateAppearance(EntityUid uid, JukeboxVisualState visualState, Juk
}
}

private void PlayAnimation(EntityUid uid, JukeboxVisualLayers layer, string? state, float animationTime, SpriteComponent sprite)
private void PlayAnimation(EntityUid uid,
JukeboxVisualLayers layer,
string? state,
float animationTime,
SpriteComponent sprite)
{
if (string.IsNullOrEmpty(state))
return;

if (!_animationPlayer.HasRunningAnimation(uid, state))
{
var animation = GetAnimation(layer, state, animationTime);
sprite.LayerSetVisible(layer, true);
_animationPlayer.Play(uid, animation, state);
}
if (_animationPlayer.HasRunningAnimation(uid, state))
return; // Short-circuit

var animation = GetAnimation(layer, state, animationTime);
sprite.LayerSetVisible(layer, true);
_animationPlayer.Play(uid, animation, state);
}

private static Animation GetAnimation(JukeboxVisualLayers layer, string state, float animationTime)
Expand All @@ -120,16 +129,16 @@ private static Animation GetAnimation(JukeboxVisualLayers layer, string state, f
{
Length = TimeSpan.FromSeconds(animationTime),
AnimationTracks =
{
new AnimationTrackSpriteFlick
{
new AnimationTrackSpriteFlick
LayerKey = layer,
KeyFrames =
{
LayerKey = layer,
KeyFrames =
{
new AnimationTrackSpriteFlick.KeyFrame(state, 0f)
}
new AnimationTrackSpriteFlick.KeyFrame(state, 0f)
}
}
}
};
}

Expand Down
33 changes: 18 additions & 15 deletions Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using System.Linq;
using System.Numerics;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using System.Linq;
using System.Numerics;
using Content.Shared.FixedPoint;
using Robust.Client.Graphics;
using static Robust.Client.UserInterface.Controls.BoxContainer;

namespace Content.Client.Chemistry.UI
Expand Down Expand Up @@ -47,14 +47,15 @@ public ChemMasterWindow()
{
// For every button decide which stylebase to have
// Every row has 10 buttons
String styleBase = StyleBase.ButtonOpenBoth;
uint modulo = i % 10;
if (i > 0 && modulo == 0)
styleBase = StyleBase.ButtonOpenRight;
else if (i > 0 && modulo == 9)
styleBase = StyleBase.ButtonOpenLeft;
else if (i == 0)
styleBase = StyleBase.ButtonOpenRight;
var styleBase = StyleBase.ButtonOpenBoth;
var modulo = i % 10;
styleBase = i switch
{
> 0 when modulo == 0 => StyleBase.ButtonOpenRight,
> 0 when modulo == 9 => StyleBase.ButtonOpenLeft,
0 => StyleBase.ButtonOpenRight,
_ => styleBase,
};

// Generate buttons
PillTypeButtons[i] = new Button
Expand All @@ -67,7 +68,7 @@ public ChemMasterWindow()

// Generate buttons textures
var specifier = new SpriteSpecifier.Rsi(resourcePath, "pill" + (i + 1));
TextureRect pillTypeTexture = new TextureRect
var pillTypeTexture = new TextureRect
{
Texture = specifier.Frame0(),
TextureScale = new Vector2(1.75f, 1.75f),
Expand Down Expand Up @@ -103,14 +104,16 @@ private ReagentButton MakeReagentButton(string text, ChemMasterReagentAmount amo
private List<ReagentButton> CreateReagentTransferButtons(ReagentId reagent, bool isBuffer, bool addReagentButtons)
{
if (!addReagentButtons)
return new List<ReagentButton>(); // Return an empty list if reagentTransferButton creation is disabled.
return []; // Return an empty list if reagentTransferButton creation is disabled.

var buttonConfigs = new (string text, ChemMasterReagentAmount amount, string styleClass)[]
{
("1", ChemMasterReagentAmount.U1, StyleBase.ButtonOpenBoth),
("5", ChemMasterReagentAmount.U5, StyleBase.ButtonOpenBoth),
("10", ChemMasterReagentAmount.U10, StyleBase.ButtonOpenBoth),
("15", ChemMasterReagentAmount.U15, StyleBase.ButtonOpenBoth),
("25", ChemMasterReagentAmount.U25, StyleBase.ButtonOpenBoth),
("30", ChemMasterReagentAmount.U30, StyleBase.ButtonOpenBoth),
("50", ChemMasterReagentAmount.U50, StyleBase.ButtonOpenBoth),
("100", ChemMasterReagentAmount.U100, StyleBase.ButtonOpenBoth),
(Loc.GetString("chem-master-window-buffer-all-amount"), ChemMasterReagentAmount.All, StyleBase.ButtonOpenLeft),
Expand Down Expand Up @@ -392,7 +395,7 @@ private Control BuildReagentRow(Color reagentColor, int rowCount, string name, R
{
rowContainer.AddChild(reagentTransferButton);
}
//Apply panencontainer to allow for striped rows
//Apply PanelContainer to allow for striped rows
return new PanelContainer
{
PanelOverride = new StyleBoxFlat(currentRowColor),
Expand Down
16 changes: 10 additions & 6 deletions Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public void UpdateReagentsList(List<ReagentInventoryItem> inventory)

ReagentList.Children.Clear();
//Sort inventory by reagentLabel
inventory.Sort((x, y) => x.ReagentLabel.CompareTo(y.ReagentLabel));
inventory.Sort((x, y)
=> string.Compare(x.ReagentLabel, y.ReagentLabel, StringComparison.Ordinal));

foreach (var item in inventory)
{
Expand All @@ -59,7 +60,7 @@ public void UpdateReagentsList(List<ReagentInventoryItem> inventory)
/// <param name="state">State data sent by the server.</param>
public void UpdateState(BoundUserInterfaceState state)
{
var castState = (ReagentDispenserBoundUserInterfaceState) state;
var castState = (ReagentDispenserBoundUserInterfaceState)state;
UpdateContainerInfo(castState);
UpdateReagentsList(castState.Inventory);

Expand All @@ -77,8 +78,10 @@ public void UpdateState(BoundUserInterfaceState state)
/// Update the fill state and list of reagents held by the current reagent container, if applicable.
/// <para>Also highlights a reagent if it's dispense button is being mouse hovered.</para>
/// </summary>
/// <param name="state">State data for the dispenser.</param>
/// or null if no button is being hovered.</param>
/// <param name="state">
/// State data for the dispenser,
/// or null if no button is being hovered.
/// </param>
public void UpdateContainerInfo(ReagentDispenserBoundUserInterfaceState state)
{
ContainerInfo.Children.Clear();
Expand All @@ -87,7 +90,8 @@ public void UpdateContainerInfo(ReagentDispenserBoundUserInterfaceState state)
{
ContainerInfoName.Text = "";
ContainerInfoFill.Text = "";
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 Down Expand Up @@ -116,7 +120,7 @@ public void UpdateContainerInfo(ReagentDispenserBoundUserInterfaceState state)
{
nameLabel,
quantityLabel,
}
},
});
}
}
Expand Down
2 changes: 2 additions & 0 deletions Content.Shared/Chemistry/SharedChemMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ public enum ChemMasterReagentAmount
U1 = 1,
U5 = 5,
U10 = 10,
U15 = 15,
U25 = 25,
U30 = 30,
U50 = 50,
U100 = 100,
All,
Expand Down
4 changes: 3 additions & 1 deletion Resources/Locale/en-US/_Null/guidebook/guides_shipyard.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ guide-entry-shipyard-framework = The Humble Framework (Civil/Scrap)

# Expedition
guide-entry-shipyard-archon = Archon (Expedition)
guide-entry-shipyard-crapbucket = Crapbucket (Expedition)
guide-entry-shipyard-bossman = Bossman (Expedition)
guide-entry-shipyard-clam = Clam (Piracy)
guide-entry-shipyard-crapbucket = Crapbucket (Piracy)
guide-entry-shipyard-foxhunt = Foxhunt (Expedition)
guide-entry-shipyard-littora = Littora (Expedition)
guide-entry-shipyard-pisces = Pisces (Expedition)
Expand Down
6 changes: 5 additions & 1 deletion Resources/Locale/en-US/_Null/tiles.ftl
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
tiles-wood-parquet = wood parquet
tiles-wood-parquet = wood parquet
tiles-plasma-glass-floor = plasma glass floor
tiles-reinforced-plasma-glass-floor = reinforced plasma glass floor
tiles-uranium-glass-floor = uranium floor
tiles-reinforced-uranium-glass-floor = reinforced uranium floor
20 changes: 20 additions & 0 deletions Resources/Prototypes/Entities/Objects/Materials/Sheets/glass.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@
- type: Construction
graph: Glass
node: SheetPGlass
# Frontier : Placable Plasma glass floor tile
- type: FloorTile
outputs:
- FloorPGlass
# End Frontier
- type: Destructible
thresholds:
- trigger:
Expand Down Expand Up @@ -298,6 +303,11 @@
map: ["base"]
- type: Item
heldPrefix: rpglass
# Frontier : Placable reinforced plasma glass floor tile
- type: FloorTile
outputs:
- FloorRPGlass
# End Frontier
- type: Construction
graph: Glass
node: SheetRPGlass
Expand Down Expand Up @@ -353,6 +363,11 @@
map: ["base"]
- type: Item
heldPrefix: uglass
# Frontier : Placable Uranium glass
- type: FloorTile
outputs:
- FloorUGlass
# End Frontier
- type: Construction
graph: Glass
node: SheetUGlass
Expand Down Expand Up @@ -427,6 +442,11 @@
map: ["base"]
- type: Item
heldPrefix: ruglass
# Frontier : Placable Reinforced Uranium Glass
- type: FloorTile
outputs:
- FloorRUGlass
# End Frontier
- type: Construction
graph: Glass
node: SheetRUGlass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@
fireRate: 2.5
- type: Item
sprite: Objects/Weapons/Guns/Battery/svalinn.rsi
size: Small
shape:
- 0,0,1,0
- 0,1,0,1
storedOffset: 0,-8
- type: MagazineVisuals
magState: mag
steps: 5
Expand Down
Loading
Loading