diff --git a/Content.Client/_Shitmed/Xenonids/UI/XenoChoiceControl.xaml b/Content.Client/_Shitmed/Choice/UI/ChoiceControl.xaml similarity index 86% rename from Content.Client/_Shitmed/Xenonids/UI/XenoChoiceControl.xaml rename to Content.Client/_Shitmed/Choice/UI/ChoiceControl.xaml index b778b36458..56cc2cf252 100644 --- a/Content.Client/_Shitmed/Xenonids/UI/XenoChoiceControl.xaml +++ b/Content.Client/_Shitmed/Choice/UI/ChoiceControl.xaml @@ -1,6 +1,6 @@ - + xmlns:ui="clr-namespace:Content.Client._Shitmed.Choice.UI"> - \ No newline at end of file + \ No newline at end of file diff --git a/Content.Client/_Shitmed/Xenonids/UI/XenoChoiceControl.xaml.cs b/Content.Client/_Shitmed/Choice/UI/ChoiceControl.xaml.cs similarity index 75% rename from Content.Client/_Shitmed/Xenonids/UI/XenoChoiceControl.xaml.cs rename to Content.Client/_Shitmed/Choice/UI/ChoiceControl.xaml.cs index 459a1e4bd7..ac2a8385ac 100644 --- a/Content.Client/_Shitmed/Xenonids/UI/XenoChoiceControl.xaml.cs +++ b/Content.Client/_Shitmed/Choice/UI/ChoiceControl.xaml.cs @@ -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) { diff --git a/Content.Client/_Shitmed/Medical/Surgery/SurgeryBui.cs b/Content.Client/_Shitmed/Medical/Surgery/SurgeryBui.cs index 0aa7f7b589..f08fdfb3ba 100644 --- a/Content.Client/_Shitmed/Medical/Surgery/SurgeryBui.cs +++ b/Content.Client/_Shitmed/Medical/Surgery/SurgeryBui.cs @@ -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(_part); + var body = _entities.GetComponent(_part.Value).Body!.Value; // DeltaV _window.Surgeries.DisposeAllChildren(); var surgeries = new List<(Entity 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(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(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); diff --git a/Content.Client/_Shitmed/Medical/Surgery/SurgeryStepButton.xaml.cs b/Content.Client/_Shitmed/Medical/Surgery/SurgeryStepButton.xaml.cs index 5c39db09b6..78e2568850 100644 --- a/Content.Client/_Shitmed/Medical/Surgery/SurgeryStepButton.xaml.cs +++ b/Content.Client/_Shitmed/Medical/Surgery/SurgeryStepButton.xaml.cs @@ -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; }