From 4aed3c059dff0ed697e5af25d2660929110f7a68 Mon Sep 17 00:00:00 2001 From: Nathan Byrd Date: Fri, 25 Mar 2022 20:10:33 -0500 Subject: [PATCH] Fixed prompt location. --- core/menu_module.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/core/menu_module.js b/core/menu_module.js index 990f7f78..ef6ad831 100644 --- a/core/menu_module.js +++ b/core/menu_module.js @@ -63,7 +63,7 @@ exports.MenuModule = class MenuModule extends PluginModule { (Array.isArray(self.menuConfig.art) && _.has(self.menuConfig.art[0], 'acs')); }; - async.series( + async.waterfall( [ function beforeArtInterrupt(callback) { return self.displayQueuedInterruptions(callback); @@ -73,7 +73,7 @@ exports.MenuModule = class MenuModule extends PluginModule { }, function displayMenuArt(callback) { if(!hasArt()) { - return callback(null); + return callback(null, null); } self.displayAsset( @@ -84,15 +84,17 @@ exports.MenuModule = class MenuModule extends PluginModule { self.client.log.trace('Could not display art', { art : self.menuConfig.art, reason : err.message } ); } else { mciData.menu = artData.mciMap; + } + + if(artData) { pausePosition.row = artData.height + 1; } - - return callback(null); // any errors are non-fatal + return callback(null, artData); // any errors are non-fatal } ); }, - function displayPromptArt(callback) { + function displayPromptArt(artData, callback) { if(!_.isString(self.menuConfig.prompt)) { return callback(null); } @@ -101,17 +103,21 @@ exports.MenuModule = class MenuModule extends PluginModule { return callback(Errors.MissingConfig('Prompt specified but no "promptConfig" block found')); } + const options = self.menuConfig.config; + + if(artData != null && artData.height != null) { + options.startRow = artData.height + 1; + } self.displayAsset( self.menuConfig.promptConfig.art, - self.menuConfig.config, - (err, promptArtData) => { - if(promptArtData) { - mciData.prompt = promptArtData.mciMap; - } - if(promptArtData.height != null) { - pausePosition.row = pausePosition.row + promptArtData.height; + options, + (err, artData) => { + if(artData) { + mciData.prompt = artData.mciMap; + pausePosition.row = artData.height + 1; } + return callback(err); // pass err here; prompts *must* have art } ); @@ -131,7 +137,7 @@ exports.MenuModule = class MenuModule extends PluginModule { return self.pausePrompt(pausePosition, callback); }, - function finishAndNext(callback) { + function finishAndNext(artInfo, callback) { self.finishedLoading(); self.realTimeInterrupt = 'allowed'; return self.autoNextMenu(callback);