debug: force process/physic process ticks after runtime script attach

This commit is contained in:
2026-06-03 17:10:48 -04:00
parent 5cb2013d6c
commit 30770be7c0
+7 -1
View File
@@ -7,6 +7,11 @@ signal chain_updated(count: int, bonus: float)
var _machine: MovementStateMachine = null
# Explicitly ensure this node ticks after being attached by set_script().
func _ensure_process() -> void:
set_process(true)
set_physics_process(true)
func _ensure_machine() -> MovementStateMachine:
if is_instance_valid(_machine):
@@ -38,6 +43,7 @@ func _ready() -> void:
sm.player = self
sm.params = params
sm.movement_event.connect(_on_movement_event)
_ensure_process()
func _process(_delta: float) -> void:
@@ -51,7 +57,7 @@ func _process(_delta: float) -> void:
sm.input_dash = Input.is_action_just_pressed("dash") and not sm.input_dash
sm.input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
# DEBUG: confirm controller is receiving input and machine state each frame
# DEBUG: emit every frame so we can see whether inputs reach the controller.
var p = sm.player
print("MOVEMENT_DEBUG state=%s vel=%s input_dir=%s jump=%s sprint=%s crouch=%s dash=%s" % [
sm.current_state,