diff --git a/client/Chamber.cs b/client/Chamber.cs
index 42cd0b8..f45125e 100644
--- a/client/Chamber.cs
+++ b/client/Chamber.cs
@@ -32,8 +32,9 @@ public partial class Chamber : Node3D
/// The glow last drawn, 0 (dark) to 1.
public float Glow { get; private set; }
- public void Sync(BodyPainBoxSession session, double intensity)
+ public void Sync(BodyPainBoxSession session)
{
+ double intensity = session.BoxIntensity; // 0 once the box is off
var box = session.Chamber;
Position = new Vector3(box.CenterX, box.CenterY, box.CenterZ);
_volume.Scale = new Vector3(2f * box.HalfX, 2f * box.HalfY, 2f * box.HalfZ);
diff --git a/client/Hud.cs b/client/Hud.cs
index ac4a9e8..c29e2f3 100644
--- a/client/Hud.cs
+++ b/client/Hud.cs
@@ -76,10 +76,10 @@ public partial class Hud : CanvasLayer
var r = s.Result();
_text.Clear();
_text.Append($"seed {_main.Seed} t {s.TickIndex * BodyPainBox.TickSeconds:F2} s (tick {s.TickIndex})\n");
- _text.Append($"box intensity {_main.ShownBoxIntensity:F2} (set {_main.Intensity:F2})\n");
+ _text.Append($"box intensity {s.BoxIntensity:F2}{(s.BoxOn ? "" : " off")} (set {_main.Intensity:F2})\n");
_text.Append($"pain {s.Pain:F2} strain {s.Strain:F2} resolve {s.Resolve:F2}\n");
_text.Append($"goal {s.Goal} flinches {r.Flinches}\n");
- _text.Append($"will broke at {Ms(r.TimeToBreakMs)} withdrew {(s.Goal == Lodur.Goal.Withdraw ? "yes" : "no")}\n");
+ _text.Append($"will broke at {Ms(r.TimeToBreakMs)} withdrew {(s.Goal == Goal.Withdraw ? "yes" : "no")}\n");
_text.Append($"hand {(s.Hand.InBox ? "in box" : "out of box")} hand out at {Ms(s.HandOutMs)}\n");
_text.Append(s.Finished ? $"outcome {r.Outcome}\n" : "running\n");
var events = _main.Events;
diff --git a/client/Main.cs b/client/Main.cs
index 8287141..11ee9e1 100644
--- a/client/Main.cs
+++ b/client/Main.cs
@@ -42,13 +42,6 @@ public partial class Main : Node3D
/// Every event the session has reported since the last Reset, oldest first.
public IReadOnlyList Events => _events;
- ///
- /// The box's intensity as the player should see it. The session stops writing it once a run ends because the box
- /// was switched off, so the last written value would stay on screen; that run ended with the box off.
- ///
- public double ShownBoxIntensity =>
- _session is { } s ? (s.Finished && s.Result().Outcome == Outcome.BoxDisabled ? 0.0 : s.BoxIntensity) : 0.0;
-
/// The parameters of a run at the given box intensity: every default except the 1/120 s tick the body needs.
public static PainBoxParameters ParametersFor(double intensity) =>
new() { TickSeconds = BodyPainBox.TickSeconds, BoxIntensity = intensity };
@@ -129,7 +122,7 @@ public partial class Main : Node3D
{
var s = Session;
_bodies.Sync(s.View, teleport);
- _chamber.Sync(s, ShownBoxIntensity);
+ _chamber.Sync(s);
Span events = stackalloc BodyEvent[8];
int n;
while ((n = s.DrainEvents(events)) > 0)
diff --git a/client/tests/Smoke.cs b/client/tests/Smoke.cs
index b286e72..86c61f7 100644
--- a/client/tests/Smoke.cs
+++ b/client/tests/Smoke.cs
@@ -133,6 +133,18 @@ public partial class Smoke : Node
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame); // the HUD draws in _Process, after this frame's signal
Check(_main.Chamber.Glow == 0f, $"the chamber still glows ({_main.Chamber.Glow}) with the box off");
Check(Hud.Readout.Contains("box intensity 0.00"), "the readout does not show the box off: " + Hud.Readout.Split('\n')[1]);
+
+ // Box off after the will has broken: the run is over, and the box the player switches off still goes dark.
+ PressReset(Seed);
+ while (!Session.Finished) await Frame();
+ Check(Session.Result().Outcome == Outcome.WillBroke && Session.BoxOn, $"the run ended {Session.Result().Outcome} with the box on: expected WillBroke");
+ await Frame();
+ Check(_main.Chamber.Glow > 0.1f, $"the chamber is dark ({_main.Chamber.Glow}) after the will broke, so the probe proves nothing");
+ Hud.BoxOffButton.EmitSignal(BaseButton.SignalName.Pressed);
+ await Frame();
+ await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
+ await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
+ Check(!Session.BoxOn && _main.Chamber.Glow == 0f && Hud.Readout.Contains("box intensity 0.00 off"), $"after Box off on a finished run: on {Session.BoxOn}, glow {_main.Chamber.Glow}");
}
private void CheckEngineAndScene()