This commit is contained in:
2025-01-28 14:17:29 +08:00
parent a43811fe77
commit 9640283964
22 changed files with 512 additions and 10 deletions
+6 -6
View File
@@ -273,16 +273,16 @@ func create_bot(bot_id):
var bot_character = player_scene.instantiate()
bot_character.set_multiplayer_authority(1)
bot_character.name = str(bot_id)
# Add Beehave tree
var behavior_tree = preload("res://scripts/bot_behavior_tree.gd").new()
bot_character.add_child(behavior_tree)
behavior_tree.name = "BehaviorTree"
add_child(bot_character)
bot_character.add_to_group("Players", true)
bot_character.add_to_group("Bots", true)
# The BehaviorTree will auto-activate for bots
var behavior_tree = bot_character.get_node_or_null("BotBehavior")
if behavior_tree:
behavior_tree.enabled = true
behavior_tree.actor = bot_character
if multiplayer.is_server():
bots.append(bot_id)
players.append(bot_id)
-2
View File
@@ -17,8 +17,6 @@
[node name="Main" type="Node3D"]
script = ExtResource("1_xcpe3")
players = null
turn_based_mode = false
[node name="EnhancedGridMap" type="GridMap" parent="."]
mesh_library = ExtResource("1_110wo")
+1 -1
View File
@@ -74,7 +74,7 @@ func _unhandled_input(event):
#if is_in_group("Bots"):
#return
var main = get_node("/root/Main")
var main = get_node("/root/Main/")
if not is_multiplayer_authority() or (main.turn_based_mode and (not is_my_turn or is_player_moving)):
return
+5 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=3 uid="uid://1dbdbg3q5778"]
[gd_scene load_steps=13 format=3 uid="uid://1dbdbg3q5778"]
[ext_resource type="Script" path="res://scenes/player.gd" id="1_qecr4"]
[ext_resource type="PackedScene" uid="uid://ejeamn0pyey4" path="res://assets/characters/Bob.glb" id="2_3e0d5"]
@@ -7,6 +7,7 @@
[ext_resource type="PackedScene" uid="uid://d4cul3w3wem5w" path="res://assets/characters/Gatot.glb" id="4_3tlf6"]
[ext_resource type="PackedScene" uid="uid://bmln7v6v5kvxg" path="res://assets/characters/Oldpop.glb" id="5_alfd1"]
[ext_resource type="AnimationLibrary" uid="uid://c3pyopnwibckj" path="res://assets/characters/animations/animation-pack.res" id="6_5oq5w"]
[ext_resource type="Script" path="res://scripts/bot_behavior.gd" id="8_1o2fn"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xqgey"]
albedo_color = Color(0.85, 0.085, 0.238, 1)
@@ -85,3 +86,6 @@ uppercase = true
autowrap_mode = 3
justification_flags = 171
width = 700.0
[node name="Node" type="Node" parent="."]
script = ExtResource("8_1o2fn")