diff --git a/Content.Client/Labels/UI/HandLabelerWindow.xaml.cs b/Content.Client/Labels/UI/HandLabelerWindow.xaml.cs index 7a0627b3e236..528e227f552a 100644 --- a/Content.Client/Labels/UI/HandLabelerWindow.xaml.cs +++ b/Content.Client/Labels/UI/HandLabelerWindow.xaml.cs @@ -33,8 +33,13 @@ public HandLabelerWindow() _focused = false; LabelLineEdit.Text = _label; }; + } - // Give the editor keybard focus, since that's the only + protected override void Opened() + { + base.Opened(); + + // Give the editor keyboard focus, since that's the only // thing the user will want to be doing with this UI LabelLineEdit.GrabKeyboardFocus(); } diff --git a/Content.Client/UserInterface/Controls/DialogWindow.xaml.cs b/Content.Client/UserInterface/Controls/DialogWindow.xaml.cs index 733dbe326583..d831f6024774 100644 --- a/Content.Client/UserInterface/Controls/DialogWindow.xaml.cs +++ b/Content.Client/UserInterface/Controls/DialogWindow.xaml.cs @@ -87,9 +87,6 @@ public DialogWindow(string title, List entries, bool ok = true Prompts.AddChild(box); } - // Grab keyboard focus for the first dialog entry - _promptLines[0].Item2.GrabKeyboardFocus(); - OkButton.OnPressed += _ => Confirm(); CancelButton.OnPressed += _ => @@ -110,6 +107,14 @@ public DialogWindow(string title, List entries, bool ok = true OpenCentered(); } + protected override void Opened() + { + base.Opened(); + + // Grab keyboard focus for the first dialog entry + _promptLines[0].Item2.GrabKeyboardFocus(); + } + private void Confirm() { var results = new Dictionary(); diff --git a/Content.Server/Implants/ImplantedSystem.cs b/Content.Server/Implants/ImplantedSystem.cs index 16b2c79d25f4..c5048cbd8df7 100644 --- a/Content.Server/Implants/ImplantedSystem.cs +++ b/Content.Server/Implants/ImplantedSystem.cs @@ -1,5 +1,6 @@ using Content.Server.Body.Components; using Content.Shared.Implants.Components; +using Content.Shared.Storage; using Robust.Shared.Containers; namespace Content.Server.Implants; @@ -13,21 +14,26 @@ public void InitializeImplanted() SubscribeLocalEvent(OnGibbed); } - private void OnImplantedInit(EntityUid uid, ImplantedComponent component, ComponentInit args) + private void OnImplantedInit(Entity ent, ref ComponentInit args) { - component.ImplantContainer = _container.EnsureContainer(uid, ImplanterComponent.ImplantSlotId); - component.ImplantContainer.OccludesLight = false; + ent.Comp.ImplantContainer = _container.EnsureContainer(ent.Owner, ImplanterComponent.ImplantSlotId); + ent.Comp.ImplantContainer.OccludesLight = false; } - private void OnShutdown(EntityUid uid, ImplantedComponent component, ComponentShutdown args) + private void OnShutdown(Entity ent, ref ComponentShutdown args) { //If the entity is deleted, get rid of the implants - _container.CleanContainer(component.ImplantContainer); + _container.CleanContainer(ent.Comp.ImplantContainer); } private void OnGibbed(Entity ent, ref BeingGibbedEvent args) { - //If the entity is gibbed, get rid of the implants - _container.CleanContainer(ent.Comp.ImplantContainer); + // Drop the storage implant contents before the implants are deleted by the body being gibbed + foreach (var implant in ent.Comp.ImplantContainer.ContainedEntities) + { + if (TryComp(implant, out var storage)) + _container.EmptyContainer(storage.Container, destination: Transform(ent).Coordinates); + } + } } diff --git a/Content.Shared/Implants/Components/ImplantedComponent.cs b/Content.Shared/Implants/Components/ImplantedComponent.cs index 727213907ac5..2744d0291b8d 100644 --- a/Content.Shared/Implants/Components/ImplantedComponent.cs +++ b/Content.Shared/Implants/Components/ImplantedComponent.cs @@ -10,5 +10,6 @@ namespace Content.Shared.Implants.Components; [RegisterComponent, NetworkedComponent] public sealed partial class ImplantedComponent : Component { + [ViewVariables(VVAccess.ReadOnly)] public Container ImplantContainer = default!; }