#359: Throttle attack

This commit is contained in:
Dennis Postma 2025-02-16 21:22:49 +01:00
parent 58d7e02de2
commit bfba7197b7

View File

@ -19,6 +19,11 @@ export default class CharacterMove extends BaseEvent {
// Don't attack if the character is already moving // Don't attack if the character is already moving
if (this.getMapCharacter()?.isMoving) return if (this.getMapCharacter()?.isMoving) return
const throttleKey = `attack_${this.socket.characterId}`
if (this.isThrottled(throttleKey, 1000)) {
return
}
// Start attack // Start attack
await this.characterAttackService.attack(this.socket.characterId!) await this.characterAttackService.attack(this.socket.characterId!)
} catch (error) { } catch (error) {