fix radiators leaking heat into atmos blocked tiles (#24124)

* fix radiators leaking heat into atmos blocked tiles

* Fix the fix

Pointyhat to: emogarbage

* Remove unused imports

---------

Co-authored-by: Kevin Zheng <kevinz5000@gmail.com>
(cherry picked from commit c29896f505db28bf3dca9af9e6f0430dcf0f4629)
This commit is contained in:
Nemanja 2024-01-16 02:58:04 -05:00 committed by Debug
parent 38ff9d80b8
commit 48ad5ea014
No known key found for this signature in database
GPG Key ID: 271270A74EF9C350
1 changed files with 12 additions and 0 deletions

View File

@ -20,6 +20,7 @@ public sealed class HeatExchangerSystem : EntitySystem
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
float tileLoss;
@ -53,6 +54,17 @@ public sealed class HeatExchangerSystem : EntitySystem
return;
}
// make sure that the tile the device is on isn't blocked by a wall or something similar.
var xform = Transform(uid);
if (_transform.TryGetGridTilePosition(uid, out var tile))
{
// TryGetGridTilePosition() already returns false if GridUid is null, but the null checker isn't smart enough yet
if (xform.GridUid != null && _atmosphereSystem.IsTileAirBlocked(xform.GridUid.Value, tile))
{
return;
}
}
var dt = args.dt;
// Let n = moles(inlet) - moles(outlet), really a Δn