make fetchHadler synchronous only

This commit is contained in:
Elizabeth Hunt 2023-08-26 13:54:39 -06:00
parent 2fbe0f0595
commit 594921352c
Signed by: simponic
GPG Key ID: 52B3774857EB24B1
2 changed files with 8 additions and 7 deletions

View File

@ -75,13 +75,17 @@ export class Input extends System {
PhysicsConstants.MAX_JUMP_TIME_MS
) {
const mass = entity.getComponent<Mass>(ComponentNames.Mass).mass;
entity.getComponent<Forces>(ComponentNames.Forces)?.forces.push({
const jumpForce = {
fCartesian: {
fy: mass * PhysicsConstants.PLAYER_JUMP_ACC,
fx: 0
},
torque: 0
});
};
entity
.getComponent<Forces>(ComponentNames.Forces)
?.forces.push(jumpForce);
}
}
}

View File

@ -65,10 +65,10 @@ export class GameServer {
const { sessionId } = websocket.data;
const sessionEntities = this.sessions.get(sessionId)!.controllableEntities;
this.sessions.delete(sessionId);
if (!sessionEntities) return;
this.messagePublisher.addMessage({
type: MessageType.REMOVE_ENTITIES,
body: Array.from(sessionEntities)
@ -103,10 +103,7 @@ export class GameServer {
this.sessions.get(sessionId)!.controllableEntities.add(player.id);
}
private fetchHandler(
req: Request,
server: Server
): Promise<Response> | Response {
private fetchHandler(req: Request, server: Server): Response {
const url = new URL(req.url);
const headers = new Headers();