From 754fde14b5aa28b1264ec38e72c9934ac2f3ac17 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 3 Nov 2019 22:13:49 -0600 Subject: [PATCH] chore: tidy --- common/traits/tool.trait.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) 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, ); }