mirror of
https://github.com/AutismDevelopment/Autism-Client.git
synced 2026-10-28 19:39:48 +00:00
Refactor: extract MacroPrearm from MacroExecutor (upstream #4)
Move 24 prearm/capture-commit/MacroValue-builder methods verbatim into MacroPrearm (predicateFuture through waitForPacketMatch). Shared members referenced as MacroExecutor.xxx (mechanical qualification only); staying and earlier-helper call sites re-pointed to MacroPrearm.xxx. PrearmedWait widened to package-visible. All bodies verified identical against HEAD modulo that qualification.
This commit is contained in:
parent
f4fcb7bca9
commit
f014d6e5c0
4 changed files with 587 additions and 565 deletions
|
|
@ -120,7 +120,7 @@ final class MacroPacketWait {
|
|||
public static void awaitChat(WaitForChatAction wca) {
|
||||
MacroExecutor.RunState run = MacroExecutor.CURRENT_RUN.get();
|
||||
if (run != null) {
|
||||
MacroExecutor.clearCaptureOutputs(wca);
|
||||
MacroPrearm.clearCaptureOutputs(wca);
|
||||
CompletableFuture<Void> future = new CompletableFuture<>();
|
||||
run.chatFuture = future;
|
||||
run.waitingChatAction = wca;
|
||||
|
|
@ -128,7 +128,7 @@ final class MacroPacketWait {
|
|||
try {
|
||||
if (wca.timeoutMs > 0) future.completeOnTimeout(null, wca.timeoutMs, java.util.concurrent.TimeUnit.MILLISECONDS);
|
||||
MacroExecutor.waitForCondition(future);
|
||||
MacroExecutor.commitStagedCapture(wca);
|
||||
MacroPrearm.commitStagedCapture(wca);
|
||||
} finally {
|
||||
if (run.chatFuture == future) {
|
||||
run.waitingForChat.set(false);
|
||||
|
|
@ -162,7 +162,7 @@ final class MacroPacketWait {
|
|||
public static void awaitCaptureValueChat(CaptureValueAction action) {
|
||||
if (action == null) return;
|
||||
MacroExecutor.RunState run = MacroExecutor.CURRENT_RUN.get();
|
||||
MacroExecutor.clearCaptureOutputs(action);
|
||||
MacroPrearm.clearCaptureOutputs(action);
|
||||
MacroExecutor.OneShotPacketListener listener = MacroExecutor.awaitReceive(packet -> {
|
||||
MacroExecutor.ChatCapture capture = MacroChatObserve.extractIncomingChat(packet);
|
||||
if (capture == null) return false;
|
||||
|
|
@ -181,7 +181,7 @@ final class MacroPacketWait {
|
|||
return true;
|
||||
});
|
||||
try {
|
||||
if (MacroExecutor.waitForFutureDone(listener.future, 0) && run != null) MacroExecutor.commitStagedCapture(action);
|
||||
if (MacroExecutor.waitForFutureDone(listener.future, 0) && run != null) MacroPrearm.commitStagedCapture(action);
|
||||
} finally {
|
||||
listener.cancel();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue