Skip to content

Commit

Permalink
fixed #39
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Jan 26, 2023
1 parent 62dcefa commit fec4d63
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 100 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 8 additions & 1 deletion main/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -120,7 +121,13 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
}

afterEvaluate {
tasks.named<JavaExec>("runClient") {
if (Os.isFamily(Os.FAMILY_MAC)) {
jvmArgs = (jvmArgs ?: mutableListOf()) + "-XstartOnFirstThread"
}
}
}
publishing {
publications {
create<MavenPublication>("maven") {
Expand Down
2 changes: 1 addition & 1 deletion main/src/net/liplum/Meta.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
55 changes: 36 additions & 19 deletions main/src/net/liplum/holo/HoloUnitType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<ItemStack> = emptyArray()
@JvmField
var sacrificeLifeFunc: FUNC = { it * 15f }
@JvmField
var researchReq: Array<ItemStack> = emptyArray()

init {
//outlineColor = S.HologramDark
Expand All @@ -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
Expand Down
44 changes: 28 additions & 16 deletions main/src/net/liplum/holo/HoloWall.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.liplum.holo

import arc.Core
import arc.func.Prov
import arc.graphics.Color
import arc.graphics.Texture
Expand Down Expand Up @@ -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() }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
125 changes: 63 additions & 62 deletions main/src/net/liplum/registry/CioTechTree.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {}
}
}
}
Expand Down

0 comments on commit fec4d63

Please sign in to comment.