feat: includes most-currently run statement when signalling a statement's/event's completion to aid in debugging messages
This commit is contained in:
@@ -372,16 +372,18 @@ func set_changing_scene(p_is_changing_scene: bool) -> void:
|
|||||||
# The event finished running
|
# The event finished running
|
||||||
#
|
#
|
||||||
# #### Parameters
|
# #### Parameters
|
||||||
# - finished_statement: statement object that finished
|
# - finished_event: statement object representing the event that finished
|
||||||
|
# - finished_statement: statement object representing the "deepest" statement (most likely a command)
|
||||||
|
# that just completed; this is useful for interrupted or failed statements especially
|
||||||
# - return_code: Return code of the finished event
|
# - return_code: Return code of the finished event
|
||||||
# - channel_name: Name of the channel that the event came from
|
# - channel_name: Name of the channel that the event came from
|
||||||
func _on_event_finished(finished_statement: ESCStatement, return_code: int, channel_name: String) -> void:
|
func _on_event_finished(finished_event: ESCStatement, finished_statement: ESCStatement, return_code: int, channel_name: String) -> void:
|
||||||
var event = _running_events[channel_name]
|
var event = _running_events[channel_name]
|
||||||
if not event:
|
if not event:
|
||||||
escoria.logger.warn(
|
escoria.logger.warn(
|
||||||
self,
|
self,
|
||||||
"Event '%s' finished without being in _running_events[%s]."
|
"Event '%s' finished without being in _running_events[%s]."
|
||||||
% [finished_statement.name, channel_name]
|
% [finished_event.name, channel_name]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ func is_valid() -> bool:
|
|||||||
# Execute this statement and return its return code
|
# Execute this statement and return its return code
|
||||||
func run() -> int:
|
func run() -> int:
|
||||||
var final_rc = ESCExecution.RC_OK
|
var final_rc = ESCExecution.RC_OK
|
||||||
|
var current_statement: ESCStatement
|
||||||
|
|
||||||
for statement in statements:
|
for statement in statements:
|
||||||
|
current_statement = statement
|
||||||
|
|
||||||
if _is_interrupted:
|
if _is_interrupted:
|
||||||
final_rc = ESCExecution.RC_INTERRUPTED
|
final_rc = ESCExecution.RC_INTERRUPTED
|
||||||
statement.interrupt()
|
statement.interrupt()
|
||||||
@@ -52,7 +56,7 @@ func run() -> int:
|
|||||||
final_rc = rc
|
final_rc = rc
|
||||||
break
|
break
|
||||||
|
|
||||||
emit_signal("finished", self, final_rc)
|
emit_signal("finished", self, current_statement, final_rc)
|
||||||
return final_rc
|
return final_rc
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user