]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Update RespiratorSystem.cs to not use Component.Owner (#30426)
authorPlykiya <58439124+Plykiya@users.noreply.github.com>
Thu, 1 Aug 2024 02:29:02 +0000 (19:29 -0700)
committerGitHub <noreply@github.com>
Thu, 1 Aug 2024 02:29:02 +0000 (19:29 -0700)
Update RespiratorSystem.cs

Co-authored-by: plykiya <plykiya@protonmail.com>
Content.Server/Body/Systems/RespiratorSystem.cs

index 5fbd0c48147eda45eb0aa9831afffc044759d911..5190ba37d50c6ba8a0620e1df866bd1d2c9ae073 100644 (file)
@@ -114,7 +114,7 @@ public sealed class RespiratorSystem : EntitySystem
         if (!Resolve(uid, ref body, logMissing: false))
             return;
 
-        var organs = _bodySystem.GetBodyOrganComponents<LungComponent>(uid, body);
+        var organs = _bodySystem.GetBodyOrganEntityComps<LungComponent>((uid, body));
 
         // Inhale gas
         var ev = new InhaleLocationEvent();
@@ -131,11 +131,11 @@ public sealed class RespiratorSystem : EntitySystem
 
         var lungRatio = 1.0f / organs.Count;
         var gas = organs.Count == 1 ? actualGas : actualGas.RemoveRatio(lungRatio);
-        foreach (var (lung, _) in organs)
+        foreach (var (organUid, lung, _) in organs)
         {
             // Merge doesn't remove gas from the giver.
             _atmosSys.Merge(lung.Air, gas);
-            _lungSystem.GasToReagent(lung.Owner, lung);
+            _lungSystem.GasToReagent(organUid, lung);
         }
     }
 
@@ -144,7 +144,7 @@ public sealed class RespiratorSystem : EntitySystem
         if (!Resolve(uid, ref body, logMissing: false))
             return;
 
-        var organs = _bodySystem.GetBodyOrganComponents<LungComponent>(uid, body);
+        var organs = _bodySystem.GetBodyOrganEntityComps<LungComponent>((uid, body));
 
         // exhale gas
 
@@ -161,12 +161,12 @@ public sealed class RespiratorSystem : EntitySystem
         }
 
         var outGas = new GasMixture(ev.Gas.Volume);
-        foreach (var (lung, _) in organs)
+        foreach (var (organUid, lung, _) in organs)
         {
             _atmosSys.Merge(outGas, lung.Air);
             lung.Air.Clear();
 
-            if (_solutionContainerSystem.ResolveSolution(lung.Owner, lung.SolutionName, ref lung.Solution))
+            if (_solutionContainerSystem.ResolveSolution(organUid, lung.SolutionName, ref lung.Solution))
                 _solutionContainerSystem.RemoveAllSolution(lung.Solution.Value);
         }
 
@@ -201,7 +201,7 @@ public sealed class RespiratorSystem : EntitySystem
         if (!Resolve(ent, ref ent.Comp))
             return false;
 
-        var organs = _bodySystem.GetBodyOrganComponents<LungComponent>(ent);
+        var organs = _bodySystem.GetBodyOrganEntityComps<LungComponent>((ent, null));
         if (organs.Count == 0)
             return false;
 
@@ -213,7 +213,7 @@ public sealed class RespiratorSystem : EntitySystem
         float saturation = 0;
         foreach (var organ in organs)
         {
-            saturation += GetSaturation(solution, organ.Comp.Owner, out var toxic);
+            saturation += GetSaturation(solution, organ.Owner, out var toxic);
             if (toxic)
                 return false;
         }