Skip to content

Commit

Permalink
inline modpack
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Dec 19, 2023
1 parent fc1167b commit db82f78
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
7 changes: 7 additions & 0 deletions TestProjectGroovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ runMindustry {
official version: "v146"
putDataAt "${buildDir}/customDataDir"
}
addClient("inline modpack") {
official version: "v146"
useModpack { it
it.testingUtilities
it.jvm repo: "liplum/CyberIO"
}
}
addClient {
// anonymous 2
fooClient tag: "v8.0.0", file: "erekir-client.jar"
Expand Down
7 changes: 7 additions & 0 deletions TestProjectKt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ runMindustry {
// anonymous 1
official(version = "v146")
}
addClient("inline modpack") {
official(version = "v146")
useModpack {
`testingUtilities`
jvm(repo = "liplum/CyberIO")
}
}
addClient("debugging") {
official(version = "v146")
useModpack(name = "for debugging")
Expand Down
2 changes: 1 addition & 1 deletion main/src/run/RunMindustry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ open class RunMindustryExtension(
* }
*/
inline fun addModpack(
name: String = "",
name: String = defaultModpackName,
config: AddModpackSpec.() -> Unit
): Modpack {
val (newName, isAnonymous) = allocModelName(name, modpacks)
Expand Down
21 changes: 21 additions & 0 deletions main/src/run/model/GameSide.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import io.github.liplum.dsl.plusAssign
import io.github.liplum.mindustry.LocalProperties.local
import io.github.liplum.mindustry.RunMindustryExtension.Companion.defaultModpackName
import io.github.liplum.mindustry.run.model.NamedModel
import org.gradle.api.Action
import org.gradle.api.Project
import java.io.File

Expand Down Expand Up @@ -104,6 +105,26 @@ abstract class AddGameSideSpec<T : GameSide> {
this.modpack = modpack.name
}

fun useModpack(
name: String = defaultModpackName,
config: AddModpackSpec.() -> Unit
) {
useModpack(proj.runMindustry.addModpack(name, config))
}

fun useModpack(
name: String,
config: Action<AddModpackSpec>
) {
useModpack(proj.runMindustry.addModpack(name, config))
}

fun useModpack(
config: Action<AddModpackSpec>
) {
useModpack(proj.runMindustry.addModpack(defaultModpackName, config))
}

protected fun IGameLoc.checkAndSet() {
if (backend.location != null) {
proj.logger.warn("The game is already set to ${backend.location}, and will be overridden by $this.")
Expand Down

0 comments on commit db82f78

Please sign in to comment.