12345678910111213141516171819202122232425 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0});
- const s = t("constants"),
- o = t("Decorator");
- i.default = class extends o.default {
- constructor({maxLoop: t = -1, child: e = null} = {}) {
- super({child: e, name: "RepeatUntilSuccess", title: "Repeat Until Success", properties: {maxLoop: -1}}),
- (this.maxLoop = t);
- }
- open(t) {
- t.blackboard.set("i", 0, t.tree.id, this.id);
- }
- tick(t) {
- if (!this.child) return s.ERROR;
- for (
- var e = t.blackboard.get("i", t.tree.id, this.id), i = s.ERROR;
- (this.maxLoop < 0 || e < this.maxLoop) && (i = this.child._execute(t)) == s.FAILURE;
- )
- e++;
- return (e = t.blackboard.set("i", e, t.tree.id, this.id)), i;
- }
- };
|