update
This commit is contained in:
+16
-3
@@ -1,5 +1,7 @@
|
||||
extends Node3D
|
||||
|
||||
@export var is_bot: bool = false
|
||||
|
||||
@export var enhanced_gridmap_path: NodePath = "/root/Main/EnhancedGridMap"
|
||||
var enhanced_gridmap: EnhancedGridMap
|
||||
@export var current_position: Vector2i
|
||||
@@ -52,19 +54,30 @@ func _ready():
|
||||
if not enhanced_gridmap:
|
||||
push_error("EnhancedGridMap node not found")
|
||||
return
|
||||
|
||||
|
||||
enhanced_gridmap.initialize_astar()
|
||||
enhanced_gridmap.set_diagonal_movement(use_diagonal_movement)
|
||||
|
||||
current_position = find_valid_starting_position()
|
||||
update_player_position(current_position)
|
||||
|
||||
if not is_in_group("Bots"):
|
||||
set_process_unhandled_input(is_multiplayer_authority())
|
||||
# Set bot flag if in Bots group
|
||||
if is_in_group("Bots"):
|
||||
is_bot = true
|
||||
|
||||
# Only process input if not a bot and is authority
|
||||
set_process_unhandled_input(not is_bot and is_multiplayer_authority())
|
||||
|
||||
append_random_goals()
|
||||
playerboard.resize(25)
|
||||
playerboard.fill(-1)
|
||||
|
||||
# Enable behavior tree if bot
|
||||
if is_bot:
|
||||
var behavior_tree = $BehaviorTree
|
||||
if behavior_tree:
|
||||
behavior_tree.enabled = true
|
||||
behavior_tree.actor = self
|
||||
|
||||
func _physics_process(_delta):
|
||||
if is_multiplayer_authority():
|
||||
|
||||
Reference in New Issue
Block a user