This commit is contained in:
2025-01-31 15:09:31 +08:00
parent 6272cd86e8
commit 552d32ff70
4 changed files with 34 additions and 42 deletions
+2 -2
View File
@@ -9,12 +9,12 @@ func tick(actor: Node, blackboard: Blackboard) -> int:
if actor.action_points <= 0:
return FAILURE
if not actor.is_bot and not actor.is_in_group("Bots"):
if not actor.is_bot == true and not actor.is_in_group("Bots"):
return FAILURE
# Execute movement
if actor.is_within_movement_range(target_pos):
if actor.is_bot:
if actor.is_bot == true:
var path = actor.enhanced_gridmap.find_path(
Vector2(actor.current_position),
Vector2(target_pos),
+6 -14
View File
@@ -1,27 +1,19 @@
@tool
extends Blackboard
# Default values when initializing blackboard
var default_data = {
"move_target": null, # Vector2i for movement target
"can_arrange": false, # Whether bot can arrange items
"can_grab": false, # Whether bot can grab items
"can_put": false, # Whether bot can put items
"should_move": false, # Whether bot should move
"action_points": 0, # Current action points
"current_action": "", # Current action being performed
"item_to_grab": null, # Item to grab
"grab_position": null, # Position to grab from
"put_position": null, # Position to put item
"arrange_from": -1, # Slot to arrange from
"arrange_to": -1 # Slot to arrange to
"move_target": null,
"current_action": "",
"action_points": 3, # Adjust this value based on your game design
"last_position": null,
"path": [],
"is_moving": false
}
func _ready():
if Engine.is_editor_hint():
return
# Initialize with default values
for key in default_data:
if not has_value(key):
set_value(key, default_data[key])