using Content.Shared.Atmos; using Content.Shared.Body.Components; namespace Content.Shared.EntityEffects.Effects.Body; /// /// Adjust the amount of Moles stored in this set of lungs based on a given dictionary of gasses and ratios. /// The amount of gas adjusted is modified by scale. /// /// public sealed partial class ModifyLungGasEntityEffectSystem : EntityEffectSystem { // TODO: This shouldn't be an entity effect, gasses should just metabolize and make a byproduct by default... protected override void Effect(Entity entity, ref EntityEffectEvent args) { var amount = args.Scale; foreach (var (gas, ratio) in args.Effect.Ratios) { var quantity = ratio * amount / Atmospherics.BreathMolesToReagentMultiplier; if (quantity < 0) quantity = Math.Max(quantity, -entity.Comp.Air[(int) gas]); entity.Comp.Air.AdjustMoles(gas, quantity); } } } /// public sealed partial class ModifyLungGas : EntityEffectBase { [DataField(required: true)] public Dictionary Ratios = default!; }