mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
Scheduled conditionals properly using after(), before() and sequential schedule()
This commit is contained in:
1 parent
e69bbd13b0
commit
8b4892cb35
2 files changed
+9
No files matched your search
@@ -365,6 +365,9 @@ public class Action implements IAction {
|
||||
}
|
||||
@Override
|
||||
public IAction after(IAction after) {
|
||||
if (after instanceof IConditionalAction)
|
||||
return conditional((IConditionalAction) after);
|
||||
|
||||
int idx = manager.getIndex(this);
|
||||
if (idx >= 0)
|
||||
manager.scheduleActionAt(idx + 1, after);
|
||||
@@ -403,6 +406,9 @@ public class Action implements IAction {
|
||||
|
||||
@Override
|
||||
public IAction before(IAction before) {
|
||||
if (before instanceof IConditionalAction)
|
||||
return conditional((IConditionalAction) before);
|
||||
|
||||
int idx = manager.getIndex(this);
|
||||
if (idx >= 0)
|
||||
manager.scheduleActionAt(Math.max(0, idx), before);
|
||||
|
||||
@@ -101,6 +101,9 @@ public class ActionManager implements IActionManager {
|
||||
|
||||
@Override
|
||||
public IAction schedule(IAction action) {
|
||||
if (action instanceof IConditionalAction)
|
||||
return schedule((IConditionalAction) action);
|
||||
|
||||
Action act = (Action) action;
|
||||
if (act.unscheduledBefore != null)
|
||||
act.scheduleAllBefore(actionQueue);
|
||||
|
||||
Reference in new issue
Block a user