Update RespiratorSystem.cs to not use Component.Owner (#30426)

Update RespiratorSystem.cs

Co-authored-by: plykiya <plykiya@protonmail.com>
This commit is contained in:
Plykiya 2024-07-31 19:29:02 -07:00 committed by deltanedas
parent 2242470cac
commit f7b70eb1f7
1 changed files with 8 additions and 8 deletions

View 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;
}