Skip to content

Commit

Permalink
chore: screen merge follow-ups (#5241)
Browse files Browse the repository at this point in the history
* fix: screen name after merge

* chore: remove no longer used translation tags

* feat: return user to previous screen if no module with world generator in use

* feat: differentiate world generator creation errors

- add popup for user in case selected world generator cannot be resolved

* UnresolvedDependencyException is in package excpeptions.

---------

Co-authored-by: soloturn <[email protected]>
  • Loading branch information
jdrueckert and soloturn authored May 16, 2024
1 parent 13c07b8 commit 30bc83a
Show file tree
Hide file tree
Showing 30 changed files with 15 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.terasology.engine.world.sun.CelestialSystem;
import org.terasology.engine.world.sun.DefaultCelestialSystem;
import org.terasology.gestalt.module.ModuleEnvironment;
import org.terasology.gestalt.module.exceptions.UnresolvedDependencyException;

import java.io.IOException;
import java.nio.file.Path;
Expand Down Expand Up @@ -104,7 +105,7 @@ public boolean step() {
// setting the world seed will create the world builder
worldGenerator.setWorldSeed(worldInfo.getSeed());
context.put(WorldGenerator.class, worldGenerator);
} catch (UnresolvedWorldGeneratorException e) {
} catch (UnresolvedWorldGeneratorException | UnresolvedDependencyException e) {
logger.error("Unable to load world generator {}. Available world generators: {}",
worldInfo.getWorldGenerator(), worldGeneratorManager.getWorldGenerators());
context.get(GameEngine.class).changeState(new StateMainMenu("Failed to resolve world generator."));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.terasology.gestalt.entitysystem.component.Component;
import org.terasology.gestalt.module.Module;
import org.terasology.gestalt.module.ModuleEnvironment;
import org.terasology.gestalt.module.exceptions.UnresolvedDependencyException;
import org.terasology.gestalt.module.dependencyresolution.DependencyInfo;
import org.terasology.gestalt.module.dependencyresolution.DependencyResolver;
import org.terasology.gestalt.module.dependencyresolution.ResolutionResult;
Expand Down Expand Up @@ -194,6 +195,8 @@ public WorldGeneratorInfo get() {

getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("No selectable world generators!",
"Please select at least one module that supports a registered world generator!");
CoreRegistry.put(UniverseWrapper.class, context.get(UniverseWrapper.class));
triggerBackAnimation();

return null;
}
Expand Down Expand Up @@ -351,6 +354,10 @@ private void addNewWorld(WorldGeneratorInfo worldGeneratorInfo) {
universeWrapper.setWorldGenerator(worldGenerator);
context.put(UniverseWrapper.class, universeWrapper);
} catch (UnresolvedWorldGeneratorException e) {
getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Selected world generator cannot be resolved!",
"Please report this issue on Discord/GitHub and select a different world generator!");
e.printStackTrace();
} catch (UnresolvedDependencyException e) {
//TODO: this will likely fail at game creation time later-on due to lack of world generator - don't just ignore this

Check warning on line 361 in engine/src/main/java/org/terasology/engine/rendering/nui/layers/mainMenu/UniverseSetupScreen.java

View check run for this annotation

Terasology Jenkins.io / Open Tasks Scanner

TODO

NORMAL: this will likely fail at game creation time later-on due to lack of world generator - don't just ignore this
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.terasology.engine.world.generator.WorldGenerator;
import org.terasology.gestalt.module.Module;
import org.terasology.gestalt.module.ModuleEnvironment;
import org.terasology.gestalt.module.exceptions.UnresolvedDependencyException;
import org.terasology.gestalt.module.dependencyresolution.DependencyResolver;
import org.terasology.gestalt.module.dependencyresolution.ResolutionResult;
import org.terasology.gestalt.naming.Name;
Expand Down Expand Up @@ -98,7 +99,8 @@ public WorldGeneratorInfo getWorldGeneratorInfo(SimpleUri uri) {
* @param context objects from this context will be injected into the
* @return The instantiated world generator.
*/
public static WorldGenerator createGenerator(SimpleUri uri, Context context) throws UnresolvedWorldGeneratorException {
public static WorldGenerator createGenerator(SimpleUri uri, Context context)
throws UnresolvedWorldGeneratorException, UnresolvedDependencyException {
ModuleManager moduleManager = context.get(ModuleManager.class);
Module module = moduleManager.getEnvironment().get(uri.getModuleName());
if (module == null) {
Expand Down Expand Up @@ -128,12 +130,12 @@ public static WorldGenerator createGenerator(SimpleUri uri, Context context) thr
* @return a new world generator with the specified uri.
*/
public static WorldGenerator createWorldGenerator(SimpleUri uri, Context context, ModuleEnvironment environment)
throws UnresolvedWorldGeneratorException {
throws UnresolvedWorldGeneratorException, UnresolvedDependencyException {
for (Class<?> generatorClass : environment.getTypesAnnotatedWith(RegisterWorldGenerator.class)) {
RegisterWorldGenerator annotation = generatorClass.getAnnotation(RegisterWorldGenerator.class);
Name moduleName = environment.getModuleProviding(generatorClass);
if (moduleName == null) {
throw new UnresolvedWorldGeneratorException("Cannot find module for world generator " + generatorClass);
throw new UnresolvedDependencyException("Cannot find module for world generator " + generatorClass);
}
SimpleUri generatorUri = new SimpleUri(moduleName, annotation.id());
if (generatorUri.equals(uri)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,9 @@
"water-reflections-ssr": "water-reflections-ssr",
"widget-selection-prompt": "widget-selection-prompt",
"widget-selection-title": "widget-selection-title",
"world-config-preview": "world-config-preview",
"world-configuration": "world-configuration",
"world-generator": "world-generator",
"world-name": "world-name",
"world-pre-generation": "world-pre-generation",
"world-seed": "world-seed",
"world-setup": "world-setup",
"catching-world": "catching-world",
"awaiting-character-spawn": "awaiting-character-spawn",
"ensuring-save-game-consistency": "ensuring-save-game-consistency",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,5 @@
"water-reflections-ssr": "SSR (تجريبي)",
"widget-selection-prompt": "Select the type of the widget:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "التفاصيل...",
"world-seed": "بذرة"
}
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,8 @@
"water-reflections-ssr": "SSR (experimentální)",
"widget-selection-prompt": "Vyber typ widgetu:",
"widget-selection-title": "Výběr Widgetu",
"world-config-preview": "Detaily...",
"world-configuration": "Nastavení světa",
"world-generator": "Generátor světa",
"world-pre-generation": "Předgenerace světa",
"world-seed": "Zdroj",
"world-setup": "Nastavení světa",
"catching-world": "Chytám svět...",
"awaiting-character-spawn": "Očekávám spawn postavy...",
"ensuring-save-game-consistency": "Zajišťuji konzistenci uložené hry",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@
"water-reflections-ssr": "SSR (experimentel)",
"widget-selection-prompt": "Bitte wähle ein Widget aus:",
"widget-selection-title": "Widget-Auswahl",
"world-config-preview": "Details ...",
"world-name": "Weltname",
"world-seed": "Seed"
}
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,9 @@
"water-reflections-ssr": "SSR (experimental)",
"widget-selection-prompt": "Select the type of the widget:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "Details...",
"world-configuration": "World Configuration",
"world-generator": "World Generator",
"world-name": "World Name",
"world-pre-generation": "World Pre-generation",
"world-seed": "Seed",
"world-setup": "World Setup",
"catching-world": "Catching World...",
"awaiting-character-spawn": "Awaiting Character Spawn...",
"ensuring-save-game-consistency": "Ensuring save game consistency",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,5 @@
"water-reflections-ssr": "SSR (experimental)",
"widget-selection-prompt": "Select the type of the widget:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "Detálles...",
"world-seed": "Semilla"
}
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,5 @@
"water-reflections-ssr": "SSR (experimental)",
"widget-selection-prompt": "انتخاب نوع عنصر",
"widget-selection-title": "انتخاب عنصر",
"world-config-preview": "جزییات...",
"world-seed": "دانه"
}
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,8 @@
"water-reflections-ssr": "SSR (expérimental)",
"widget-selection-prompt": "Sélectionner le type du widget :",
"widget-selection-title": "Sélection du widget",
"world-config-preview": "Détails...",
"world-configuration": "Configuration du monde",
"world-generator": "Générateur de monde",
"world-pre-generation": "Pré-génération du monde",
"world-seed": "Graine",
"world-setup": "Configuration du monde",
"catching-world": "Monde captivant ...",
"awaiting-character-spawn": "En attente de réapparition du personnage ...",
"ensuring-save-game-consistency": "Assurer la cohérence de la sauvegarde",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,5 @@
"water-reflections-ssr": "SSR (experimental)",
"widget-selection-prompt": "Select the type of the widget:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "Details...",
"world-seed": "Seed"
}
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,5 @@
"water-reflections-ssr": "एस.एस.आर (प्रयोगात्मक)",
"widget-selection-prompt": "विजेट के प्रकार का चयन करें:",
"widget-selection-title": "विजेट चयन",
"world-config-preview": "विवरण...",
"world-seed": "मूल"
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,5 @@
"water-reflections-ssr": "SSR (kísérleti)",
"widget-selection-prompt": "Válaszd ki a widget típusát:",
"widget-selection-title": "Widget Választás",
"world-config-preview": "Részletek...",
"world-seed": "world-seed"
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,5 @@
"water-reflections-ssr": "SSR (eksperimental)",
"widget-selection-prompt": "Pilih tipe widget:",
"widget-selection-title": "Pilihan widget",
"world-config-preview": "Detil...",
"world-seed": "Benih"
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,5 @@
"water-reflections-ssr": "SSR (sperimentale)",
"widget-selection-prompt": "Seleziona il tipo di widget:",
"widget-selection-title": "Selezione widget",
"world-config-preview": "Dettagli...",
"world-seed": "Seed"
}
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,8 @@
"water-reflections-ssr": "SSR(実験用)",
"widget-selection-prompt": "ウィジェットの種類を選択:",
"widget-selection-title": "ウィジェット・セレクション",
"world-config-preview": "ワールドのプレビュー",
"world-configuration": "ワールドの設定",
"world-generator": "ワールドの生成",
"world-pre-generation": "ワールドの生成前",
"world-seed": "シード",
"world-setup": "ワールドのセットアップ",
"catching-world": "ワールドをキャッシュ...",
"awaiting-character-spawn": "キャラクターのスポーン待ち...",
"ensuring-save-game-consistency": "保存したゲームの整合性を確認中",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,5 @@
"water-reflections-ssr": "SSR (실험적인)",
"widget-selection-prompt": "위젯 유형을 선택하십시오:",
"widget-selection-title": "위젯 선택",
"world-config-preview": "세부...",
"world-seed": "암호"
}
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,5 @@
"water-reflections-ssr": "SSR (Experimenteel)",
"widget-selection-prompt": "Selecteer het widget-type:",
"widget-selection-title": "Widget Selectie",
"world-config-preview": "Details...",
"world-seed": "Seed"
}
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,5 @@
"water-reflections-ssr": "SSR (eksperymentalne)",
"widget-selection-prompt": "Wybierz typ widżetu:",
"widget-selection-title": "Wybór widżetu",
"world-config-preview": "Szczegóły...",
"world-seed": "Ziarno"
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,5 @@
"water-reflections-ssr": "SSR (experimental)",
"widget-selection-prompt": "Select the type of the widget:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "Details...",
"world-seed": "Seed"
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@
"water-reflections-ssr": "SSR (experimental)",
"widget-selection-prompt": "Select the type of the widget:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "Detalhes...",
"world-seed": "Semente",
"catching-world": "Coletando Mundo..."
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,5 @@
"water-reflections-ssr": "SSR (experimental)",
"widget-selection-prompt": "Select the type of the widget:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "Detalii...",
"world-seed": "Seed"
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@
"water-reflections-ssr": "SSR (экспериментально)",
"widget-selection-prompt": "Выбери виджет:",
"widget-selection-title": "Выбор виджетов",
"world-config-preview": "Детали ...",
"world-seed": "Уникальный посев мира (Seed)",
"world-generator": "Генератор Мира"
}
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,8 @@
"water-reflections-ssr": "SSR (experimental)",
"widget-selection-prompt": "Zgjidhni llojin e widgetit:",
"widget-selection-title": "Përzgjedhja e Widgetit",
"world-config-preview": "Detajet...",
"world-configuration": "Konfigurimi i botës",
"world-generator": "Gjenerator Botëror",
"world-pre-generation": "Pre-Lindja Botëror",
"world-seed": "Farë",
"world-setup": "Rrëgullimi i botës",
"catching-world": "Të Kapim Botën...",
"awaiting-character-spawn": "Prisni Pjellja e Personazhit...",
"ensuring-save-game-consistency": "Garantimi i konsistencës në ruajten e lojrës",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,5 @@
"water-reflections-ssr": "SSR (experimentell)",
"widget-selection-prompt": "Select the type of the widget:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "Detaljer...",
"world-seed": "Frö"
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,5 @@
"water-reflections-ssr": "SSR (deneysel)",
"widget-selection-prompt": "Widget tipini seçiniz:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "Details...",
"world-seed": "Tohum"
}
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,9 @@
"water-reflections-ssr": "SSR (експериментальні)",
"widget-selection-prompt": "Виберіть тип віджету:",
"widget-selection-title": "Вибір типу віджету",
"world-config-preview": "Деталі...",
"world-configuration": "Конфігурація світу",
"world-generator": "Генератор світу",
"world-name": "Назва світу",
"world-pre-generation": "Попереднє генерування світу",
"world-seed": "Зерно (сід)",
"world-setup": "Налаштування світу",
"catching-world": "Кешую світ...",
"awaiting-character-spawn": "Чекаю на спаун персонажів...",
"ensuring-save-game-consistency": "Перевіряю збережені ігри...",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,5 @@
"water-reflections-ssr": "SSR (experimental)",
"widget-selection-prompt": "Select the type of the widget:",
"widget-selection-title": "Widget Selection",
"world-config-preview": "Details...",
"world-seed": "Seed"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "UILabel",
"id": "title",
"family": "title",
"text": "${engine:menu#world-pre-generation}",
"text": "${engine:menu#universe-setup}",
"layoutInfo": {
"height": 48,
"position-horizontal-center": {},
Expand Down Expand Up @@ -78,10 +78,6 @@
"type": "ColumnLayout",
"columns": 1,
"contents": [
{
"type": "UILabel",
"text": "${engine:menu#universe-setup-description}"
},
{
"type": "UILabel",
"text": "${engine:menu#game-world-generators}:",
Expand Down

0 comments on commit 30bc83a

Please sign in to comment.