no fucking bots

This commit is contained in:
2025-02-18 11:13:39 +08:00
parent 84457ce915
commit 330d5a401b
3 changed files with 20 additions and 4 deletions
+15 -3
View File
@@ -4,6 +4,8 @@ var multiplayer_peer = ENetMultiplayerPeer.new()
const PORT = 9999
const ADDRESS = "127.0.0.1"
@export var enable_bots: bool = true # Add this line
var connected_peer_ids = []
var local_player_character : CharacterBody3D
var player_scene = preload("res://scenes/player.tscn")
@@ -256,9 +258,11 @@ func _on_host_pressed():
add_player_character(1)
players.append(1)
# Add bots with their own goals
for i in range(2, max_players + 1):
add_bot(i)
# Only add bots if enable_bots is true
if enable_bots:
# Add bots with their own goals
for i in range(2, max_players + 1):
add_bot(i)
start_game()
@@ -377,6 +381,14 @@ func create_bot(bot_id):
bot_character.add_to_group("Players", true)
bot_character.add_to_group("Bots", true)
if not enable_bots:
bot_character.set_process(false)
bot_character.set_physics_process(false)
# Disable Beehave tree if it exists
var behavior_tree = bot_character.get_node_or_null("BehaviorTree")
if behavior_tree:
behavior_tree.enabled = false
if multiplayer.is_server():
bots.append(bot_id)
players.append(bot_id)