@satelliteoflove/godot-mcp 3.7.0 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,6 +11,13 @@ var _sampler: MCPRuntimeStateSampler
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
func _ready() -> void:
|
|
14
|
+
# The bridge must keep processing while the scene tree is paused. Input
|
|
15
|
+
# sequences are driven from _process, so without this a press that toggles
|
|
16
|
+
# `paused = true` freezes the runner mid-sequence: the paired release never
|
|
17
|
+
# fires and the editor-side wait times out (~30s) — pause menus, a primary
|
|
18
|
+
# injection target, become undrivable. The bridge answers to the debugger,
|
|
19
|
+
# not the game's pause state. Children (the sampler) inherit this mode.
|
|
20
|
+
process_mode = Node.PROCESS_MODE_ALWAYS
|
|
14
21
|
if not EngineDebugger.is_active():
|
|
15
22
|
return
|
|
16
23
|
_logger = _MCPGameLogger.new()
|
|
@@ -24,6 +31,9 @@ func _ready() -> void:
|
|
|
24
31
|
|
|
25
32
|
|
|
26
33
|
func _exit_tree() -> void:
|
|
34
|
+
# Guaranteed cleanup: never leave an action latched when the bridge node
|
|
35
|
+
# leaves the tree (game shutdown / scene change). Safe if nothing is held.
|
|
36
|
+
_release_held_actions()
|
|
27
37
|
if EngineDebugger.is_active():
|
|
28
38
|
EngineDebugger.unregister_message_capture("godot_mcp")
|
|
29
39
|
if _profiler:
|
|
@@ -43,7 +53,10 @@ func _process(_delta: float) -> void:
|
|
|
43
53
|
input_event.pressed = seq_event.is_press
|
|
44
54
|
input_event.strength = 1.0 if seq_event.is_press else 0.0
|
|
45
55
|
Input.parse_input_event(input_event)
|
|
46
|
-
if
|
|
56
|
+
if seq_event.is_press:
|
|
57
|
+
_held_actions[seq_event.action] = true
|
|
58
|
+
else:
|
|
59
|
+
_held_actions.erase(seq_event.action)
|
|
47
60
|
_actions_completed += 1
|
|
48
61
|
|
|
49
62
|
if _sequence_events.is_empty():
|
|
@@ -60,6 +73,29 @@ var _sequence_start_time: int = 0
|
|
|
60
73
|
var _sequence_running: bool = false
|
|
61
74
|
var _actions_completed: int = 0
|
|
62
75
|
var _actions_total: int = 0
|
|
76
|
+
# Actions whose press has been injected but whose paired release has not yet
|
|
77
|
+
# fired. Used to guarantee a release even if the queue is cleared mid-flight
|
|
78
|
+
# (new sequence) or the node leaves the tree — otherwise the dropped release
|
|
79
|
+
# latches the action "pressed" in the Input singleton (the stuck-held bug).
|
|
80
|
+
var _held_actions: Dictionary = {}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# Release any action still held from an interrupted sequence. A release here is a
|
|
84
|
+
# guaranteed cleanup, never a queued step that a clear could drop. Safe to call
|
|
85
|
+
# when nothing is held.
|
|
86
|
+
func _release_held_actions() -> void:
|
|
87
|
+
if _held_actions.is_empty():
|
|
88
|
+
return
|
|
89
|
+
for action in _held_actions.keys():
|
|
90
|
+
var release := InputEventAction.new()
|
|
91
|
+
release.action = action
|
|
92
|
+
release.pressed = false
|
|
93
|
+
release.strength = 0.0
|
|
94
|
+
Input.parse_input_event(release)
|
|
95
|
+
# Flush so the release takes effect immediately — _exit_tree may not get
|
|
96
|
+
# another frame, and a cleanup should be deterministic, not deferred.
|
|
97
|
+
Input.flush_buffered_events()
|
|
98
|
+
_held_actions.clear()
|
|
63
99
|
|
|
64
100
|
|
|
65
101
|
func _on_debugger_message(message: String, data: Array) -> bool:
|
|
@@ -890,6 +926,10 @@ func _handle_execute_input_sequence(data: Array) -> void:
|
|
|
890
926
|
}])
|
|
891
927
|
return
|
|
892
928
|
|
|
929
|
+
# Release anything still held from a prior, interrupted sequence BEFORE
|
|
930
|
+
# clearing the queue — otherwise that sequence's unfired releases are dropped
|
|
931
|
+
# and its actions stay latched (stuck-held bug).
|
|
932
|
+
_release_held_actions()
|
|
893
933
|
_sequence_events.clear()
|
|
894
934
|
_actions_completed = 0
|
|
895
935
|
_actions_total = inputs.size()
|
package/addon/plugin.cfg
CHANGED