Skip to content

Commit

Permalink
Merge branch 'develop' into feature/java-17-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminAmos authored Nov 17, 2023
2 parents 4a0739f + 84228c1 commit 7ff993e
Show file tree
Hide file tree
Showing 17 changed files with 550 additions and 884 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fun moduleDependencyOrdering(modulesConfig: Configuration): List<String> {
// configurations.resolvedConfiguration is more straightforward if you just want all the artifacts,
// but using `.incoming` lets us turn on lenient mode as well as do more accurate filtering of local modules
val resolvable = modulesConfig.incoming
val artifactView = resolvable.artifactView {
resolvable.artifactView {
lenient(true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public GameManifest createGameManifest() {

gameManifest.setTitle(worldGenConfig.getWorldTitle());
gameManifest.setSeed(worldGenConfig.getDefaultSeed());
WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, worldGenConfig.getWorldTitle(), gameManifest.getSeed(),
WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, gameManifest.getSeed(),
(long) (WorldTime.DAY_LENGTH * WorldTime.NOON_OFFSET), worldGeneratorUri);
gameManifest.addWorld(worldInfo);
return gameManifest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
package org.terasology.engine.rendering.nui.layers.mainMenu;

import com.google.common.collect.Maps;
import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -13,16 +12,14 @@
import org.terasology.engine.game.GameManifest;
import org.terasology.engine.registry.In;
import org.terasology.engine.rendering.nui.layers.mainMenu.savedGames.GameProvider;
import org.terasology.engine.rendering.world.WorldSetupWrapper;
import org.terasology.engine.world.generator.WorldConfigurator;
import org.terasology.engine.world.generator.WorldGenerator;
import org.terasology.engine.world.internal.WorldInfo;
import org.terasology.engine.world.time.WorldTime;
import org.terasology.gestalt.entitysystem.component.Component;
import org.terasology.gestalt.module.Module;
import org.terasology.gestalt.module.dependencyresolution.DependencyResolver;
import org.terasology.gestalt.module.dependencyresolution.ResolutionResult;

import java.util.Map;

/**
* Generates new games manifest according to input data.
*/
Expand Down Expand Up @@ -67,30 +64,25 @@ public static GameManifest createGameManifest(final UniverseWrapper universeWrap

SimpleUri uri;
String seed;
WorldSetupWrapper worldSetup = universeWrapper.getTargetWorld();
if (worldSetup != null) {
uri = worldSetup.getWorldGenerator().getUri();
seed = worldSetup.getWorldGenerator().getWorldSeed();
WorldGenerator worldGenerator = universeWrapper.getWorldGenerator();
if (worldGenerator != null) {
uri = worldGenerator.getUri();
seed = worldGenerator.getWorldSeed();
} else {
uri = config.getWorldGeneration().getDefaultGenerator();
seed = universeWrapper.getSeed();
}
gameManifest.setSeed(seed);

String targetWorldName = "";
Map<String, Component> worldConfig = Maps.newHashMap();
if (worldSetup != null) {
targetWorldName = worldSetup.getWorldName().toString();
if (worldSetup.getWorldConfigurator() != null) {

// horrible hack to get configs into manifest.
// config driven by CreateWorldEntity.
// world config set somewhere else as well no clear drive from config --> world
gameManifest.setModuleConfigs(uri, worldSetup.getWorldConfigurator().getProperties());
}
WorldConfigurator worldConfigurator = universeWrapper.getWorldConfigurator();
if (worldConfigurator != null) {
// horrible hack to get configs into manifest.
// config driven by CreateWorldEntity.
// world config set somewhere else as well no clear drive from config --> world
gameManifest.setModuleConfigs(uri, worldConfigurator.getProperties());
}
// This is multiplied by the number of seconds in a day (86400000) to determine the exact millisecond at which the game will start.
WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, targetWorldName, seed,
WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, seed,
(long) (WorldTime.DAY_LENGTH * WorldTime.SUNRISE_OFFSET), uri);

gameManifest.addWorld(worldInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public String get() {
AdvancedGameSetupScreen advancedSetupGameScreen = getManager().createScreen(AdvancedGameSetupScreen.ASSET_URI, AdvancedGameSetupScreen.class);
WidgetUtil.trySubscribe(this, "advancedSetup", button -> {
universeWrapper.setGameName(gameName.getText());
advancedSetupGameScreen.setUniverseWrapper(universeWrapper);
advancedSetupGameScreen.setEnvironment(universeWrapper);
triggerForwardAnimation(advancedSetupGameScreen);
});

Expand Down Expand Up @@ -281,12 +281,10 @@ public void setUniverseWrapper(UniverseWrapper wrapper) {

@Override
public boolean onKeyEvent(NUIKeyEvent event) {
if (event.isDown() && event.getKey() == Keyboard.Key.ESCAPE) {
if (GameProvider.isSavesFolderEmpty()) {
// skip selectGameScreen and get back directly to main screen
getManager().pushScreen("engine:mainMenuScreen");
return true;
}
if (event.isDown() && event.getKey() == Keyboard.Key.ESCAPE && GameProvider.isSavesFolderEmpty()) {
// skip selectGameScreen and get back directly to main screen
getManager().pushScreen("engine:mainMenuScreen");
return true;
}
return super.onKeyEvent(event);
}
Expand Down
Loading

0 comments on commit 7ff993e

Please sign in to comment.