aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-08-28 21:37:24 +0200
committertpart <tpart120@proton.me>2024-08-28 21:37:24 +0200
commit89d31e3bdb9bd7cb9381d361afceb524f0e6de01 (patch)
tree1e1edf1752bb35531bc63619ae8a59b33051692b
parent269d0c8079ef3b37321e699ccaa288281a447d0c (diff)
downloadhurrycurry-89d31e3bdb9bd7cb9381d361afceb524f0e6de01.tar
hurrycurry-89d31e3bdb9bd7cb9381d361afceb524f0e6de01.tar.bz2
hurrycurry-89d31e3bdb9bd7cb9381d361afceb524f0e6de01.tar.zst
Add bot count limit
-rw-r--r--client/menu/lobby.gd8
1 files changed, 3 insertions, 5 deletions
diff --git a/client/menu/lobby.gd b/client/menu/lobby.gd
index 44afe9cf..7d1e3af7 100644
--- a/client/menu/lobby.gd
+++ b/client/menu/lobby.gd
@@ -17,6 +17,7 @@
extends Control
class_name Lobby
+const MAX_BOT_COUNT_PER_TYPE: int = 16
const PLAYER = preload("res://menu/lobby/player.tscn")
var map_count
@@ -116,14 +117,11 @@ func select_map(i: int):
map_list_container.get_child(i).grab_focus()
func increase_bot_count(algo_id: String):
- bot_counts[algo_id] = bot_counts[algo_id] + 1
+ bot_counts[algo_id] = clampi(bot_counts[algo_id] + 1, 0, MAX_BOT_COUNT_PER_TYPE)
update_bot_reset_text(algo_id)
func decrease_bot_count(algo_id: String):
- var new_count = bot_counts[algo_id] - 1
- if new_count < 0:
- return
- bot_counts[algo_id] = new_count
+ bot_counts[algo_id] = clampi(bot_counts[algo_id] - 1, 0, MAX_BOT_COUNT_PER_TYPE)
update_bot_reset_text(algo_id)
func reset_bot_count(algo_id: String):