diff --git a/Content.Client/Body/Systems/BodySystem.cs b/Content.Client/Body/Systems/BodySystem.cs deleted file mode 100644 index bab785525b0..00000000000 --- a/Content.Client/Body/Systems/BodySystem.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Content.Shared.Body.Systems; - -namespace Content.Client.Body.Systems; - -public sealed class BodySystem : SharedBodySystem -{ -} diff --git a/Content.Client/Hands/Systems/HandsSystem.cs b/Content.Client/Hands/Systems/HandsSystem.cs index 68800a2afe5..18e4540e153 100644 --- a/Content.Client/Hands/Systems/HandsSystem.cs +++ b/Content.Client/Hands/Systems/HandsSystem.cs @@ -4,6 +4,7 @@ using Content.Client.Examine; using Content.Client.Strip; using Content.Client.Verbs.UI; +using Content.Shared.Body.Part; using Content.Shared.Hands; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; @@ -40,7 +41,6 @@ public sealed class HandsSystem : SharedHandsSystem public event Action? OnPlayerItemRemoved; public event Action? OnPlayerHandBlocked; public event Action? OnPlayerHandUnblocked; - public override void Initialize() { base.Initialize(); @@ -51,6 +51,8 @@ public override void Initialize() SubscribeLocalEvent(OnHandsShutdown); SubscribeLocalEvent(HandleComponentState); SubscribeLocalEvent(OnVisualsChanged); + SubscribeLocalEvent(HandleBodyPartRemoved); // _CorvaxNext: surgery + SubscribeLocalEvent(HandleBodyPartDisabled); // _CorvaxNext: surgery OnHandSetActive += OnHandActivated; } @@ -238,8 +240,40 @@ public void UIHandAltActivateItem(string handName) RaisePredictiveEvent(new RequestHandAltInteractEvent(handName)); } + #region pulling + + #endregion + #region visuals + // start-_CorvaxNext: surgery + private void HideLayers(EntityUid uid, HandsComponent component, Entity part, SpriteComponent? sprite = null) + { + if (part.Comp.PartType != BodyPartType.Hand || !Resolve(uid, ref sprite, logMissing: false)) + return; + + var location = part.Comp.Symmetry switch + { + BodyPartSymmetry.None => HandLocation.Middle, + BodyPartSymmetry.Left => HandLocation.Left, + BodyPartSymmetry.Right => HandLocation.Right, + _ => throw new ArgumentOutOfRangeException(nameof(part.Comp.Symmetry)) + }; + + if (component.RevealedLayers.TryGetValue(location, out var revealedLayers)) + { + foreach (var key in revealedLayers) + sprite.RemoveLayer(key); + + revealedLayers.Clear(); + } + } + + private void HandleBodyPartRemoved(EntityUid uid, HandsComponent component, ref BodyPartRemovedEvent args) => HideLayers(uid, component, args.Part); + + private void HandleBodyPartDisabled(EntityUid uid, HandsComponent component, ref BodyPartDisabledEvent args) => HideLayers(uid, component, args.Part); + // end-_CorvaxNext: surgery + protected override void HandleEntityInserted(EntityUid uid, HandsComponent hands, EntInsertedIntoContainerMessage args) { base.HandleEntityInserted(uid, hands, args); @@ -264,6 +298,7 @@ protected override void HandleEntityRemoved(EntityUid uid, HandsComponent hands, if (!hands.Hands.TryGetValue(args.Container.ID, out var hand)) return; + UpdateHandVisuals(uid, args.Entity, hand); _stripSys.UpdateUi(uid); diff --git a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerBoundUserInterface.cs b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerBoundUserInterface.cs index baea03c8923..e2c75c4b391 100644 --- a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerBoundUserInterface.cs +++ b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerBoundUserInterface.cs @@ -1,6 +1,7 @@ using Content.Shared.MedicalScanner; +using Content.Shared._CorvaxNext.Targeting; using JetBrains.Annotations; -using Robust.Client.UserInterface; +using Robust.Client.GameObjects; namespace Content.Client.HealthAnalyzer.UI { @@ -17,10 +18,13 @@ public HealthAnalyzerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owne protected override void Open() { base.Open(); - - _window = this.CreateWindow(); - - _window.Title = EntMan.GetComponent(Owner).EntityName; + _window = new HealthAnalyzerWindow + { + Title = EntMan.GetComponent(Owner).EntityName, + }; + _window.OnClose += Close; + _window.OnBodyPartSelected += SendBodyPartMessage; + _window.OpenCentered(); } protected override void ReceiveMessage(BoundUserInterfaceMessage message) @@ -33,5 +37,22 @@ protected override void ReceiveMessage(BoundUserInterfaceMessage message) _window.Populate(cast); } + + private void SendBodyPartMessage(TargetBodyPart? part, EntityUid target) => SendMessage(new HealthAnalyzerPartMessage(EntMan.GetNetEntity(target), part ?? null)); + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) + return; + + if (_window != null) + { + _window.OnClose -= Close; + _window.OnBodyPartSelected -= SendBodyPartMessage; + } + + _window?.Dispose(); + } } } diff --git a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml index aae8785b1fe..0a0b5ac89e7 100644 --- a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml +++ b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml @@ -1,8 +1,8 @@ - + MinWidth="350">