diff --git a/src/main/java/noppes/npcs/controllers/data/action/ActionChain.java b/src/main/java/noppes/npcs/controllers/data/action/ActionChain.java index e5e12ab9e..572748a69 100644 --- a/src/main/java/noppes/npcs/controllers/data/action/ActionChain.java +++ b/src/main/java/noppes/npcs/controllers/data/action/ActionChain.java @@ -21,15 +21,21 @@ public class ActionChain implements IActionChain { * schedule the next task ‘delay’ ticks after the previous one */ @Override - public IActionChain after(int delay, Consumer task) { + public IActionChain after(int delay, String name, Consumer task) { offset += delay; Consumer wrapper = act -> { task.accept(act); act.markDone(); }; - IAction a = scriptedActionManager.create("chain#" + (index++), offset, wrapper); + IAction a = scriptedActionManager.create(name, offset, wrapper); + index++; a.setUpdateEveryXTick(1); scriptedActionManager.scheduleAction(a); return this; } + + @Override + public IActionChain after(int delay, Consumer task) { + return after(delay, "chain#" + index, task); + } } diff --git a/src/main/java/noppes/npcs/controllers/data/action/ParallelActionChain.java b/src/main/java/noppes/npcs/controllers/data/action/ParallelActionChain.java index 81ee25044..d437d80b1 100644 --- a/src/main/java/noppes/npcs/controllers/data/action/ParallelActionChain.java +++ b/src/main/java/noppes/npcs/controllers/data/action/ParallelActionChain.java @@ -18,17 +18,23 @@ public class ParallelActionChain implements IActionChain { * schedule the next task ‘delay’ ticks after the previous one, fully in parallel */ @Override - public IActionChain after(int delay, Consumer task) { + public IActionChain after(int delay, String name, Consumer task) { offset += delay; Consumer wrapper = act -> { task.accept(act); act.markDone(); }; - IAction a = scriptedActionManager.create("parallel#" + (idx++), + IAction a = scriptedActionManager.create(name, offset, wrapper); + idx++; a.setUpdateEveryXTick(1); scriptedActionManager.scheduleParallelAction(a); return this; } + + @Override + public IActionChain after(int delay, Consumer task) { + return after(delay, "parallel#" + idx, task); + } }