feat: update
This commit is contained in:
+6
-1
@@ -1254,7 +1254,12 @@ func _create_tekton(pos: Vector2i, tekton_id: int, is_static: bool = false):
|
||||
var node_name = "Tekton_%d" % tekton_id
|
||||
if has_node(node_name): return
|
||||
|
||||
var tekton_scene = load("res://scenes/tekton.tscn")
|
||||
var tekton_scene
|
||||
if is_static:
|
||||
tekton_scene = load("res://scenes/static_tekton.tscn")
|
||||
else:
|
||||
tekton_scene = load("res://scenes/tekton.tscn")
|
||||
|
||||
var tekton = tekton_scene.instantiate()
|
||||
tekton.name = node_name
|
||||
add_child(tekton)
|
||||
|
||||
+35
-44
@@ -247,8 +247,10 @@ func _ready():
|
||||
# Visible to all human players. Green for local player, Red for others.
|
||||
var pointer = get_node_or_null("CharacterPointer")
|
||||
|
||||
# === Dynamically load new Dasher animations ===
|
||||
_load_dasher_animations()
|
||||
# === Dasher animations are loaded statically via player.tscn ext_resource ===
|
||||
# The dasher-pack.tres AnimationLibrary is referenced on the AnimationPlayer
|
||||
# node as a second library ("dasher-pack"). See tools/convert_dasher_animations.gd
|
||||
# and tools/build_dasher_pack.gd to regenerate the .tres from the source .glb files.
|
||||
if pointer:
|
||||
pointer.visible = true
|
||||
|
||||
@@ -374,45 +376,10 @@ func _init_floor_spawn_anchor():
|
||||
floor_spawn_top.reparent(floor_spawn_anchor, false)
|
||||
|
||||
func _load_dasher_animations():
|
||||
"""Dynamically loads dasher animations from GLB files and adds them to the AnimationPlayer."""
|
||||
if not anim_player: return
|
||||
|
||||
var anim_library = anim_player.get_animation_library("animation-pack")
|
||||
if not anim_library:
|
||||
anim_library = AnimationLibrary.new()
|
||||
anim_player.add_animation_library("animation-pack", anim_library)
|
||||
|
||||
var dasher_files = [
|
||||
{"path": "res://assets/characters/dashers/dasher_getting_hit.glb", "name": "dasher_getting_hit"},
|
||||
{"path": "res://assets/characters/dashers/dasher_hit.glb", "name": "dasher_hit"},
|
||||
{"path": "res://assets/characters/dashers/dasher_hold.glb", "name": "dasher_hold"},
|
||||
{"path": "res://assets/characters/dashers/dasher_put.glb", "name": "dasher_put"},
|
||||
{"path": "res://assets/characters/dashers/dasher_stun.glb", "name": "dasher_stun"},
|
||||
{"path": "res://assets/characters/dashers/dasher_take.glb", "name": "dasher_take"}
|
||||
]
|
||||
|
||||
for file_data in dasher_files:
|
||||
var gltf_doc = GLTFDocument.new()
|
||||
var gltf_state = GLTFState.new()
|
||||
var error = gltf_doc.append_from_file(file_data.path, gltf_state)
|
||||
|
||||
if error == OK:
|
||||
var anim_player_node = gltf_state.get_animation_player(0)
|
||||
# Godot's GLTF importer creates an AnimationPlayer inside the scene
|
||||
var scene = gltf_doc.generate_scene(gltf_state)
|
||||
if scene:
|
||||
var scene_anim_player = scene.find_child("AnimationPlayer", true, false)
|
||||
if scene_anim_player:
|
||||
var libs = scene_anim_player.get_animation_library_list()
|
||||
for lib_name in libs:
|
||||
var temp_lib = scene_anim_player.get_animation_library(lib_name)
|
||||
for anim_name in temp_lib.get_animation_list():
|
||||
var anim = temp_lib.get_animation(anim_name)
|
||||
if not anim_library.has_animation(file_data.name):
|
||||
anim_library.add_animation(file_data.name, anim)
|
||||
scene.queue_free()
|
||||
|
||||
print("[Player] Dasher animations loaded into 'animation-pack'.")
|
||||
# Deprecated: dasher animations are now loaded statically via the
|
||||
# dasher-pack.tres AnimationLibrary referenced on the AnimationPlayer node
|
||||
# in player.tscn. Keep this stub for backward compatibility / no-op.
|
||||
pass
|
||||
|
||||
@onready var floor_spawn_bot: AnimatedSprite3D = $floor_spawn_bot
|
||||
@onready var floor_spawn_top: AnimatedSprite3D = $floor_spawn_top
|
||||
@@ -684,6 +651,8 @@ const ANIMATION_SPEED: float = 2.0
|
||||
|
||||
func play_walk_animation() -> void:
|
||||
"""Play walking animation at increased speed."""
|
||||
if is_carrying_tekton and anim_player and anim_player.has_animation("dasher-pack/dasher_hold"):
|
||||
return # Let dasher_hold keep playing
|
||||
if anim_player and anim_player.has_animation("animation-pack/walk_forward"):
|
||||
anim_player.play("animation-pack/walk_forward", -1, ANIMATION_SPEED)
|
||||
|
||||
@@ -704,6 +673,8 @@ func play_special_animation() -> void:
|
||||
|
||||
func play_idle_animation() -> void:
|
||||
"""Play idle animation at normal speed."""
|
||||
if is_carrying_tekton and anim_player and anim_player.has_animation("dasher-pack/dasher_hold"):
|
||||
return # Let dasher_hold keep playing
|
||||
if anim_player and anim_player.has_animation("animation-pack/idle"):
|
||||
anim_player.play("animation-pack/idle")
|
||||
|
||||
@@ -1002,6 +973,10 @@ func apply_stagger(duration: float = 1.5):
|
||||
|
||||
# Play knock VFX sequence on the receiver
|
||||
_play_knock_vfx()
|
||||
if anim_player and anim_player.has_animation("dasher-pack/dasher_getting_hit"):
|
||||
anim_player.play("dasher-pack/dasher_getting_hit")
|
||||
if anim_player.has_animation("dasher-pack/dasher_stun"):
|
||||
anim_player.queue("dasher-pack/dasher_stun")
|
||||
|
||||
# Set immunity (3 seconds as requested)
|
||||
immunity_timer = 3.0
|
||||
@@ -1019,6 +994,7 @@ func apply_stagger(duration: float = 1.5):
|
||||
|
||||
is_frozen = false
|
||||
_refresh_player_visuals()
|
||||
play_idle_animation()
|
||||
|
||||
func _play_knock_vfx() -> void:
|
||||
"""Plays the three knock receiver VFX concurrently.
|
||||
@@ -2439,7 +2415,10 @@ func sync_snatch_tekton(carrier_path: NodePath, tekton_path: NodePath):
|
||||
is_charged_strike = false
|
||||
|
||||
SfxManager.play("pick_up_tekton_roaming")
|
||||
play_pickup_animation()
|
||||
if anim_player and anim_player.has_animation("dasher-pack/dasher_take"):
|
||||
anim_player.play("dasher-pack/dasher_take")
|
||||
if anim_player.has_animation("dasher-pack/dasher_hold"):
|
||||
anim_player.queue("dasher-pack/dasher_hold")
|
||||
|
||||
# Visual feedback for the victim
|
||||
if carrier.has_method("sync_bump"):
|
||||
@@ -2452,6 +2431,11 @@ func sync_snatch_tekton(carrier_path: NodePath, tekton_path: NodePath):
|
||||
func sync_grab_tekton(tekton_path: NodePath):
|
||||
var tekton = get_node_or_null(tekton_path)
|
||||
if tekton:
|
||||
if anim_player and anim_player.has_animation("dasher-pack/dasher_take"):
|
||||
anim_player.play("dasher-pack/dasher_take")
|
||||
if anim_player.has_animation("dasher-pack/dasher_hold"):
|
||||
anim_player.queue("dasher-pack/dasher_hold")
|
||||
|
||||
carried_tekton = tekton
|
||||
self.is_carrying_tekton = true
|
||||
tekton.set_carried(true, self )
|
||||
@@ -2461,7 +2445,6 @@ func sync_grab_tekton(tekton_path: NodePath):
|
||||
is_charged_strike = false
|
||||
|
||||
SfxManager.play("pick_up_tekton_roaming")
|
||||
play_pickup_animation()
|
||||
print("[Player %s] Grabbed Tekton %s" % [name, tekton.name])
|
||||
|
||||
func throw_tekton():
|
||||
@@ -2499,6 +2482,8 @@ func throw_tekton():
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_throw_tekton(target_pos: Vector2i):
|
||||
if anim_player and anim_player.has_animation("dasher-pack/dasher_put"):
|
||||
anim_player.play("dasher-pack/dasher_put")
|
||||
if carried_tekton:
|
||||
var tekton = carried_tekton
|
||||
carried_tekton = null
|
||||
@@ -2582,6 +2567,8 @@ func drop_tekton():
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_drop_tekton():
|
||||
if anim_player and anim_player.has_animation("dasher-pack/dasher_put"):
|
||||
anim_player.play("dasher-pack/dasher_put")
|
||||
if carried_tekton:
|
||||
var tekton = carried_tekton
|
||||
carried_tekton = null
|
||||
@@ -2619,6 +2606,8 @@ func update_active_player_indicator():
|
||||
@rpc("any_peer", "call_local", "unreliable")
|
||||
func sync_bump(target_pos: Vector2i, is_soft: bool = false):
|
||||
"""Visual attack 'bump' or collision animation."""
|
||||
if not is_soft and anim_player and anim_player.has_animation("dasher-pack/dasher_hit"):
|
||||
anim_player.play("dasher-pack/dasher_hit")
|
||||
# Always return to LOGICAL position to prevent character drift!
|
||||
var original_pos = grid_to_world(current_position)
|
||||
var target_world = grid_to_world(target_pos)
|
||||
@@ -2650,7 +2639,7 @@ func knock_tekton():
|
||||
# Consume Boost if we haven't already (or just consume it now if we are in mode)
|
||||
if powerup_manager:
|
||||
powerup_manager.consume_boost(100.0)
|
||||
|
||||
|
||||
if is_multiplayer_authority():
|
||||
rpc("sync_knock_tekton", tekton.get_path())
|
||||
|
||||
@@ -2665,6 +2654,8 @@ func knock_tekton():
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_knock_tekton(tekton_path: NodePath):
|
||||
if anim_player and anim_player.has_animation("dasher-pack/dasher_hit"):
|
||||
anim_player.play("dasher-pack/dasher_hit")
|
||||
var tekton = get_node_or_null(tekton_path)
|
||||
if tekton:
|
||||
# Intensity 2.0 for knock (drops 200% tiles) + Shrink/Recover
|
||||
|
||||
+3
-2
@@ -6,6 +6,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://1vk0mjnwkngi" path="res://assets/characters/Masbro.glb" id="2_mjsl8"]
|
||||
[ext_resource type="PackedScene" uid="uid://d4cul3w3wem5w" path="res://assets/characters/Gatot.glb" id="4_3tlf6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmln7v6v5kvxg" path="res://assets/characters/Oldpop.glb" id="5_alfd1"]
|
||||
[ext_resource type="AnimationLibrary" uid="uid://nsko4grplr5m" path="res://assets/characters/animations/dasher-pack.res" id="6a_dashp"]
|
||||
[ext_resource type="AnimationLibrary" uid="uid://c3pyopnwibckj" path="res://assets/characters/animations/animation-pack.res" id="6_5oq5w"]
|
||||
[ext_resource type="Script" uid="uid://cwwwixc07jc86" path="res://scripts/bot_controller.gd" id="7_botctrl"]
|
||||
[ext_resource type="FontFile" uid="uid://xnjx058n4tsw" path="res://assets/fonts/Nougat-ExtraBlack.ttf" id="8_y4r1p"]
|
||||
@@ -50,8 +51,9 @@ visible = false
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.485, 0)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1085499957]
|
||||
root_node = NodePath("../Masbro")
|
||||
root_node = NodePath("../Oldpop")
|
||||
libraries/animation-pack = ExtResource("6_5oq5w")
|
||||
libraries/dasher-pack = ExtResource("6a_dashp")
|
||||
|
||||
[node name="CharacterPointer" type="MeshInstance3D" parent="." unique_id=1262762501]
|
||||
transform = Transform3D(0.3535534, 0, 0.35355335, 0, 0.5, 0, -0.35355335, 0, 0.3535534, 0, -0.468462, 0)
|
||||
@@ -85,7 +87,6 @@ billboard = 1
|
||||
no_depth_test = true
|
||||
render_priority = 2
|
||||
outline_render_priority = 1
|
||||
modulate = Color(0.32, 0.614667, 1, 1)
|
||||
text = "1st"
|
||||
font = ExtResource("8_y4r1p")
|
||||
font_size = 62
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
[gd_scene format=3 uid="uid://d4mjd3tkf21xe"]
|
||||
|
||||
[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="PackedScene" uid="uid://statictektonmesh001" path="res://scenes/static_tekton_mesh.tscn" id="3_d2kpk"]
|
||||
[ext_resource type="Texture2D" uid="uid://biun2yvglxgij" path="res://assets/graphics/touch_control/grab_tekton.png" id="4_grab_icon"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_tekton"]
|
||||
size = Vector3(0.8, 1, 0.8)
|
||||
|
||||
[node name="Tekton" type="Node3D" unique_id=119914767 groups=["Tektons"]]
|
||||
script = ExtResource("1_tekton")
|
||||
|
||||
[node name="TektonController" type="Node" parent="." unique_id=1658331083]
|
||||
script = ExtResource("2_controller")
|
||||
|
||||
[node name="Visuals" type="Node3D" parent="." unique_id=1698719440]
|
||||
|
||||
[node name="tekton" parent="Visuals" unique_id=2052742928 instance=ExtResource("3_d2kpk")]
|
||||
|
||||
[node name="HitArea" type="Area3D" parent="." unique_id=2139590311]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="HitArea" unique_id=818146069]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
|
||||
shape = SubResource("BoxShape3D_tekton")
|
||||
|
||||
[node name="InteractionPrompt" type="Node3D" parent="." unique_id=855764577]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.4, 0)
|
||||
|
||||
[node name="PromptIcon" type="Sprite3D" parent="InteractionPrompt" unique_id=11135903]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.3731489, 0)
|
||||
pixel_size = 0.002
|
||||
billboard = 1
|
||||
no_depth_test = true
|
||||
render_priority = 1
|
||||
texture = ExtResource("4_grab_icon")
|
||||
|
||||
[node name="KeyLabel" type="Label3D" parent="InteractionPrompt" unique_id=1816493043]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.30466843, 0)
|
||||
pixel_size = 0.01
|
||||
billboard = 1
|
||||
no_depth_test = true
|
||||
render_priority = 2
|
||||
outline_render_priority = 1
|
||||
modulate = Color(0.1, 1, 0.2, 1)
|
||||
text = "[ G ]"
|
||||
font_size = 48
|
||||
outline_size = 18
|
||||
|
||||
[node name="ActionLabel" type="Label3D" parent="InteractionPrompt" unique_id=848495007]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.79176676, 0)
|
||||
pixel_size = 0.01
|
||||
billboard = 1
|
||||
no_depth_test = true
|
||||
render_priority = 2
|
||||
outline_render_priority = 1
|
||||
text = "LIFT TEKTON"
|
||||
font_size = 38
|
||||
outline_size = 10
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user