Skip to content

Commit 7914be9

Browse files
committed
suppressed ability to combine mods during collection install
fixes #16889
1 parent 0c27a92 commit 7914be9

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/extensions/mod_management/views/ModList.tsx

+26-4
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ interface IConnectedProps extends IModProps {
120120
downloadPath: string;
121121
showDropzone: boolean;
122122
autoInstall: boolean;
123+
// some mod actions are not allowed while installing dependencies/collections
124+
// e.g. combining a mod with other patch mods while the collection is still installing.
125+
suppressModActions: boolean;
123126
}
124127

125128
interface IActionProps {
@@ -1473,19 +1476,27 @@ class ModList extends ComponentEx<IProps, IComponentState> {
14731476
}
14741477

14751478
private canBeCombined = (modIds: string[]) => {
1476-
const { t, mods } = this.props;
1479+
const { t, mods, suppressModActions } = this.props;
14771480

14781481
const notInstalled = modIds.find(modId => mods[modId] === undefined);
14791482
if (notInstalled !== undefined) {
14801483
return t('You can only combine installed mods') ;
14811484
}
1485+
1486+
if (suppressModActions) {
1487+
return t('Try again after installing dependencies');
1488+
}
1489+
14821490
return true;
14831491
}
14841492

14851493
private combine = (modIds: string[]) => {
1486-
const { gameMode } = this.props;
1494+
const { gameMode, suppressModActions } = this.props;
14871495
const { api } = this.context;
1488-
1496+
if (suppressModActions) {
1497+
api.showErrorNotification('Try again after installing dependencies', 'Mod actions are currently disabled', { allowReport: false });
1498+
return;
1499+
}
14891500
return combineMods(api, gameMode, modIds);
14901501
}
14911502

@@ -1530,10 +1541,20 @@ class ModList extends ComponentEx<IProps, IComponentState> {
15301541

15311542
const empty = {};
15321543

1544+
const shouldSuppressModActions = (state: IState): boolean => {
1545+
const suppressOnActivities = ['conflicts', 'installing_dependencies', 'deployment', 'purging'];
1546+
const isActivityRunning = (activity: string) =>
1547+
getSafe(state, ['session', 'base', 'activity', 'mods'], []).includes(activity) // purge/deploy
1548+
|| getSafe(state, ['session', 'base', 'activity', activity], []).length > 0; // installing_dependencies
1549+
const suppressingActivities = suppressOnActivities.filter(activity => isActivityRunning(activity));
1550+
const suppressing = suppressingActivities.length > 0;
1551+
return suppressing;
1552+
}
1553+
15331554
function mapStateToProps(state: IState): IConnectedProps {
15341555
const profile = selectors.activeProfile(state);
15351556
const gameMode = selectors.activeGameId(state);
1536-
1557+
const suppressModActions = shouldSuppressModActions(state);
15371558
return {
15381559
mods: getSafe(state, ['persistent', 'mods', gameMode], empty),
15391560
modState: getSafe(profile, ['modState'], empty),
@@ -1545,6 +1566,7 @@ function mapStateToProps(state: IState): IConnectedProps {
15451566
downloadPath: selectors.downloadPath(state),
15461567
showDropzone: state.settings.mods.showDropzone,
15471568
autoInstall: state.settings.automation.install,
1569+
suppressModActions,
15481570
};
15491571
}
15501572

0 commit comments

Comments
 (0)