hide surgeries that cant be done yet (#3335)

* kill xeno

* hide surgeries that cant be done yet

* a

* guh

Co-authored-by: Tobias Berger <toby@tobot.dev>
Signed-off-by: deltanedas <39013340+deltanedas@users.noreply.github.com>

* empty

---------

Signed-off-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: Tobias Berger <toby@tobot.dev>
This commit is contained in:
deltanedas 2025-04-04 20:42:52 +01:00 committed by GitHub
parent 248d1d5619
commit 730ec71337
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 16 deletions

View File

@ -1,6 +1,6 @@
<ui:XenoChoiceControl
<ui:ChoiceControl
xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client._Shitmed.Xenonids.UI">
xmlns:ui="clr-namespace:Content.Client._Shitmed.Choice.UI">
<BoxContainer Orientation="Horizontal">
<Button Name="Button" Access="Public"
HorizontalExpand="True" VerticalExpand="False"
@ -14,4 +14,4 @@
</BoxContainer>
</Button>
</BoxContainer>
</ui:XenoChoiceControl>
</ui:ChoiceControl>

View File

@ -4,13 +4,13 @@ using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
namespace Content.Client._Shitmed.Xenonids.UI;
namespace Content.Client._Shitmed.Choice.UI;
[GenerateTypedNameReferences]
[Virtual]
public partial class XenoChoiceControl : Control
public partial class ChoiceControl : Control
{
public XenoChoiceControl() => RobustXamlLoader.Load(this);
public ChoiceControl() => RobustXamlLoader.Load(this);
public void Set(string name, Texture? texture)
{

View File

@ -1,4 +1,4 @@
using Content.Client._Shitmed.Xenonids.UI;
using Content.Client._Shitmed.Choice.UI;
using Content.Client.Administration.UI.CustomControls;
using Content.Shared._Shitmed.Medical.Surgery;
using Content.Shared.Body.Components;
@ -52,10 +52,6 @@ public sealed class SurgeryBui : BoundUserInterface
private void Update(SurgeryBuiState state)
{
if (!_entities.TryGetComponent(_player.LocalEntity, out SurgeryTargetComponent? surgeryTargetComp)
|| !surgeryTargetComp.CanOperate)
return;
if (_window == null)
{
_window = new SurgeryWindow();
@ -146,7 +142,7 @@ public sealed class SurgeryBui : BoundUserInterface
{
//var netPart = _entities.GetNetEntity(part.Owner);
var surgeries = state.Choices[netEntity];
var partButton = new XenoChoiceControl();
var partButton = new ChoiceControl();
partButton.Set(partName, null);
partButton.Button.OnPressed += _ => OnPartPressed(netEntity, surgeries);
@ -200,7 +196,7 @@ public sealed class SurgeryBui : BoundUserInterface
// This apparently does not consider if theres multiple surgery requirements in one surgery. Maybe thats fine.
if (surgery.Comp.Requirement is { } requirementId && _system.GetSingleton(requirementId) is { } requirement)
{
var label = new XenoChoiceControl();
var label = new ChoiceControl();
label.Button.OnPressed += _ =>
{
_previousSurgeries.Add(surgeryId);
@ -231,6 +227,7 @@ public sealed class SurgeryBui : BoundUserInterface
_part = _entities.GetEntity(netPart);
_isBody = _entities.HasComponent<BodyComponent>(_part);
var body = _entities.GetComponent<BodyPartComponent>(_part.Value).Body!.Value; // DeltaV
_window.Surgeries.DisposeAllChildren();
var surgeries = new List<(Entity<SurgeryComponent> Ent, EntProtoId Id, string Name)>();
@ -242,6 +239,18 @@ public sealed class SurgeryBui : BoundUserInterface
continue;
}
// Begin DeltaV Additions - only show surgeries with completed requirements
if (surgeryComp.Requirement is { } reqId && _system.GetSingleton(reqId) is { } reqUid)
{
if (!_entities.TryGetComponent<SurgeryComponent>(reqUid, out var reqComp) ||
!_system.PreviousStepsComplete(body, _part.Value, (reqUid, reqComp), string.Empty)) // step is unused as this is only for checking the requirement
{
// don't show any surgeries whose requirement isn't complete
continue;
}
}
// End DeltaV Additions
var name = _entities.GetComponent<MetaDataComponent>(surgery).EntityName;
surgeries.Add(((surgery, surgeryComp), surgeryId, name));
}
@ -257,7 +266,7 @@ public sealed class SurgeryBui : BoundUserInterface
foreach (var surgery in surgeries)
{
var surgeryButton = new XenoChoiceControl();
var surgeryButton = new ChoiceControl();
surgeryButton.Set(surgery.Name, null);
surgeryButton.Button.OnPressed += _ => OnSurgeryPressed(surgery.Ent, netPart, surgery.Id);

View File

@ -1,11 +1,11 @@
using Content.Client._Shitmed.Xenonids.UI;
using Content.Client._Shitmed.Choice.UI;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
namespace Content.Client._Shitmed.Medical.Surgery;
[GenerateTypedNameReferences]
public sealed partial class SurgeryStepButton : XenoChoiceControl
public sealed partial class SurgeryStepButton : ChoiceControl
{
public EntityUid Step { get; set; }