diff --git a/packages/behavior/item/routine.js b/packages/behavior/item/routine.js index 9fcb675..a9f9b73 100644 --- a/packages/behavior/item/routine.js +++ b/packages/behavior/item/routine.js @@ -7,14 +7,9 @@ export class Routine { } constructor() { - this._context = undefined; this.actions = new Actions(); } - set context(context) { - this._context = context; - } - clone(other) { this.actions = other.actions.clone(); } @@ -24,8 +19,8 @@ export class Routine { return this; } - tick(elapsed) { - this.actions.tick(this._context, elapsed); + tick(context, elapsed) { + this.actions.tick(context, elapsed); } toJSON() { diff --git a/packages/behavior/item/routines.js b/packages/behavior/item/routines.js index 5f04bae..8337926 100644 --- a/packages/behavior/item/routines.js +++ b/packages/behavior/item/routines.js @@ -7,7 +7,6 @@ export class Routines { } constructor() { - this._context = undefined; this.routines = {}; } @@ -18,13 +17,6 @@ export class Routines { } } - set context(context) { - this._context = context; - for (const routine of this) { - routine.context = context; - } - } - clone(other) { for (const i in other.routines) { const routine = other.routines[i]; diff --git a/packages/behavior/traits/behaved.trait.js b/packages/behavior/traits/behaved.trait.js index 3ce5f30..679407f 100644 --- a/packages/behavior/traits/behaved.trait.js +++ b/packages/behavior/traits/behaved.trait.js @@ -38,7 +38,6 @@ export class Behaved extends decorate(Trait) { this._currentRoutine = undefined; const routinesJSON = this.params.routines; this._routines = (new Routines()).fromJSON(routinesJSON); - this._routines.context = this._context; this.updateCurrentRoutine(this.state.currentRoutine); } @@ -73,7 +72,7 @@ export class Behaved extends decorate(Trait) { tick(elapsed) { if (AVOCADO_SERVER) { if (this._currentRoutine && this.entity.isBehaving) { - this._currentRoutine.tick(elapsed); + this._currentRoutine.tick(this._context, elapsed); } } }