]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
HOTFIX: fix minibomb implant and syndicats not exploding (#34923)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Thu, 6 Feb 2025 15:17:58 +0000 (16:17 +0100)
committerGitHub <noreply@github.com>
Thu, 6 Feb 2025 15:17:58 +0000 (16:17 +0100)
fix minibomb implant not exploding

Content.Server/Implants/ImplantedSystem.cs
Content.Shared/Implants/Components/ImplantedComponent.cs

index 16b2c79d25f49f1b99183259bb2c06c60e20e420..c5048cbd8df7db12cf5c7f06ac24e5493dafe087 100644 (file)
@@ -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 sealed partial class ImplanterSystem
         SubscribeLocalEvent<ImplantedComponent, BeingGibbedEvent>(OnGibbed);
     }
 
-    private void OnImplantedInit(EntityUid uid, ImplantedComponent component, ComponentInit args)
+    private void OnImplantedInit(Entity<ImplantedComponent> ent, ref ComponentInit args)
     {
-        component.ImplantContainer = _container.EnsureContainer<Container>(uid, ImplanterComponent.ImplantSlotId);
-        component.ImplantContainer.OccludesLight = false;
+        ent.Comp.ImplantContainer = _container.EnsureContainer<Container>(ent.Owner, ImplanterComponent.ImplantSlotId);
+        ent.Comp.ImplantContainer.OccludesLight = false;
     }
 
-    private void OnShutdown(EntityUid uid, ImplantedComponent component, ComponentShutdown args)
+    private void OnShutdown(Entity<ImplantedComponent> 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<ImplantedComponent> 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<StorageComponent>(implant, out var storage))
+                _container.EmptyContainer(storage.Container, destination: Transform(ent).Coordinates);
+        }
+
     }
 }
index 727213907ac55a783548524e85f5ea28415f02c5..2744d0291b8dc213967f4ab69252942ca8214a1a 100644 (file)
@@ -10,5 +10,6 @@ namespace Content.Shared.Implants.Components;
 [RegisterComponent, NetworkedComponent]
 public sealed partial class ImplantedComponent : Component
 {
+    [ViewVariables(VVAccess.ReadOnly)]
     public Container ImplantContainer = default!;
 }