diff --git a/packages/core/index.ts b/packages/core/index.ts index 626e545..57f6797 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -68,7 +68,7 @@ export default ({ // detached so that Minecraft gets to terminate gracefully on SIGINT // child process should be exited by @telecraft/core instead of OS - const minecraft = spawn(launch, options, { + const game = spawn(launch, options, { cwd: config.workdir, detached: true, }); @@ -76,9 +76,9 @@ export default ({ const readers: Reader[] = []; const inputReaders: Reader[] = []; - const { stdin } = minecraft; - const stdout = decode(minecraft.stdout); - const stderr = decode(minecraft.stderr); + const { stdin } = game; + const stdout = decode(game.stdout); + const stderr = decode(game.stderr); stdout.pipe(io.stdout); stderr.pipe(io.stderr); @@ -171,9 +171,9 @@ export default ({ ); io.stdin.pause(); cliInput.close(); - if (!minecraft.killed) { + if (!game.killed) { console.log("Stopping server."); - server.send("stop"); + server.send("/stop"); alreadyExiting = true; } events.emit("core:close", {}); @@ -188,7 +188,7 @@ export default ({ cleanup(); }); - minecraft.once("exit", () => { + game.once("exit", () => { console.log("Game server exited."); if (alreadyExiting) console.log("Core is already exiting."); else cleanup(); diff --git a/packages/parser/vintagestory/index.ts b/packages/parser/vintagestory/index.ts index d216252..450c63f 100644 --- a/packages/parser/vintagestory/index.ts +++ b/packages/parser/vintagestory/index.ts @@ -165,27 +165,17 @@ const parts = sequenceOf([ ]), ]).map(([timestamp, , event]) => ({ ...timestamp, ...event })); -const stream = Deno.openSync("./test.log", { - create: true, - write: true, - truncate: true, -}); -const log = (line: string) => - stream.writeSync(new TextEncoder().encode(line + "\n")); -// const log = console.log; - const sleep = (ms: number) => new Promise(r => setTimeout(r, ms)); // Get 4 random numbers const rand = () => String(Math.floor(1000 + Math.random() * 9000)); const V119: Parser = (server, emit) => { let buf = ""; - let timer: number | undefined = undefined; + // let timer: number | undefined = undefined; let waiting = ""; const parse = (line: string) => { buf = ""; - log("> " + line); const result = parts.run(line); if (!result.isError) return emit("vs:" + result.result.event, result.result);