ECS Atmos Part 2: Moves a lot of Gas Mixture methods to AtmosphereSystem. (#4218)
This commit is contained in:
committed by
GitHub
parent
e16c23a747
commit
263c9ef974
@@ -2,12 +2,14 @@
|
||||
using System;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Body.Circulatory;
|
||||
using Content.Server.Body.Respiratory;
|
||||
using Content.Server.Notification;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.MobState;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
@@ -67,7 +69,7 @@ namespace Content.Server.Body.Behavior
|
||||
|
||||
public void Transfer(GasMixture from, GasMixture to, float ratio)
|
||||
{
|
||||
to.Merge(from.RemoveRatio(ratio));
|
||||
EntitySystem.Get<AtmosphereSystem>().Merge(to, from.RemoveRatio(ratio));
|
||||
}
|
||||
|
||||
public void ToBloodstream(GasMixture mixture)
|
||||
@@ -84,7 +86,7 @@ namespace Content.Server.Body.Behavior
|
||||
|
||||
var to = bloodstream.Air;
|
||||
|
||||
to.Merge(mixture);
|
||||
EntitySystem.Get<AtmosphereSystem>().Merge(to, mixture);
|
||||
mixture.Clear();
|
||||
}
|
||||
|
||||
@@ -189,7 +191,7 @@ namespace Content.Server.Body.Behavior
|
||||
bloodstream.PumpToxins(Air);
|
||||
|
||||
var lungRemoved = Air.RemoveRatio(0.5f);
|
||||
to.Merge(lungRemoved);
|
||||
EntitySystem.Get<AtmosphereSystem>().Merge(to, lungRemoved);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Metabolism;
|
||||
@@ -69,17 +71,20 @@ namespace Content.Server.Body.Circulatory
|
||||
|
||||
public void PumpToxins(GasMixture to)
|
||||
{
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
if (!Owner.TryGetComponent(out MetabolismComponent? metabolism))
|
||||
{
|
||||
to.Merge(Air);
|
||||
atmosphereSystem.Merge(to, Air);
|
||||
Air.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
var toxins = metabolism.Clean(this);
|
||||
var toOld = to.Gases.ToArray();
|
||||
var toOld = new float[to.Moles.Length];
|
||||
Array.Copy(to.Moles, toOld, toOld.Length);
|
||||
|
||||
to.Merge(toxins);
|
||||
atmosphereSystem.Merge(to, toxins);
|
||||
|
||||
for (var i = 0; i < toOld.Length; i++)
|
||||
{
|
||||
@@ -90,7 +95,7 @@ namespace Content.Server.Body.Circulatory
|
||||
toxins.AdjustMoles(i, -delta);
|
||||
}
|
||||
|
||||
Air.Merge(toxins);
|
||||
atmosphereSystem.Merge(Air, toxins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user