From 2ffaf602f5a04073c86165bd78fbdc2d62fca231 Mon Sep 17 00:00:00 2001
From: Paolo Brasolin <paolo.brasolin@eurac.edu>
Date: Tue, 15 Mar 2022 00:28:44 +0100
Subject: [PATCH] fix: fe limit spawn rate

---
 frontend/src/js/fight_scene.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts
index 0469ca0..130ff03 100644
--- a/frontend/src/js/fight_scene.ts
+++ b/frontend/src/js/fight_scene.ts
@@ -315,7 +315,7 @@ function spawn(scene: any) {
   scene.time.now;
   const delay =
     (8 * 1000 * (60 * 1000 - scene.time.now)) / 60 / 1000 + 2 * 1000;
-  setTimeout(() => spawn(scene), delay);
+  setTimeout(() => spawn(scene), Math.max(delay, 2000));
 }
 
 function dispatchEnemy(scene: any) {
-- 
GitLab