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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions Content.Client/Lathe/UI/LatheBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared._DV.Salvage;
using Content.Shared.Lathe;
using Content.Shared.Research.Components;
using JetBrains.Annotations;
Expand Down Expand Up @@ -34,6 +35,8 @@ protected override void Open()
_menu.QueueMoveUpAction += index => SendMessage(new LatheMoveRequestMessage(index, -1));
_menu.QueueMoveDownAction += index => SendMessage(new LatheMoveRequestMessage(index, 1));
_menu.DeleteFabricatingAction += () => SendMessage(new LatheAbortFabricationMessage());

_menu.OnClaimMiningPoints += () => SendMessage(new LatheClaimMiningPointsMessage()); // DeltaV
}

protected override void UpdateState(BoundUserInterfaceState state)
Expand Down
24 changes: 14 additions & 10 deletions Content.Client/Lathe/UI/LatheMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,21 @@
HorizontalExpand="True"
Orientation="Vertical">
<Label Text="{Loc 'lathe-menu-materials-title'}" Margin="5 5 5 5" HorizontalAlignment="Center"/>
<PanelContainer VerticalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>
<BoxContainer
Orientation="Vertical"
VerticalExpand="True"
HorizontalExpand="True">
<ui:MaterialStorageControl Name="MaterialsList" SizeFlagsStretchRatio="8"/>
<BoxContainer
Orientation="Vertical"
VerticalExpand="True"
HorizontalExpand="True">
<ui:MaterialStorageControl Name="MaterialsList" SizeFlagsStretchRatio="8"/>
</BoxContainer>
<!-- Begin DeltaV Additions: Mining points -->
<BoxContainer Orientation="Vertical" Name="MiningPointsContainer" Visible="False">
<BoxContainer Orientation="Horizontal">
<Label Name="MiningPointsLabel" HorizontalExpand="True"/>
<Button Name="MiningPointsClaimButton" Text="{Loc 'lathe-menu-mining-points-claim-button'}"/>
</BoxContainer>
</PanelContainer>
<RichTextLabel Name="MiningPointsNoConnectionWarning"></RichTextLabel>
</BoxContainer>
<!-- End DeltaV Additions: Mining points -->
</BoxContainer>
</BoxContainer>

Expand Down
55 changes: 54 additions & 1 deletion Content.Client/Lathe/UI/LatheMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
using System.Linq;
using System.Text;
using Content.Client.Materials;
using Content.Shared._DV.Salvage.Components; // DeltaV
using Content.Shared._DV.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;
using Robust.Shared.Utility;

namespace Content.Client.Lathe.UI;
Expand All @@ -19,17 +23,20 @@ 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<BaseButton.ButtonEventArgs>? OnServerListButtonPressed;
public event Action<string, int>? RecipeQueueAction;
public event Action<int>? QueueDeleteAction;
public event Action<int>? QueueMoveUpAction;
public event Action<int>? QueueMoveDownAction;
public event Action<BaseButton.ButtonEventArgs>? OnResetQueueListButtonPressed; // Goobstation
public event Action? OnClaimMiningPoints; // DeltaV
public event Action? DeleteFabricatingAction;

public List<ProtoId<LatheRecipePrototype>> Recipes = new();
Expand All @@ -40,6 +47,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);
Expand All @@ -48,6 +57,7 @@ public LatheMenu()
_spriteSystem = _entityManager.System<SpriteSystem>();
_lathe = _entityManager.System<LatheSystem>();
_materialStorage = _entityManager.System<MaterialStorageSystem>();
_miningPoints = _entityManager.System<MiningPointsSystem>(); // DeltaV

SearchBar.OnTextChanged += _ =>
{
Expand Down Expand Up @@ -86,7 +96,50 @@ public void SetEntity(EntityUid uid)
AmountLineEdit.SetText(latheComponent.DefaultProductionAmount.ToString());
}

// Begin DeltaV Additions: Mining points UI
MiningPointsContainer.Visible = _entityManager.TryGetComponent<MiningPointsComponent>(Entity, out var points);
MiningPointsClaimButton.OnPressed += _ => OnClaimMiningPoints?.Invoke();

if (points != null)
{
UpdateMiningPoints(points.Points);
// if (!IsSiloConnected(Entity, out var warning, true))
// {
// MiningPointsNoConnectionWarning.Visible = true;

// if (warning != null)
// MiningPointsNoConnectionWarning.SetMessage(FormattedMessage.FromMarkupOrThrow(warning));
// }
}

MaterialsList.SetOwner(Entity);
// End DeltaV Additions
}

/// <summary>
/// DeltaV: Updates the UI elements for mining points.
/// </summary>
private void UpdateMiningPoints(uint points)
{
MiningPointsClaimButton.Disabled = points == 0 ||
_player.LocalSession?.AttachedEntity is not { } player ||
!_miningPoints.CanClaimPoints(player); // Goobstation - borg mining Points
if (points == _lastMiningPoints)
return;

_lastMiningPoints = points;
MiningPointsLabel.Text = Loc.GetString("lathe-menu-mining-points", ("points", points));
}

/// <summary>
/// DeltaV: Update mining points UI whenever it changes.
/// </summary>
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);

if (_entityManager.TryGetComponent<MiningPointsComponent>(Entity, out var points))
UpdateMiningPoints(points.Points);
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion Content.Client/Overlays/EquipmentHudSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ private void OnRoundRestart(RoundRestartCleanupEvent args)

protected virtual void OnRefreshEquipmentHud(Entity<T> ent, ref InventoryRelayedEvent<RefreshEquipmentHudEvent<T>> args)
{
OnRefreshComponentHud(ent, ref args.Args);
// Goobstation edit
args.Args.Active = true;
args.Args.Components.Add(ent.Comp);
}

protected virtual void OnRefreshComponentHud(Entity<T> ent, ref RefreshEquipmentHudEvent<T> args)
Expand Down
11 changes: 9 additions & 2 deletions Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;
using Content.Client.Gameplay;
using Content.Shared._Goobstation.Weapons;
using Content.Shared.CCVar;
using Content.Shared.CombatMode;
using Content.Shared.Effects;
Expand Down Expand Up @@ -212,14 +213,20 @@ private void ClientLightAttack(EntityUid attacker, MapCoordinates mousePos, Enti
{
var attackerPos = TransformSystem.GetMapCoordinates(attacker);

if (mousePos.MapId != attackerPos.MapId || (attackerPos.Position - mousePos.Position).Length() > meleeComponent.Range)
return;

EntityUid? target = null;

// Goobstation start
if (_stateManager.CurrentState is GameplayStateBase screen)
target = screen.GetClickedEntity(mousePos);

var ev = new GetLightAttackRangeEvent(target, attacker, meleeComponent.Range);
RaiseLocalEvent(weaponUid, ref ev);
// Goobstation end

if (mousePos.MapId != attackerPos.MapId || (attackerPos.Position - mousePos.Position).Length() > ev.Range) // Goob range edit
return;

// Don't light-attack if interaction will be handling this instead
if (Interaction.CombatModeCanHandInteract(attacker, target))
return;
Expand Down
27 changes: 27 additions & 0 deletions Content.Client/_DV/Salvage/UI/MiningVoucherBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Content.Shared._DV.Salvage;
using Robust.Client.UserInterface;

namespace Content.Client._DV.Salvage.UI;

public sealed class MiningVoucherBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private MiningVoucherMenu? _menu;

public MiningVoucherBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
base.Open();

_menu = this.CreateWindow<MiningVoucherMenu>();
_menu.SetEntity(Owner);
_menu.OnSelected += i =>
{
SendMessage(new MiningVoucherSelectMessage(i));
Close();
};
}
}
10 changes: 10 additions & 0 deletions Content.Client/_DV/Salvage/UI/MiningVoucherMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<ui:RadialMenu xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
BackButtonStyleClass="RadialMenuBackButton"
CloseButtonStyleClass="RadialMenuCloseButton"
VerticalExpand="True"
HorizontalExpand="True"
MinSize="450 450">
<!-- Populated in SetEntity -->
<ui:RadialContainer Name="Main" VerticalExpand="True" HorizontalExpand="True" InitialRadius="100"/>
</ui:RadialMenu>
81 changes: 81 additions & 0 deletions Content.Client/_DV/Salvage/UI/MiningVoucherMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 Aidenkrz <aiden@djkraz.com>
// SPDX-FileCopyrightText: 2025 Aineias1 <dmitri.s.kiselev@gmail.com>
// SPDX-FileCopyrightText: 2025 FaDeOkno <143940725+FaDeOkno@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
// SPDX-FileCopyrightText: 2025 McBosserson <148172569+McBosserson@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 Milon <plmilonpl@gmail.com>
// SPDX-FileCopyrightText: 2025 Piras314 <p1r4s@proton.me>
// SPDX-FileCopyrightText: 2025 Rouden <149893554+Roudenn@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 SX_7 <sn1.test.preria.2002@gmail.com>
// SPDX-FileCopyrightText: 2025 TheBorzoiMustConsume <197824988+TheBorzoiMustConsume@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 Unlumination <144041835+Unlumy@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 deltanedas <39013340+deltanedas@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
// SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 gluesniffler <linebarrelerenthusiast@gmail.com>
// SPDX-FileCopyrightText: 2025 username <113782077+whateverusername0@users.noreply.github.com>
// SPDX-FileCopyrightText: 2025 whateverusername0 <whateveremail>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

using Content.Client.UserInterface.Controls;
using Content.Shared._DV.Salvage.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using System.Numerics;

namespace Content.Client._DV.Salvage.UI;

[GenerateTypedNameReferences]
public sealed partial class MiningVoucherMenu : RadialMenu
{
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;

private readonly SpriteSystem _sprite;

public event Action<int>? OnSelected;

public MiningVoucherMenu()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

_sprite = _entMan.System<SpriteSystem>();
}

public void SetEntity(EntityUid owner)
{
if (!_entMan.TryGetComponent<MiningVendorComponent>(owner, out var comp))
return;

for (int i = 0; i < comp.Kits.Count; i++)
{
var index = i; // copy so the closure doesn't borrow it
var kit = _proto.Index(comp.Kits[i]);
var button = new RadialMenuButtonWithSector()
{
StyleClasses = { "RadialMenuButtonWithSector" },
SetSize = new Vector2(64f, 64f),
ToolTip = Loc.GetString(kit.Description)
};
button.AddChild(new TextureRect()
{
VerticalAlignment = VAlignment.Center,
HorizontalAlignment = HAlignment.Center,
Texture = _sprite.Frame0(kit.Sprite),
TextureScale = new Vector2(2f, 2f)
});

button.OnPressed += _ => OnSelected?.Invoke(index);

Main.AddChild(button);
}
}
}
Loading
Loading