updated some performance stuff

This commit is contained in:
Warren H
2026-07-17 15:39:31 -04:00
parent 10ff124466
commit 638aef22b2
7 changed files with 660 additions and 130 deletions
@@ -9,6 +9,9 @@ import {
bossDeathDespawnSeconds,
bossDeathHoldSeconds,
bossDeathOpacity,
consumeBossIndicatorPatch,
createBossIndicatorPatchState,
updateBossIndicatorPatchState,
} from "./bossDeathVisuals";
describe("boss death visuals", () => {
@@ -25,6 +28,22 @@ describe("boss death visuals", () => {
expect(advanceBossIndicatorOpacity(0.4, false, 1 / 60)).toBe(1);
});
it("patches indicator meshes once per defeat, including a replacement boss", () => {
let state = createBossIndicatorPatchState(false);
expect(state.pending).toBe(false);
state = updateBossIndicatorPatchState(state, true);
expect(state.pending).toBe(true);
state = consumeBossIndicatorPatch(state);
expect(state.pending).toBe(false);
expect(updateBossIndicatorPatchState(state, true)).toBe(state);
state = updateBossIndicatorPatchState(state, false);
expect(state.pending).toBe(false);
state = updateBossIndicatorPatchState(state, true);
expect(state.pending).toBe(true);
});
it("holds the death pose for a few seconds, then fades the model", () => {
expect(bossDeathOpacity(BOSS_DEATH_HOLD_SECONDS)).toBe(1);
expect(bossDeathOpacity(BOSS_DEATH_HOLD_SECONDS + BOSS_DEATH_FADE_SECONDS / 2)).toBeCloseTo(0.5);