From fec4d63fc61b6537a8bd566aa8389aa3da591072 Mon Sep 17 00:00:00 2001 From: Liplum Date: Thu, 26 Jan 2023 13:42:35 +0800 Subject: [PATCH] fixed #39 --- gradle.properties | 2 +- main/build.gradle.kts | 9 +- main/src/net/liplum/Meta.java | 2 +- main/src/net/liplum/holo/HoloUnitType.kt | 55 ++++++--- main/src/net/liplum/holo/HoloWall.kt | 44 ++++--- main/src/net/liplum/registry/CioTechTree.kt | 125 ++++++++++---------- 6 files changed, 137 insertions(+), 100 deletions(-) diff --git a/gradle.properties b/gradle.properties index b7f30052..64685359 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,6 @@ kotlin.code.style=official OpenGalPlumyVersion=v0.1.4 PlumyVersion=7597fd8bb8 -MKUtilsVersion=acb5b5b403 +MKUtilsVersion=6cbe6aafa5 OpenGalVersion=v0.4.3 mgpp.deploy.enableFatJar=false \ No newline at end of file diff --git a/main/build.gradle.kts b/main/build.gradle.kts index c6e20b20..17a2ffd1 100644 --- a/main/build.gradle.kts +++ b/main/build.gradle.kts @@ -5,6 +5,7 @@ import io.github.liplum.mindustry.importMindustry import io.github.liplum.mindustry.mindustry import io.github.liplum.mindustry.mindustryAssets import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.apache.tools.ant.taskdefs.condition.Os plugins { kotlin("jvm") @@ -120,7 +121,13 @@ java { targetCompatibility = JavaVersion.VERSION_1_8 withSourcesJar() } - +afterEvaluate { + tasks.named("runClient") { + if (Os.isFamily(Os.FAMILY_MAC)) { + jvmArgs = (jvmArgs ?: mutableListOf()) + "-XstartOnFirstThread" + } + } +} publishing { publications { create("maven") { diff --git a/main/src/net/liplum/Meta.java b/main/src/net/liplum/Meta.java index 90aaec25..7970f820 100644 --- a/main/src/net/liplum/Meta.java +++ b/main/src/net/liplum/Meta.java @@ -3,7 +3,7 @@ import net.liplum.update.Version2; public class Meta { - public static final boolean EnableDebug = false; + public static final boolean EnableDebug = true; public static final String ModID = "cyber-io"; public static final String Author = "Liplum"; public static final String Name = "Cyber IO"; diff --git a/main/src/net/liplum/holo/HoloUnitType.kt b/main/src/net/liplum/holo/HoloUnitType.kt index c52036fb..8d6d204c 100644 --- a/main/src/net/liplum/holo/HoloUnitType.kt +++ b/main/src/net/liplum/holo/HoloUnitType.kt @@ -52,22 +52,41 @@ import kotlin.math.min * Only support flying unit for now. */ open class HoloUnitType(name: String) : UnitType(name) { - @JvmField @ClientOnly var ColorOpacity = -1f - @JvmField @ClientOnly var HoloOpacity = -1f - @JvmField @ClientOnly var minAlpha = 0.15f - @JvmField var lose = 0.3f - @JvmField var loseMultiplierWhereMissing = 12f - @JvmField var lifespan = 120 * 60f - @JvmField var overageDmgFactor = 0.5f - @ClientOnly @JvmField var ruvikShootingTipTime = 30f - @ClientOnly @JvmField var ruvikTipRange = 100f - @ClientOnly @JvmField var enableRuvikTip = false - @JvmField var sacrificeCyberionAmount = 1f + @JvmField + @ClientOnly + var ColorOpacity = -1f + @JvmField + @ClientOnly + var HoloOpacity = -1f + @JvmField + @ClientOnly + var minAlpha = 0.15f + @JvmField + var lose = 0.3f + @JvmField + var loseMultiplierWhereMissing = 12f + @JvmField + var lifespan = 120 * 60f + @JvmField + var overageDmgFactor = 0.5f + @ClientOnly + @JvmField + var ruvikShootingTipTime = 30f + @ClientOnly + @JvmField + var ruvikTipRange = 100f + @ClientOnly + @JvmField + var enableRuvikTip = false + @JvmField + var sacrificeCyberionAmount = 1f /** * Cyber amount -> Lifetime (unit:tick) */ - @JvmField var sacrificeLifeFunc: FUNC = { it * 15f } - @JvmField var researchReq: Array = emptyArray() + @JvmField + var sacrificeLifeFunc: FUNC = { it * 15f } + @JvmField + var researchReq: Array = emptyArray() init { //outlineColor = S.HologramDark @@ -93,17 +112,15 @@ open class HoloUnitType(name: String) : UnitType(name) { super.loadIcon() val width = fullIcon.width val height = fullIcon.height - val maker = StackIconMaker(width, height) + val maker = StackIconBakery(width, height) val rawIcon = fullIcon val layers = listOf( - (PixmapRegionModelLayerFrom(rawIcon)){ - +PlainLayerProcessor() - }, - (PixmapRegionModelLayerFrom(rawIcon)){ + Layer(Core.atlas.getPixmap(rawIcon).toLayerBuffer()), + Layer(Core.atlas.getPixmap(rawIcon).toLayerBuffer()) { +TintLerpLayerProcessor(S.Hologram, Var.HoloUnitTintAlpha) } ) - val baked = maker.bake(layers).texture.toPixmap() + val baked = maker.bake(layers).createPixmap() val icon = TR(Texture(baked)) fullIcon = icon uiIcon = icon diff --git a/main/src/net/liplum/holo/HoloWall.kt b/main/src/net/liplum/holo/HoloWall.kt index 0c98c138..39bbaeb6 100644 --- a/main/src/net/liplum/holo/HoloWall.kt +++ b/main/src/net/liplum/holo/HoloWall.kt @@ -1,5 +1,6 @@ package net.liplum.holo +import arc.Core import arc.func.Prov import arc.graphics.Color import arc.graphics.Texture @@ -48,20 +49,31 @@ import plumy.texture.* import kotlin.math.max open class HoloWall(name: String) : Wall(name) { - @JvmField var restoreCharge: Tick = 10 * 60f - @ClientOnly @JvmField var ProjectorTR = EmptyTR - @ClientOnly @JvmField var ImageTR = EmptyTR - @JvmField var minHealthProportion = 0.05f - @ClientOnly @JvmField var floatingRange = 2f - @JvmField var needPower = false + @JvmField + var restoreCharge: Tick = 10 * 60f + @ClientOnly + @JvmField + var ProjectorTR = EmptyTR + @ClientOnly + @JvmField + var ImageTR = EmptyTR + @JvmField + var minHealthProportion = 0.05f + @ClientOnly + @JvmField + var floatingRange = 2f + @JvmField + var needPower = false /** * Used when [needPower] is true. */ - @JvmField var powerCapacity = 1000f + @JvmField + var powerCapacity = 1000f /** * Used when [needPower] is true. */ - @JvmField var powerUseForChargePreUnit = 0.1f + @JvmField + var powerUseForChargePreUnit = 0.1f init { buildType = Prov { HoloWallBuild() } @@ -101,16 +113,15 @@ open class HoloWall(name: String) : Wall(name) { override fun loadIcon() { val size = size * 32 - val maker = StackIconMaker(size, size) + val maker = StackIconBakery(size, size) val layers = listOf( - (PixmapRegionModelLayerFrom(ProjectorTR)){ - +PlainLayerProcessor() - }, - (PixmapRegionModelLayerFrom(ImageTR)){ + Layer(Core.atlas.getPixmap(ProjectorTR).toLayerBuffer()), + Layer(Core.atlas.getPixmap(ProjectorTR).toLayerBuffer()) { +TintLerpLayerProcessor(S.Hologram, Var.HoloWallTintAlpha) - } + + }, ) - val baked = maker.bake(layers).texture.toPixmap() + val baked = maker.bake(layers).createPixmap() val icon = TR(Texture(baked)) fullIcon = icon uiIcon = icon @@ -172,7 +183,8 @@ open class HoloWall(name: String) : Wall(name) { open var lastDamagedTime = restoreCharge override val minHealthProportion: Float get() = this@HoloWall.minHealthProportion - @ClientOnly @JvmField + @ClientOnly + @JvmField var floating: Floating = Floating(floatingRange).apply { clockwise = nextBoolean() randomPos() diff --git a/main/src/net/liplum/registry/CioTechTree.kt b/main/src/net/liplum/registry/CioTechTree.kt index 565f5a2a..05758716 100644 --- a/main/src/net/liplum/registry/CioTechTree.kt +++ b/main/src/net/liplum/registry/CioTechTree.kt @@ -4,6 +4,7 @@ import mindustry.content.Items.oxide import mindustry.content.Items.thorium import mindustry.content.Liquids.cryofluid import mindustry.content.Liquids.slag +import mindustry.content.Planets import net.liplum.ErekirSpec import net.liplum.Meta import net.liplum.VanillaSpec @@ -51,99 +52,99 @@ object CioTechTree { } fun loadSerpulo() { - CreateTechTree(ic, Meta.Name) { - node(icAssembler) { - node(cyberionMixer, cryofluid, thorium) { - node(stealth) { - node(jammer) + CreateTechTree(name = Meta.Name, origin = ic, planet = Planets.serpulo) { + icAssembler { + cyberionMixer(require = listOf(cryofluid, thorium)) { + stealth { + jammer {} } - node(holoProjector) { - node(holoMiner) { - node(holoSupporter) - node(holoArchitect) + holoProjector { + holoMiner { + holoSupporter {} + holoArchitect {} } - node(holoGuardian) { - node(holoFighter) + holoGuardian { + holoFighter {} } } } } - node(zipBomb) - node(eye) { - node(ear) { - node(heimdall) + zipBomb {} + eye { + ear { + heimdall {} } } - node(TMTRAINER) { - node(deleter) - node(prism) { - node(prismObelisk) + TMTRAINER { + deleter {} + prism { + prismObelisk {} } } - node(holoWall) { - node(holoWallLarge) + holoWall { + holoWallLarge {} } - node(sender) { - node(receiver) { - node(smartUnloader) - node(smartDistributor) + sender { + receiver { + smartUnloader {} + smartDistributor {} } } - node(p2pNode) { - node(streamClient) - node(streamHost, streamClient) - node(streamServer, streamClient) + p2pNode { + streamClient {} + streamHost(require = listOf(streamClient)) + streamServer(require = listOf(streamClient)) } - node(wirelessTower) { - node(underdriveProjector) + wirelessTower { + underdriveProjector {} } } } fun loadErekir() { - CreateTechTree(ic, Meta.Name) { - node(icAssembler) { - node(cyberionMixer, slag, oxide) { - node(stealth) { - node(jammer) + CreateTechTree(name = Meta.Name, origin = ic, planet = Planets.erekir) { + icAssembler { + cyberionMixer(require = listOf(slag, oxide)) { + stealth { + jammer {} } - node(holoProjector) { - node(holoFighter) - node(holoSupporter) - node(holoArchitect) - node(holoMiner) - node(holoGuardian) + holoProjector { + holoFighter {} + holoSupporter {} + holoArchitect {} + holoMiner {} + holoGuardian {} } } } - node(eye) { - node(ear) { - node(heimdall) + eye { + ear { + heimdall {} } } - node(zipBomb) { - node(TMTRAINER) - node(deleter) - node(prism) { - node(prismObelisk) + zipBomb { + TMTRAINER {} + deleter {} + prism { + prismObelisk {} } } - node(holoWall) { - node(holoWallLarge) + holoWall { + holoWallLarge {} } - node(sender) { - node(receiver) - node(smartDistributor) { - node(smartUnloader) + sender { + receiver {} + smartDistributor { + smartUnloader {} } } - node(p2pNode) { - node(streamHost) - node(streamClient) - node(streamServer, streamClient, streamHost) + p2pNode { + streamHost {} + streamClient {} + streamServer(require = listOf(streamClient, streamHost)) } - node(underdriveProjector) { - node(wirelessTower) + underdriveProjector { + wirelessTower {} } } }