From dec7b614d895a1b507137e4a96a8999ff63aa179 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Wed, 23 Aug 2023 19:44:59 -0600 Subject: holy fuck we actually got somewhere --- engine/systems/Input.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engine/systems/Input.ts') diff --git a/engine/systems/Input.ts b/engine/systems/Input.ts index d9b7133..a32ba9a 100644 --- a/engine/systems/Input.ts +++ b/engine/systems/Input.ts @@ -12,12 +12,14 @@ import { Action } from "../interfaces"; import { System, SystemNames } from "."; export class Input extends System { + public clientId: string; private keys: Set; private actionTimeStamps: Map; - constructor() { + constructor(clientId: string) { super(SystemNames.Input); + this.clientId = clientId; this.keys = new Set(); this.actionTimeStamps = new Map(); } @@ -42,6 +44,7 @@ export class Input extends System { const controlComponent = entity.getComponent( ComponentNames.Control, ); + if (controlComponent.controllableBy != this.clientId) return; if (this.hasSomeKey(KeyConstants.ActionKeys.get(Action.MOVE_RIGHT))) { controlComponent.controlVelocityComponent.velocity.dCartesian.dx += -- cgit v1.2.3-70-g09d2