#359: Throttle attack
This commit is contained in:
parent
58d7e02de2
commit
bfba7197b7
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user