Index: binaries/data/mods/public/gui/common/tooltips.js =================================================================== --- binaries/data/mods/public/gui/common/tooltips.js +++ binaries/data/mods/public/gui/common/tooltips.js @@ -319,14 +319,14 @@ /** * Helper function for getEntityCostTooltip. */ -function getEntityCostComponentsTooltipString(template, trainNum, entity) +function getEntityCostComponentsTooltipString(template, entity, buildingsCountToTrainFullBatch = 1, fullBatchSize = 1, remainderBatch = 0) { - if (!trainNum) - trainNum = 1; - - let totalCosts = multiplyEntityCosts(template, trainNum); + let totalCosts = multiplyEntityCosts(template, buildingsCountToTrainFullBatch * fullBatchSize + remainderBatch); if (template.cost.time) - totalCosts.time = Math.ceil(template.cost.time * (entity ? Engine.GuiInterfaceCall("GetBatchTime", { "entity": entity, "batchSize": trainNum }) : 1)); + totalCosts.time = Math.ceil(template.cost.time * (entity ? Engine.GuiInterfaceCall("GetBatchTime", { + "entity": entity, + "batchSize": buildingsCountToTrainFullBatch > 0 ? fullBatchSize : remainderBatch + }) : 1)); let costs = []; for (let type in template.cost) @@ -435,7 +435,7 @@ /** * Returns the cost information to display in the specified entity's construction button tooltip. */ -function getEntityCostTooltip(template, trainNum, entity) +function getEntityCostTooltip(template, entity, buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch) { // Entities with a wallset component are proxies for initiating wall placement and as such do not have a cost of // their own; the individual wall pieces within it do. @@ -454,7 +454,7 @@ } if (template.cost) - return getEntityCostComponentsTooltipString(template, trainNum, entity).join(" "); + return getEntityCostComponentsTooltipString(template, entity, buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch).join(" "); return ""; } Index: binaries/data/mods/public/gui/session/input.js =================================================================== --- binaries/data/mods/public/gui/session/input.js +++ binaries/data/mods/public/gui/session/input.js @@ -1441,7 +1441,7 @@ /** * Returns the number of units that will be present in a batch if the user clicks - * the training button with shift down + * the training button */ function getTrainingStatus(playerState, trainEntType, selection) { @@ -1463,10 +1463,13 @@ limits = getEntityLimitAndCount(playerState, trainEntType); // We need to calculate count after the next increment if it's possible - if (limits.canBeAddedCount == undefined || - limits.canBeAddedCount > nextBatchTrainingCount * appropriateBuildings.length) + if ((limits.canBeAddedCount == undefined || + limits.canBeAddedCount > nextBatchTrainingCount * appropriateBuildings.length) && + Engine.HotkeyIsPressed("session.batchtrain")) nextBatchTrainingCount += batchIncrementSize; + nextBatchTrainingCount = max(nextBatchTrainingCount, 1); + // If training limits don't allow us to train batchTrainingCount in each appropriate building // train as many full batches as we can and remainer in one more building. var buildingsCountToTrainFullBatch = appropriateBuildings.length; Index: binaries/data/mods/public/gui/session/selection_panels.js =================================================================== --- binaries/data/mods/public/gui/session/selection_panels.js +++ binaries/data/mods/public/gui/session/selection_panels.js @@ -1047,9 +1047,7 @@ let [buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch] = getTrainingStatus(data.playerState, data.item, data.unitEntStates.map(status => status.id)); - let trainNum = buildingsCountToTrainFullBatch || 1; - if (Engine.HotkeyIsPressed("session.batchtrain")) - trainNum = buildingsCountToTrainFullBatch * fullBatchSize + remainderBatch; + let trainNum = buildingsCountToTrainFullBatch * fullBatchSize + remainderBatch; let neededResources; if (template.cost) @@ -1071,7 +1069,7 @@ getVisibleEntityClassesFormatted(template), getAurasTooltip(template), getEntityTooltip(template), - getEntityCostTooltip(template, trainNum, data.unitEntStates[0].id) + getEntityCostTooltip(template, data.unitEntStates[0].id, buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch) ]; let limits = getEntityLimitAndCount(data.playerState, data.item);