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)
+1
View File
@@ -32,6 +32,7 @@ texture = ExtResource("13_ahjgs")
[node name="Main" type="Node3D"]
script = ExtResource("1_xcpe3")
enable_bots = false
turn_based_mode = false
[node name="EnhancedGridMap" type="GridMap" parent="."]
+4 -1
View File
@@ -86,6 +86,10 @@ func _ready():
playerboard.fill(-1)
return
# Disable Beehave tree if this is not a bot
if not is_bot and has_node("BehaviorTree"):
$BehaviorTree.enabled = false
# Rest of initialization (only for human players)
if enhanced_gridmap:
enhanced_gridmap.initialize_astar()
@@ -676,7 +680,6 @@ func get_adjacent_playerboard_slots(slot_index) -> Array:
return adjacent
func has_item_at_current_position() -> bool:
var current_cell = Vector3i(current_position.x, 1, current_position.y)
return enhanced_gridmap.get_cell_item(current_cell) != -1