Skip to content

"bound must be positive" crash if planetsConfig does not have an easyOnly, hardOnly, and non-specific planet #719

@Du4lity5151

Description

@Du4lity5151

What you were trying to do

Create a planetsConfig that only contains an easyOnly and hardOnly planet

What actually happened

The game crashes when continuing or starting a new game, with the error message showing "bound must be positive".

How to reproduce

Step 1: Navigate to DestinationSol\modules\core\assets\configs\planetsConfig.json and replace the word "easy" with "hard" in the following snippet, converting the only easy planet to a hard planet:

{ "rocky": { "easyOnly": true,

Step 2: Launch the game and start a new game

Game version

Commit 52b23c4

Log details

java.lang.IllegalArgumentException: bound must be positive
at java.base/java.util.Random.nextInt(Random.java:388)
at org.destinationsol.common.SolRandom.seededRandomInt(SolRandom.java:88)
at org.destinationsol.common.SolRandom.seededRandomInt(SolRandom.java:64)
at org.destinationsol.common.SolRandom.seededRandomElement(SolRandom.java:170)
at org.destinationsol.game.planet.PlanetConfigManager.getRandom(PlanetConfigManager.java:109)
at org.destinationsol.world.generators.PlanetGenerator.getPlanetConfigDefaultSettings(PlanetGenerator.java:78)
at org.destinationsol.world.generators.PlanetGeneratorImpl.build(PlanetGeneratorImpl.java:31)
at org.destinationsol.world.generators.SolarSystemGenerator.buildFeatureGenerators(SolarSystemGenerator.java:372)
at org.destinationsol.world.generators.SolarSystemGeneratorImpl.build(SolarSystemGeneratorImpl.java:59)
at org.destinationsol.world.GalaxyBuilder.buildSolarSystems(GalaxyBuilder.java:190)
at org.destinationsol.world.GalaxyBuilder.buildWithRandomSolarSystemGenerators(GalaxyBuilder.java:137)
at org.destinationsol.game.SolGame.startGame(SolGame.java:244)
at org.destinationsol.SolApplication.play(SolApplication.java:356)
at org.destinationsol.ui.nui.screens.mainMenu.LoadingScreen.update(LoadingScreen.java:49)
at org.destinationsol.ui.nui.NUIManager.update(NUIManager.java:275)
at org.destinationsol.SolApplication.update(SolApplication.java:264)
at org.destinationsol.SolApplication.safeUpdate(SolApplication.java:241)
at org.destinationsol.SolApplication.render(SolApplication.java:205)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:387)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:193)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.(Lwjgl3Application.java:167)
at org.destinationsol.desktop.SolDesktop.main(SolDesktop.java:138)

Operating System

Windows

Additional Info

Although this is not an issue with the core game, it limits modding flexibility and forces both systems to have two different types of planets each, with one of them being a shared type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions