mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 12:39:05 +00:00
Added print debugging dump methods for most IAction framework components
This commit is contained in:
1 parent
253bfd7e17
commit
5e48063311
4 files changed
+92
-11
No files matched your search
@@ -111,11 +111,6 @@ public class ActionQueue implements IActionQueue {
|
||||
public IAction schedule(IAction action) {
|
||||
Action act = (Action) action;
|
||||
|
||||
if (act.queue != this)
|
||||
act.setQueue(this);
|
||||
|
||||
act.isScheduled = true;
|
||||
|
||||
if (!isParallel && act.unscheduledList != null) {
|
||||
act.unscheduledList.scheduleAll(this).forEach((act1) -> act1.unscheduledList = null).kill();
|
||||
return action;
|
||||
@@ -123,6 +118,8 @@ public class ActionQueue implements IActionQueue {
|
||||
|
||||
queue.addLast(action);
|
||||
|
||||
act.queue = this;
|
||||
act.isScheduled = true;
|
||||
return action;
|
||||
}
|
||||
|
||||
@@ -319,4 +316,25 @@ public class ActionQueue implements IActionQueue {
|
||||
return new ActionChain(manager, this, isParallel ? "parallel#" : "sequential#");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String printQueue() {
|
||||
if (queue.isEmpty()) {
|
||||
return String.format("ActionQueue[name=%s] is empty", name);
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(String.format("%s\n", this));
|
||||
|
||||
int i = 0;
|
||||
for (IAction action : queue) {
|
||||
sb.append(String.format(" [%d] %s\n", i++, action.toString()));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("ActionQueue '%s' [size=%d, parallel=%s, working=%s, dead=%s, killWhenEmpty=%s, killAfter=%d]", name, queue.size(), isParallel, isWorking, isDead, killWhenEmpty, killWhenEmptyAfter);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user