Repository navigation
Add opt-in deferred speech reports with SpeakAfter() - #2858
CMDR-Evolution wants to merge 2 commits into
Conversation
Keep core mapping state immediate and release the mapping notification after matching SAA signals or a one-second fallback. Cover separate journal reads, body identity, replay, rings, context changes, and timer races with focused tests.
|
Does the genera need to be available to a body mapping report? Why not use surface signals as a follow-on event as it is currently? |
Hey TKael. From our chat on Discord, I assume a very small amount of time could be enough, like 300ms, or maybe even less than that. Please see the journal times in my opening comment at the top. After the change earlier this year, I tried to work-around the issue over a few months, to force Body report to stem from Surface signals detected via Body mapped from either an event based route, or SAA (only when post FSS for confirmed biological signals),. However, there were edge cases which couldn't be covered such as pre-scanned systems, so I had to revert the work-around. |
|
Please do not merge Please force push to undo that commit. |
15c71ab to
8a04745
Compare
My apologies, Tkael. I resolved the conflicts through GitHub’s UI without realising that it would merge develop into my branch. I’m still learning the contribution workflow. I’ve now force-pushed the branch back to the original commit, undoing the merge as requested. I’ve also read the contribution guidelines and will leave the conflicts for you to handle. Thanks for pointing me in the right direction. |
|
Thanks for explaining the use case. I've checked the history and found no mapping-specific reorder rule that was removed. However, speech generation ran in an unawaited background task starting in 4.1.0; 4.1.7 removed that background execution and introduced awaited speech handling. That could explain why later events previously supplied information before your mapping report evaluated it, although that ordering wasn’t guaranteed. The concern with this PR is that it changes notification order for every monitor and responder, including VoiceAttack. Other user's may rely on Body mapped establishing context before surface signals are handled. Your combined-report requirement is reasonable but I'm hesitant to change core event order to support it, particularly since this would introduce a new ordering guarantee rather than restore an earlier one. |
|
Thanks for looking into the history and explaining that, Tkael. I understand now that the earlier behaviour wasn’t a guaranteed ordering, and I appreciate the concern about changing it for other responders and VoiceAttack. Would you be open to an optional approach confined to the Speech Responder, where The report could run as soon as matching SAA surface signals have been processed, using the system address and body ID to match them. If they haven’t arrived, perhaps a short fallback of around 200 ms could release the ordinary mapping report. The intention would be to schedule the report for later evaluation while allowing event processing to continue, rather than pause the event handler. This would keep the normal event order for other monitors and responders, with the combined reporting behaviour enabled only by personalities that want it. Would that be a more acceptable direction, or is there another approach you would prefer? I’d be happy to revise the proposal around your guidance before making further changes. |
|
Yes, I was thinking that a custom Cottle function for delaying and then enqueuing new speech might be a possibility to explore (perhaps something like |
Keep core event delivery unchanged. Add deferred script evaluation in the Speech Responder with configurable fallback, same-body SAA matching, original event context, explicit arguments, and lifecycle cancellation. Include focused tests and personality integration examples.
|
Thanks a lot, Tkael. That sounds like a promising approach for what I need, and could be usable elsewhere too. I’ve revised this PR with an initial implementation of your SpeakAfter() suggestion, along with tests and usage examples, to give you something concrete to review. Please feel free to tweak or reshape it however you think best. |
This proposes an optional SpeakAfter(scriptToSpeak, maximumDelayMs, scriptToWaitFor?, args?) Cottle function for deferred speech reporting.
Core event delivery remains unchanged. A personality can schedule a separate mapping report, released after matching SAA surface signals have finished processing or a configurable timeout. The report is evaluated then, retaining the original mapping event while reading updated state.
The implementation includes same-body matching, cancellation, protection against duplicate execution, and documentation with combined-report examples. Default personalities are unchanged.
All 28 focused tests pass in an isolated harness using the production speech code and real Cottle. Full Windows and in-game validation remain outstanding, including whether 200 ms is sufficient in practice.
This is a proposed starting point for review; the API and implementation are open to adjustment.