summaryrefslogtreecommitdiff
path: root/engine/systems/Input.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-23 19:44:59 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-23 19:44:59 -0600
commitdec7b614d895a1b507137e4a96a8999ff63aa179 (patch)
tree827437755bf9674db51818ee59d919c74a4ea2fc /engine/systems/Input.ts
parentd64ffb5016119e54f0e20d05ae8ac9c96955d9d5 (diff)
downloadjumpstorm-dec7b614d895a1b507137e4a96a8999ff63aa179.tar.gz
jumpstorm-dec7b614d895a1b507137e4a96a8999ff63aa179.zip
holy fuck we actually got somewhere
Diffstat (limited to 'engine/systems/Input.ts')
-rw-r--r--engine/systems/Input.ts5
1 files changed, 4 insertions, 1 deletions
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<string>;
private actionTimeStamps: Map<Action, number>;
- constructor() {
+ constructor(clientId: string) {
super(SystemNames.Input);
+ this.clientId = clientId;
this.keys = new Set<string>();
this.actionTimeStamps = new Map<Action, number>();
}
@@ -42,6 +44,7 @@ export class Input extends System {
const controlComponent = entity.getComponent<Control>(
ComponentNames.Control,
);
+ if (controlComponent.controllableBy != this.clientId) return;
if (this.hasSomeKey(KeyConstants.ActionKeys.get(Action.MOVE_RIGHT))) {
controlComponent.controlVelocityComponent.velocity.dCartesian.dx +=