45 lines
1.5 KiB
GDScript
45 lines
1.5 KiB
GDScript
extends SceneTree
|
|
|
|
## Verify the sci-fi clip arms wire-up: found, animated, toggled by the fists slot.
|
|
## godot --headless --path game --script dev/probe_scifi.gd
|
|
|
|
func _initialize() -> void:
|
|
var main: Node = (load("res://main.tscn") as PackedScene).instantiate()
|
|
get_root().add_child(main)
|
|
await process_frame
|
|
await process_frame
|
|
var p := _find(main, "Player") as Player
|
|
if p == null:
|
|
print("FAIL no player"); quit(); return
|
|
var vm := p.viewmodel
|
|
var arms: Node3D = p.camera.get_node_or_null("SciFiArms")
|
|
print("arms found: ", arms != null)
|
|
if arms == null: quit(); return
|
|
var ap := _anim(arms)
|
|
print("anims: ", ap.get_animation_list() if ap else [])
|
|
vm.equip(p.loadout()[0]) # fists
|
|
await process_frame
|
|
print("fists -> arms visible: ", arms.visible, " rig visible: ", vm.get_node("Rig").visible, " playing: ", ap.current_animation)
|
|
vm.start_swing()
|
|
await process_frame
|
|
print("swing -> playing: ", ap.current_animation)
|
|
vm.equip(p.loadout()[1]) # a weapon
|
|
await process_frame
|
|
print("weapon -> arms visible: ", arms.visible, " rig visible: ", vm.get_node("Rig").visible)
|
|
print("PROBE OK")
|
|
quit()
|
|
|
|
func _anim(n: Node) -> AnimationPlayer:
|
|
if n is AnimationPlayer: return n
|
|
for c in n.get_children():
|
|
var r := _anim(c)
|
|
if r != null: return r
|
|
return null
|
|
|
|
func _find(n: Node, name_: String) -> Node:
|
|
if (name_ == "Player" and n is Player) or n.name == name_: return n
|
|
for c in n.get_children():
|
|
var r := _find(c, name_)
|
|
if r != null: return r
|
|
return null
|