hud: drop [T] CONDUITS layer, always-active thermal glow, and directional hit-arcs

This commit is contained in:
Meta Vens 2026-12-04 23:56:25 +01:00
commit 3e499c31ee
4 changed files with 192 additions and 153 deletions

View file

@ -62,8 +62,6 @@ public partial class InventoryGridControl : Control
private string? _lastSelectedCargoId;
private int _lastMountedSig = int.MinValue;
private Vector2I? _hoveredCell;
private bool _thermalEnabled;
private float _thermalBlend;
private bool _dataDirty;
private bool _tempDirty;
@ -105,29 +103,10 @@ public partial class InventoryGridControl : Control
? _hardpointLookup[c.X, c.Y]
: null;
public bool ThermalEnabled
{
get => _thermalEnabled;
set
{
if (_thermalEnabled == value) return;
_thermalEnabled = value;
}
}
public float ThermalBlend => _thermalBlend;
internal int LabelsDrawCount => _labelsOverlay.DrawCount;
internal string? GetLastDrawnLabel(string hardpointId) =>
_labelsOverlay.LastDrawnTags.TryGetValue(hardpointId, out string? tag) ? tag : null;
public void SetThermalInstant(bool enabled)
{
_thermalEnabled = enabled;
_thermalBlend = enabled ? 1f : 0f;
_material.SetShaderParameter("thermal_mode", _thermalBlend);
_labelsOverlay.QueueRedraw();
}
public event Action<int, int>? CellClicked;
public event Action<string>? HardpointClicked;
public event Action<Vector2I?, HardpointSpec?>? HoverChanged;
@ -144,25 +123,6 @@ public partial class InventoryGridControl : Control
public override void _Process(double delta)
{
float dt = (float)delta;
bool needUniform = false;
float targetThermal = _thermalEnabled ? 1f : 0f;
if (MathF.Abs(_thermalBlend - targetThermal) > 0.001f)
{
float t = dt >= 0.25f ? 1f : 1f - MathF.Exp(-dt * 14f);
_thermalBlend = Mathf.Lerp(_thermalBlend, targetThermal, t);
if (MathF.Abs(_thermalBlend - targetThermal) < 0.005f)
{
_thermalBlend = targetThermal;
}
needUniform = true;
_labelsOverlay.QueueRedraw();
}
if (needUniform)
{
_material.SetShaderParameter("thermal_mode", _thermalBlend);
}
bool anyPulse = false;
for (int y = 0; y < _gridHeight; y++)
@ -398,7 +358,6 @@ public partial class InventoryGridControl : Control
}
_material.SetShaderParameter("grid_size", new Vector2(w, h));
_material.SetShaderParameter("thermal_mode", _thermalBlend);
if (hadHover)
{
@ -606,20 +565,8 @@ public partial class InventoryGridControl : Control
if (isCompatible) flags |= 16; // bit 4: compatible cargo drop target
if (isBorder) flags |= 32; // bit 5: border radiator cell
// 3x+2.B: 4-bit N/E/S/W thermal conductivity pipe mask
byte cond = 0;
for (int i = 0; i < 4; i++)
{
int nx = x + Offsets8[i].Dx;
int ny = y + Offsets8[i].Dy;
if (spec.IsActive(nx, ny))
{
cond |= (byte)(1 << i);
}
}
float pulse = Math.Clamp(_hitPulse[x, y], 0f, 1f);
var meta = new Color(mask / 255f, flags / 255f, cond / 255f, pulse);
var meta = new Color(mask / 255f, flags / 255f, 0f, pulse);
_dataImage.SetPixel(x * 3 + 0, y, fill);
_dataImage.SetPixel(x * 3 + 1, y, accent);
@ -758,7 +705,7 @@ public partial class InventoryGridControl : Control
var spec = grid.Spec;
int fontSize = cellSize >= 38f ? 10 : 9;
float alpha = Mathf.Lerp(0.95f, 0.55f, _owner._thermalBlend);
float alpha = 0.95f;
for (int i = 0; i < spec.Hardpoints.Length; i++)
{