#!/bin/env -S deno run --allow-net --allow-read import { log_from, v2 } from "../common/utils.ts"; import { Engine } from "./engine.ts"; import { Session } from "./entities/player.ts"; import { sys_spawn_structure } from "./components/world.ts"; import { Gateway } from "./network.ts"; import { sys_spawn_enemy } from "./entities/enemy.ts"; const log = log_from(import.meta); async function main() { log("Starting."); const engine = new Engine(); engine.start(); engine.run(await sys_spawn_structure("../data/structures/houses.txt", v2(2, 2))); engine.run(sys_spawn_enemy(v2(1, 1))); const port = 9999; const gateway = new Gateway(port); log("Awaiting connection."); for await (const client of gateway.accept()) { Session.init(client, engine).start(); } } if (import.meta.main) await main();