Skip to content

Commit

Permalink
feat: use storage.running instead of storage.lastLoopResult
Browse files Browse the repository at this point in the history
  • Loading branch information
tdeignan1 committed Sep 24, 2023
1 parent 3298918 commit 26858bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/nodes/decorators/While.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class While<S extends BlueshellState, E> extends Decorator<S, E> {
protected decorateCall(handleEvent: (state: S, event: E) => ResultCode, state: S, event: E) {
const storage: WhileNodeStorage = this.getNodeStorage(state);

if (storage.lastLoopResult === rc.RUNNING || this.conditional(state, event)) {
if (storage.running !== undefined || this.conditional(state, event)) {
if (storage.beganAtLeastOneLoop) {
Action.treePublisher.publishResult(state, event, false);
clearEventSeenRecursive(this.child, state);
Expand All @@ -52,7 +52,7 @@ export class While<S extends BlueshellState, E> extends Decorator<S, E> {

if (res === rc.RUNNING) {
// yield to the behavior tree because the child node is running
storage.lastLoopResult = res;
storage.running = 0;
return res;
} else if (storage.break) {
// teardown internal state and yield to the behavior tree because the loop has completed
Expand Down

0 comments on commit 26858bd

Please sign in to comment.