feat: implement Tekton NPC with core movement, combat, carrying, throwing, and grid interaction logic, alongside its static controller.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
extends Node
|
||||
|
||||
@export var throw_interval_min: float = 4.0
|
||||
@export var throw_interval_max: float = 7.0
|
||||
@export var throw_interval_min: float = 2.0
|
||||
@export var throw_interval_max: float = 4.0
|
||||
@export var throw_range: int = 6
|
||||
|
||||
var tekton: Node3D
|
||||
@@ -43,18 +43,18 @@ func _on_timer_timeout():
|
||||
_start_timer()
|
||||
return
|
||||
|
||||
print("[StaticTekton] Timer timeout. Attempting throw...")
|
||||
# print("[StaticTekton] Timer timeout. Attempting throw...")
|
||||
_attempt_throw()
|
||||
|
||||
func _attempt_throw():
|
||||
# Find target
|
||||
var target = _find_empty_tile()
|
||||
if target == Vector2i(-1, -1):
|
||||
print("[StaticTekton] No valid target found.")
|
||||
# print("[StaticTekton] No valid target found.")
|
||||
_start_timer()
|
||||
return
|
||||
|
||||
print("[StaticTekton] Target found: %s" % target)
|
||||
# print("[StaticTekton] Target found: %s" % target)
|
||||
# Execute Throw
|
||||
# 1. Face target
|
||||
var target_world_pos = Vector3(target.x + 0.5, 0, target.y + 0.5)
|
||||
@@ -71,8 +71,11 @@ func _attempt_throw():
|
||||
if tekton.has_method("play_animation_rpc"):
|
||||
tekton.rpc("play_animation_rpc", "tekton_throw_tile")
|
||||
|
||||
# 3. Sync projectile/effect (Delay for animation sync?)
|
||||
# Assuming animation takes ~1.0s, throw happens at ~0.5s?
|
||||
# 3. Create Projectile Visual (Synced)
|
||||
if tekton.has_method("spawn_projectile_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")
|
||||
@@ -81,11 +84,8 @@ func _attempt_throw():
|
||||
var item_id = randi_range(7, 10)
|
||||
main.rpc("sync_grid_item", target.x, 1, target.y, item_id)
|
||||
|
||||
# Optional: Spawn Projectile Visual?
|
||||
# For now, instant spawn is safest, or we can add a projectile RPC later.
|
||||
|
||||
# 4. Resume Idle
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
# 5. Resume Idle
|
||||
await get_tree().create_timer(0.5).timeout # Small delay after throw
|
||||
if tekton.has_method("play_animation_rpc"):
|
||||
tekton.rpc("play_animation_rpc", "tekton_idle")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user