Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] block input while waiting for transition to prevent changing starter during move select #2342

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/ui/starter-select-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
];
if (this.speciesStarterMoves.length > 1) {
const showSwapOptions = (moveset: StarterMoveset) => {

this.blockInput = true;
scottarrr marked this conversation as resolved.
Show resolved Hide resolved

ui.setMode(Mode.STARTER_SELECT).then(() => {
ui.showText(i18next.t("starterSelectUiHandler:selectMoveSwapOut"), null, () => {
this.moveInfoOverlay.show(allMoves[moveset[0]]);
Expand All @@ -1158,6 +1161,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const option: OptionSelectItem = {
label: allMoves[m].name,
handler: () => {
this.blockInput = true;
ui.setMode(Mode.STARTER_SELECT).then(() => {
ui.showText(`${i18next.t("starterSelectUiHandler:selectMoveSwapWith")} ${allMoves[m].name}.`, null, () => {
const possibleMoves = this.speciesStarterMoves.filter((sm: Moves) => sm !== m);
Expand Down Expand Up @@ -1192,6 +1196,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
maxOptions: 8,
yOffset: 19
});
this.blockInput = false;
});
});
return true;
Expand All @@ -1217,6 +1222,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
maxOptions: 8,
yOffset: 19
});
this.blockInput = false;
});
});
};
Expand All @@ -1233,6 +1239,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
if (this.canCycleNature) {
// if we could cycle natures, enable the improved nature menu
const showNatureOptions = () => {

this.blockInput = true;

ui.setMode(Mode.STARTER_SELECT).then(() => {
ui.showText(i18next.t("starterSelectUiHandler:selectNature"), null, () => {
const natures = this.scene.gameData.getNaturesForAttr(this.speciesStarterDexEntry.natureAttr);
Expand All @@ -1251,6 +1260,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
ui.setMode(Mode.STARTER_SELECT);
// set nature for starter
this.setSpeciesDetails(this.lastSpecies, undefined, undefined, undefined, undefined, undefined, n, undefined);
this.blockInput = false;
return true;
}
};
Expand All @@ -1260,6 +1270,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
handler: () => {
this.clearText();
ui.setMode(Mode.STARTER_SELECT);
this.blockInput = false;
return true;
}
}),
Expand Down
Loading