fix player not being deleted
This commit is contained in:
parent
328d508ae7
commit
c04c7b725f
1 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,7 @@ import { mts } from "../../common/mod.ts";
|
||||||
import { log_from, v2, Vec2 } from "../../common/utils.ts";
|
import { log_from, v2, Vec2 } from "../../common/utils.ts";
|
||||||
import { CompDisplay, sys_render_world } from "../components/display.ts";
|
import { CompDisplay, sys_render_world } from "../components/display.ts";
|
||||||
import { CompPos, sys_find_free_pos } from "../components/world.ts";
|
import { CompPos, sys_find_free_pos } from "../components/world.ts";
|
||||||
import { Engine, Entity } from "../engine.ts";
|
import { CompId, Engine, Entity } from "../engine.ts";
|
||||||
import { ClientInterface } from "../network.ts";
|
import { ClientInterface } from "../network.ts";
|
||||||
const log = log_from(import.meta);
|
const log = log_from(import.meta);
|
||||||
|
|
||||||
|
@ -32,12 +32,12 @@ export class Session {
|
||||||
if (input.kind === "ping") this.client.outputs.send({ kind: "ping_response", content: input.content });
|
if (input.kind === "ping") this.client.outputs.send({ kind: "ping_response", content: input.content });
|
||||||
if (input.kind === "request_display") this.send_display(input.content.width, input.content.height);
|
if (input.kind === "request_display") this.send_display(input.content.width, input.content.height);
|
||||||
if (input.kind === "input") this.handle_input(input);
|
if (input.kind === "input") this.handle_input(input);
|
||||||
if (input.kind === "exit") this.engine.delete(this.entity.identifier);
|
if (input.kind === "exit") break;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Session loop failed, ", error);
|
console.error("Session loop failed, ", error);
|
||||||
this.engine.delete(this.entity.identifier);
|
|
||||||
}
|
}
|
||||||
|
this.engine.delete(this.entity.get_force(CompId).id);
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_input(input: mts.MsgInput) {
|
handle_input(input: mts.MsgInput) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue