Skip to content

Commit

Permalink
Scenario directory as a parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
hovi committed Dec 15, 2022
1 parent fcad213 commit 58e9c63
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions JvmClient/src/jvmMain/kotlin/environments/SeEnvironment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ fun CharacterObservation.toWorldModel(): WorldModel {
}
}

class SeEnvironment(
class SeEnvironment @JvmOverloads constructor(
val worldId: String,
val controller: ContextControllerWrapper,
val scenarioDir: String = DEFAULT_SCENARIO_DIR,
) : W3DEnvironment(), AutoCloseable {
val SCENARIO_DIR = "src/jvmTest/resources/game-saves/"

val context: SpaceEngineersTestContext = controller.context

Expand All @@ -93,7 +93,7 @@ class SeEnvironment(
}

override fun loadWorld() {
val scenario = File("$SCENARIO_DIR$worldId").absolutePath
val scenario = File("$scenarioDir$worldId").absolutePath
controller.session.loadScenario(scenario)
}

Expand Down Expand Up @@ -138,4 +138,8 @@ class SeEnvironment(
override fun close() {
controller.close()
}

companion object {
val DEFAULT_SCENARIO_DIR = "src/jvmTest/resources/game-saves/"
}
}

0 comments on commit 58e9c63

Please sign in to comment.