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
+20 -20
View File
@@ -58,7 +58,7 @@ func _ready():
var behavior_tree = $BehaviorTree
# Early setup for bots
if is_bot or is_in_group("Bots"):
if is_bot == true or is_in_group("Bots"):
# Set Input process to false for bots immediately
set_process_input(false)
set_process_unhandled_input(false)
@@ -119,7 +119,7 @@ func _physics_process(_delta):
rpc("remote_set_position", global_position)
func _unhandled_input(event):
if is_bot or is_in_group("Bots"):
if is_bot == true or is_in_group("Bots"):
set_process_unhandled_input(false)
set_process_input(false)
return
@@ -133,7 +133,7 @@ func _unhandled_input(event):
return
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
if is_bot or is_in_group("Bots"):
if is_bot == true or is_in_group("Bots"):
set_process_unhandled_input(false)
set_process_input(false)
return
@@ -166,7 +166,7 @@ func _on_slot_gui_input(event, slot_index, slot_ui) -> int:
return -1
func handle_grid_click(grid_position: Vector2i):
if is_bot or is_in_group("Bots"):
if is_bot == true or is_in_group("Bots"):
return
var main = get_tree().get_root().get_node_or_null("Main")
if not main:
@@ -287,7 +287,7 @@ func move_player_to_clicked_position(grid_position: Vector2i):
path.pop_front()
rpc("start_movement_along_path", path)
action_points -= 1
if not is_bot:
if not is_bot == true:
clear_highlights()
else:
@@ -307,7 +307,7 @@ func start_movement_along_path(path: Array, clear_visual: bool = true):
current_position = Vector2i(path[-1].x, path[-1].y)
is_player_moving = false
if clear_visual:
if clear_visual == true:
enhanced_gridmap.clear_path_visualization()
has_moved_this_turn = path.size() <= movement_range
@@ -406,7 +406,7 @@ func grab_item(grid_position: Vector2i = current_position) -> bool:
if item == -1:
return false
if is_in_group("Bots") or is_bot:
if is_in_group("Bots") or is_bot == true:
var empty_slot = playerboard.find(-1)
if empty_slot == -1:
return false
@@ -465,7 +465,7 @@ func put_item(grid_position: Vector2i = current_position) -> bool:
has_performed_action = true
consume_action_points(1)
if not is_bot:
if not is_bot == true:
clear_highlights()
clear_playerboard_highlights()
selected_playerboard_slot = -1
@@ -481,7 +481,7 @@ func handle_put_action():
if not main or action_points < 1:
return
if not is_bot:
if not is_bot == true:
clear_highlights()
clear_playerboard_highlights()
@@ -516,7 +516,7 @@ func handle_playerboard_slot_selected(slot_index: int):
has_performed_action = true
consume_action_points(1)
if not is_bot:
if not is_bot == true:
clear_highlights()
clear_playerboard_highlights()
selected_gridmap_position = Vector2i(-1, -1)
@@ -532,7 +532,7 @@ func handle_put_slot_selected(slot_index: int):
if slot_index in highlighted_cells and playerboard[slot_index] in goals:
selected_playerboard_slot = slot_index
clear_highlights()
if not is_bot:
if not is_bot == true:
highlight_empty_adjacent_cells()
@@ -570,7 +570,7 @@ func arrange_playerboard_item(slot_index: int):
slot.gui_input.connect(_on_slot_clicked.bind(i))
func _on_slot_clicked(event: InputEvent, slot_index: int):
if not event is InputEventMouseButton or is_bot or not event.pressed or event.button_index != MOUSE_BUTTON_LEFT:
if not event is InputEventMouseButton or is_bot == true or not event.pressed or event.button_index != MOUSE_BUTTON_LEFT:
return
var main = get_tree().get_root().get_node_or_null("Main")
@@ -638,7 +638,7 @@ func playerboard_is_full() -> bool:
return playerboard.find(-1) == -1
func highlight_movement_range():
if is_bot or is_in_group("Bots") or not is_multiplayer_authority():
if is_bot == true or is_in_group("Bots") or not is_multiplayer_authority():
return
for x in range(enhanced_gridmap.columns):
@@ -651,7 +651,7 @@ func highlight_movement_range():
enhanced_gridmap.set_cell_item(Vector3i(x, 0, z), enhanced_gridmap.hover_item)
func highlight_adjacent_cells():
if is_bot or is_in_group("Bots") or not is_multiplayer_authority():
if is_bot == true or is_in_group("Bots") or not is_multiplayer_authority():
return
var current_cell = Vector3i(current_position.x, 1, current_position.y)
@@ -669,7 +669,7 @@ func highlight_adjacent_cells():
func highlight_empty_adjacent_cells():
if is_bot or is_in_group("Bots") or not is_multiplayer_authority():
if is_bot == true or is_in_group("Bots") or not is_multiplayer_authority():
return
# Clear previous highlights
@@ -694,7 +694,7 @@ func highlight_empty_adjacent_cells():
enhanced_gridmap.hover_item)
func highlight_random_valid_cells():
if is_bot or is_in_group("Bots") or not is_multiplayer_authority():
if is_bot == true or is_in_group("Bots") or not is_multiplayer_authority():
return
var valid_cells = []
@@ -715,7 +715,7 @@ func highlight_random_valid_cells():
valid_cells.remove_at(index)
func highlight_occupied_playerboard_slots():
if is_bot or is_in_group("Bots") or not is_multiplayer_authority():
if is_bot == true or is_in_group("Bots") or not is_multiplayer_authority():
return
var main = get_tree().get_root().get_node_or_null("Main")
@@ -740,7 +740,7 @@ func highlight_occupied_playerboard_slots():
main.update_playerboard_ui()
func clear_highlights():
if is_bot or is_in_group("Bots") or not is_multiplayer_authority():
if is_bot == true or is_in_group("Bots") or not is_multiplayer_authority():
return
if not enhanced_gridmap:
return
@@ -759,7 +759,7 @@ func clear_highlights():
child.hide()
func clear_playerboard_highlights():
if is_bot or is_in_group("Bots") or not is_multiplayer_authority():
if is_bot == true or is_in_group("Bots") or not is_multiplayer_authority():
return
var main = get_tree().get_root().get_node_or_null("Main")
if main and main.playerboard_ui:
@@ -904,7 +904,7 @@ func consume_action_points(points: int):
return
# Don't consume points for bots in non-turn-based mode
if is_bot and not main.turn_based_mode:
if is_bot == true and not main.turn_based_mode:
_after_action_completed()
return