From 0cff06b2760ac255e6d0039212c629f7cd7541a1 Mon Sep 17 00:00:00 2001 From: Kikorono Date: Thu, 29 Jun 2023 13:57:21 -0500 Subject: [PATCH 1/2] Fixing a bug causing dialogue to crash and fail --- package-lock.json | 4 ---- src/engine/world/actor/dialogue.ts | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1b061264c..d7fc90e80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,8 +74,6 @@ "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.4", - "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3", - "chokidar": "^3.4.0", "commander": "^4.0.1", "convert-source-map": "^1.1.0", "fs-readdir-recursive": "^1.1.0", @@ -4046,7 +4044,6 @@ "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", - "fsevents": "~2.3.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", @@ -6663,7 +6660,6 @@ "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", - "fsevents": "^2.3.2", "graceful-fs": "^4.2.9", "jest-regex-util": "^29.4.3", "jest-util": "^29.5.0", diff --git a/src/engine/world/actor/dialogue.ts b/src/engine/world/actor/dialogue.ts index 9754bd93a..b72da4653 100644 --- a/src/engine/world/actor/dialogue.ts +++ b/src/engine/world/actor/dialogue.ts @@ -364,16 +364,17 @@ function parseDialogueTree(player: Player, npcParticipants: NpcParticipant[], di } } + console.log('npc:', npc); + dialogueDetails = dialogueAction(npc); + + if (npc === -1) { + throw new Error('No npc found for dialogue action.'); + } } else { dialogueDetails = dialogueAction(player); } - // TODO (Jameskmonger) not sure if this check is needed, added it when getting TypeScript types into strict mode - if (npc === -1) { - throw new Error('No npc found for dialogue action.'); - } - const emote = dialogueDetails[0] as Emote; const text = carryoverDialogue.join(' ') + dialogueDetails[1] as string; carryoverDialogue = []; @@ -582,10 +583,10 @@ async function runDialogueAction(player: Player, dialogueAction: string | Dialog if (dialogueAction.type === 'NPC') { npcId = (dialogueAction as NpcDialogueAction).npcId; - } - // TODO (Jameskmonger) not sure if this check is needed, added it when getting TypeScript types into strict mode - if (npcId === -1) { - throw new Error('No npc found for dialogue action.'); + + if (npcId === -1) { + throw new Error('No npc found for dialogue action.'); + } } const actorDialogueAction = dialogueAction as ActorDialogueAction; From 8305229a68c7218a7a6c8ced52bdf5753df2b155 Mon Sep 17 00:00:00 2001 From: Kikorono Date: Thu, 29 Jun 2023 14:26:19 -0500 Subject: [PATCH 2/2] Removing console.log --- src/engine/world/actor/dialogue.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/engine/world/actor/dialogue.ts b/src/engine/world/actor/dialogue.ts index b72da4653..de042e18f 100644 --- a/src/engine/world/actor/dialogue.ts +++ b/src/engine/world/actor/dialogue.ts @@ -364,8 +364,6 @@ function parseDialogueTree(player: Player, npcParticipants: NpcParticipant[], di } } - console.log('npc:', npc); - dialogueDetails = dialogueAction(npc); if (npc === -1) {