Skip to content

Commit

Permalink
Logic optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed Nov 1, 2024
1 parent 337a16b commit b957ba9
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ private void OnUpdate(EntityUid uid, PressureControlledValveComponent comp, ref
}

// If the pressure in either inlet or outlet exceeds the side pressure, act as an open pipe.
if (controlNode.Air.Pressure < inletNode.Air.Pressure
|| controlNode.Air.Pressure < outletNode.Air.Pressure)
if (!comp.Enabled && (controlNode.Air.Pressure < inletNode.Air.Pressure
|| controlNode.Air.Pressure < outletNode.Air.Pressure))
{
inletNode.AddAlwaysReachable(outletNode);
outletNode.AddAlwaysReachable(inletNode);
Expand All @@ -49,6 +49,9 @@ private void OnUpdate(EntityUid uid, PressureControlledValveComponent comp, ref
return;
}

if (!comp.Enabled)
return;

inletNode.RemoveAlwaysReachable(outletNode);
outletNode.RemoveAlwaysReachable(inletNode);
comp.Enabled = false;
Expand Down

0 comments on commit b957ba9

Please sign in to comment.