Skip to content

Commit 3940d22

Browse files
Merge stable into master (space-wizards#34924)
2 parents 6c7170e + 11e5d59 commit 3940d22

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

Content.Client/Labels/UI/HandLabelerWindow.xaml.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ public HandLabelerWindow()
3333
_focused = false;
3434
LabelLineEdit.Text = _label;
3535
};
36+
}
3637

37-
// Give the editor keybard focus, since that's the only
38+
protected override void Opened()
39+
{
40+
base.Opened();
41+
42+
// Give the editor keyboard focus, since that's the only
3843
// thing the user will want to be doing with this UI
3944
LabelLineEdit.GrabKeyboardFocus();
4045
}

Content.Client/UserInterface/Controls/DialogWindow.xaml.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ public DialogWindow(string title, List<QuickDialogEntry> entries, bool ok = true
8787
Prompts.AddChild(box);
8888
}
8989

90-
// Grab keyboard focus for the first dialog entry
91-
_promptLines[0].Item2.GrabKeyboardFocus();
92-
9390
OkButton.OnPressed += _ => Confirm();
9491

9592
CancelButton.OnPressed += _ =>
@@ -110,6 +107,14 @@ public DialogWindow(string title, List<QuickDialogEntry> entries, bool ok = true
110107
OpenCentered();
111108
}
112109

110+
protected override void Opened()
111+
{
112+
base.Opened();
113+
114+
// Grab keyboard focus for the first dialog entry
115+
_promptLines[0].Item2.GrabKeyboardFocus();
116+
}
117+
113118
private void Confirm()
114119
{
115120
var results = new Dictionary<string, string>();
+13-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Content.Server.Body.Components;
22
using Content.Shared.Implants.Components;
3+
using Content.Shared.Storage;
34
using Robust.Shared.Containers;
45

56
namespace Content.Server.Implants;
@@ -13,21 +14,26 @@ public void InitializeImplanted()
1314
SubscribeLocalEvent<ImplantedComponent, BeingGibbedEvent>(OnGibbed);
1415
}
1516

16-
private void OnImplantedInit(EntityUid uid, ImplantedComponent component, ComponentInit args)
17+
private void OnImplantedInit(Entity<ImplantedComponent> ent, ref ComponentInit args)
1718
{
18-
component.ImplantContainer = _container.EnsureContainer<Container>(uid, ImplanterComponent.ImplantSlotId);
19-
component.ImplantContainer.OccludesLight = false;
19+
ent.Comp.ImplantContainer = _container.EnsureContainer<Container>(ent.Owner, ImplanterComponent.ImplantSlotId);
20+
ent.Comp.ImplantContainer.OccludesLight = false;
2021
}
2122

22-
private void OnShutdown(EntityUid uid, ImplantedComponent component, ComponentShutdown args)
23+
private void OnShutdown(Entity<ImplantedComponent> ent, ref ComponentShutdown args)
2324
{
2425
//If the entity is deleted, get rid of the implants
25-
_container.CleanContainer(component.ImplantContainer);
26+
_container.CleanContainer(ent.Comp.ImplantContainer);
2627
}
2728

2829
private void OnGibbed(Entity<ImplantedComponent> ent, ref BeingGibbedEvent args)
2930
{
30-
//If the entity is gibbed, get rid of the implants
31-
_container.CleanContainer(ent.Comp.ImplantContainer);
31+
// Drop the storage implant contents before the implants are deleted by the body being gibbed
32+
foreach (var implant in ent.Comp.ImplantContainer.ContainedEntities)
33+
{
34+
if (TryComp<StorageComponent>(implant, out var storage))
35+
_container.EmptyContainer(storage.Container, destination: Transform(ent).Coordinates);
36+
}
37+
3238
}
3339
}

Content.Shared/Implants/Components/ImplantedComponent.cs

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ namespace Content.Shared.Implants.Components;
1010
[RegisterComponent, NetworkedComponent]
1111
public sealed partial class ImplantedComponent : Component
1212
{
13+
[ViewVariables(VVAccess.ReadOnly)]
1314
public Container ImplantContainer = default!;
1415
}

0 commit comments

Comments
 (0)