feat: add Tekton roaming NPC script with movement, interaction, and combat mechanics

This commit is contained in:
Yogi Wiguna
2026-03-31 17:50:16 +08:00
parent 5ea41806f1
commit 0c50668887
+6 -4
View File
@@ -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)