update some files on 4.4

This commit is contained in:
2025-04-10 15:07:29 +08:00
parent 679961aa77
commit ca171c65c8
4 changed files with 5 additions and 148 deletions
+1 -1
View File
@@ -17,4 +17,4 @@
- NetworkManager.gd
- assets/
- (3D models, textures, etc.)
```
```
+4 -4
View File
@@ -22,10 +22,10 @@ BeehaveGlobalDebugger="*res://addons/beehave/debug/global_debugger.gd"
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
window/size/window_width_override=1366
window/size/window_height_override=768
window/size/viewport_width=1366
window/size/viewport_height=720
window/size/window_width_override=1024
window/size/window_height_override=576
window/stretch/mode="viewport"
[editor_plugins]
-1
View File
@@ -33,7 +33,6 @@ texture = ExtResource("13_ahjgs")
[node name="Main" type="Node3D"]
script = ExtResource("1_xcpe3")
enable_bots = false
turn_based_mode = false
[node name="EnhancedGridMap" type="GridMap" parent="."]
mesh_library = ExtResource("1_110wo")
-142
View File
@@ -297,45 +297,6 @@ func is_within_movement_range(target_position: Vector2i) -> bool:
distance = abs(target_position.x - current_position.x) + abs(target_position.y - current_position.y)
return distance <= movement_range
#func move_player_to_clicked_position(grid_position: Vector2i):
#if not is_multiplayer_authority() or is_player_moving or action_points <= 0:
#return
#
#var main = get_tree().get_root().get_node_or_null("Main")
#if not main or main.current_action_state != main.ActionState.MOVING or not grid_position in highlighted_cells:
#return
#
#if not is_within_movement_range(grid_position):
#return
#
#var cell_item = enhanced_gridmap.get_cell_item(Vector3i(grid_position.x, 0, grid_position.y))
#if cell_item in enhanced_gridmap.non_walkable_items or is_position_occupied(grid_position):
#return
#
#rotate_towards_target(grid_position)
#
#var path = enhanced_gridmap.find_path(Vector2(current_position), Vector2(grid_position))
#if path.size() <= 1:
#return
#
#var valid_path = true
#for point in path.slice(1):
#if is_position_occupied(Vector2i(point.x, point.y)):
#valid_path = false
#break
#
#if valid_path:
#path.pop_front()
## Pass clear_visual=false for bots to preserve player highlights
#rpc("start_movement_along_path", path, not (is_bot or is_in_group("Bots")))
#action_points -= 1
#
## Only clear highlights if not a bot
#if not (is_bot or is_in_group("Bots")):
#clear_highlights()
#else:
#print("Path is blocked by other players")
func move_player_to_clicked_position(grid_position: Vector2i):
if not is_multiplayer_authority() or is_player_moving or action_points <= 0:
return
@@ -844,88 +805,6 @@ func highlight_cells_if_authorized(cells_to_highlight: Array):
enhanced_gridmap.hover_item
)
## Update highlight_movement_range to respect obstacle blocking
#func highlight_movement_range():
#if not is_multiplayer_authority() or is_bot or is_in_group("Bots"):
#return
#
#clear_highlights()
#var cells_to_highlight = []
#
## Get neighboring cells that are directly accessible (not blocked by obstacles)
#var direct_neighbors = []
#var directions = [
#Vector2i(0, -1), # North
#Vector2i(1, 0), # East
#Vector2i(0, 1), # South
#Vector2i(-1, 0), # West
#]
#
## Add diagonal directions if enabled
#if enhanced_gridmap.diagonal_movement:
#directions.append(Vector2i(-1, -1)) # Northwest
#directions.append(Vector2i(1, -1)) # Northeast
#directions.append(Vector2i(-1, 1)) # Southwest
#directions.append(Vector2i(1, 1)) # Southeast
#
## First, get direct neighbors that aren't blocked
#for dir in directions:
#var neighbor_pos = current_position + dir
#
## Check if position is valid and walkable
#if enhanced_gridmap.is_position_valid(neighbor_pos) and \
#enhanced_gridmap.is_cell_walkable(neighbor_pos, 0) and \
#not is_position_occupied(neighbor_pos):
#
## Check if movement is blocked by obstacle
#if not enhanced_gridmap.is_movement_blocked(current_position, neighbor_pos, 3):
#direct_neighbors.append(neighbor_pos)
#
## Now, add all cells that are within movement range
## and can be reached via the direct neighbors
#for x in range(max(0, current_position.x - movement_range),
#min(enhanced_gridmap.columns, current_position.x + movement_range + 1)):
#for z in range(max(0, current_position.y - movement_range),
#min(enhanced_gridmap.rows, current_position.y + movement_range + 1)):
#var test_pos = Vector2i(x, z)
#
## Skip the current position
#if test_pos == current_position:
#continue
#
## Check if within movement range
#if is_within_movement_range(test_pos):
#var cell_item = enhanced_gridmap.get_cell_item(Vector3i(x, 0, z))
#
## Basic walkability check
#if cell_item != -1 and not (cell_item in enhanced_gridmap.non_walkable_items) and \
#not is_position_occupied(test_pos):
#
## Check if we can reach this position through one of our direct neighbors
#var can_reach = false
#
## Direct neighbors are always reachable
#if test_pos in direct_neighbors:
#can_reach = true
#else:
## For other cells, check if there's a valid path through direct neighbors
#for neighbor in direct_neighbors:
## Check if we can move from the neighbor to the target position
## without being blocked by an obstacle
#if not enhanced_gridmap.is_blocked_by_obstacle(neighbor, test_pos, 3):
#var manhattan_dist = abs(neighbor.x - test_pos.x) + abs(neighbor.y - test_pos.y)
#var remaining_range = movement_range - 1 # -1 for the first step
#
## Check if the remaining distance is within our movement range
#if manhattan_dist <= remaining_range:
#can_reach = true
#break
#
#if can_reach:
#cells_to_highlight.append(test_pos)
#
#highlight_cells_if_authorized(cells_to_highlight)
# Update highlight_movement_range to respect the expanded obstacle blocking
func highlight_movement_range():
if not is_multiplayer_authority() or is_bot or is_in_group("Bots"):
@@ -1102,27 +981,6 @@ func highlight_empty_adjacent_cells():
func sync_action_points(points: int):
action_points = points
#func highlight_random_valid_cells():
#if is_bot == true or is_in_group("Bots") or not is_multiplayer_authority():
#return
#
#var valid_cells = []
#for x in range(enhanced_gridmap.columns):
#for z in range(enhanced_gridmap.rows):
#var cell_pos = Vector2i(x, z)
#var cell_item = enhanced_gridmap.get_cell_item(Vector3i(x, 0, z))
#if cell_item != -1 and not (cell_item in enhanced_gridmap.non_walkable_items):
#valid_cells.append(cell_pos)
#
#var rng = RandomNumberGenerator.new()
#rng.randomize()
#for _i in range(min(5, valid_cells.size())):
#var index = rng.randi() % valid_cells.size()
#var cell = valid_cells[index]
#highlighted_cells.append(cell)
#enhanced_gridmap.set_cell_item(Vector3i(cell.x, 0, cell.y), enhanced_gridmap.hover_item)
#valid_cells.remove_at(index)
func highlight_random_valid_cells():
if is_bot == true or is_in_group("Bots") or not is_multiplayer_authority():
return