Files
wwdpublic/Content.Server/EntityEffects/Effects/ModifyLungGas.cs
ilmenwe 8338b0c699 Removed Duplicate Using. Removed Unused Using. (#2163)
# Description

Removed duplicate using statements, removed unused using statements.
this will decrease the number of warnings a small bit, and decrease
unused dependency references in general.
---

# TODO

- [x] Remove double references.
- [x] Remove unused references.
---

# Changelog

🆑
- remove: double references in code
- remove: unused references in code that had double references.

Co-authored-by: ilmenwe <no@mail.com>

(cherry picked from commit 9b73c88feefff68223f083893505826dc021ddee)
2025-04-18 17:04:50 +03:00

49 lines
1.6 KiB
C#

using Content.Server.Body.Components;
using Content.Shared.Atmos;
using Content.Shared.EntityEffects;
using Robust.Shared.Prototypes;
namespace Content.Server.EntityEffects.Effects;
public sealed partial class ModifyLungGas : EntityEffect
{
[DataField("ratios", required: true)]
private Dictionary<Gas, float> _ratios = default!;
// JUSTIFICATION: This is internal magic that players never directly interact with.
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
=> null;
public override void Effect(EntityEffectBaseArgs args)
{
LungComponent? lung;
float amount = 1f;
if (args is EntityEffectReagentArgs reagentArgs)
{
if (!args.EntityManager.TryGetComponent<LungComponent>(reagentArgs.OrganEntity, out var organLung))
return;
lung = organLung;
amount = reagentArgs.Quantity.Float();
}
else
{
if (!args.EntityManager.TryGetComponent<LungComponent>(args.TargetEntity, out var organLung)) //Likely needs to be modified to ensure it works correctly
return;
lung = organLung;
}
if (lung != null)
{
foreach (var (gas, ratio) in _ratios)
{
var quantity = ratio * amount / Atmospherics.BreathMolesToReagentMultiplier;
if (quantity < 0)
quantity = Math.Max(quantity, -lung.Air[(int) gas]);
lung.Air.AdjustMoles(gas, quantity);
}
}
}
}