From 46eb1f5910e5329da25cf191eecd18e2752ac791 Mon Sep 17 00:00:00 2001 From: Borig Date: Thu, 23 Jan 2025 22:26:19 +1300 Subject: [PATCH] Ensure woodcutting animations repeat while chopping --- .../skills/woodcutting/woodcutting-task.ts | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/plugins/skills/woodcutting/woodcutting-task.ts b/src/plugins/skills/woodcutting/woodcutting-task.ts index 5bd62b84d..d9615fbee 100644 --- a/src/plugins/skills/woodcutting/woodcutting-task.ts +++ b/src/plugins/skills/woodcutting/woodcutting-task.ts @@ -87,28 +87,29 @@ class WoodcuttingTask extends ActorLandscapeObjectInteractionTask { this.actor.sendMessage('You swing your axe at the tree.'); this.actor.face(this.landscapeObjectPosition); this.actor.playAnimation(tool.animation); + // First tick / iteration should never proceed beyond this point. return; } // play a random axe sound at the correct time - if(taskIteration % 3 !== 0) { - if(taskIteration % 1 === 0) { - const randomSoundIdx = Math.floor(Math.random() * soundIds.axeSwing.length); - this.actor.playSound(soundIds.axeSwing[randomSoundIdx], 7, 0); - } - return; - } - - // Get tool level, and set it to 2 if the tool is an iron hatchet or iron pickaxe - // TODO why is this set to 2? Was ported from the old code - let toolLevel = tool.level - 1; - if(tool.itemId === 1349 || tool.itemId === 1267) { - toolLevel = 2; + if (taskIteration % 3 !== 0) { + const randomSoundIdx = Math.floor( + Math.random() * soundIds.axeSwing.length, + ); + this.actor.playSound(soundIds.axeSwing[randomSoundIdx], 7, 0); } // roll for success - const succeeds = canCut(this.treeInfo, toolLevel, this.actor.skills.woodcutting.level); - if(!succeeds) { + const succeeds = canCut( + this.treeInfo, + tool.level, + this.actor.skills.woodcutting.level, + ); + + if (!succeeds) { + this.actor.playAnimation(tool.animation); + + // Keep chopping. return; } @@ -160,11 +161,7 @@ class WoodcuttingTask extends ActorLandscapeObjectInteractionTask { } this.stop(); - return; } - - this.actor.playAnimation(tool.animation); - } /**