feat: Implement Tekton roaming NPC with movement, combat, carry, throw, and knock mechanics.

This commit is contained in:
Yogi Wiguna
2026-02-19 17:29:14 +08:00
parent a7a8106b7e
commit e90cbfe246
11 changed files with 235 additions and 84 deletions
+4 -4
View File
@@ -68,25 +68,25 @@ func _attempt_throw():
tekton.look_at(Vector3(target_world_pos.x, tekton.global_position.y, target_world_pos.z), Vector3.UP)
# 2. Play Animation
if tekton.has_method("play_animation_rpc"):
if tekton.has_method("play_animation_rpc") and tekton.has_method("can_rpc") and tekton.can_rpc():
tekton.rpc("play_animation_rpc", "tekton_throw_tile")
# 3. Create Projectile Visual (Synced)
if tekton.has_method("spawn_projectile_rpc"):
if tekton.has_method("spawn_projectile_rpc") and tekton.has_method("can_rpc") and tekton.can_rpc():
tekton.rpc("spawn_projectile_rpc", target_world_pos, 0.5)
# 4. Impact / Spawn
await get_tree().create_timer(0.5).timeout
var main = tekton.get_tree().get_root().get_node_or_null("Main")
if main:
if main and tekton.has_method("can_rpc") and tekton.can_rpc():
# Spawn Item (Random ID 7-10)
var item_id = randi_range(7, 10)
main.rpc("sync_grid_item", target.x, 1, target.y, item_id)
# 5. Resume Idle
await get_tree().create_timer(0.5).timeout # Small delay after throw
if tekton.has_method("play_animation_rpc"):
if tekton.has_method("play_animation_rpc") and tekton.has_method("can_rpc") and tekton.can_rpc():
tekton.rpc("play_animation_rpc", "tekton_idle")
_start_timer()