feat: Add Tekton NPC with roaming behavior, combat reactions, and interaction mechanics including carrying and throwing.

This commit is contained in:
Yogi Wiguna
2026-02-12 16:15:27 +08:00
parent 4d7ee61e7d
commit e620e69d73
4 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -1933,7 +1933,7 @@ func sync_throw_tekton(target_pos: Vector2i):
# 2. Tekton drops tiles (Spawn tiles around) AND shrinks # 2. Tekton drops tiles (Spawn tiles around) AND shrinks
if tekton.has_method("on_thrown_landing"): if tekton.has_method("on_thrown_landing"):
tekton.on_thrown_landing(self ) tekton.on_thrown_landing(self, 2.0)
else: else:
# Fallback # Fallback
tekton.on_hit(self , 1.0) tekton.on_hit(self , 1.0)
+1 -2
View File
@@ -2,7 +2,7 @@
[ext_resource type="Script" uid="uid://dyovwailce5tf" path="res://scripts/tekton.gd" id="1_tekton"] [ext_resource type="Script" uid="uid://dyovwailce5tf" path="res://scripts/tekton.gd" id="1_tekton"]
[ext_resource type="Script" uid="uid://c67yq846u8y68" path="res://scripts/tekton_controller.gd" id="2_controller"] [ext_resource type="Script" uid="uid://c67yq846u8y68" path="res://scripts/tekton_controller.gd" id="2_controller"]
[ext_resource type="PackedScene" uid="uid://bdaghaxkmi3w1" path="res://scenes/tekton_mesh.tscn" id="3_d2kpk"] [ext_resource type="PackedScene" uid="uid://b6d6qu1ir13q1" path="res://scenes/tekton_mesh.scn" id="3_d2kpk"]
[sub_resource type="BoxShape3D" id="BoxShape3D_tekton"] [sub_resource type="BoxShape3D" id="BoxShape3D_tekton"]
size = Vector3(0.8, 1, 0.8) size = Vector3(0.8, 1, 0.8)
@@ -16,7 +16,6 @@ script = ExtResource("2_controller")
[node name="Visuals" type="Node3D" parent="." unique_id=1698719440] [node name="Visuals" type="Node3D" parent="." unique_id=1698719440]
[node name="tekton" parent="Visuals" unique_id=2052742928 instance=ExtResource("3_d2kpk")] [node name="tekton" parent="Visuals" unique_id=2052742928 instance=ExtResource("3_d2kpk")]
transform = Transform3D(0.15, 0, 0, 0, 0.15, 0, 0, 0, 0.15, 0, 0, 0)
[node name="HitArea" type="Area3D" parent="." unique_id=2139590311] [node name="HitArea" type="Area3D" parent="." unique_id=2139590311]
collision_layer = 4 collision_layer = 4
Binary file not shown.
+3 -4
View File
@@ -194,7 +194,7 @@ func on_thrown_landing(attacker: Node = null, intensity: float = 1.0):
print("[Tekton] Landed/Knocked! Shrinking and waiting... (Intensity: %.1f)" % intensity) print("[Tekton] Landed/Knocked! Shrinking and waiting... (Intensity: %.1f)" % intensity)
_flash_damage() # Add visual flash too? Why not. # _flash_damage() # Disabled to prevent tween conflict with shrinking
# Disable movement/interaction logic temporarily # Disable movement/interaction logic temporarily
var controller = get_node_or_null("TektonController") var controller = get_node_or_null("TektonController")
@@ -205,14 +205,13 @@ func on_thrown_landing(attacker: Node = null, intensity: float = 1.0):
# Use cached meshes if available, else find them (but can't restore accurately if not cached) # Use cached meshes if available, else find them (but can't restore accurately if not cached)
if mesh_cache.is_empty(): if mesh_cache.is_empty():
# Fallback if _ready hasn't run or failed # Fallback if _ready hasn't run or failed
# We'll just define the user's specific vector as fallback target for the sphere
# But better to rely on cache.
pass pass
for i in range(mesh_cache.size()): for i in range(mesh_cache.size()):
var mesh = mesh_cache[i] var mesh = mesh_cache[i]
if is_instance_valid(mesh): if is_instance_valid(mesh):
var base_scale = original_scales[i] var base_scale = original_scales[i]
# Kill any existing tweens on this mesh to stop flash_damage or previous effects
var t = create_tween() var t = create_tween()
t.tween_property(mesh, "scale", base_scale * 0.5, 0.2).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK) t.tween_property(mesh, "scale", base_scale * 0.5, 0.2).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
@@ -223,7 +222,7 @@ func on_thrown_landing(attacker: Node = null, intensity: float = 1.0):
# Floor Freeze (Visual/Instant - Run on all clients locally) # Floor Freeze (Visual/Instant - Run on all clients locally)
temporarily_change_floor(current_position, 1, 6, 3.0) temporarily_change_floor(current_position, 1, 6, 3.0)
# Wait 3 seconds # Wait 3.0 seconds
await get_tree().create_timer(3.0).timeout await get_tree().create_timer(3.0).timeout
# Grow back # Grow back