Partial atmos refactor (#22521)
* 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
This commit is contained in:
@@ -16,12 +16,15 @@ public sealed partial class ModifyLungGas : ReagentEffect
|
||||
|
||||
public override void Effect(ReagentEffectArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent<LungComponent>(args.OrganEntity, out var lung))
|
||||
if (!args.EntityManager.TryGetComponent<LungComponent>(args.OrganEntity, out var lung))
|
||||
return;
|
||||
|
||||
foreach (var (gas, ratio) in _ratios)
|
||||
{
|
||||
foreach (var (gas, ratio) in _ratios)
|
||||
{
|
||||
lung.Air.Moles[(int) gas] += (ratio * args.Quantity.Float()) / Atmospherics.BreathMolesToReagentMultiplier;
|
||||
}
|
||||
var quantity = ratio * args.Quantity.Float() / Atmospherics.BreathMolesToReagentMultiplier;
|
||||
if (quantity < 0)
|
||||
quantity = Math.Max(quantity, -lung.Air[(int)gas]);
|
||||
lung.Air.AdjustMoles(gas, quantity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user