diff --git a/common/traits/tool.trait.js b/common/traits/tool.trait.js index 1e7ddf8..a582220 100644 --- a/common/traits/tool.trait.js +++ b/common/traits/tool.trait.js @@ -55,6 +55,12 @@ export class Tool extends decorate(Trait) { this.toolSetup = behaviorItemFromJSON(this.params.setup); } + destroy() { + if (AVOCADO_CLIENT) { + this.guidePrimitives.destroy(); + } + } + calculateTargetStart() { const wielder = this.entity.wielder; if (!wielder) { @@ -196,22 +202,22 @@ export class Tool extends decorate(Trait) { wielderChanged: (oldWielder, newWielder) => { if (oldWielder && oldWielder.is('visible')) { oldWielder.off( - 'positionChanged', - this.onWielderPositionChanged, + 'activeSlotIndexChanged', + this.onWielderActiveSlotIndexChanged, ); oldWielder.off( 'directionChanged', this.onWielderDirectionChanged, ); oldWielder.off( - 'activeSlotIndexChanged', - this.onWielderActiveSlotIndexChanged, + 'positionChanged', + this.onWielderPositionChanged, ); } if (newWielder && newWielder.is('visible')) { newWielder.on( - 'positionChanged', - this.onWielderPositionChanged, + 'activeSlotIndexChanged', + this.onWielderActiveSlotIndexChanged, this, ); newWielder.on( @@ -220,8 +226,8 @@ export class Tool extends decorate(Trait) { this, ); newWielder.on( - 'activeSlotIndexChanged', - this.onWielderActiveSlotIndexChanged, + 'positionChanged', + this.onWielderPositionChanged, this, ); }