add beehave
This commit is contained in:
+65
-65
@@ -71,8 +71,8 @@ func _physics_process(_delta):
|
||||
rpc("remote_set_position", global_position)
|
||||
|
||||
func _unhandled_input(event):
|
||||
if is_in_group("Bots"):
|
||||
return
|
||||
#if is_in_group("Bots"):
|
||||
#return
|
||||
|
||||
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)):
|
||||
@@ -576,28 +576,28 @@ func _on_slot_clicked(event: InputEvent, slot_index: int):
|
||||
main.set_action_state(main.ActionState.NONE)
|
||||
|
||||
|
||||
func check_playerboard_arrangement(bot: Node) -> bool:
|
||||
var goal_indices = [] # Store indices of non-empty goals
|
||||
var goal_items = [] # Store the actual goal items
|
||||
|
||||
# Get all valid goals (non -1)
|
||||
for i in range(goals.size()):
|
||||
if goals[i] != -1:
|
||||
goal_indices.append(i)
|
||||
goal_items.append(goals[i])
|
||||
|
||||
# Check if current arrangement matches goals
|
||||
var current_items = []
|
||||
for i in range(playerboard.size()):
|
||||
if playerboard[i] in goal_items:
|
||||
current_items.append(playerboard[i])
|
||||
|
||||
# Compare current order with goal order
|
||||
for i in range(min(current_items.size(), goal_items.size())):
|
||||
if current_items[i] != goal_items[i]:
|
||||
return true
|
||||
|
||||
return false
|
||||
#func check_playerboard_arrangement(bot: Node) -> bool:
|
||||
#var goal_indices = [] # Store indices of non-empty goals
|
||||
#var goal_items = [] # Store the actual goal items
|
||||
#
|
||||
## Get all valid goals (non -1)
|
||||
#for i in range(goals.size()):
|
||||
#if goals[i] != -1:
|
||||
#goal_indices.append(i)
|
||||
#goal_items.append(goals[i])
|
||||
#
|
||||
## Check if current arrangement matches goals
|
||||
#var current_items = []
|
||||
#for i in range(playerboard.size()):
|
||||
#if playerboard[i] in goal_items:
|
||||
#current_items.append(playerboard[i])
|
||||
#
|
||||
## Compare current order with goal order
|
||||
#for i in range(min(current_items.size(), goal_items.size())):
|
||||
#if current_items[i] != goal_items[i]:
|
||||
#return true
|
||||
#
|
||||
#return false
|
||||
|
||||
func is_valid_arrangement_slot(from_slot: int, to_slot: int) -> bool:
|
||||
var from_row = from_slot / 5
|
||||
@@ -622,39 +622,39 @@ func get_adjacent_playerboard_slots(slot_index) -> Array:
|
||||
|
||||
return adjacent
|
||||
|
||||
func find_best_arrangement_slot() -> int:
|
||||
for i in range(playerboard.size()):
|
||||
if playerboard[i] != -1:
|
||||
var neighbors = get_adjacent_playerboard_slots(i)
|
||||
for adj_slot in neighbors:
|
||||
if playerboard[adj_slot] == -1 and playerboard[i] in goals:
|
||||
return adj_slot
|
||||
return playerboard.find(-1)
|
||||
#func find_best_arrangement_slot() -> int:
|
||||
#for i in range(playerboard.size()):
|
||||
#if playerboard[i] != -1:
|
||||
#var neighbors = get_adjacent_playerboard_slots(i)
|
||||
#for adj_slot in neighbors:
|
||||
#if playerboard[adj_slot] == -1 and playerboard[i] in goals:
|
||||
#return adj_slot
|
||||
#return playerboard.find(-1)
|
||||
|
||||
func find_best_put_position(bot: Node) -> Vector2i:
|
||||
# Find the first empty cell adjacent to a matching item in the playerboard
|
||||
for i in range(playerboard.size()):
|
||||
if playerboard[i] in goals:
|
||||
var neighbors = enhanced_gridmap.get_neighbors(current_position, 1)
|
||||
for neighbor in neighbors:
|
||||
var cell = Vector3i(neighbor.position.x, 1, neighbor.position.y)
|
||||
if enhanced_gridmap.get_cell_item(cell) == -1:
|
||||
return neighbor.position
|
||||
return Vector2i(-1, -1)
|
||||
#func find_best_put_position(bot: Node) -> Vector2i:
|
||||
## Find the first empty cell adjacent to a matching item in the playerboard
|
||||
#for i in range(playerboard.size()):
|
||||
#if playerboard[i] in goals:
|
||||
#var neighbors = enhanced_gridmap.get_neighbors(current_position, 1)
|
||||
#for neighbor in neighbors:
|
||||
#var cell = Vector3i(neighbor.position.x, 1, neighbor.position.y)
|
||||
#if enhanced_gridmap.get_cell_item(cell) == -1:
|
||||
#return neighbor.position
|
||||
#return Vector2i(-1, -1)
|
||||
|
||||
func find_best_grab_position() -> Vector2i:
|
||||
# Find the first matching item in the grid or adjacent cells
|
||||
var current_cell = Vector3i(current_position.x, 1, current_position.y)
|
||||
if enhanced_gridmap.get_cell_item(current_cell) in goals:
|
||||
return current_position
|
||||
|
||||
var neighbors = enhanced_gridmap.get_neighbors(current_position, 1)
|
||||
for neighbor in neighbors:
|
||||
var cell = Vector3i(neighbor.position.x, 1, neighbor.position.y)
|
||||
if enhanced_gridmap.get_cell_item(cell) in goals:
|
||||
return neighbor.position
|
||||
|
||||
return Vector2i(-1, -1)
|
||||
#func find_best_grab_position() -> Vector2i:
|
||||
## Find the first matching item in the grid or adjacent cells
|
||||
#var current_cell = Vector3i(current_position.x, 1, current_position.y)
|
||||
#if enhanced_gridmap.get_cell_item(current_cell) in goals:
|
||||
#return current_position
|
||||
#
|
||||
#var neighbors = enhanced_gridmap.get_neighbors(current_position, 1)
|
||||
#for neighbor in neighbors:
|
||||
#var cell = Vector3i(neighbor.position.x, 1, neighbor.position.y)
|
||||
#if enhanced_gridmap.get_cell_item(cell) in goals:
|
||||
#return neighbor.position
|
||||
#
|
||||
#return Vector2i(-1, -1)
|
||||
|
||||
func has_item_at_current_position() -> bool:
|
||||
var current_cell = Vector3i(current_position.x, 1, current_position.y)
|
||||
@@ -667,8 +667,8 @@ func playerboard_is_full() -> bool:
|
||||
return playerboard.find(-1) == -1
|
||||
|
||||
func highlight_movement_range():
|
||||
if is_in_group("Bots"):
|
||||
return
|
||||
#if is_in_group("Bots"):
|
||||
#return
|
||||
|
||||
for x in range(enhanced_gridmap.columns):
|
||||
for z in range(enhanced_gridmap.rows):
|
||||
@@ -680,8 +680,8 @@ func highlight_movement_range():
|
||||
enhanced_gridmap.set_cell_item(Vector3i(x, 0, z), enhanced_gridmap.hover_item)
|
||||
|
||||
func highlight_adjacent_cells():
|
||||
if is_in_group("Bots"):
|
||||
return
|
||||
#if is_in_group("Bots"):
|
||||
#return
|
||||
|
||||
var current_cell = Vector3i(current_position.x, 1, current_position.y)
|
||||
if enhanced_gridmap.get_cell_item(current_cell) != -1:
|
||||
@@ -698,8 +698,8 @@ func highlight_adjacent_cells():
|
||||
|
||||
|
||||
func highlight_empty_adjacent_cells():
|
||||
if is_in_group("Bots"):
|
||||
return
|
||||
#if is_in_group("Bots"):
|
||||
#return
|
||||
|
||||
# Clear previous highlights
|
||||
clear_highlights()
|
||||
@@ -723,8 +723,8 @@ func highlight_empty_adjacent_cells():
|
||||
enhanced_gridmap.hover_item)
|
||||
|
||||
func highlight_random_valid_cells():
|
||||
if is_in_group("Bots"):
|
||||
return
|
||||
#if is_in_group("Bots"):
|
||||
#return
|
||||
|
||||
var valid_cells = []
|
||||
for x in range(enhanced_gridmap.columns):
|
||||
@@ -744,8 +744,8 @@ func highlight_random_valid_cells():
|
||||
valid_cells.remove_at(index)
|
||||
|
||||
func highlight_occupied_playerboard_slots():
|
||||
if is_in_group("Bots"):
|
||||
return
|
||||
#if is_in_group("Bots"):
|
||||
#return
|
||||
|
||||
var main = get_node("/root/Main")
|
||||
if not main or not main.playerboard_ui:
|
||||
|
||||
Reference in New Issue
Block a user