feat: implement Tekton NPC with core movement, combat, carrying, throwing, and grid interaction logic, alongside its static controller.
This commit is contained in:
@@ -351,6 +351,31 @@ func spawn_tiles_around(count: int = 4):
|
||||
func play_animation_rpc(anim_name: String):
|
||||
play_animation(anim_name)
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func spawn_projectile_rpc(target_pos: Vector3, duration: float):
|
||||
var projectile = MeshInstance3D.new()
|
||||
var box = BoxMesh.new()
|
||||
box.size = Vector3(0.4, 0.1, 0.4)
|
||||
projectile.mesh = box
|
||||
var mat = StandardMaterial3D.new()
|
||||
mat.albedo_color = Color(1, 0.5, 0) # Orange
|
||||
projectile.material_override = mat
|
||||
|
||||
get_parent().add_child(projectile)
|
||||
projectile.global_position = global_position + Vector3(0, 2.0, 0)
|
||||
|
||||
var tween = create_tween()
|
||||
tween.set_parallel(true)
|
||||
tween.tween_property(projectile, "global_position:x", target_pos.x, duration).set_trans(Tween.TRANS_LINEAR)
|
||||
tween.tween_property(projectile, "global_position:z", target_pos.z, duration).set_trans(Tween.TRANS_LINEAR)
|
||||
|
||||
var mid_y = max(global_position.y, target_pos.y) + 3.0
|
||||
var tween_y = create_tween()
|
||||
tween_y.tween_property(projectile, "global_position:y", mid_y, duration/2).set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
|
||||
tween_y.tween_property(projectile, "global_position:y", target_pos.y, duration/2).set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN).set_delay(duration/2)
|
||||
|
||||
tween.chain().tween_callback(projectile.queue_free)
|
||||
|
||||
func play_animation(anim_name: String):
|
||||
# Try specific user path first
|
||||
var anim_player = get_node_or_null("Visuals/tekton/Armature/AnimationPlayer")
|
||||
|
||||
Reference in New Issue
Block a user