Files
CustomNPC-Plus-API/java/noppes/npcs/api/IActionManager.java
T
bigguy345 e13c6762f3 Added Scheduled Tasks system for NPC scripting.
Allows for scripting the scheduling of runnable methods in sequence within the NPC's AI

An example sequence of tasks:
1. Dashes towards player (might take 3-5 seconds, doesn't matter, task durations are dynamic so it can take as long as it needs).
2. Punches player away
3. Waits 10 ticks - Fires a ki blast
4. Teleports behind player
5. Knocks player out
2025-03-03 23:59:48 +02:00

52 lines
1.3 KiB
Java

package noppes.npcs.api;
import java.util.Queue;
import java.util.function.Consumer;
public interface IActionManager {
/**
* @param name
* @param maxDuration once maxDuration is reached the action ends
* @param action function to invoke as long as this action is active
* @param startAfterTicks number of ticks to elapse before starting action
* @return
*/
IAction createAction(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
/**
* Starts ActionManager (paused by default)
*/
void start();
/**
* stops ActionManager
*/
void stop();
void addScheduledAction(IAction action);
void addScheduledAction(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
/**
* @param index to add action at in the actionQueue
* @param action
*/
void addScheduledActionAt(int index, IAction action);
/**
* @param after The action to add toSchedule after
* @param toSchedule
*/
void scheduleActionAfter(IAction after, IAction toSchedule);
/**
* @param action
* @return action's index in the actionQueue
*/
int getActionIndex(IAction action);
IAction getCurrentAction();
Queue<IAction> getActionQueue();
}