diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index aed5d3e8..6bb4b724 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -1691,7 +1691,6 @@ ${escapedMessage} texturesPromise, PlayerAnimationDirections.Down, false, - this.userInputManager, this.companion, this.companion !== null ? lazyLoadCompanionResource(this.load, this.companion) : undefined ); @@ -1811,7 +1810,7 @@ ${escapedMessage} update(time: number, delta: number): void { this.dirty = false; this.currentTick = time; - this.CurrentPlayer.moveUser(delta); + this.CurrentPlayer.moveUser(delta, this.userInputManager.getEventListForGameTick()); // Let's handle all events while (this.pendingEvents.length !== 0) { diff --git a/front/src/Phaser/Player/Player.ts b/front/src/Phaser/Player/Player.ts index e41b3237..e340eeed 100644 --- a/front/src/Phaser/Player/Player.ts +++ b/front/src/Phaser/Player/Player.ts @@ -1,8 +1,7 @@ import { PlayerAnimationDirections } from "./Animation"; import type { GameScene } from "../Game/GameScene"; -import { ActiveEventList, UserInputEvent, UserInputManager } from "../UserInput/UserInputManager"; +import { ActiveEventList, UserInputEvent } from "../UserInput/UserInputManager"; import { Character } from "../Entity/Character"; -import type { RemotePlayer } from "../Entity/RemotePlayer"; import { get } from "svelte/store"; import { userMovingStore } from "../../Stores/GameStore"; @@ -20,7 +19,6 @@ export class Player extends Character { texturesPromise: Promise, direction: PlayerAnimationDirections, moving: boolean, - private userInputManager: UserInputManager, companion: string | null, companionTexturePromise?: Promise ) { @@ -100,12 +98,11 @@ export class Player extends Character { return [xMovement, yMovement]; } - public moveUser(delta: number): void { - const activeEvents = this.userInputManager.getEventListForGameTick(); + public moveUser(delta: number, activeUserInputEvents: ActiveEventList): void { const state = get(followStateStore); const role = get(followRoleStore); - if (activeEvents.get(UserInputEvent.Follow)) { + if (activeUserInputEvents.get(UserInputEvent.Follow)) { if (state === "off" && this.scene.groups.size > 0) { this.sendFollowRequest(); } else if (state === "active") { @@ -118,7 +115,7 @@ export class Player extends Character { if ((state === "active" || state === "ending") && role === "follower") { [x, y] = this.computeFollowMovement(); } - this.inputStep(activeEvents, x, y); + this.inputStep(activeUserInputEvents, x, y); } public sendFollowRequest() {