From 0c50668887bab7a035692836232ce0f674fbe0f4 Mon Sep 17 00:00:00 2001 From: Yogi Wiguna Date: Tue, 31 Mar 2026 17:50:16 +0800 Subject: [PATCH] feat: add Tekton roaming NPC script with movement, interaction, and combat mechanics --- scripts/tekton.gd | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/tekton.gd b/scripts/tekton.gd index 50628ad..796c39a 100644 --- a/scripts/tekton.gd +++ b/scripts/tekton.gd @@ -45,7 +45,9 @@ func update_visual_position(): var offset = 0.2 if is_static_turret: offset = 0.5 - floor_y = 1.0 + floor_y = 1.0 # Static Tekton sits higher on the seat + else: + floor_y += 0.3 # Roaming Tekton sits slightly above the floor surface position = Vector3(current_position.x + offset, floor_y, current_position.y + offset) @@ -62,8 +64,8 @@ func move_to(target_pos: Vector2i): # Tekton is slightly offset, so query center of its current and target tiles # Just checking TARGET center is usually enough to stop entering a blocked tile # RAY HEIGHT: 0.3 to hit the 0.6m tall stand - var from = Vector3(target_pos.x + 0.5, 0.3, target_pos.y + 0.5) + Vector3.UP * 5.0 - var to = Vector3(target_pos.x + 0.5, 0.3, target_pos.y + 0.5) + Vector3.DOWN * 5.0 + var from = Vector3(target_pos.x + 0.5, 0.6, target_pos.y + 0.5) + Vector3.UP * 5.0 + var to = Vector3(target_pos.x + 0.5, 0.6, target_pos.y + 0.5) + Vector3.DOWN * 5.0 # Raycast VERTICALLY at target to see if it's occupied by a Stand # Actually, vertical ray from high up is fine IF it goes low enough. @@ -85,7 +87,7 @@ func move_to(target_pos: Vector2i): var floor_y = 0.05 if enhanced_gridmap and "cell_size" in enhanced_gridmap: - floor_y = enhanced_gridmap.cell_size.y + floor_y = enhanced_gridmap.cell_size.y + 0.3 # Add the same 0.3 offset while moving var target_world_pos = Vector3(target_pos.x + 0.2, floor_y, target_pos.y + 0.2)