Re-ordered ConditionalAction's Supplier<Boolean> terminateWhen arg

This commit is contained in:
bigguy345 committed 2025-04-29 08:53:16 +03:00
1 parent 6eb08b2c4e
commit 28cc2d837b
2 files changed
+19 -19

No files matched your search

@@ -59,45 +59,45 @@ public interface IActionManager {
* Schedule a conditional action that gives up after at most maxChecks attempts.
*
* @param predicate supplier checked every tick, if it returns true, task is fired
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @param task code to run once predicate first becomes true
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @return the action scheduled
*/
IConditionalAction create(Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task);
IConditionalAction create(Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminateWhen);
/**
* Schedule a conditional action that gives up after at most maxChecks attempts.
*
* @param name unique name
* @param predicate supplier checked every tick, if it returns true, task is fired
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @param task code to run once predicate first becomes true
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @return the action scheduled
*/
IConditionalAction create(String name, Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task);
IConditionalAction create(String name, Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminateWhen);
/**
* Schedule a conditional action that gives up after at most maxChecks attempts.
*
* @param predicate supplier checked every tick, if it returns true, task is fired
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @param task code to run once predicate first becomes true
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @param onTermination code to run when the termination predicate returns true
* @return the action scheduled
*/
IConditionalAction create(Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task, Consumer<IAction> onTermination);
IConditionalAction create(Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminateWhen, Consumer<IAction> onTermination);
/**
* Schedule a conditional action that gives up after at most maxChecks attempts.
*
* @param name unique name
* @param predicate supplier checked every tick, if it returns true, task is fired
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @param task code to run once predicate first becomes true
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @param onTermination code to run when the termination predicate returns true
* @return the action scheduled
*/
IConditionalAction create(String name, Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task, Consumer<IAction> onTermination);
IConditionalAction create(String name, Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminateWhen, Consumer<IAction> onTermination);
/**
* Begin processing scheduled actions. Must be called once.
@@ -174,13 +174,13 @@ public interface IActionManager {
/**
* Schedule a conditional action that gives up after at most maxChecks attempts.
*
* @param name unique name
* @param predicate supplier checked every tick, if it returns true, task is fired
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @param task code to run once predicate first becomes true
* @param name unique name
* @param predicate supplier checked every tick, if it returns true, task is fired
* @param task code to run once predicate first becomes true
* @param terminateWhen supplier checked every tick, if it returns true, action is terminated (gets marked done)
* @return the action scheduled
*/
IConditionalAction scheduleAction(String name, Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task);
IConditionalAction scheduleAction(String name, Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminateWhen);
IConditionalAction scheduleAction(IConditionalAction action);
@@ -246,8 +246,8 @@ public interface IActionManager {
/**
* Convenience: create & enqueue a conditional task that gives up after maxChecks.
*/
default void addConditionalTask(String name, Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task) {
scheduleAction(name, predicate, terminateWhen, task);
default void addConditionalTask(String name, Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminateWhen) {
scheduleAction(name, predicate, task, terminateWhen);
}
@@ -56,11 +56,11 @@ public interface IConditionalAction extends IAction {
IConditionalAction after(String name, Supplier<Boolean> predicate, Consumer<IAction> task);
IConditionalAction after(Supplier<Boolean> predicate, Supplier<Boolean> terminate, Consumer<IAction> task);
IConditionalAction after(Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminate);
IConditionalAction after(String name, Supplier<Boolean> predicate, Supplier<Boolean> terminate, Consumer<IAction> task);
IConditionalAction after(String name, Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminate);
IConditionalAction after(Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task, Consumer<IAction> onTermination);
IConditionalAction after(Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminateWhen, Consumer<IAction> onTermination);
IConditionalAction after(String name, Supplier<Boolean> predicate, Supplier<Boolean> terminateWhen, Consumer<IAction> task, Consumer<IAction> onTermination);
IConditionalAction after(String name, Supplier<Boolean> predicate, Consumer<IAction> task, Supplier<Boolean> terminateWhen, Consumer<IAction> onTermination);
}