diff --git a/Content.Client/Lathe/UI/LatheBoundUserInterface.cs b/Content.Client/Lathe/UI/LatheBoundUserInterface.cs
index a599f79152e..66f09aa41da 100644
--- a/Content.Client/Lathe/UI/LatheBoundUserInterface.cs
+++ b/Content.Client/Lathe/UI/LatheBoundUserInterface.cs
@@ -1,3 +1,4 @@
+using Content.Shared.DeltaV.Salvage; // DeltaV
using Content.Shared.Lathe;
using Content.Shared.Research.Components;
using JetBrains.Annotations;
@@ -31,6 +32,8 @@ protected override void Open()
{
SendMessage(new LatheQueueRecipeMessage(recipe, amount));
};
+
+ _menu.OnClaimMiningPoints += () => SendMessage(new LatheClaimMiningPointsMessage()); // DeltaV
}
protected override void UpdateState(BoundUserInterfaceState state)
diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml b/Content.Client/Lathe/UI/LatheMenu.xaml
index 5b21f0bae66..506a63328ab 100644
--- a/Content.Client/Lathe/UI/LatheMenu.xaml
+++ b/Content.Client/Lathe/UI/LatheMenu.xaml
@@ -132,9 +132,14 @@
HorizontalExpand="True">
+
+
+
+
+
+
-
diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml.cs b/Content.Client/Lathe/UI/LatheMenu.xaml.cs
index 02464d22e12..d1927cefb69 100644
--- a/Content.Client/Lathe/UI/LatheMenu.xaml.cs
+++ b/Content.Client/Lathe/UI/LatheMenu.xaml.cs
@@ -1,16 +1,20 @@
using System.Linq;
using System.Text;
using Content.Client.Materials;
+using Content.Shared.DeltaV.Salvage.Components; // DeltaV
+using Content.Shared.DeltaV.Salvage.Systems; // DeltaV
using Content.Shared.Lathe;
using Content.Shared.Lathe.Prototypes;
using Content.Shared.Research.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
+using Robust.Client.Player; // DeltaV
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
+using Robust.Shared.Timing; // DeltaV
namespace Content.Client.Lathe.UI;
@@ -18,14 +22,17 @@ namespace Content.Client.Lathe.UI;
public sealed partial class LatheMenu : DefaultWindow
{
[Dependency] private readonly IEntityManager _entityManager = default!;
+ [Dependency] private readonly IPlayerManager _player = default!; // DeltaV
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
private readonly SpriteSystem _spriteSystem;
private readonly LatheSystem _lathe;
private readonly MaterialStorageSystem _materialStorage;
+ private readonly MiningPointsSystem _miningPoints; // DeltaV
public event Action? OnServerListButtonPressed;
public event Action? RecipeQueueAction;
+ public event Action? OnClaimMiningPoints; // DeltaV
public List> Recipes = new();
@@ -35,6 +42,8 @@ public sealed partial class LatheMenu : DefaultWindow
public EntityUid Entity;
+ private uint? _lastMiningPoints; // DeltaV: used to avoid Loc.GetString every frame
+
public LatheMenu()
{
RobustXamlLoader.Load(this);
@@ -43,6 +52,7 @@ public LatheMenu()
_spriteSystem = _entityManager.System();
_lathe = _entityManager.System();
_materialStorage = _entityManager.System();
+ _miningPoints = _entityManager.System(); // DeltaV
SearchBar.OnTextChanged += _ =>
{
@@ -70,9 +80,29 @@ public void SetEntity(EntityUid uid)
}
}
+ // Begin DeltaV Additions: Mining points UI
+ MiningPointsContainer.Visible = _entityManager.TryGetComponent(Entity, out var points);
+ MiningPointsClaimButton.OnPressed += _ => OnClaimMiningPoints?.Invoke();
+ if (points != null)
+ UpdateMiningPoints(points.Points);
+ // End DeltaV Additions
+
MaterialsList.SetOwner(Entity);
}
+ ///
+ /// DeltaV: Updates the UI elements for mining points.
+ ///
+ private void UpdateMiningPoints(uint points)
+ {
+ MiningPointsClaimButton.Disabled = points == 0 || _player.LocalSession?.AttachedEntity is not {} player || _miningPoints.TryFindIdCard(player) == null;
+ if (points == _lastMiningPoints)
+ return;
+
+ _lastMiningPoints = points;
+ MiningPointsLabel.Text = Loc.GetString("lathe-menu-mining-points", ("points", points));
+ }
+
protected override void Opened()
{
base.Opened();
@@ -83,6 +113,17 @@ protected override void Opened()
}
}
+ ///
+ /// DeltaV: Update mining points UI whenever it changes.
+ ///
+ protected override void FrameUpdate(FrameEventArgs args)
+ {
+ base.FrameUpdate(args);
+
+ if (_entityManager.TryGetComponent(Entity, out var points))
+ UpdateMiningPoints(points.Points);
+ }
+
///
/// Populates the list of all the recipes
///
diff --git a/Resources/Locale/en-US/deltav/lathe/ui/lathe-menu.ftl b/Resources/Locale/en-US/deltav/lathe/ui/lathe-menu.ftl
new file mode 100644
index 00000000000..9f43b363f13
--- /dev/null
+++ b/Resources/Locale/en-US/deltav/lathe/ui/lathe-menu.ftl
@@ -0,0 +1,2 @@
+lathe-menu-mining-points = Mining Points: {$points}
+lathe-menu-mining-points-claim-button = Claim Points