24 lines
712 B
TypeScript
Executable file
24 lines
712 B
TypeScript
Executable file
#!/bin/env -S deno run --allow-net --allow-read
|
|
|
|
import { log_from, Vec2 } from "../common/utils.ts";
|
|
import { Engine, World } from "./engine.ts";
|
|
import { Enemy } from "./entities/enemy.ts";
|
|
import { Gateway } from "./network.ts";
|
|
const log = log_from(import.meta);
|
|
|
|
async function main() {
|
|
log("Starting.");
|
|
const world = new World();
|
|
await world.spawn_structure("../data/structures/houses.txt", new Vec2(2, 2));
|
|
const engine = new Engine(world);
|
|
engine.start();
|
|
|
|
Enemy.spawn(world, new Vec2(-3, -3));
|
|
|
|
const port = 9999;
|
|
const gateway = new Gateway(port);
|
|
log("Awaiting connection.");
|
|
for await (const session of gateway.accept()) engine.add_session(session);
|
|
}
|
|
|
|
if (import.meta.main) await main();
|