From 2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 25 Sep 2026 21:53:00 -0300 Subject: sketchbook: what the game's review needed - input.started: true on the first update of a run, never after a reload, for a sketch to stop what should not resume from saved state. - A console line that errors fails its script. Sketch commands answer unknown, done or failed (abi.Outcome) instead of a bool that hid errors. - addScript also takes the hot-reloadable library, run through the generic host, so scripts can reload a real build. - Sounds that do not load are .none, not an empty clip. - sk_tag reads an enum field's tag name from the web build, for tests. --- src/host/Console.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/host/Console.zig') diff --git a/src/host/Console.zig b/src/host/Console.zig index d9aa469..e6be2f0 100644 --- a/src/host/Console.zig +++ b/src/host/Console.zig @@ -135,7 +135,7 @@ pub fn execute(self: *Console, host: *Host, line: []const u8, now: u64) ![]const if (eq(command, "help")) { self.log("save|load [1..7] snapshot N | record|play [0..15] recording N | stop | pause | step N | seek start|end|"); self.log("diff [N] | reset | get | set | overlay memory|sound | quit"); - if (!host.forward(self, line, now)) self.log("Backtick hides the console. Tab completes."); + if (host.forward(self, line, now) == .unknown) self.log("Backtick hides the console. Tab completes."); return &.{}; } if (eq(command, "overlay")) { @@ -210,7 +210,11 @@ pub fn execute(self: *Console, host: *Host, line: []const u8, now: u64) ![]const } else { // Sketch commands edit state outside the recorded input. h.stop(now); - if (!host.forward(self, line, now)) return error.UnknownCommand; + switch (host.forward(self, line, now)) { + .unknown => return error.UnknownCommand, + .failed => return error.CommandFailed, + .done => {}, + } } return &.{}; } -- cgit v1.3