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>
This commit is contained in:
Nemanja
2024-01-16 02:58:04 -05:00
committed by GitHub
parent 9337d74283
commit c29896f505

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