"use strict"; const fs = require("fs"); const path = require("path"); const root = path.resolve(__dirname, ".."); const read = rel => fs.readFileSync(path.join(root, rel), "utf8"); let failed = false; function ok(name, cond) { if (cond) console.log(`[OK] ${name}`); else { console.error(`[FAIL] ${name}`); failed = true; } } const render = read("js/render.js"); const sim = read("js/simulation_creature_system.js"); const frame = read("js/tarinai_update_step_frame.js"); const care = read("js/tarinai_cursor_care_system.js"); ok("cursor care is updated from one spatial query per frame", sim.includes("function updateCursorCare") && sim.includes("worldRef.nearbyTarinai?.") && sim.includes("updateCursorCare(worldRef, dt)")); ok("cursor care is no longer cadence-throttled inside full Tarinai updates", !frame.includes("TarinaiCursorCareSystem.updateOne")); ok("cursor hearts use the central effect queue", care.includes('this.world.queueEffect("heart"') && !care.includes("new EffectCtor")); ok("stable object raster cache exists", render.includes("STATIC_ITEM_BITMAP_TYPES") && render.includes("drawStaticItemBitmapCached")); ok("cached objects preserve individual depth-stack entries", render.includes("drawStaticItemBitmapCached(ctx, it, world.time, lighting, world)") && render.includes("drawRenderEntity(ctx, entry.entity, world.time, lighting, world)")); ok("close-up object art bypasses raster cache", render.includes("viewScale?.() || 1) > 1.35")); ok("slow-frame visible-creature anti-spiral budget is bounded", sim.includes("antiSpiralVisibleBudget") && sim.includes("Math.floor(2.8 / Math.max(0.028, dt))")); ok("budget-deferred visible creatures keep motion-only updates", sim.includes("updateMotionOnly(t, dt, { context })")); if (failed) process.exit(1); console.log("Object render/cursor regression audit passed.");