From d0e90fd2aaff2b048848d7d208feb9301b2ce381 Mon Sep 17 00:00:00 2001 From: Yogi Wiguna Date: Mon, 23 Mar 2026 10:22:55 +0800 Subject: [PATCH] feat: Add initial core game scene, player script, and static Tekton manager. --- scenes/main.gd | 4 +++- scenes/player.gd | 8 ++++++++ scripts/managers/static_tekton_manager.gd | 6 +++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scenes/main.gd b/scenes/main.gd index 5c93202..359f208 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -528,6 +528,9 @@ func _setup_host_game(): stop_n_go_manager._setup_arena() elif LobbyManager.game_mode == "Tekton Doors" and portal_mode_manager: portal_mode_manager.setup_arena_locally() + else: + # Randomize grid first to ensure Floor 0 is walkable for pre-calculation + randomize_game_grid() # 1. PVT: Pre-calculate Static Tekton positions AFTER arena size is known _precalculate_static_positions() @@ -725,7 +728,6 @@ func _start_game(): # Spawn Static Tektons and random tiles BEFORE countdown (Free Mode Only) # Exclude for Stop n Go and Tekton Doors if LobbyManager.game_mode != "Stop n Go" and LobbyManager.game_mode != "Tekton Doors": - randomize_game_grid() spawn_static_tektons() # Tekton Doors: Randomize connections BEFORE countdown so colors show diff --git a/scenes/player.gd b/scenes/player.gd index bfcfe53..e79655a 100644 --- a/scenes/player.gd +++ b/scenes/player.gd @@ -1217,6 +1217,14 @@ func is_position_occupied(pos: Vector2i) -> bool: if p.is_player_moving and p.target_position == pos: return true + # Prevent overlap with Static Tekton Stands (3x3 area) + if enhanced_gridmap: + for stand in get_tree().get_nodes_in_group("StaticTektonStands"): + var local_pos = enhanced_gridmap.to_local(stand.global_position) + var stand_map_pos = enhanced_gridmap.local_to_map(local_pos) + if abs(pos.x - stand_map_pos.x) <= 1 and abs(pos.y - stand_map_pos.z) <= 1: + return true + return false func find_valid_starting_position() -> Vector2i: diff --git a/scripts/managers/static_tekton_manager.gd b/scripts/managers/static_tekton_manager.gd index 2777817..c10a733 100644 --- a/scripts/managers/static_tekton_manager.gd +++ b/scripts/managers/static_tekton_manager.gd @@ -42,9 +42,9 @@ func calculate_spawn_points(count: int, gridmap: Node) -> Array[Vector2i]: # If count > 5, we only return 5 because that's the max safe non-adjacent set in 3x3 var spawn_points: Array[Vector2i] = [] - var iterations = min(count, target_indices.size()) - for i in range(iterations): - var zone_idx = target_indices[i] + for zone_idx in target_indices: + if spawn_points.size() >= count: + break var zone = zones[zone_idx] # Determine Position Type for Bias