]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Remove cryo pod component references (#15247)
authorDrSmugleaf <DrSmugleaf@users.noreply.github.com>
Sun, 9 Apr 2023 22:28:19 +0000 (15:28 -0700)
committerGitHub <noreply@github.com>
Sun, 9 Apr 2023 22:28:19 +0000 (15:28 -0700)
Content.Client/Medical/Cryogenics/CryoPodComponent.cs [deleted file]
Content.Client/Medical/Cryogenics/CryoPodSystem.cs
Content.Server/Medical/Components/CryoPodAirComponent.cs [moved from Content.Server/Medical/Components/CryoPodComponent.cs with 68% similarity]
Content.Server/Medical/CryoPodSystem.cs
Content.Server/Medical/InsideCryoPodSystem.cs
Content.Shared/Medical/Cryogenics/CryoPodComponent.cs [moved from Content.Shared/Medical/Cryogenics/SharedCryoPodComponent.cs with 93% similarity]
Content.Shared/Medical/Cryogenics/SharedCryoPodSystem.cs
Resources/Prototypes/Entities/Structures/Machines/Medical/cryo_pod.yml

diff --git a/Content.Client/Medical/Cryogenics/CryoPodComponent.cs b/Content.Client/Medical/Cryogenics/CryoPodComponent.cs
deleted file mode 100644 (file)
index e07d69e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-using Content.Shared.DragDrop;
-using Content.Shared.Medical.Cryogenics;
-
-namespace Content.Client.Medical.Cryogenics;
-
-[RegisterComponent, ComponentReference(typeof(SharedCryoPodComponent))]
-public sealed class CryoPodComponent : SharedCryoPodComponent { }
index d1918d75fba2f2a928ac799dde506238e3b23352..bb6c1f0fae929d86ebb9d9b1b9f64468d3def983 100644 (file)
@@ -1,5 +1,4 @@
-using Content.Shared.Destructible;
-using Content.Shared.Emag.Systems;
+using Content.Shared.Emag.Systems;
 using Content.Shared.Medical.Cryogenics;
 using Content.Shared.Verbs;
 using Robust.Client.GameObjects;
@@ -46,15 +45,15 @@ public sealed class CryoPodSystem: SharedCryoPodSystem
         spriteComponent.Offset = component.PreviousOffset;
     }
 
-    private void OnAppearanceChange(EntityUid uid, SharedCryoPodComponent component, ref AppearanceChangeEvent args)
+    private void OnAppearanceChange(EntityUid uid, CryoPodComponent component, ref AppearanceChangeEvent args)
     {
         if (args.Sprite == null)
         {
             return;
         }
 
-        if (!_appearance.TryGetData<bool>(uid, SharedCryoPodComponent.CryoPodVisuals.ContainsEntity, out var isOpen, args.Component)
-            || !_appearance.TryGetData<bool>(uid, SharedCryoPodComponent.CryoPodVisuals.IsOn, out var isOn, args.Component))
+        if (!_appearance.TryGetData<bool>(uid, CryoPodComponent.CryoPodVisuals.ContainsEntity, out var isOpen, args.Component)
+            || !_appearance.TryGetData<bool>(uid, CryoPodComponent.CryoPodVisuals.IsOn, out var isOn, args.Component))
         {
             return;
         }
similarity index 68%
rename from Content.Server/Medical/Components/CryoPodComponent.cs
rename to Content.Server/Medical/Components/CryoPodAirComponent.cs
index 362576e10c368ba9597f6c895b9e9e3ecd3573b2..cc5416a4d20d2a5b73317b596817677fc7db16ae 100644 (file)
@@ -1,11 +1,10 @@
 using Content.Server.Atmos;
 using Content.Shared.Atmos;
-using Content.Shared.Medical.Cryogenics;
 
 namespace Content.Server.Medical.Components;
 
-[RegisterComponent, ComponentReference(typeof(SharedCryoPodComponent))]
-public sealed class CryoPodComponent: SharedCryoPodComponent
+[RegisterComponent]
+public sealed class CryoPodAirComponent : Component
 {
     /// <summary>
     /// Local air buffer that will be mixed with the pipenet, if one exists, per tick.
index 62c168c3e7ac1438df2a08cd1eef7334af98d846..e45f2f920f9f08313d56da784882187295d173b6 100644 (file)
@@ -110,7 +110,7 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
         }
     }
 
-    public override void EjectBody(EntityUid uid, SharedCryoPodComponent? cryoPodComponent)
+    public override void EjectBody(EntityUid uid, CryoPodComponent? cryoPodComponent)
     {
         if (!Resolve(uid, ref cryoPodComponent))
             return;
@@ -221,17 +221,24 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
 
         if (!nodeContainer.TryGetNode(cryoPod.PortName, out PortablePipeNode? portNode))
             return;
-        _atmosphereSystem.React(cryoPod.Air, portNode);
+
+        if (!TryComp(uid, out CryoPodAirComponent? cryoPodAir))
+            return;
+
+        _atmosphereSystem.React(cryoPodAir.Air, portNode);
 
         if (portNode.NodeGroup is PipeNet {NodeCount: > 1} net)
         {
-            _gasCanisterSystem.MixContainerWithPipeNet(cryoPod.Air, net.Air);
+            _gasCanisterSystem.MixContainerWithPipeNet(cryoPodAir.Air, net.Air);
         }
     }
 
     private void OnGasAnalyzed(EntityUid uid, CryoPodComponent component, GasAnalyzerScanEvent args)
     {
-        var gasMixDict = new Dictionary<string, GasMixture?> { { Name(uid), component.Air } };
+        if (!TryComp(uid, out CryoPodAirComponent? cryoPodAir))
+            return;
+
+        var gasMixDict = new Dictionary<string, GasMixture?> { { Name(uid), cryoPodAir.Air } };
         // If it's connected to a port, include the port side
         if (TryComp(uid, out NodeContainerComponent? nodeContainer))
         {
index a41896b7269bf21f285263a0d7b145aa02c79c3b..a2252fa395a069dd96f7f525933304509fdc608d 100644 (file)
@@ -19,26 +19,26 @@ namespace Content.Server.Medical
 
         private void OnGetAir(EntityUid uid, InsideCryoPodComponent component, ref AtmosExposedGetAirEvent args)
         {
-            if (TryComp<CryoPodComponent>(Transform(uid).ParentUid, out var cryoPodComponent))
+            if (TryComp<CryoPodAirComponent>(Transform(uid).ParentUid, out var cryoPodAir))
             {
-                args.Gas = cryoPodComponent.Air;
+                args.Gas = cryoPodAir.Air;
                 args.Handled = true;
             }
         }
 
         private void OnInhaleLocation(EntityUid uid, InsideCryoPodComponent component, InhaleLocationEvent args)
         {
-            if (TryComp<CryoPodComponent>(Transform(uid).ParentUid, out var cryoPodComponent))
+            if (TryComp<CryoPodAirComponent>(Transform(uid).ParentUid, out var cryoPodAir))
             {
-                args.Gas = cryoPodComponent.Air;
+                args.Gas = cryoPodAir.Air;
             }
         }
 
         private void OnExhaleLocation(EntityUid uid, InsideCryoPodComponent component, ExhaleLocationEvent args)
         {
-            if (TryComp<CryoPodComponent>(Transform(uid).ParentUid, out var cryoPodComponent))
+            if (TryComp<CryoPodAirComponent>(Transform(uid).ParentUid, out var cryoPodAir))
             {
-                args.Gas = cryoPodComponent.Air;
+                args.Gas = cryoPodAir.Air;
             }
         }
 
similarity index 93%
rename from Content.Shared/Medical/Cryogenics/SharedCryoPodComponent.cs
rename to Content.Shared/Medical/Cryogenics/CryoPodComponent.cs
index 752d4ce72ebc9102915a3491ac499b78e61cb4d2..d317d4954687e9760ea34bdeacbbdfc2f222ef46 100644 (file)
@@ -1,14 +1,12 @@
-using Content.Shared.Body.Components;
-using Content.Shared.DragDrop;
-using Robust.Shared.Containers;
+using Robust.Shared.Containers;
 using Robust.Shared.GameStates;
 using Robust.Shared.Serialization;
 using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
 
 namespace Content.Shared.Medical.Cryogenics;
 
-[NetworkedComponent]
-public abstract class SharedCryoPodComponent: Component
+[RegisterComponent, NetworkedComponent]
+public sealed class CryoPodComponent : Component
 {
     /// <summary>
     /// Specifies the name of the atmospherics port to draw gas from.
index 4b82b8388a1c8ff7ddde3c21b263ff46535f743d..c1eeb34202c91ef9fd3f0d443005dde658002e15 100644 (file)
@@ -1,6 +1,6 @@
 using Content.Server.Medical.Components;
-using Content.Shared.DoAfter;
 using Content.Shared.Body.Components;
+using Content.Shared.DoAfter;
 using Content.Shared.DragDrop;
 using Content.Shared.Emag.Systems;
 using Content.Shared.Mobs.Components;
@@ -10,7 +10,6 @@ using Content.Shared.Standing;
 using Content.Shared.Stunnable;
 using Content.Shared.Verbs;
 using Robust.Shared.Containers;
-using Robust.Shared.Player;
 using Robust.Shared.Serialization;
 
 namespace Content.Shared.Medical.Cryogenics;
@@ -27,11 +26,11 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
     {
         base.Initialize();
 
-        SubscribeLocalEvent<SharedCryoPodComponent, CanDropTargetEvent>(OnCryoPodCanDropOn);
+        SubscribeLocalEvent<CryoPodComponent, CanDropTargetEvent>(OnCryoPodCanDropOn);
         InitializeInsideCryoPod();
     }
 
-    private void OnCryoPodCanDropOn(EntityUid uid, SharedCryoPodComponent component, ref CanDropTargetEvent args)
+    private void OnCryoPodCanDropOn(EntityUid uid, CryoPodComponent component, ref CanDropTargetEvent args)
     {
         if (args.Handled)
             return;
@@ -40,12 +39,12 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
         args.Handled = true;
     }
 
-    protected void OnComponentInit(EntityUid uid, SharedCryoPodComponent cryoPodComponent, ComponentInit args)
+    protected void OnComponentInit(EntityUid uid, CryoPodComponent cryoPodComponent, ComponentInit args)
     {
         cryoPodComponent.BodyContainer = _containerSystem.EnsureContainer<ContainerSlot>(uid, "scanner-body");
     }
 
-    protected void UpdateAppearance(EntityUid uid, SharedCryoPodComponent? cryoPod = null, AppearanceComponent? appearance = null)
+    protected void UpdateAppearance(EntityUid uid, CryoPodComponent? cryoPod = null, AppearanceComponent? appearance = null)
     {
         if (!Resolve(uid, ref cryoPod))
             return;
@@ -57,11 +56,11 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
 
         if (!Resolve(uid, ref appearance))
             return;
-        _appearanceSystem.SetData(uid, SharedCryoPodComponent.CryoPodVisuals.ContainsEntity, cryoPod.BodyContainer.ContainedEntity == null, appearance);
-        _appearanceSystem.SetData(uid, SharedCryoPodComponent.CryoPodVisuals.IsOn, cryoPodEnabled, appearance);
+        _appearanceSystem.SetData(uid, CryoPodComponent.CryoPodVisuals.ContainsEntity, cryoPod.BodyContainer.ContainedEntity == null, appearance);
+        _appearanceSystem.SetData(uid, CryoPodComponent.CryoPodVisuals.IsOn, cryoPodEnabled, appearance);
     }
 
-    public void InsertBody(EntityUid uid, EntityUid target, SharedCryoPodComponent cryoPodComponent)
+    public void InsertBody(EntityUid uid, EntityUid target, CryoPodComponent cryoPodComponent)
     {
         if (cryoPodComponent.BodyContainer.ContainedEntity != null)
             return;
@@ -78,7 +77,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
         UpdateAppearance(uid, cryoPodComponent);
     }
 
-    public void TryEjectBody(EntityUid uid, EntityUid userId, SharedCryoPodComponent? cryoPodComponent)
+    public void TryEjectBody(EntityUid uid, EntityUid userId, CryoPodComponent? cryoPodComponent)
     {
         if (!Resolve(uid, ref cryoPodComponent))
         {
@@ -94,7 +93,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
         EjectBody(uid, cryoPodComponent);
     }
 
-    public virtual void EjectBody(EntityUid uid, SharedCryoPodComponent? cryoPodComponent)
+    public virtual void EjectBody(EntityUid uid, CryoPodComponent? cryoPodComponent)
     {
         if (!Resolve(uid, ref cryoPodComponent))
             return;
@@ -119,7 +118,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
         UpdateAppearance(uid, cryoPodComponent);
     }
 
-    protected void AddAlternativeVerbs(EntityUid uid, SharedCryoPodComponent cryoPodComponent, GetVerbsEvent<AlternativeVerb> args)
+    protected void AddAlternativeVerbs(EntityUid uid, CryoPodComponent cryoPodComponent, GetVerbsEvent<AlternativeVerb> args)
     {
         if (!args.CanAccess || !args.CanInteract)
             return;
@@ -137,7 +136,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
         }
     }
 
-    protected void OnEmagged(EntityUid uid, SharedCryoPodComponent? cryoPodComponent, ref GotEmaggedEvent args)
+    protected void OnEmagged(EntityUid uid, CryoPodComponent? cryoPodComponent, ref GotEmaggedEvent args)
     {
         if (!Resolve(uid, ref cryoPodComponent))
         {
@@ -149,7 +148,7 @@ public abstract partial class SharedCryoPodSystem: EntitySystem
         args.Handled = true;
     }
 
-    protected void OnCryoPodPryFinished(EntityUid uid, SharedCryoPodComponent cryoPodComponent, CryoPodPryFinished args)
+    protected void OnCryoPodPryFinished(EntityUid uid, CryoPodComponent cryoPodComponent, CryoPodPryFinished args)
     {
         if (args.Cancelled)
             return;
index ed4c967df411aff9c237395501edfc57e27d8753..9248b4c8d9db4a0d17676f2024fef6895d266d19 100644 (file)
     containers:
       - scanner-body
   - type: CryoPod
+  - type: CryoPodAir
   - type: ContainerTemperatureDamageThresholds
     coldDamageThreshold: 10