mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-08 07:17:28 +00:00
* Reduce atmos component queries
* Remove method events
* Cache airtight data
* Make MolesArchived nullable
* Fix airtight cache
* only get tile def once
* Immutable mixtures
* firelock queries
* misc
* misc cleanup
* Trim disconnected tiles
* Fix merge issues and bugs
* Why does the PR keep increasing in scope
* debug overlay
* Fix bugs
* Fix test, remove unused events
* Add setmapatmos command
* Fix overlays
* Add map check
* A
* Resolve conflicts with #26102
* Remove some obsolete methods
(cherry picked from commit 18a35e7e83)
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using Content.Server.Body.Components;
|
|
using Content.Shared.Atmos;
|
|
using Content.Shared.Chemistry.Reagent;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server.Chemistry.ReagentEffects;
|
|
|
|
public sealed partial class ModifyLungGas : ReagentEffect
|
|
{
|
|
[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(ReagentEffectArgs args)
|
|
{
|
|
if (!args.EntityManager.TryGetComponent<LungComponent>(args.OrganEntity, out var lung))
|
|
return;
|
|
|
|
foreach (var (gas, ratio) in _ratios)
|
|
{
|
|
var quantity = ratio * args.Quantity.Float() / Atmospherics.BreathMolesToReagentMultiplier;
|
|
if (quantity < 0)
|
|
quantity = Math.Max(quantity, -lung.Air[(int)gas]);
|
|
lung.Air.AdjustMoles(gas, quantity);
|
|
}
|
|
}
|
|
}
|