Fixed prompt location.

This commit is contained in:
Nathan Byrd 2022-03-25 20:10:33 -05:00
parent f72b4659b3
commit 4aed3c059d
1 changed files with 19 additions and 13 deletions

View File

@ -63,7 +63,7 @@ exports.MenuModule = class MenuModule extends PluginModule {
(Array.isArray(self.menuConfig.art) && _.has(self.menuConfig.art[0], 'acs')); (Array.isArray(self.menuConfig.art) && _.has(self.menuConfig.art[0], 'acs'));
}; };
async.series( async.waterfall(
[ [
function beforeArtInterrupt(callback) { function beforeArtInterrupt(callback) {
return self.displayQueuedInterruptions(callback); return self.displayQueuedInterruptions(callback);
@ -73,7 +73,7 @@ exports.MenuModule = class MenuModule extends PluginModule {
}, },
function displayMenuArt(callback) { function displayMenuArt(callback) {
if(!hasArt()) { if(!hasArt()) {
return callback(null); return callback(null, null);
} }
self.displayAsset( 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 } ); self.client.log.trace('Could not display art', { art : self.menuConfig.art, reason : err.message } );
} else { } else {
mciData.menu = artData.mciMap; mciData.menu = artData.mciMap;
}
if(artData) {
pausePosition.row = artData.height + 1; pausePosition.row = artData.height + 1;
} }
return callback(null, artData); // any errors are non-fatal
return callback(null); // any errors are non-fatal
} }
); );
}, },
function displayPromptArt(callback) { function displayPromptArt(artData, callback) {
if(!_.isString(self.menuConfig.prompt)) { if(!_.isString(self.menuConfig.prompt)) {
return callback(null); return callback(null);
} }
@ -101,17 +103,21 @@ exports.MenuModule = class MenuModule extends PluginModule {
return callback(Errors.MissingConfig('Prompt specified but no "promptConfig" block found')); 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.displayAsset(
self.menuConfig.promptConfig.art, self.menuConfig.promptConfig.art,
self.menuConfig.config, options,
(err, promptArtData) => { (err, artData) => {
if(promptArtData) { if(artData) {
mciData.prompt = promptArtData.mciMap; mciData.prompt = artData.mciMap;
} pausePosition.row = artData.height + 1;
if(promptArtData.height != null) {
pausePosition.row = pausePosition.row + promptArtData.height;
} }
return callback(err); // pass err here; prompts *must* have art 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); return self.pausePrompt(pausePosition, callback);
}, },
function finishAndNext(callback) { function finishAndNext(artInfo, callback) {
self.finishedLoading(); self.finishedLoading();
self.realTimeInterrupt = 'allowed'; self.realTimeInterrupt = 'allowed';
return self.autoNextMenu(callback); return self.autoNextMenu(callback);