From e859bec4a926781420933efee78c30c463715be3 Mon Sep 17 00:00:00 2001 From: way-zer Date: Thu, 18 Jul 2024 18:01:49 +0800 Subject: [PATCH] =?UTF-8?q?SCRIPTS=20=E7=AE=80=E5=8C=96patch=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...001-BUILD-build.gradle.kts-and-clear.patch | 489 +-- patches/client/0003-CS-Version.patch | 116 +- patches/client/0004-API-Hooks.patch | 24 +- patches/client/0005-CS-Bundle-Extend.patch | 22 +- .../0006-S-update-TypeIO.writeRequest.patch | 8 +- .../0007-API-Add-LogicBlock.running.patch | 32 +- .../client/0008-API-add-SendPacketEvent.patch | 53 +- ...erties-bundles-block_colors.png-to-s.patch | 16 +- ...-add-Config.locale-for-localizedName.patch | 8 +- .../0011-API-add-LogicAssembledEvent.patch | 55 +- patches/client/0012-SC-Fix-6.patch | 8 +- patches/client/0013-C.patch | 16 +- patches/client/0014-API-Hooks-onHttp.patch | 16 +- patches/client/0015-API-RenderExt.patch | 48 +- ...etShow-showMineBeam-displayAllMessag.patch | 64 +- .../0017-C-RenderExt-arcChoiceUiIcon.patch | 111 +- .../0018-C-RenderExt-researchViewer.patch | 78 +- ...9-C-RenderExt-hiddenItemTransparency.patch | 92 +- .../0020-C-RenderExt-overdriveZone.patch | 48 +- patches/client/0021-C-StatusEffects.patch | 8 +- patches/client/0022-C-staticShield.patch | 24 +- patches/client/0023-C-StatExt.patch | 612 +--- .../0024-API-Hooks-onHandleSendMessage.patch | 32 +- patches/client/0025-F-InternalMods.patch | 8 +- patches/client/0026-C-InternalMods-claj.patch | 16 +- ...0027-C-RenderExt-showPlacementEffect.patch | 50 +- patches/client/0028-FC-TimeControl.patch | 8 +- patches/client/0029-BUILD-Kotlin-1.9.20.patch | 37 +- patches/client/0031-API-UIExt.patch | 8 +- .../0032-API-UIExt-TeamSelectDialog.patch | 15 +- patches/client/0035-BUILD-buildPlugins.patch | 35 +- patches/client/0037-C-ReplayController.patch | 47 +- patches/client/0038-API-VarsX.isLoader.patch | 8 +- patches/client/0039-UI-Settings.patch | 175 +- .../client/0040-ARC-bundle-and-settings.patch | 59 +- patches/client/0041-C-floatLabel.patch | 32 +- patches/client/0042-C-misc-patch.patch | 146 +- patches/client/0043-C-AutoUpdate.patch | 49 +- patches/client/0044-C-better-chatField.patch | 16 +- .../0045-C-fix-console-messages-order.patch | 8 +- patches/client/0046-ARC-setBars.patch | 263 +- patches/client/0047-BUILD-ci.patch | 5 +- patches/client/0048-FC.patch | 37 +- patches/client/0049-API-Hooks-pollKeys.patch | 16 +- .../client/0050-C-RenderExt-unitHide.patch | 56 +- ...xt-logicDisplayNoBorder-arcDrillMode.patch | 90 +- .../0052-CS-Building.updatePowerGraph.patch | 8 +- patches/client/0053-FC-MarkerType.patch | 55 +- ...4-C-no-MapPreviewLoader.setupLoaders.patch | 8 +- patches/client/0055-OSC-lambda.patch | 118 +- patches/client/0056-API-C-DebugUtil.patch | 64 +- .../0057-C-RenderExt-blockRenderLevel.patch | 112 +- patches/client/0058-C-JoinDialog-info.patch | 99 +- patches/client/0059-OC-Batch.patch | 72 +- patches/client/0060-C.patch | 34 +- .../client/0061-CS-PointDefenseWeapon.patch | 38 +- patches/client/0063-UI-Mod-Mod.patch | 239 +- patches/client/0064-C.patch | 23 +- patches/client/0065-UI-TeamsStatDisplay.patch | 19 +- ...UI-HudSettingsTable-AdvanceBuildTool.patch | 16 +- patches/client/0067-API-LogicExt.patch | 8 +- .../0068-API-LogicExt-limitUpdate.patch | 32 +- .../0069-FC-LogicExt-terrainSchematic.patch | 65 +- patches/client/0070-UI-AdvanceToolTable.patch | 16 +- .../client/0071-UI-ARC-AuxiliaryTools.patch | 40 +- patches/client/0072-C-Editor.patch | 171 +- patches/client/0073-ARC-arcScanMode.patch | 22 +- patches/client/0074-C.patch | 31 +- patches/client/0075-C.patch | 8 +- ...-SDL_SetHint-SDL_WINDOWS_DPI_SCALING.patch | 8 +- .../0077-C-RenderExt-massDriverLine.patch | 49 +- .../client/0078-C-RenderExt-drawBars.patch | 46 +- patches/client/0079-FC-Icon.patch | 8 +- patches/client/0081-PICK.patch | 43 +- ...I-UIExt-announce-and-sendChatMessage.patch | 27 +- ...0083-OC-no-bullet-create-when-hidden.patch | 16 +- .../0085-C-RenderExt-playerEffectColor.patch | 16 +- .../0086-API-add-PlayerTeamChangedEvent.patch | 19 +- .../client/0087-UI-ARC-logic-Support.patch | 284 +- patches/client/0088-ARC-merged.patch | 2702 +++-------------- patches/client/0089-BUILD-BE-release.patch | 18 +- scripts/applyPatches.sh | 4 +- scripts/genPatches.sh | 7 +- 83 files changed, 1212 insertions(+), 6497 deletions(-) diff --git a/patches/client/0001-BUILD-build.gradle.kts-and-clear.patch b/patches/client/0001-BUILD-build.gradle.kts-and-clear.patch index 39cfaebae716..e85921e18fd6 100644 --- a/patches/client/0001-BUILD-build.gradle.kts-and-clear.patch +++ b/patches/client/0001-BUILD-build.gradle.kts-and-clear.patch @@ -18,14 +18,14 @@ way-zer on 2024/6/9 gradle.properties | 2 + gradle/wrapper/gradle-wrapper.jar | Bin 59203 -> 43462 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- - gradlew | 282 +++++++++++------- + gradlew | 281 +++++++++++------- gradlew.bat | 35 ++- ios/build.gradle | 2 +- server/build.gradle | 44 +-- settings.gradle | 10 +- tools/build.gradle | 44 ++- tools/src/mindustry/tools/Generators.java | 2 +- - 19 files changed, 389 insertions(+), 611 deletions(-) + 19 files changed, 388 insertions(+), 611 deletions(-) create mode 100644 annotations/src/main/java/com/github/bsideup/jabel/Desugar.java create mode 100644 annotations/src/main/resources/META-INF/services/javax.annotation.processing.Processor delete mode 100644 core/build.gradle @@ -35,27 +35,15 @@ diff --git a/.gitignore b/.gitignore index dd3f2a0f065d3f774ea84fbc932e337160e4b307..7d91d3191096c431b739d2d5ecd951a764feead3 100644 --- a/.gitignore +++ b/.gitignore -@@ -28,6 +28,7 @@ saves/ - /core/assets-raw/fontgen/out/ - /core/assets-raw/fontgen/icons/ - /core/assets-raw/fontgen/icon_parts/ +@@ -30,0 +31 @@ saves/ +/core/assets-raw/packed/ - core/assets/saves/ - /core/assets/saves/ - steam_appid.txt -@@ -35,7 +36,6 @@ steam_appid.txt - /android/assets/mindustry-maps/ - /android/assets/mindustry-saves/ - /core/assets/gifexport/ +@@ -38 +38,0 @@ steam_appid.txt -/annotations/src/main/resources/META-INF/services - /core/assets/version.properties - /core/assets/locales - /core/assets/cache/ diff --git a/android/build.gradle b/android/build.gradle index f7f1ce377bb162249e8034db9ab712a75e96bc17..8b9676e3f124728d59ee80367d14f433853c0c40 100644 --- a/android/build.gradle +++ b/android/build.gradle -@@ -1,18 +1,19 @@ +@@ -1,7 +1,3 @@ -buildscript{ - repositories{ - mavenLocal() @@ -66,7 +54,7 @@ index f7f1ce377bb162249e8034db9ab712a75e96bc17..8b9676e3f124728d59ee80367d14f433 +plugins{ + id("com.android.application") version "8.3.1" +} - +@@ -9,2 +5,9 @@ buildscript{ - dependencies{ - classpath 'com.android.tools.build:gradle:7.2.1' +ext{ @@ -78,18 +66,10 @@ index f7f1ce377bb162249e8034db9ab712a75e96bc17..8b9676e3f124728d59ee80367d14f433 + def file = new File(rootDir, "local.properties") + def props = new Properties().with{ p -> p.load(file.newReader()); return p } + return props.get("sdk.dir") - } - } - +@@ -14,2 +16,0 @@ buildscript{ -apply plugin: "com.android.application" - - configurations{ natives } - - repositories{ -@@ -20,17 +21,10 @@ repositories{ - maven{ url "https://maven.google.com" } - } - +@@ -23,8 +23,0 @@ repositories{ -task deploy(type: Copy){ - dependsOn "assembleRelease" - @@ -98,66 +78,35 @@ index f7f1ce377bb162249e8034db9ab712a75e96bc17..8b9676e3f124728d59ee80367d14f433 - rename("android-release.apk", "${generateDeployName('android')}.apk") -} - - android{ +@@ -32,2 +25,3 @@ android{ - buildToolsVersion '33.0.2' - compileSdkVersion 33 + namespace = "com.github.tinylake.mindustryX" + buildToolsVersion = '33.0.2' + compileSdk = 33 - sourceSets{ - main{ - manifest.srcFile 'AndroidManifest.xml' -@@ -50,8 +44,6 @@ android{ - } - - defaultConfig{ +@@ -53,2 +46,0 @@ android{ - Properties props = loadVersionProps() - Integer vcode = props['androidBuildCode']?.toInteger() ?: 1 - def versionNameResult = "$versionNumber-$versionType-${getBuildVersion().replace(" ", "-")}" - - applicationId "io.anuke.mindustry" -@@ -59,12 +51,15 @@ android{ - targetSdkVersion 33 - - versionName versionNameResult +@@ -62 +54 @@ android{ - versionCode = vcode + versionCode = 1 - - if(project.hasProperty("release")){ +@@ -64,0 +57,3 @@ android{ + Properties props = loadVersionProps() + Integer vcode = props['androidBuildCode']?.toInteger() ?: 1 + versionCode = vcode - props['androidBuildCode'] = (vcode + 1).toString() +@@ -65,0 +61 @@ android{ + props.store(file('../core/assets/version.properties').newWriter(), null) - } +@@ -67 +62,0 @@ android{ - props.store(file('../core/assets/version.properties').newWriter(), null) - } - - compileOptions{ -@@ -72,7 +67,7 @@ android{ - targetCompatibility JavaVersion.VERSION_1_8 - } - +@@ -75 +70 @@ android{ - flavorDimensions "google" + flavorDimensions = ["google"] - - signingConfigs{ - release{ -@@ -119,8 +114,8 @@ dependencies{ - implementation arcModule("backends:backend-android") - implementation 'com.jakewharton.android.repackaged:dalvik-dx:9.0.0_r3' - +@@ -122,2 +117,2 @@ dependencies{ - natives "com.github.Anuken.Arc:natives-android:$arcHash" - natives "com.github.Anuken.Arc:natives-freetype-android:$arcHash" + natives arcModule("natives-android") + natives arcModule("natives-freetype-android") - - def version; - def highestVersion; -@@ -133,24 +128,25 @@ dependencies{ - if(sdkFile.exists()) compileOnly files(sdkFile.absolutePath) - } - +@@ -136,7 +131,3 @@ dependencies{ -task copyAndroidNatives(){ - configurations.natives.files.each{ jar -> - copy{ @@ -168,15 +117,12 @@ index f7f1ce377bb162249e8034db9ab712a75e96bc17..8b9676e3f124728d59ee80367d14f433 +tasks.register('copyAndroidNatives', Copy){ + from(configurations.natives.collect{ zipTree(it) }){ + exclude("META-INF/**") - } +@@ -143,0 +135 @@ task copyAndroidNatives(){ + into file("libs/") - } - +@@ -146 +138 @@ task copyAndroidNatives(){ -task run(type: Exec){ +tasks.register('run', Exec){ - commandLine "${findSdkDir()}/platform-tools/adb", 'shell', 'am', 'start', '-n', 'io.anuke.mindustry/mindustry.android.AndroidLauncher' - } - +@@ -150,5 +142,3 @@ task run(type: Exec){ -if(!project.ext.hasSprites()){ - tasks.whenTaskAdded{ task -> - if(task.name == 'assembleDebug' || task.name == 'assembleRelease'){ @@ -185,7 +131,7 @@ index f7f1ce377bb162249e8034db9ab712a75e96bc17..8b9676e3f124728d59ee80367d14f433 +tasks.configureEach{ task -> + if(task.name == 'mergeDebugAssets' || task.name == 'mergeReleaseAssets' || task.name == 'lintVitalAnalyzeRelease' || task.name == 'generateReleaseLintVitalReportModel'){ + task.dependsOn ":core:allAssets" - } +@@ -156 +146,7 @@ if(!project.ext.hasSprites()){ -} + if(task.name == 'mergeDebugJniLibFolders' || task.name == 'mergeReleaseJniLibFolders'){ + task.dependsOn "copyAndroidNatives" @@ -199,22 +145,14 @@ diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro index 368b7f4e1e14f4f6cd83f3390fb33899552235fc..7977507301e2bb020346409539c54f8c87e4b320 100644 --- a/android/proguard-rules.pro +++ b/android/proguard-rules.pro -@@ -3,9 +3,14 @@ - #these are essential packages that should not be "optimized" in any way - #the main purpose of d8 here is to shrink the absurdly-large google play games libraries - -keep class mindustry.** { *; } +@@ -5,0 +6 @@ +-keep class mindustryX.** { *; } - -keep class arc.** { *; } - -keep class net.jpountz.** { *; } - -keep class rhino.** { *; } - -keep class com.android.dex.** { *; } +@@ -9,0 +11,3 @@ +-keep class kotlin.** { *; } +-keep class org.jetbrains.annotations.** { *; } +-keep class org.intellij.lang.annotations.** { *; } - +@@ -10,0 +15 @@ +-dontwarn javax.naming.** - #-printusage out.txt -\ No newline at end of file diff --git a/annotations/src/main/java/com/github/bsideup/jabel/Desugar.java b/annotations/src/main/java/com/github/bsideup/jabel/Desugar.java new file mode 100644 index 0000000000000000000000000000000000000000..dcea5cdf03b366f9f59e20511dafee3601e15fb6 @@ -250,14 +188,10 @@ diff --git a/build.gradle b/build.gradle index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b63112d61 100644 --- a/build.gradle +++ b/build.gradle -@@ -7,22 +7,9 @@ buildscript{ - arcModule = { String name -> - //skip to last submodule - name = name.substring(name.lastIndexOf(':') + 1) +@@ -10 +10 @@ buildscript{ - return "com.github.Anuken${localArc ? "" : ".Arc"}:$name:$arcHash" + return "com.github.anuken${localArc ? "" : ".Arc"}:$name:$arcHash" - } - } +@@ -13,13 +12,0 @@ buildscript{ - - repositories{ - mavenLocal() @@ -271,13 +205,7 @@ index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b - classpath arcModule(":extensions:packer") - classpath arcModule(":arc-core") - } - } - - plugins{ -@@ -48,123 +35,10 @@ allprojects{ - return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p } - } - +@@ -51,36 +37,0 @@ allprojects{ - debugged = { - return new File(projectDir.parent, '../Mindustry-Debug').exists() && !project.hasProperty("release") && project.hasProperty("args") - } @@ -314,10 +242,7 @@ index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b - return "" - } - - getBuildVersion = { - if(!project.hasProperty("buildversion")) return "custom build" - return project.getProperties()["buildversion"] - } +@@ -91,77 +41,0 @@ allprojects{ - - getPackage = { - return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1) @@ -395,13 +320,7 @@ index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b - - processorFile.text = text.toString().replace(".java", "").replace("/", ".").replace("\\", ".") - } - } - - repositories{ -@@ -175,48 +49,30 @@ allprojects{ - maven{ url 'https://jitpack.io' } - } - +@@ -178,8 +51,0 @@ allprojects{ - task clearCache{ - doFirst{ - delete{ @@ -410,8 +329,7 @@ index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b - } - } - - tasks.withType(JavaCompile){ - targetCompatibility = 8 +@@ -188 +54,15 @@ allprojects{ - sourceCompatibility = JavaVersion.VERSION_17 + if(project.name == "annotations"){ + sourceCompatibility = 8 @@ -428,8 +346,7 @@ index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b + options.release = 8 + if(project.name == "core" || project.name == "annotations") + options.setFork(true) - options.encoding = "UTF-8" - options.compilerArgs += ["-Xlint:deprecation"] +@@ -191,20 +70,0 @@ allprojects{ - dependsOn clearCache - - options.forkOptions.jvmArgs += [ @@ -450,44 +367,20 @@ index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b - targetCompatibility = 8 - sourceCompatibility = 8 - options.fork = true - } - } - - //compile with java 8 compatibility for everything except the annotation project - configure(subprojects - project(":annotations")){ +@@ -216,4 +75,0 @@ configure(subprojects - project(":annotations")){ - tasks.withType(JavaCompile){ - options.compilerArgs.addAll(['--release', '8']) - } - - tasks.withType(Javadoc){ - options{ - addStringOption('Xdoclint:none', '-quiet') -@@ -226,11 +82,10 @@ configure(subprojects - project(":annotations")){ - } - } - +@@ -228,0 +85 @@ configure(subprojects - project(":annotations")){ +if(findProject("desktop")!=null) - project(":desktop"){ - apply plugin: "java" - +@@ -232,2 +88,0 @@ project(":desktop"){ - compileJava.options.fork = true - - dependencies{ - implementation project(":core") - implementation arcModule("extensions:discord") -@@ -238,8 +93,6 @@ project(":desktop"){ - implementation arcModule("natives:natives-desktop") - implementation arcModule("natives:natives-freetype-desktop") - +@@ -241,2 +95,0 @@ project(":desktop"){ - if(debugged()) implementation project(":debug") - - implementation "com.github.Anuken:steamworks4j:$steamworksVersion" - - implementation arcModule("backends:backend-sdl") -@@ -258,16 +111,6 @@ project(":core"){ - } - } - +@@ -261,10 +113,0 @@ project(":core"){ - compileJava.options.fork = true - - task preGen{ @@ -498,13 +391,7 @@ index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b - writePlugins() - } - - task copyChangelog{ - doLast{ - def props = loadVersionProps() -@@ -292,18 +135,6 @@ project(":core"){ - } - } - +@@ -295,12 +137,0 @@ project(":core"){ - task sourcesJar(type: Jar, dependsOn: classes){ - archiveClassifier = 'sources' - from sourceSets.main.allSource @@ -517,55 +404,27 @@ index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b - } - } - - task musicJar(type: Jar){ - archiveClassifier = 'music' - from files("assets"){ -@@ -312,8 +143,6 @@ project(":core"){ - } - - dependencies{ +@@ -315,2 +145,0 @@ project(":core"){ - compileJava.dependsOn(preGen) - - api "org.lz4:lz4-java:1.8.0" - api arcModule("arc-core") - api arcModule("extensions:flabel") -@@ -323,20 +152,18 @@ project(":core"){ - api arcModule("extensions:arcnet") - implementation arcModule("extensions:filedialogs") - api "com.github.Anuken:rhino:$rhinoVersion" +@@ -326 +154,0 @@ project(":core"){ - if(localArc && debugged()) api arcModule("extensions:recorder") - if(localArc) api arcModule(":extensions:packer") - +@@ -329 +157,3 @@ project(":core"){ - annotationProcessor 'com.github.Anuken:jabel:0.9.0' +// compileOnly 'com.github.bsideup.jabel:jabel-javac-plugin:0.4.2' + annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:0.4.2' +// annotationProcessor 'com.github.Anuken:jabel:0.9.0' - compileOnly project(":annotations") - if(!project.hasProperty("noKapt")) kapt project(":annotations") - } - - afterEvaluate{ - task mergedJavadoc(type: Javadoc){ +@@ -336,4 +166 @@ project(":core"){ - def blacklist = [project(":ios"), project(":desktop"), project(":server"), project(":annotations")] - if(findProject(":android") != null){ - blacklist += project(":android") - } + def blacklist = [project(":server"), project(":annotations"), findProject(":ios"), findProject(":desktop"), findProject(":android")] - - source rootProject.subprojects.collect{ project -> - if(!blacklist.contains(project) && project.hasProperty("sourceSets")){ -@@ -430,37 +257,11 @@ configure([":core", ":server"].collect{project(it)}){ - publications{ - maven(MavenPublication){ - from components.java +@@ -433,3 +259,0 @@ configure([":core", ":server"].collect{project(it)}){ - if(project.name == "core"){ - artifact(tasks.named("assetsJar")) - } - } - } - } - } - +@@ -441,23 +264,0 @@ configure([":core", ":server"].collect{project(it)}){ -task deployAll{ - task cleanDeployOutput{ - doFirst{ @@ -589,9 +448,6 @@ index 9bca8edb256e33ff341e5cae71c6b2922811a720..0cb5c6337c2d6a41243907d2c34c679b - } -} - - task resolveDependencies{ - doLast{ - rootProject.allprojects{ project -> diff --git a/core/build.gradle b/core/build.gradle deleted file mode 100644 index f7f291ef1ab71577313759a7e9fdfd3c1e0833dc..0000000000000000000000000000000000000000 @@ -670,31 +526,16 @@ diff --git a/desktop/build.gradle b/desktop/build.gradle index 7f4ecdcf0a6407ffce7181234527dc6cbc4d484b..ecb36e1a2a501040d3adee3203eacef2743e7764 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle -@@ -3,11 +3,6 @@ sourceSets.main.java.srcDirs = ["src/"] - project.ext.mainClassName = "mindustry.desktop.DesktopLauncher" - project.ext.assetsDir = new File("../core/assets") - +@@ -6,5 +5,0 @@ project.ext.assetsDir = new File("../core/assets") -def enableTemplates = true -def JDK_DIR = "$System.env.JDK_DIR" -def ICON_DIR = new File("$rootDir/core/assets/icons/icon.icns") -def platforms = ["Linux64", "Windows64", "Windows32", "MacOS"] - - task run(dependsOn: classes, type: JavaExec){ - mainClass = project.mainClassName - classpath = sourceSets.main.runtimeClasspath -@@ -44,7 +39,7 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.runtimeClasspath.collect{ it.isDirectory() ? it : zipTree(it) }} +@@ -47 +42 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ - from files(project.assetsDir) + from(files(tasks.getByPath(":core:allAssets"))) - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - - //don't include steam shared libraries unless necessary -@@ -57,157 +52,4 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ - manifest{ - attributes 'Main-Class': project.mainClassName - } +@@ -60,154 +55 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ -} - -if(!project.ext.hasSprites() && System.getenv("JITPACK") != "true"){ @@ -855,15 +696,9 @@ diff --git a/gradle.properties b/gradle.properties index 087025418f6b5419bcf23f6354c18f53a7eef0dc..f43e22ea642fe0dcd62cf970a518de025db65ea4 100644 --- a/gradle.properties +++ b/gradle.properties -@@ -21,6 +21,8 @@ kapt.include.compile.classpath=false - kotlin.stdlib.default.dependency=false - #needed for android compilation - android.useAndroidX=true +@@ -23,0 +24,2 @@ android.useAndroidX=true +# AGP 8 update +android.enableR8.fullMode=false - org.gradle.caching=true - #used for slow jitpack builds; TODO see if this actually works - org.gradle.internal.http.socketTimeout=100000 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..d64cd4917707c1f8861d8cb53dd15194d4248596 100644 GIT binary patch @@ -2653,33 +2488,22 @@ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wr index 3994438e229201828cf0e387c24a7c12d78b3972..a80b22ce5cffec8b48ee79b11c67945e91f99d5f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties -@@ -1,5 +1,7 @@ - distributionBase=GRADLE_USER_HOME - distributionPath=wrapper/dists +@@ -3 +3,3 @@ distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +networkTimeout=10000 +validateDistributionUrl=true - zipStoreBase=GRADLE_USER_HOME - zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e0826030965 100755 --- a/gradlew +++ b/gradlew -@@ -1,7 +1,7 @@ +@@ -1 +1 @@ -#!/usr/bin/env sh +#!/bin/sh - - # +@@ -4 +4 @@ -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. - # - # Licensed under the Apache License, Version 2.0 (the "License"); - # you may not use this file except in compliance with the License. -@@ -17,67 +17,99 @@ - # - - ############################################################################## +@@ -20,3 +20,43 @@ -## -## Gradle start up script for UN*X -## @@ -2726,11 +2550,7 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 +# +# You can find Gradle at https://github.com/gradle/gradle/. +# - ############################################################################## - - # Attempt to set APP_HOME -+ - # Resolve links: $0 may be a link +@@ -27,10 +68,13 @@ -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do @@ -2754,12 +2574,12 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac - done +@@ -38,4 +81,0 @@ done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - +@@ -43,5 +83,5 @@ cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - @@ -2770,29 +2590,16 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit - - # Use the maximum available, or set MAX_FD != -1 to use that value. +@@ -50 +90 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -MAX_FD="maximum" +MAX_FD=maximum - - warn () { - echo "$*" +@@ -54 +94 @@ warn () { -} +} >&2 - - die () { - echo - echo "$*" - echo - exit 1 +@@ -61 +101 @@ die () { -} +} >&2 - - # OS specific support (must be 'true' or 'false'). - cygwin=false - msys=false - darwin=false - nonstop=false +@@ -68,13 +108,5 @@ nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true @@ -2811,38 +2618,22 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; - esac - - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar -@@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables +@@ -90 +122 @@ if [ -n "$JAVA_HOME" ] ; then - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java - else +@@ -92 +124 @@ if [ -n "$JAVA_HOME" ] ; then - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME -@@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the - location of your Java installation." - fi - else +@@ -101,2 +133,4 @@ else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - - Please set the JAVA_HOME variable in your environment to match the - location of your Java installation." +@@ -105,0 +140 @@ location of your Java installation." + fi - fi - - # Increase the maximum file descriptors if we can. +@@ -109,13 +144,16 @@ fi -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then @@ -2872,8 +2663,7 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac - fi - +@@ -124,4 +162,7 @@ fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" @@ -2885,8 +2675,7 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - - # For Cygwin or MSYS, switch paths to Windows format before running java +@@ -130,18 +171,6 @@ fi -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` @@ -2911,7 +2700,7 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + - # Now convert the arguments - kludge to limit ourselves to /bin/sh +@@ -149,9 +178,10 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` @@ -2931,7 +2720,7 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) - fi +@@ -159 +189,9 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but @@ -2942,7 +2731,7 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg - done +@@ -161,12 +198,0 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; @@ -2955,15 +2744,14 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac - fi - +@@ -175,6 +200,0 @@ fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - +@@ -182,2 +202,46 @@ APP_ARGS=`save "$@"` -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @@ -3012,38 +2800,21 @@ index 4f906e0c811fc9e230eb44819f509cd0627f2600..1aa94a4269074199e6ed2c37e8db3e08 + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' - - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 107acd32c4e687021ef32db511e8a206129b88ec..25da30dbdeee93f6eaceea674c3b635de168ce06 100644 --- a/gradlew.bat +++ b/gradlew.bat -@@ -14,7 +14,7 @@ - @rem limitations under the License. - @rem - +@@ -17 +17 @@ -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off - @rem ########################################################################## - @rem - @rem Gradle startup script for Windows -@@ -25,7 +25,8 @@ - if "%OS%"=="Windows_NT" setlocal - - set DIRNAME=%~dp0 +@@ -28 +28,2 @@ set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused - set APP_BASE_NAME=%~n0 - set APP_HOME=%DIRNAME% - -@@ -40,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome - - set JAVA_EXE=java.exe - %JAVA_EXE% -version >NUL 2>&1 +@@ -43 +44 @@ set JAVA_EXE=java.exe -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute - +@@ -45,5 +46,5 @@ if "%ERRORLEVEL%" == "0" goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. @@ -3054,13 +2825,7 @@ index 107acd32c4e687021ef32db511e8a206129b88ec..25da30dbdeee93f6eaceea674c3b635d +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 - - goto fail - -@@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe - - if exist "%JAVA_EXE%" goto execute - +@@ -59,5 +60,5 @@ if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. @@ -3071,73 +2836,38 @@ index 107acd32c4e687021ef32db511e8a206129b88ec..25da30dbdeee93f6eaceea674c3b635d +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 - - goto fail - -@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - :end - @rem End local scope for the variables with windows NT shell +@@ -78 +79 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd - - :fail - rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of - rem the _cmd.exe /c_ return code! +@@ -83,2 +84,4 @@ rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% - - :mainEnd - if "%OS%"=="Windows_NT" endlocal diff --git a/ios/build.gradle b/ios/build.gradle index d0ec38f0a9c9f7d07c240a3d0c8c24bd0f6c1ebf..44d6d24b5b4d43514c8c5bf535bf707729361f97 100644 --- a/ios/build.gradle +++ b/ios/build.gradle -@@ -77,7 +77,7 @@ task deploy{ - } - - //must pack before deployment, as iOS never has the latest sprites. +@@ -80 +80 @@ task deploy{ -copyAssets.dependsOn ":tools:pack" +copyAssets.dependsOn ":core:allAssets" - copyAssets.dependsOn copyNatives - launchIPhoneSimulator.dependsOn build - launchIPadSimulator.dependsOn build diff --git a/server/build.gradle b/server/build.gradle index 7359fdac3cb101aec25a7be9e8b9813ed1afd547..badc019ded25d495a139efe134085184640eb500 100644 --- a/server/build.gradle +++ b/server/build.gradle -@@ -3,10 +3,6 @@ sourceSets.main.java.srcDirs = ["src/"] - project.ext.mainClassName = "mindustry.server.ServerLauncher" - project.ext.assetsDir = new File("../core/assets") - +@@ -6,4 +5,0 @@ project.ext.assetsDir = new File("../core/assets") -ext.getServerFolder = { - return "../deploy/${appName}-server-${getVersionString()}" -} - - task run(dependsOn: classes, type: JavaExec){ - mainClass = project.mainClassName - classpath = sourceSets.main.runtimeClasspath -@@ -31,10 +27,11 @@ task debug(dependsOn: classes, type: JavaExec){ - } - - task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ +@@ -33,0 +30 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ + dependsOn classes - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.runtimeClasspath.collect{ it.isDirectory() ? it : zipTree(it) }} +@@ -37 +34 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ - from files(project.assetsDir) + from files(tasks.getByPath(":core:allAssets")) - exclude("sprites/**") - exclude("music/**") - exclude("sounds/**") -@@ -51,40 +48,3 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ - attributes 'Main-Class': project.mainClassName - } - } +@@ -54,37 +50,0 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ - -task dzip(type: Zip){ - from getServerFolder() @@ -3179,7 +2909,7 @@ diff --git a/settings.gradle b/settings.gradle index b74305dad2bd47c96c697e92b902717e9b36b73e..17add3c489d87175c3ceb175b03cba0b3a22ee79 100644 --- a/settings.gradle +++ b/settings.gradle -@@ -1,8 +1,16 @@ +@@ -0,0 +1,7 @@ +pluginManagement { + repositories { + gradlePluginPortal() @@ -3187,21 +2917,15 @@ index b74305dad2bd47c96c697e92b902717e9b36b73e..17add3c489d87175c3ceb175b03cba0b + } +} + - if(JavaVersion.current().ordinal() < JavaVersion.VERSION_16.ordinal()){ - throw new Exception("!!! YOU MUST USE JAVA 16 OR ABOVE TO COMPILE AND RUN MINDUSTRY !!! Read the README. Your version: ${System.properties["java.version"]}") - } - +@@ -5 +12,2 @@ if(JavaVersion.current().ordinal() < JavaVersion.VERSION_16.ordinal()){ -include 'desktop', 'core', 'server', 'ios', 'annotations', 'tools', 'tests' +include 'core', 'server', 'annotations', 'tools', 'tests' +include 'desktop', 'ios' - - def hasSdk = System.getenv("ANDROID_HOME") != null - diff --git a/tools/build.gradle b/tools/build.gradle index b02926630256dec9f95c9e6eed2b35d0ea496db9..abe620bc87a2c455d6d170470111863d7c6b3395 100644 --- a/tools/build.gradle +++ b/tools/build.gradle -@@ -1,3 +1,13 @@ +@@ -0,0 +1,10 @@ +buildscript{ + repositories{ + maven{ url 'https://jitpack.io' } @@ -3212,13 +2936,7 @@ index b02926630256dec9f95c9e6eed2b35d0ea496db9..abe620bc87a2c455d6d170470111863d + } +} + - sourceSets.main.java.srcDirs = ["src/"] - - import arc.files.Fi -@@ -119,8 +129,11 @@ task tileImages(){ - } - } - +@@ -122,2 +132,5 @@ task tileImages(){ -task pack(dependsOn: [classes, configurations.runtimeClasspath]){ - +task doPack(){ @@ -3226,25 +2944,13 @@ index b02926630256dec9f95c9e6eed2b35d0ea496db9..abe620bc87a2c455d6d170470111863d + mustRunAfter(classes, configurations.runtimeClasspath) + inputs.dir("../core/assets-raw/sprites/") + outputs.dir("../core/assets-raw/packed") - doLast{ - //cleanup old sprites - delete{ -@@ -145,10 +158,7 @@ task pack(dependsOn: [classes, configurations.runtimeClasspath]){ - from "../core/assets-raw/sprites_out/ui/icons" - into "../core/assets-raw/sprites_out/ui/" - } +@@ -148,4 +161 @@ task pack(dependsOn: [classes, configurations.runtimeClasspath]){ - - delete{ - delete "../core/assets-raw/sprites_out/ui/icons" - } + delete("../core/assets-raw/sprites_out/ui/icons") - - if(enableAA){ - ExecutorService executor = Executors.newFixedThreadPool(OS.cores) -@@ -171,21 +181,25 @@ task pack(dependsOn: [classes, configurations.runtimeClasspath]){ - println("\n\nPacking normal 4096 sprites...\n\n") - - //pack normal sprites +@@ -174,8 +184 @@ task pack(dependsOn: [classes, configurations.runtimeClasspath]){ - TexturePacker.process(new File(rootDir, "core/assets-raw/sprites_out/").absolutePath, new File(rootDir, "core/assets/sprites/").absolutePath, "sprites.aatls") - - println("\n\nPacking fallback 2048 sprites...\n\n") @@ -3254,9 +2960,7 @@ index b02926630256dec9f95c9e6eed2b35d0ea496db9..abe620bc87a2c455d6d170470111863d - if(!file.isDirectory()) file.file.text = file.file.text.replace("4096", "2048") - } + TexturePacker.process(new File(rootDir, "core/assets-raw/sprites_out/").absolutePath, new File(rootDir, "core/assets-raw/packed").absolutePath, "sprites.aatls") - - //pack fallback 2048x2048 sprites - disabled when debugging - if(!project.hasProperty("args")){ +@@ -185 +188,7 @@ task pack(dependsOn: [classes, configurations.runtimeClasspath]){ - TexturePacker.process(new File(rootDir, "core/assets-raw/sprites_out/").absolutePath, new File(rootDir, "core/assets/sprites/fallback/").absolutePath, "sprites.aatls") + println("\n\nPacking fallback 2048 sprites...\n\n") + @@ -3265,27 +2969,16 @@ index b02926630256dec9f95c9e6eed2b35d0ea496db9..abe620bc87a2c455d6d170470111863d + if(!file.isDirectory()) file.file.text = file.file.text.replace("4096", "2048") + } + TexturePacker.process(new File(rootDir, "core/assets-raw/sprites_out/").absolutePath, new File(rootDir, "core/assets-raw/packed/fallback/").absolutePath, "sprites.aatls") - } - } - } +@@ -188,0 +198,5 @@ task pack(dependsOn: [classes, configurations.runtimeClasspath]){ +task pack(type: Copy){ + dependsOn(classes, configurations.runtimeClasspath) + destinationDir(new File(rootDir, "core/assets/sprites/")) + from(files(doPack)) +} - - task genSprites(dependsOn: classes, type: JavaExec){ - finalizedBy 'antialiasGen' diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index 108784fe478d349ae944eef423b709c7978e55ea..7ef8ce8d9b61ca9bdb764281a6306391a1e79902 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java -@@ -416,7 +416,7 @@ public class Generators{ - } - } - +@@ -419 +419 @@ public class Generators{ - save(colors, "../../../assets/sprites/block_colors"); + save(colors, "../../packed/block_colors"); - }); - - generate("shallows", () -> { diff --git a/patches/client/0003-CS-Version.patch b/patches/client/0003-CS-Version.patch index 09b2ec5b3d7b..8c9700d9c968 100644 --- a/patches/client/0003-CS-Version.patch +++ b/patches/client/0003-CS-Version.patch @@ -21,142 +21,75 @@ diff --git a/.gitignore b/.gitignore index 7d91d3191096c431b739d2d5ecd951a764feead3..ba271e6bd0dd06971fff6fa2314254149cc90087 100644 --- a/.gitignore +++ b/.gitignore -@@ -4,6 +4,7 @@ logs/ - /core/assets/mindustry-maps/ - /core/assets/bundles/output/ - /core/assets/.gifimages/ +@@ -6,0 +7 @@ logs/ +/core/assets/MindustryX.hjson - /deploy/ - /out/ - ios/libs/ diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 8cae20eee7a480cef6a14576fc72b096d38271e1..25602c4ab4070b7db9b31803c88281c7e4aa449e 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml -@@ -1,6 +1,5 @@ - +@@ -2,2 +2 @@ - + - - - diff --git a/android/build.gradle b/android/build.gradle index 8b9676e3f124728d59ee80367d14f433853c0c40..c39484bf6b00b8031b7ae8862cc172f8946f12cc 100644 --- a/android/build.gradle +++ b/android/build.gradle -@@ -18,7 +18,7 @@ configurations{ natives } - - repositories{ - mavenCentral() +@@ -21 +21 @@ repositories{ - maven{ url "https://maven.google.com" } + maven{ url "https://dl.google.com/dl/android/maven2/" } - } - - android{ -@@ -46,7 +46,7 @@ android{ - defaultConfig{ - def versionNameResult = "$versionNumber-$versionType-${getBuildVersion().replace(" ", "-")}" - +@@ -49 +49 @@ android{ - applicationId "io.anuke.mindustry" + applicationId "com.github.tinylake.mindustryX" - minSdkVersion 14 - targetSdkVersion 33 - diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml index d42ffe6d4a318ce558f1010eae46140f88ed5c99..bf44ead5c58abfb79c500e6daae30c3e7c322bed 100644 --- a/android/res/values/strings.xml +++ b/android/res/values/strings.xml -@@ -1,4 +1,4 @@ - - +@@ -3 +3 @@ - Mindustry + MindustryX - diff --git a/build.gradle b/build.gradle index 0cb5c6337c2d6a41243907d2c34c679b63112d61..fb6808e41d2fbff78c81f3904d01eb4e8e413492 100644 --- a/build.gradle +++ b/build.gradle -@@ -21,12 +21,12 @@ allprojects{ - apply plugin: 'maven-publish' - - version = project.hasProperty("packageVersion") ? project.getProperty("packageVersion") : 'release' +@@ -24 +24 @@ allprojects{ - group = 'com.github.Anuken' + group = 'cf.wayzer.MindustryX' - - ext{ - versionNumber = '7' - if(!project.hasProperty("versionModifier")) versionModifier = 'release' +@@ -29 +29 @@ allprojects{ - if(!project.hasProperty("versionType")) versionType = 'official' + if(!project.hasProperty("versionType")) versionType = 'MindustryX' - appName = 'Mindustry' - steamworksVersion = '0b86023401880bb5e586bc404bedbaae9b1f1c94' - rhinoVersion = '73a812444ac388ac2d94013b5cadc8f70b7ea027' diff --git a/core/build.gradle.kts b/core/build.gradle.kts index e2a6d4ede97677940bc6b73de42f6f5ff71fc0be..9d9d170c1fb00fbd4bf35c1a2f04bcff6dca09cf 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts -@@ -46,7 +46,7 @@ tasks{ - property("type", findProperty("versionType") ?: "official") - property("modifier", findProperty("versionModifier") ?: "release") - property("number", '7') +@@ -49 +49 @@ tasks{ - property("build", findProperty("buildversion") ?: "custom build") + property("build", findProperty("upstreamBuild") ?: "custom build") - } - processResources.configure { - dependsOn(generateLocales, generateBasePartNames, writeVersion) diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java index bc4c6a494aec88af73f001906598ba91a50ac6a3..d08d04a6f0e8107cec995876b2072c46aa85b3c2 100644 --- a/core/src/mindustry/Vars.java +++ b/core/src/mindustry/Vars.java -@@ -77,7 +77,7 @@ public class Vars implements Loadable{ - //TODO merge with v6 list upon release - public static final String serverJsonURL = "https://raw.githubusercontent.com/Anuken/Mindustry/master/servers_v7.json"; - /** URL of the github issue report template.*/ +@@ -80 +80 @@ public class Vars implements Loadable{ - public static final String reportIssueURL = "https://github.com/Anuken/Mindustry/issues/new?labels=bug&template=bug_report.md"; + public static final String reportIssueURL = "https://github.com/TinyLake/MindustryX/issues/new?labels=bug&template=bug_report.md"; - /** list of built-in servers.*/ - public static final Seq defaultServers = Seq.with(); - /** maximum size of any block, do not change unless you know what you're doing */ diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java index 8171a89797a0d1cb29fb50364a94b6d3130698ae..6b05845bad6eb3862dea511563e099085d15b479 100644 --- a/core/src/mindustry/core/NetClient.java +++ b/core/src/mindustry/core/NetClient.java -@@ -135,6 +135,8 @@ public class NetClient implements ApplicationListener{ - Log.info("Received world data: @ bytes.", data.stream.available()); - NetworkIO.loadWorld(new InflaterInputStream(data.stream)); - +@@ -137,0 +138,2 @@ public class NetClient implements ApplicationListener{ + Call.serverPacketReliable("ARC", Version.mdtXBuild); + Call.serverPacketReliable("MDTX", Version.mdtXBuild); - finishConnecting(); - }); - } diff --git a/core/src/mindustry/core/Version.java b/core/src/mindustry/core/Version.java index 73bbd59416cc8e1b64bcb5538fdd73886a455451..8698103654e40dd4e85451e1020563ca562ed2d2 100644 --- a/core/src/mindustry/core/Version.java +++ b/core/src/mindustry/core/Version.java -@@ -6,6 +6,8 @@ import arc.files.*; - import arc.struct.*; - import arc.util.*; - import arc.util.io.*; +@@ -8,0 +9,2 @@ import arc.util.io.*; +import arc.util.serialization.*; +import mindustryX.*; - - public class Version{ - /** Build type. 'official' for official releases; 'custom' or 'bleeding edge' are also used. */ -@@ -20,6 +22,8 @@ public class Version{ - public static int revision = 0; - /** Whether version loading is enabled. */ - public static boolean enabled = true; +@@ -22,0 +25,2 @@ public class Version{ + @MindustryXApi + public static String mdtXBuild; - - public static void init(){ - if(!enabled) return; -@@ -44,6 +48,15 @@ public class Version{ - }else{ - build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1; - } +@@ -46,0 +51,9 @@ public class Version{ + //MDTX: mdtXBuild + if(Core.files == null) return; + try{ @@ -166,39 +99,22 @@ index 73bbd59416cc8e1b64bcb5538fdd73886a455451..8698103654e40dd4e85451e1020563ca + e.printStackTrace(); + mdtXBuild = "custom build"; + } - } - - /** @return whether the current game version is greater than the specified version string, e.g. "120.1"*/ -@@ -73,6 +86,7 @@ public class Version{ - if(build == -1){ - return "custom build"; - } +@@ -76 +89,2 @@ public class Version{ - return (type.equals("official") ? modifier : type) + " build " + build + (revision == 0 ? "" : "." + revision); + return (type.equals("official") ? modifier : type) + " build " + build + (revision == 0 ? "" : "." + revision) + + "\nMindustryX " + mdtXBuild; - } - } diff --git a/core/src/mindustry/net/NetworkIO.java b/core/src/mindustry/net/NetworkIO.java index 48599c6b96474117057e7ca2b87b545873a0ea31..4366eeef830845fb13132a0ae3534129b7a859dc 100644 --- a/core/src/mindustry/net/NetworkIO.java +++ b/core/src/mindustry/net/NetworkIO.java -@@ -107,7 +107,7 @@ public class NetworkIO{ - buffer.putInt(Core.settings.getInt("totalPlayers", Groups.player.size())); - buffer.putInt(state.wave); - buffer.putInt(Version.build); +@@ -110 +110 @@ public class NetworkIO{ - writeString(buffer, Version.type); + writeString(buffer, "MindustryX"); - - buffer.put((byte)state.rules.mode().ordinal()); - buffer.putInt(netServer.admins.getPlayerLimit()); diff --git a/gradle.properties b/gradle.properties index f43e22ea642fe0dcd62cf970a518de025db65ea4..b1921b8ac0d8d0ca7ac86e4d551a694d1ae38ed9 100644 --- a/gradle.properties +++ b/gradle.properties -@@ -28,3 +28,5 @@ org.gradle.caching=true - org.gradle.internal.http.socketTimeout=100000 - org.gradle.internal.http.connectionTimeout=100000 - archash=7d6e89dffd +@@ -30,0 +31,2 @@ archash=7d6e89dffd + +upstreamBuild=25087 \ No newline at end of file diff --git a/patches/client/0004-API-Hooks.patch b/patches/client/0004-API-Hooks.patch index 28c8f072ad23..ee2684685de0 100644 --- a/patches/client/0004-API-Hooks.patch +++ b/patches/client/0004-API-Hooks.patch @@ -15,26 +15,14 @@ diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientL index 2a7b133588279145272136f6aa2a02276f34d824..fa6e5c5b52cfdb83de5b50539d57c579aa6e0c95 100644 --- a/core/src/mindustry/ClientLauncher.java +++ b/core/src/mindustry/ClientLauncher.java -@@ -171,6 +171,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform - add(ui = new UI()); - add(netServer = new NetServer()); - add(netClient = new NetClient()); +@@ -173,0 +174 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform + add(new mindustryX.Hooks()); - - assets.load(schematics); - diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java index d08d04a6f0e8107cec995876b2072c46aa85b3c2..793c1759060a5e28e1df276bae2fdcf23f78284e 100644 --- a/core/src/mindustry/Vars.java +++ b/core/src/mindustry/Vars.java -@@ -269,6 +269,7 @@ public class Vars implements Loadable{ - } - - public static void init(){ +@@ -271,0 +272 @@ public class Vars implements Loadable{ + mindustryX.Hooks.beforeInit(); - Groups.init(); - - if(loadLocales){ diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java new file mode 100644 index 0000000000000000000000000000000000000000..499a9f3403c6769288ad44e7fb4a68ffb36bc591 @@ -62,11 +50,5 @@ diff --git a/server/src/mindustry/server/ServerLauncher.java b/server/src/mindus index 1aea11b2cc877ef9a35280575e6419d9fab16f01..1799c999b2affdc0de392841212edc1f544e4751 100644 --- a/server/src/mindustry/server/ServerLauncher.java +++ b/server/src/mindustry/server/ServerLauncher.java -@@ -76,6 +76,7 @@ public class ServerLauncher implements ApplicationListener{ - Core.app.addListener(netServer = new NetServer()); - Core.app.addListener(new ServerControl(args)); - Core.app.addListener(new ApplicationListener(){public void update(){ asyncCore.end(); }}); +@@ -78,0 +79 @@ public class ServerLauncher implements ApplicationListener{ + Core.app.addListener(new mindustryX.Hooks()); - - mods.eachClass(Mod::init); - diff --git a/patches/client/0005-CS-Bundle-Extend.patch b/patches/client/0005-CS-Bundle-Extend.patch index 946579f2608d..e7eb79fc648d 100644 --- a/patches/client/0005-CS-Bundle-Extend.patch +++ b/patches/client/0005-CS-Bundle-Extend.patch @@ -16,27 +16,14 @@ diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java index 499a9f3403c6769288ad44e7fb4a68ffb36bc591..ca6144798666f96ee074838e489b51df1a10d19d 100644 --- a/core/src/mindustryX/Hooks.java +++ b/core/src/mindustryX/Hooks.java -@@ -1,12 +1,16 @@ - package mindustryX; - - import arc.*; +@@ -3,0 +4 @@ import arc.*; +import arc.files.*; - import arc.util.*; - +@@ -5,0 +7,2 @@ import arc.util.*; +import java.util.*; + - public class Hooks implements ApplicationListener{ - /** invoke before `Vars.init`. Note that may be executed from `Vars.loadAsync` */ - public static void beforeInit(){ - Log.infoTag("MindustryX", "Hooks.beforeInit"); +@@ -9,0 +13 @@ public class Hooks implements ApplicationListener{ + registerBundle(); - } - - /** invoke after loading, just before `Mod::init` */ -@@ -14,4 +18,22 @@ public class Hooks implements ApplicationListener{ - public void init(){ - Log.infoTag("MindustryX", "Hooks.init"); - } +@@ -16,0 +21,18 @@ public class Hooks implements ApplicationListener{ + + private static void registerBundle(){ + //MDTX: bundle overwrite @@ -55,4 +42,3 @@ index 499a9f3403c6769288ad44e7fb4a68ffb36bc591..ca6144798666f96ee074838e489b51df + Log.err(e); + } + } - } diff --git a/patches/client/0006-S-update-TypeIO.writeRequest.patch b/patches/client/0006-S-update-TypeIO.writeRequest.patch index 1689dd4ddb7c..ca1274957391 100644 --- a/patches/client/0006-S-update-TypeIO.writeRequest.patch +++ b/patches/client/0006-S-update-TypeIO.writeRequest.patch @@ -11,15 +11,9 @@ diff --git a/core/src/mindustry/io/TypeIO.java b/core/src/mindustry/io/TypeIO.ja index 70d1543c366b4eeef80c67f4eaeb05643c93451e..fe9682663342ccd1f3537cf82ea4c74996655440 100644 --- a/core/src/mindustry/io/TypeIO.java +++ b/core/src/mindustry/io/TypeIO.java -@@ -414,8 +414,9 @@ public class TypeIO{ - if(!plan.breaking){ - write.s(plan.block.id); - write.b((byte)plan.rotation); +@@ -417,2 +417,3 @@ public class TypeIO{ - write.b(1); //always has config - writeObject(write, plan.config); + boolean writePlan = !headless || !net.server(); + write.b(writePlan ? 1 : 0); //always has config + writeObject(write, writePlan ? plan.config : null); - } - } - diff --git a/patches/client/0007-API-Add-LogicBlock.running.patch b/patches/client/0007-API-Add-LogicBlock.running.patch index 6949354ad4a5..9230a0d5c24d 100644 --- a/patches/client/0007-API-Add-LogicBlock.running.patch +++ b/patches/client/0007-API-Add-LogicBlock.running.patch @@ -11,36 +11,12 @@ diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mi index 655cf48e4f974d2e05cdca66deb361f1ee9f65bf..6f4d08ac40d461d0c41dbb292866add7565ed784 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java -@@ -24,6 +24,7 @@ import mindustry.ui.*; - import mindustry.world.*; - import mindustry.world.blocks.ConstructBlock.*; - import mindustry.world.meta.*; +@@ -26,0 +27 @@ import mindustry.world.meta.*; +import mindustryX.*; - - import java.io.*; - import java.util.zip.*; -@@ -31,6 +32,8 @@ import java.util.zip.*; - import static mindustry.Vars.*; - - public class LogicBlock extends Block{ +@@ -33,0 +35,2 @@ public class LogicBlock extends Block{ + @MindustryXApi + public static boolean running = false; - private static final int maxByteLen = 1024 * 100; - public static final int maxNameLength = 32; - -@@ -531,6 +534,7 @@ public class LogicBlock extends Block{ - - if(accumulator > maxInstructionScale * ipt) accumulator = maxInstructionScale * ipt; - +@@ -533,0 +537 @@ public class LogicBlock extends Block{ + running = true; - for(int i = 0; i < (int)accumulator; i++){ - executor.runOnce(); - accumulator --; -@@ -539,6 +543,7 @@ public class LogicBlock extends Block{ - break; - } - } +@@ -541,0 +546 @@ public class LogicBlock extends Block{ + running = false; - } - } - diff --git a/patches/client/0008-API-add-SendPacketEvent.patch b/patches/client/0008-API-add-SendPacketEvent.patch index 6f6a1db0b57d..6a94b3ec6bae 100644 --- a/patches/client/0008-API-add-SendPacketEvent.patch +++ b/patches/client/0008-API-add-SendPacketEvent.patch @@ -14,64 +14,27 @@ diff --git a/core/src/mindustry/net/ArcNetProvider.java b/core/src/mindustry/net index e7a1a33dd6b4a523900d841d08246d0383ce2f30..23e8b294d646f2835750a1b085ae826032c3c627 100644 --- a/core/src/mindustry/net/ArcNetProvider.java +++ b/core/src/mindustry/net/ArcNetProvider.java -@@ -16,6 +16,7 @@ import mindustry.game.EventType.*; - import mindustry.net.Administration.*; - import mindustry.net.Net.*; - import mindustry.net.Packets.*; +@@ -18,0 +19 @@ import mindustry.net.Packets.*; +import mindustryX.events.*; - import net.jpountz.lz4.*; - - import java.io.*; -@@ -335,6 +336,7 @@ public class ArcNetProvider implements NetProvider{ - - @Override - public void sendStream(Streamable stream){ +@@ -337,0 +339 @@ public class ArcNetProvider implements NetProvider{ + if(SendPacketEvent.emit(this, null, stream)) return; - connection.addListener(new InputStreamSender(stream.stream, 1024){ - int id; - -@@ -360,6 +362,7 @@ public class ArcNetProvider implements NetProvider{ - - @Override - public void send(Object object, boolean reliable){ +@@ -362,0 +365 @@ public class ArcNetProvider implements NetProvider{ + if(SendPacketEvent.emit(this, null, object)) return; - try{ - if(reliable){ - connection.sendTCP(object); diff --git a/core/src/mindustry/net/Net.java b/core/src/mindustry/net/Net.java index 145238bf8856c7b83da468b89362c3d1df5d5928..7db098b1985ea7df7516f43ab4b0c49f05c723fa 100644 --- a/core/src/mindustry/net/Net.java +++ b/core/src/mindustry/net/Net.java -@@ -10,6 +10,7 @@ import mindustry.game.EventType.*; - import mindustry.gen.*; - import mindustry.net.Packets.*; - import mindustry.net.Streamable.*; +@@ -12,0 +13 @@ import mindustry.net.Streamable.*; +import mindustryX.events.*; - import net.jpountz.lz4.*; - - import java.io.*; -@@ -223,8 +224,10 @@ public class Net{ - - /** Send an object to all connected clients, or to the server if this is a client.*/ - public void send(Object object, boolean reliable){ +@@ -225,0 +227 @@ public class Net{ + if(SendPacketEvent.emit(null, null, object)) return; - if(server){ - for(NetConnection con : provider.getConnections()){ +@@ -227,0 +230 @@ public class Net{ + if(!con.hasBegunConnecting) continue; - con.send(object, reliable); - } - }else{ -@@ -234,8 +237,9 @@ public class Net{ - - /** Send an object to everyone EXCEPT a certain client. Server-side only.*/ - public void sendExcept(NetConnection except, Object object, boolean reliable){ +@@ -236,0 +240 @@ public class Net{ + if(SendPacketEvent.emit(null, except, object)) return; - for(NetConnection con : getConnections()){ +@@ -238 +242 @@ public class Net{ - if(con != except){ + if(con != except && con.hasBegunConnecting){ - con.send(object, reliable); - } - } diff --git a/core/src/mindustryX/events/SendPacketEvent.java b/core/src/mindustryX/events/SendPacketEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..11e0817d8d2f2fc95cb40027660372f6662b9b6b diff --git a/patches/client/0009-S-Add-icons.properties-bundles-block_colors.png-to-s.patch b/patches/client/0009-S-Add-icons.properties-bundles-block_colors.png-to-s.patch index 0f7ba8b38393..a20d81a55701 100644 --- a/patches/client/0009-S-Add-icons.properties-bundles-block_colors.png-to-s.patch +++ b/patches/client/0009-S-Add-icons.properties-bundles-block_colors.png-to-s.patch @@ -13,10 +13,7 @@ diff --git a/server/build.gradle b/server/build.gradle index badc019ded25d495a139efe134085184640eb500..f212b7bf9d8a3e46179ba62d8987fcb15efa5568 100644 --- a/server/build.gradle +++ b/server/build.gradle -@@ -31,18 +31,18 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ - from files(sourceSets.main.output.classesDirs) - from files(sourceSets.main.output.resourcesDir) - from {configurations.runtimeClasspath.collect{ it.isDirectory() ? it : zipTree(it) }} +@@ -34,12 +34,12 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){ - from files(tasks.getByPath(":core:allAssets")) - exclude("sprites/**") - exclude("music/**") @@ -41,19 +38,10 @@ index badc019ded25d495a139efe134085184640eb500..f212b7bf9d8a3e46179ba62d8987fcb1 + include "locales" + include "*.*" + } - - manifest{ - attributes 'Main-Class': project.mainClassName diff --git a/server/src/mindustry/server/ServerLauncher.java b/server/src/mindustry/server/ServerLauncher.java index 1799c999b2affdc0de392841212edc1f544e4751..81683e05cc3f38d943ae94f00621da01e09a1f31 100644 --- a/server/src/mindustry/server/ServerLauncher.java +++ b/server/src/mindustry/server/ServerLauncher.java -@@ -41,7 +41,7 @@ public class ServerLauncher implements ApplicationListener{ - @Override - public void init(){ - Core.settings.setDataDirectory(Core.files.local("config")); +@@ -44 +44 @@ public class ServerLauncher implements ApplicationListener{ - loadLocales = false; +// loadLocales = false; - headless = true; - - Vars.loadSettings(); diff --git a/patches/client/0010-S-add-Config.locale-for-localizedName.patch b/patches/client/0010-S-add-Config.locale-for-localizedName.patch index 56455b5fd363..6fabb9dc0c0d 100644 --- a/patches/client/0010-S-add-Config.locale-for-localizedName.patch +++ b/patches/client/0010-S-add-Config.locale-for-localizedName.patch @@ -11,11 +11,5 @@ diff --git a/core/src/mindustry/net/Administration.java b/core/src/mindustry/net index da453afaa53fd7cc72e073baedb29da31e705bb9..6e17790494961f306260d2b521ce2add39642d93 100644 --- a/core/src/mindustry/net/Administration.java +++ b/core/src/mindustry/net/Administration.java -@@ -488,6 +488,7 @@ public class Administration{ - serverName = new Config("name", "The server name as displayed on clients.", "Server", "servername"), - desc = new Config("desc", "The server description, displayed under the name. Max 100 characters.", "off"), - port = new Config("port", "The port to host on.", Vars.port), +@@ -490,0 +491 @@ public class Administration{ + locale = new Config("locale", "The locale for localizedName.", "default", "locale"), - autoUpdate = new Config("autoUpdate", "Whether to auto-update and exit when a new bleeding-edge update arrives.", false), - showConnectMessages = new Config("showConnectMessages", "Whether to display connect/disconnect messages.", true), - enableVotekick = new Config("enableVotekick", "Whether votekick is enabled.", true), diff --git a/patches/client/0011-API-add-LogicAssembledEvent.patch b/patches/client/0011-API-add-LogicAssembledEvent.patch index cee967d3835e..bab79b33d5f5 100644 --- a/patches/client/0011-API-add-LogicAssembledEvent.patch +++ b/patches/client/0011-API-add-LogicAssembledEvent.patch @@ -15,40 +15,19 @@ diff --git a/core/src/mindustry/logic/LParser.java b/core/src/mindustry/logic/LP index 6f65e9981f2291d1c892c23f3ec8603aec8e3a4c..32133826223d3e4fe1be991c8abd3bc23d720779 100644 --- a/core/src/mindustry/logic/LParser.java +++ b/core/src/mindustry/logic/LParser.java -@@ -5,6 +5,8 @@ import arc.util.*; - import mindustry.gen.*; - import mindustry.logic.LStatements.*; - +@@ -7,0 +8,2 @@ import mindustry.logic.LStatements.*; +import java.util.*; + - public class LParser{ - private static final String[] tokens = new String[16]; - private static final int maxJumps = 500; -@@ -155,7 +157,7 @@ public class LParser{ - statements.add(LAssembler.customParsers.get(tokens[0]).get(tokens)); - }else{ - //unparseable statement +@@ -158 +160 @@ public class LParser{ - statements.add(new InvalidStatement()); + statements.add(new InvalidStatement(Arrays.copyOf(tokens, tok))); - } - } - line ++; diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index 3ca506e0e0ec45bf4bfbc58029e2db65673a4c60..9884b9846f06a48c4596ffa5f29f59279b3c21b7 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java -@@ -20,6 +20,7 @@ import mindustry.logic.LogicFx.*; - import mindustry.type.*; - import mindustry.ui.*; - import mindustry.world.meta.*; +@@ -22,0 +23 @@ import mindustry.world.meta.*; +import mindustryX.*; - - import static mindustry.Vars.*; - import static mindustry.logic.LCanvas.*; -@@ -45,6 +46,16 @@ public class LStatements{ - - @RegisterStatement("noop") - public static class InvalidStatement extends LStatement{ +@@ -47,0 +49,10 @@ public class LStatements{ + @MindustryXApi + public transient String[] tokens = {}; + @@ -59,37 +38,17 @@ index 3ca506e0e0ec45bf4bfbc58029e2db65673a4c60..9884b9846f06a48c4596ffa5f29f5927 + public InvalidStatement(String[] tokens){ + this.tokens = tokens; + } - - @Override - public void build(Table table){ diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index 6f4d08ac40d461d0c41dbb292866add7565ed784..261b6374360c2cbae88f44aa441f55706c181936 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java -@@ -1,5 +1,6 @@ - package mindustry.world.blocks.logic; - +@@ -2,0 +3 @@ package mindustry.world.blocks.logic; +import arc.*; - import arc.Graphics.*; - import arc.Graphics.Cursor.*; - import arc.func.*; -@@ -25,6 +26,7 @@ import mindustry.world.*; - import mindustry.world.blocks.ConstructBlock.*; - import mindustry.world.meta.*; - import mindustryX.*; +@@ -27,0 +29 @@ import mindustryX.*; +import mindustryX.events.*; - - import java.io.*; - import java.util.zip.*; -@@ -404,6 +406,8 @@ public class LogicBlock extends Block{ - asm.putConst("@thisx", World.conv(x)); - asm.putConst("@thisy", World.conv(y)); - +@@ -406,0 +409,2 @@ public class LogicBlock extends Block{ + //MDTX: LogicAssembledEvent + Events.fire(new LogicAssembledEvent(this, asm)); - executor.load(asm); - }catch(Exception e){ - //handle malformed code and replace it with nothing diff --git a/core/src/mindustryX/events/LogicAssembledEvent.java b/core/src/mindustryX/events/LogicAssembledEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..4db97d52e70a6cd0b53346d86461b3677da44138 diff --git a/patches/client/0012-SC-Fix-6.patch b/patches/client/0012-SC-Fix-6.patch index 1405550f3a7b..14c0c1b38a8b 100644 --- a/patches/client/0012-SC-Fix-6.patch +++ b/patches/client/0012-SC-Fix-6.patch @@ -11,15 +11,9 @@ diff --git a/core/src/mindustry/world/blocks/payloads/PayloadConveyor.java b/cor index e6c368d97eec75f27d68d681fec480defe7e8218..f9064cdc0773a76860f6d1873901083c4ccd07ce 100644 --- a/core/src/mindustry/world/blocks/payloads/PayloadConveyor.java +++ b/core/src/mindustry/world/blocks/payloads/PayloadConveyor.java -@@ -154,7 +154,10 @@ public class PayloadConveyor extends Block{ - if(valid && stepAccepted != curStep && item != null){ - if(next != null){ - //trigger update forward +@@ -157 +157,4 @@ public class PayloadConveyor extends Block{ - next.updateTile(); + //MDTX: fix NPE bug, copy from PayloadRouter.PayloadRouterBuild.pickNext + if(next instanceof PayloadConveyorBuild){ + next.updateTile();//Update for progress?? + } - - //TODO add self to queue of next conveyor, then check if this conveyor was selected next frame - selection happens deterministically - if(next != null && next.acceptPayload(this, item)){ diff --git a/patches/client/0013-C.patch b/patches/client/0013-C.patch index e3428b70cd4c..4c7afd9c786e 100644 --- a/patches/client/0013-C.patch +++ b/patches/client/0013-C.patch @@ -15,19 +15,10 @@ diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientL index fa6e5c5b52cfdb83de5b50539d57c579aa6e0c95..8dacfa202c6ade755c54c78c67282541361fea4a 100644 --- a/core/src/mindustry/ClientLauncher.java +++ b/core/src/mindustry/ClientLauncher.java -@@ -238,6 +238,8 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform - })))); - } - }else{ +@@ -240,0 +241,2 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform + updateTitle(); + - asyncCore.begin(); - - super.update(); -@@ -254,6 +256,18 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform - } - } - +@@ -256,0 +259,12 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform + private String lastTitle = ""; + private void updateTitle(){ + var mod = mods.orderedMods(); @@ -40,6 +31,3 @@ index fa6e5c5b52cfdb83de5b50539d57c579aa6e0c95..8dacfa202c6ade755c54c78c67282541 + } + } + - @Override - public void exit(){ - //on graceful exit, finish the launch normally. diff --git a/patches/client/0014-API-Hooks-onHttp.patch b/patches/client/0014-API-Hooks-onHttp.patch index b0132f54bbde..f2e968ec8207 100644 --- a/patches/client/0014-API-Hooks-onHttp.patch +++ b/patches/client/0014-API-Hooks-onHttp.patch @@ -11,18 +11,9 @@ diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java index ca6144798666f96ee074838e489b51df1a10d19d..7cace088409de5b701577465f38ae01eb8b87a1c 100644 --- a/core/src/mindustryX/Hooks.java +++ b/core/src/mindustryX/Hooks.java -@@ -4,6 +4,7 @@ import arc.*; - import arc.files.*; - import arc.util.*; - +@@ -6,0 +7 @@ import arc.util.*; +import java.net.*; - import java.util.*; - - public class Hooks implements ApplicationListener{ -@@ -19,6 +20,22 @@ public class Hooks implements ApplicationListener{ - Log.infoTag("MindustryX", "Hooks.init"); - } - +@@ -21,0 +23,16 @@ public class Hooks implements ApplicationListener{ + @SuppressWarnings("unused")//call before arc.util.Http$HttpRequest.block + public static void onHttp(Http.HttpRequest req){ + if(Core.settings.getBool("githubMirror")){ @@ -39,6 +30,3 @@ index ca6144798666f96ee074838e489b51df1a10d19d..7cace088409de5b701577465f38ae01e + } + } + - private static void registerBundle(){ - //MDTX: bundle overwrite - try{ diff --git a/patches/client/0015-API-RenderExt.patch b/patches/client/0015-API-RenderExt.patch index b8d70f07303a..8a6c3093c050 100644 --- a/patches/client/0015-API-RenderExt.patch +++ b/patches/client/0015-API-RenderExt.patch @@ -15,67 +15,31 @@ diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Ren index ae3ae07e384731434e66a31ee13bfaa1576a83a8..01b2872b6ab744ad12f44049feb6146ce8ad84d5 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java -@@ -22,6 +22,7 @@ import mindustry.maps.*; - import mindustry.type.*; - import mindustry.world.blocks.storage.*; - import mindustry.world.blocks.storage.CoreBlock.*; +@@ -24,0 +25 @@ import mindustry.world.blocks.storage.CoreBlock.*; +import mindustryX.features.*; - - import static arc.Core.*; - import static mindustry.Vars.*; -@@ -383,7 +384,7 @@ public class Renderer implements ApplicationListener{ - Events.fire(Trigger.drawOver); - blocks.drawBlocks(); - +@@ -386 +387 @@ public class Renderer implements ApplicationListener{ - Groups.draw.draw(Drawc::draw); + Groups.draw.draw(RenderExt::onGroupDraw); - - Draw.reset(); - Draw.flush(); diff --git a/core/src/mindustry/graphics/BlockRenderer.java b/core/src/mindustry/graphics/BlockRenderer.java index aec39b666137666976321336b698e80177b05f84..5c57b1309660e500c38099d362b46a62846ac24c 100644 --- a/core/src/mindustry/graphics/BlockRenderer.java +++ b/core/src/mindustry/graphics/BlockRenderer.java -@@ -18,6 +18,7 @@ import mindustry.gen.*; - import mindustry.world.*; - import mindustry.world.blocks.environment.Floor.*; - import mindustry.world.blocks.power.*; +@@ -20,0 +21 @@ import mindustry.world.blocks.power.*; +import mindustryX.features.*; - - import static arc.Core.*; - import static mindustry.Vars.*; -@@ -417,7 +418,7 @@ public class BlockRenderer{ - - //comment wasVisible part for hiding? - if(block != Blocks.air && (visible || build.wasVisible)){ +@@ -420 +421 @@ public class BlockRenderer{ - block.drawBase(tile); + RenderExt.onBlockDraw(tile, block, build); - Draw.reset(); - Draw.z(Layer.block); - diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java index 7cace088409de5b701577465f38ae01eb8b87a1c..1548f3d6ae0d362575a05ef38ea1575af65f5afc 100644 --- a/core/src/mindustryX/Hooks.java +++ b/core/src/mindustryX/Hooks.java -@@ -3,6 +3,8 @@ package mindustryX; - import arc.*; - import arc.files.*; - import arc.util.*; +@@ -5,0 +6,2 @@ import arc.util.*; +import mindustry.*; +import mindustryX.features.*; - - import java.net.*; - import java.util.*; -@@ -18,6 +20,9 @@ public class Hooks implements ApplicationListener{ - @Override - public void init(){ - Log.infoTag("MindustryX", "Hooks.init"); +@@ -20,0 +23,3 @@ public class Hooks implements ApplicationListener{ + if(!Vars.headless){ + RenderExt.init(); + } - } - - @SuppressWarnings("unused")//call before arc.util.Http$HttpRequest.block diff --git a/core/src/mindustryX/features/RenderExt.java b/core/src/mindustryX/features/RenderExt.java new file mode 100644 index 0000000000000000000000000000000000000000..835b5d7b801f03683cbb7502ea98025ff2c24d40 diff --git a/patches/client/0016-C-RenderExt-bulletShow-showMineBeam-displayAllMessag.patch b/patches/client/0016-C-RenderExt-bulletShow-showMineBeam-displayAllMessag.patch index 1808bae22733..e680a06138f6 100644 --- a/patches/client/0016-C-RenderExt-bulletShow-showMineBeam-displayAllMessag.patch +++ b/patches/client/0016-C-RenderExt-bulletShow-showMineBeam-displayAllMessag.patch @@ -14,84 +14,42 @@ diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/Uni index 34c3b537df9075827b24df0f26c83de1cc805bf6..939924880db520a918cc51cf5cace817000fb28d 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java -@@ -37,6 +37,7 @@ import mindustry.world.blocks.payloads.*; - import mindustry.world.blocks.units.*; - import mindustry.world.consumers.*; - import mindustry.world.meta.*; +@@ -39,0 +40 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static arc.graphics.g2d.Draw.*; - import static mindustry.Vars.*; -@@ -1207,7 +1208,7 @@ public class UnitType extends UnlockableContent implements Senseable{ - - unit.drawBuilding(); - +@@ -1210 +1211 @@ public class UnitType extends UnlockableContent implements Senseable{ - drawMining(unit); + if(RenderExt.showMineBeam) drawMining(unit); - - boolean isPayload = !unit.isAdded(); - diff --git a/core/src/mindustry/world/blocks/defense/turrets/BaseTurret.java b/core/src/mindustry/world/blocks/defense/turrets/BaseTurret.java index dbe779461193af3f8b882a2db305eedfd457bd82..eced3dc7581a4916970634e600d0f5cd86f6ee7e 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/BaseTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/BaseTurret.java -@@ -1,5 +1,7 @@ - package mindustry.world.blocks.defense.turrets; - +@@ -2,0 +3,2 @@ package mindustry.world.blocks.defense.turrets; +import arc.*; +import arc.graphics.g2d.*; - import arc.math.*; - import arc.struct.*; - import arc.util.*; -@@ -68,6 +70,10 @@ public class BaseTurret extends Block{ - - Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range, Pal.placing); - +@@ -70,0 +73,4 @@ public class BaseTurret extends Block{ + if(state.rules.placeRangeCheck && Core.settings.getBool("arcTurretPlaceCheck")){ + Draw.alpha(0.5f); + Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, placeOverlapRange, Pal.remove); + } - if(fogRadiusMultiplier < 0.99f && state.rules.fog){ - Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, range * fogRadiusMultiplier, Pal.lightishGray); - } diff --git a/core/src/mindustryX/features/RenderExt.java b/core/src/mindustryX/features/RenderExt.java index 835b5d7b801f03683cbb7502ea98025ff2c24d40..c0fe214232b848835a30a51ac3c0904366858bd3 100644 --- a/core/src/mindustryX/features/RenderExt.java +++ b/core/src/mindustryX/features/RenderExt.java -@@ -1,14 +1,22 @@ - package mindustryX.features; - - import arc.*; +@@ -3,0 +4 @@ import arc.*; +import arc.graphics.g2d.*; - import arc.util.*; - import mindustry.game.EventType.*; - import mindustry.gen.*; +@@ -6,0 +8 @@ import mindustry.gen.*; +import mindustry.graphics.*; - import mindustry.world.*; +@@ -7,0 +10 @@ import mindustry.world.*; +import mindustry.world.blocks.logic.MessageBlock.*; - - public class RenderExt{ +@@ -9,0 +13,2 @@ public class RenderExt{ + public static boolean bulletShow, showMineBeam, displayAllMessage; + - public static void init(){ - Events.run(Trigger.preDraw, () -> { +@@ -11,0 +17,3 @@ public class RenderExt{ + bulletShow = Core.settings.getBool("bulletShow"); + showMineBeam = Core.settings.getBool("showminebeam"); + displayAllMessage = Core.settings.getBool("displayallmessage"); - }); - Events.run(Trigger.draw, RenderExt::draw); - } -@@ -18,10 +26,13 @@ public class RenderExt{ - } - - public static void onGroupDraw(Drawc t){ +@@ -20,0 +29 @@ public class RenderExt{ + if(!bulletShow && t instanceof Bulletc) return; - t.draw(); - } - - public static void onBlockDraw(Tile tile, Block block, @Nullable Building build){ - block.drawBase(tile); +@@ -25,0 +35,2 @@ public class RenderExt{ + if(displayAllMessage && build instanceof MessageBuild) + Draw.draw(Layer.overlayUI - 0.1f, build::drawSelect); - } - } diff --git a/patches/client/0017-C-RenderExt-arcChoiceUiIcon.patch b/patches/client/0017-C-RenderExt-arcChoiceUiIcon.patch index 22612b56929c..4c79daa246f3 100644 --- a/patches/client/0017-C-RenderExt-arcChoiceUiIcon.patch +++ b/patches/client/0017-C-RenderExt-arcChoiceUiIcon.patch @@ -22,142 +22,59 @@ diff --git a/core/src/mindustry/world/blocks/distribution/DirectionalUnloader.ja index 92ccae0e1122e1501ab2d96facb3c0cef5ce8842..e8416d87136fced0e6bc045d93a58be52cb48f31 100644 --- a/core/src/mindustry/world/blocks/distribution/DirectionalUnloader.java +++ b/core/src/mindustry/world/blocks/distribution/DirectionalUnloader.java -@@ -14,6 +14,7 @@ import mindustry.world.blocks.*; - import mindustry.world.blocks.storage.CoreBlock.*; - import mindustry.world.blocks.storage.StorageBlock.*; - import mindustry.world.meta.*; +@@ -16,0 +17 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -122,6 +123,7 @@ public class DirectionalUnloader extends Block{ - Draw.color(unloadItem.color); - Draw.rect(centerRegion, x, y); - Draw.color(); +@@ -124,0 +126 @@ public class DirectionalUnloader extends Block{ + if(RenderExt.arcChoiceUiIcon) Draw.rect(unloadItem.uiIcon, x, y,4f,4f); - }else{ - Draw.rect(arrowRegion, x, y, rotdeg()); - } diff --git a/core/src/mindustry/world/blocks/distribution/DuctRouter.java b/core/src/mindustry/world/blocks/distribution/DuctRouter.java index 502915d2887c3a9a9f78fecc2841bbfdaf10cd26..485301ae729ba660a4cad4dba2c2ddc038a23d32 100644 --- a/core/src/mindustry/world/blocks/distribution/DuctRouter.java +++ b/core/src/mindustry/world/blocks/distribution/DuctRouter.java -@@ -12,6 +12,7 @@ import mindustry.type.*; - import mindustry.world.*; - import mindustry.world.blocks.*; - import mindustry.world.meta.*; +@@ -14,0 +15 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -84,6 +85,7 @@ public class DuctRouter extends Block{ - Draw.color(sortItem.color); - Draw.rect("center", x, y); - Draw.color(); +@@ -86,0 +88 @@ public class DuctRouter extends Block{ + if(RenderExt.arcChoiceUiIcon) Draw.rect(sortItem.uiIcon, x, y,4f,4f); - }else{ - Draw.rect(topRegion, x, y, rotdeg()); - } diff --git a/core/src/mindustry/world/blocks/distribution/Sorter.java b/core/src/mindustry/world/blocks/distribution/Sorter.java index 805fad17aa2548240be635f75085c158d100fb1f..371a22776d3f569c2a65590ba720432b365cb75b 100644 --- a/core/src/mindustry/world/blocks/distribution/Sorter.java +++ b/core/src/mindustry/world/blocks/distribution/Sorter.java -@@ -13,6 +13,7 @@ import mindustry.type.*; - import mindustry.world.*; - import mindustry.world.blocks.*; - import mindustry.world.meta.*; +@@ -15,0 +16 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -78,6 +79,7 @@ public class Sorter extends Block{ - Draw.color(sortItem.color); - Fill.square(x, y, tilesize/2f - 0.00001f); - Draw.color(); +@@ -80,0 +82 @@ public class Sorter extends Block{ + if(RenderExt.arcChoiceUiIcon) Draw.rect(sortItem.uiIcon, x, y,4f,4f); - } - - super.draw(); diff --git a/core/src/mindustry/world/blocks/sandbox/ItemSource.java b/core/src/mindustry/world/blocks/sandbox/ItemSource.java index 0a7461a7ec54131d4a81f0a80c3039341f3100d1..fe9bd668c42f121d89ac4defea3c9d8981ca32b6 100644 --- a/core/src/mindustry/world/blocks/sandbox/ItemSource.java +++ b/core/src/mindustry/world/blocks/sandbox/ItemSource.java -@@ -11,6 +11,7 @@ import mindustry.type.*; - import mindustry.world.*; - import mindustry.world.blocks.*; - import mindustry.world.meta.*; +@@ -13,0 +14 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -73,6 +74,7 @@ public class ItemSource extends Block{ - Draw.color(outputItem.color); - Fill.square(x, y, tilesize/2f - 0.00001f); - Draw.color(); +@@ -75,0 +77 @@ public class ItemSource extends Block{ + if(RenderExt.arcChoiceUiIcon) Draw.rect(outputItem.uiIcon, x, y,4f,4f); - } - - super.draw(); diff --git a/core/src/mindustry/world/blocks/storage/Unloader.java b/core/src/mindustry/world/blocks/storage/Unloader.java index db0fdbfe1e4746cf55043276f84cd5e9677ec5bf..5e20ab7962934efa7bccd9450137993a46a8bc5d 100644 --- a/core/src/mindustry/world/blocks/storage/Unloader.java +++ b/core/src/mindustry/world/blocks/storage/Unloader.java -@@ -17,6 +17,8 @@ import mindustry.world.meta.*; - - import java.util.*; - +@@ -19,0 +20,2 @@ import java.util.*; +import mindustryX.features.*; + - import static mindustry.Vars.*; - - public class Unloader extends Block{ -@@ -222,6 +224,10 @@ public class Unloader extends Block{ - public void draw(){ - super.draw(); - +@@ -224,0 +227,4 @@ public class Unloader extends Block{ + if(RenderExt.arcChoiceUiIcon && sortItem != null){ + Draw.rect(sortItem.uiIcon, x, y,4f,4f); + return; + } - Draw.color(sortItem == null ? Color.clear : sortItem.color); - Draw.rect(centerRegion, x, y); - Draw.color(); diff --git a/core/src/mindustry/world/blocks/units/UnitCargoUnloadPoint.java b/core/src/mindustry/world/blocks/units/UnitCargoUnloadPoint.java index d7a2e02c0d81c1935482c3bbb4edb7b555788a43..b536c4f3fdb6b4d850deae290c9de52417deeb26 100644 --- a/core/src/mindustry/world/blocks/units/UnitCargoUnloadPoint.java +++ b/core/src/mindustry/world/blocks/units/UnitCargoUnloadPoint.java -@@ -12,6 +12,7 @@ import mindustry.type.*; - import mindustry.world.*; - import mindustry.world.blocks.*; - import mindustry.world.meta.*; +@@ -14,0 +15 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -47,6 +48,7 @@ public class UnitCargoUnloadPoint extends Block{ - Draw.color(item.color); - Draw.rect(topRegion, x, y); - Draw.color(); +@@ -49,0 +51 @@ public class UnitCargoUnloadPoint extends Block{ + if(RenderExt.arcChoiceUiIcon) Draw.rect(item.uiIcon, x, y,4f,4f); - } - } - diff --git a/core/src/mindustryX/features/RenderExt.java b/core/src/mindustryX/features/RenderExt.java index c0fe214232b848835a30a51ac3c0904366858bd3..9f2735a5acc756c9b0b3d6aa5a6bbc8ea6861a0f 100644 --- a/core/src/mindustryX/features/RenderExt.java +++ b/core/src/mindustryX/features/RenderExt.java -@@ -11,12 +11,14 @@ import mindustry.world.blocks.logic.MessageBlock.*; - - public class RenderExt{ - public static boolean bulletShow, showMineBeam, displayAllMessage; +@@ -13,0 +14 @@ public class RenderExt{ + public static boolean arcChoiceUiIcon; - - public static void init(){ - Events.run(Trigger.preDraw, () -> { - bulletShow = Core.settings.getBool("bulletShow"); - showMineBeam = Core.settings.getBool("showminebeam"); - displayAllMessage = Core.settings.getBool("displayallmessage"); +@@ -19,0 +21 @@ public class RenderExt{ + arcChoiceUiIcon = Core.settings.getBool("arcchoiceuiIcon"); - }); - Events.run(Trigger.draw, RenderExt::draw); - } diff --git a/patches/client/0018-C-RenderExt-researchViewer.patch b/patches/client/0018-C-RenderExt-researchViewer.patch index c7d185e511ff..3fb6b312af03 100644 --- a/patches/client/0018-C-RenderExt-researchViewer.patch +++ b/patches/client/0018-C-RenderExt-researchViewer.patch @@ -17,94 +17,36 @@ diff --git a/core/src/mindustry/game/Objectives.java b/core/src/mindustry/game/O index f50c8c0ca180f07cc2ce13068540910c915189d5..fbb783f85810db49bd6a321d729f5214fd0d22b3 100644 --- a/core/src/mindustry/game/Objectives.java +++ b/core/src/mindustry/game/Objectives.java -@@ -4,6 +4,7 @@ import arc.*; - import arc.scene.ui.layout.*; - import mindustry.ctype.*; - import mindustry.type.*; +@@ -6,0 +7 @@ import mindustry.type.*; +import mindustryX.features.*; - - /** Holds objective classes. */ - public class Objectives{ -@@ -26,6 +27,7 @@ public class Objectives{ - public String display(){ - return Core.bundle.format("requirement.research", - //TODO broken for multi tech nodes. +@@ -28,0 +30 @@ public class Objectives{ + RenderExt.researchViewer || - (content.techNode == null || content.techNode.parent == null || content.techNode.parent.content.unlocked()) ? - (content.emoji() + " " + content.localizedName) : "???"); - } -@@ -48,7 +50,7 @@ public class Objectives{ - @Override - public String display(){ - return Core.bundle.format("requirement.produce", +@@ -51 +53 @@ public class Objectives{ - content.unlocked() ? (content.emoji() + " " + content.localizedName) : "???"); + RenderExt.researchViewer || content.unlocked() ? (content.emoji() + " " + content.localizedName) : "???"); - } - } - diff --git a/core/src/mindustry/ui/dialogs/ResearchDialog.java b/core/src/mindustry/ui/dialogs/ResearchDialog.java index a251419f31092b68aca9fd756f19e8c3602263d4..59e3d7507a1161e9120b71d9f11ba02a501a796b 100644 --- a/core/src/mindustry/ui/dialogs/ResearchDialog.java +++ b/core/src/mindustry/ui/dialogs/ResearchDialog.java -@@ -27,6 +27,7 @@ import mindustry.type.*; - import mindustry.ui.*; - import mindustry.ui.layout.*; - import mindustry.ui.layout.TreeLayout.*; +@@ -29,0 +30 @@ import mindustry.ui.layout.TreeLayout.*; +import mindustryX.features.*; - - import java.util.*; - -@@ -349,7 +350,7 @@ public class ResearchDialog extends BaseDialog{ - } - - void checkNodes(TechTreeNode node){ +@@ -352 +353 @@ public class ResearchDialog extends BaseDialog{ - boolean locked = locked(node.node); + boolean locked = !RenderExt.researchViewer && locked(node.node); - if(!locked && (node.parent == null || node.parent.visible)) node.visible = true; - node.selectable = selectable(node.node); - for(TechTreeNode l : node.children){ -@@ -463,7 +464,7 @@ public class ResearchDialog extends BaseDialog{ - button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f + offset, Align.center); - button.getStyle().up = !locked(node.node) ? Tex.buttonOver : !selectable(node.node) || !canSpend(node.node) ? Tex.buttonRed : Tex.button; - +@@ -466 +467 @@ public class ResearchDialog extends BaseDialog{ - ((TextureRegionDrawable)button.getStyle().imageUp).setRegion(node.selectable ? node.node.content.uiIcon : Icon.lock.getRegion()); + ((TextureRegionDrawable)button.getStyle().imageUp).setRegion(node.selectable || RenderExt.researchViewer ? node.node.content.uiIcon : Icon.lock.getRegion()); - button.getImage().setColor(!locked(node.node) ? Color.white : node.selectable ? Color.gray : Pal.gray); - button.getImage().layout(); - }); -@@ -603,13 +604,13 @@ public class ResearchDialog extends BaseDialog{ - infoTable.table(b -> { - b.margin(0).left().defaults().left(); - +@@ -606 +607 @@ public class ResearchDialog extends BaseDialog{ - if(selectable){ + if(selectable || RenderExt.researchViewer){ - b.button(Icon.info, Styles.flati, () -> ui.content.show(node.content)).growY().width(50f); - } - b.add().grow(); - b.table(desc -> { - desc.left().defaults().left(); +@@ -612 +613 @@ public class ResearchDialog extends BaseDialog{ - desc.add(selectable ? node.content.localizedName : "[accent]???"); + desc.add(selectable ? node.content.localizedName : RenderExt.researchViewer ? node.content.localizedName + "\n[red]未满足前置科技" : "[accent]???"); - desc.row(); - if(locked(node) || debugShowRequirements){ - diff --git a/core/src/mindustryX/features/RenderExt.java b/core/src/mindustryX/features/RenderExt.java index 9f2735a5acc756c9b0b3d6aa5a6bbc8ea6861a0f..d08e081e7ae0bdaa67d903d97116d0c714e015bc 100644 --- a/core/src/mindustryX/features/RenderExt.java +++ b/core/src/mindustryX/features/RenderExt.java -@@ -12,6 +12,7 @@ import mindustry.world.blocks.logic.MessageBlock.*; - public class RenderExt{ - public static boolean bulletShow, showMineBeam, displayAllMessage; - public static boolean arcChoiceUiIcon; +@@ -14,0 +15 @@ public class RenderExt{ + public static boolean researchViewer; - - public static void init(){ - Events.run(Trigger.preDraw, () -> { -@@ -19,6 +20,7 @@ public class RenderExt{ - showMineBeam = Core.settings.getBool("showminebeam"); - displayAllMessage = Core.settings.getBool("displayallmessage"); - arcChoiceUiIcon = Core.settings.getBool("arcchoiceuiIcon"); +@@ -21,0 +23 @@ public class RenderExt{ + researchViewer = Core.settings.getBool("researchViewer"); - }); - Events.run(Trigger.draw, RenderExt::draw); - } diff --git a/patches/client/0019-C-RenderExt-hiddenItemTransparency.patch b/patches/client/0019-C-RenderExt-hiddenItemTransparency.patch index 7ca83d6ce727..3654dd166cc3 100644 --- a/patches/client/0019-C-RenderExt-hiddenItemTransparency.patch +++ b/patches/client/0019-C-RenderExt-hiddenItemTransparency.patch @@ -20,10 +20,7 @@ diff --git a/core/src/mindustry/world/DirectionalItemBuffer.java b/core/src/mind index 48cbdc84c09863a52f82282a70b3882e36fbed00..a55e582e7f670494adce17090e209caa7db3972f 100644 --- a/core/src/mindustry/world/DirectionalItemBuffer.java +++ b/core/src/mindustry/world/DirectionalItemBuffer.java -@@ -21,6 +21,17 @@ public class DirectionalItemBuffer{ - return indexes[buffer] < buffers[buffer].length; - } - +@@ -23,0 +24,11 @@ public class DirectionalItemBuffer{ + public Item getItem(int dir, int i){ + if(i >= indexes[dir]) return null; + return content.item(BufferItem.item(buffers[dir][i])); @@ -35,17 +32,11 @@ index 48cbdc84c09863a52f82282a70b3882e36fbed00..a55e582e7f670494adce17090e209caa + } + + - public void accept(int buffer, Item item){ - if(!accepts(buffer)) return; - buffers[buffer][indexes[buffer]++] = BufferItem.get((byte)item.id, Time.time); diff --git a/core/src/mindustry/world/ItemBuffer.java b/core/src/mindustry/world/ItemBuffer.java index d91da022ce4ca749164958cf8fc4438ddf777b23..1b8ac44e8773af0b69e40f284a1dfff5f523c040 100644 --- a/core/src/mindustry/world/ItemBuffer.java +++ b/core/src/mindustry/world/ItemBuffer.java -@@ -16,6 +16,15 @@ public class ItemBuffer{ - this.buffer = new long[capacity]; - } - +@@ -18,0 +19,9 @@ public class ItemBuffer{ + public Item getItem(int i){ + if(i < 0 || i >= index) return null; + return content.item(TimeItem.item(buffer[i])); @@ -55,35 +46,22 @@ index d91da022ce4ca749164958cf8fc4438ddf777b23..1b8ac44e8773af0b69e40f284a1dfff5 + return TimeItem.time(buffer[i]); + } + - public boolean accepts(){ - return index < buffer.length; - } diff --git a/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java b/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java index 6fe8e90722ef740148d337a09754febd47a7ab10..cf4602f09a5e5e6dfd86eef88ace838ea0309fbf 100644 --- a/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java +++ b/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java -@@ -1,9 +1,17 @@ - package mindustry.world.blocks.distribution; - +@@ -2,0 +3,4 @@ package mindustry.world.blocks.distribution; +import arc.graphics.g2d.*; +import arc.math.*; +import arc.math.geom.*; +import arc.util.*; - import arc.util.io.*; - import mindustry.gen.*; +@@ -4,0 +9 @@ import mindustry.gen.*; +import mindustry.graphics.*; - import mindustry.type.*; - import mindustry.world.*; +@@ -6,0 +12,3 @@ import mindustry.world.*; +import mindustryX.features.*; + +import static mindustry.Vars.*; - - public class BufferedItemBridge extends ItemBridge{ - public final int timerAccept = timers++; -@@ -40,6 +48,45 @@ public class BufferedItemBridge extends ItemBridge{ - dump(); - } - +@@ -42,0 +51,39 @@ public class BufferedItemBridge extends ItemBridge{ + @Override + public void draw(){ + super.draw(); @@ -123,25 +101,13 @@ index 6fe8e90722ef740148d337a09754febd47a7ab10..cf4602f09a5e5e6dfd86eef88ace838e + } + + - @Override - public void write(Writes write){ - super.write(write); diff --git a/core/src/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/mindustry/world/blocks/distribution/ItemBridge.java index 2663365fc253a5eee6113ff6070b3624bfdceaf6..050e7151487c8d248c0e6e0b48913fbe944164d9 100644 --- a/core/src/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/mindustry/world/blocks/distribution/ItemBridge.java -@@ -17,6 +17,7 @@ import mindustry.input.*; - import mindustry.type.*; - import mindustry.world.*; - import mindustry.world.meta.*; +@@ -19,0 +20 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -354,6 +355,20 @@ public class ItemBridge extends Block{ - public void draw(){ - super.draw(); - +@@ -356,0 +358,14 @@ public class ItemBridge extends Block{ + //draw each item this bridge have + if(items != null && RenderExt.hiddenItemTransparency > 0){ + Draw.z(Layer.power + 0.1f); @@ -156,35 +122,20 @@ index 2663365fc253a5eee6113ff6070b3624bfdceaf6..050e7151487c8d248c0e6e0b48913fbe + } + } + - Draw.z(Layer.power); - - Tile other = world.tile(link); diff --git a/core/src/mindustry/world/blocks/distribution/Junction.java b/core/src/mindustry/world/blocks/distribution/Junction.java index d02fb844045f4cf7b11050e86661ae6f5529e0dc..698e95ac696a3267bba1eb4bb3da2852154b71a4 100644 --- a/core/src/mindustry/world/blocks/distribution/Junction.java +++ b/core/src/mindustry/world/blocks/distribution/Junction.java -@@ -1,11 +1,17 @@ - package mindustry.world.blocks.distribution; - +@@ -2,0 +3,4 @@ package mindustry.world.blocks.distribution; +import arc.graphics.*; +import arc.graphics.g2d.*; +import arc.math.*; +import arc.math.geom.*; - import arc.util.*; - import arc.util.io.*; +@@ -4,0 +9 @@ import arc.util.io.*; +import mindustry.graphics.*; - import mindustry.gen.*; - import mindustry.type.*; - import mindustry.world.*; - import mindustry.world.meta.*; +@@ -8,0 +14 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -79,6 +85,30 @@ public class Junction extends Block{ - return to != null && to.team == team; - } - +@@ -81,0 +88,24 @@ public class Junction extends Block{ + @Override + public void draw(){ + super.draw(); @@ -209,26 +160,11 @@ index d02fb844045f4cf7b11050e86661ae6f5529e0dc..698e95ac696a3267bba1eb4bb3da2852 + } + + - @Override - public void write(Writes write){ - super.write(write); diff --git a/core/src/mindustryX/features/RenderExt.java b/core/src/mindustryX/features/RenderExt.java index d08e081e7ae0bdaa67d903d97116d0c714e015bc..62100afee7c0df3fd36781244ccd02cb318316c3 100644 --- a/core/src/mindustryX/features/RenderExt.java +++ b/core/src/mindustryX/features/RenderExt.java -@@ -13,6 +13,7 @@ public class RenderExt{ - public static boolean bulletShow, showMineBeam, displayAllMessage; - public static boolean arcChoiceUiIcon; - public static boolean researchViewer; +@@ -15,0 +16 @@ public class RenderExt{ + public static int hiddenItemTransparency; - - public static void init(){ - Events.run(Trigger.preDraw, () -> { -@@ -21,6 +22,7 @@ public class RenderExt{ - displayAllMessage = Core.settings.getBool("displayallmessage"); - arcChoiceUiIcon = Core.settings.getBool("arcchoiceuiIcon"); - researchViewer = Core.settings.getBool("researchViewer"); +@@ -23,0 +25 @@ public class RenderExt{ + hiddenItemTransparency = Core.settings.getInt("HiddleItemTransparency"); - }); - Events.run(Trigger.draw, RenderExt::draw); - } diff --git a/patches/client/0020-C-RenderExt-overdriveZone.patch b/patches/client/0020-C-RenderExt-overdriveZone.patch index e424aafb4b35..760942fefd15 100644 --- a/patches/client/0020-C-RenderExt-overdriveZone.patch +++ b/patches/client/0020-C-RenderExt-overdriveZone.patch @@ -14,48 +14,27 @@ diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Ren index 01b2872b6ab744ad12f44049feb6146ce8ad84d5..e987766b74de1fbb8d3d9e0a8f1863b0821a49db 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java -@@ -349,6 +349,11 @@ public class Renderer implements ApplicationListener{ - effectBuffer.blit(Shaders.shield); - }); - +@@ -351,0 +352,5 @@ public class Renderer implements ApplicationListener{ + Draw.drawRange(Layer.overdrive, 1f, () -> effectBuffer.begin(Color.clear), () -> { + effectBuffer.end(); + effectBuffer.blit(Shaders.shield); + }); + - Draw.drawRange(Layer.buildBeam, 1f, () -> effectBuffer.begin(Color.clear), () -> { - effectBuffer.end(); - effectBuffer.blit(Shaders.buildBeam); diff --git a/core/src/mindustry/graphics/Layer.java b/core/src/mindustry/graphics/Layer.java index 7d8d9f343acb410ba680aab1c1f6a2be9dbbf3a4..48e80224bdcbaea0476d4be204eef7670b14af87 100644 --- a/core/src/mindustry/graphics/Layer.java +++ b/core/src/mindustry/graphics/Layer.java -@@ -86,6 +86,9 @@ public class Layer{ - //shield effects - shields = 125, - +@@ -88,0 +89,3 @@ public class Layer{ + //shield effects + overdrive = 127, + - //weather effects, e.g. rain and snow - weather = 130, - diff --git a/core/src/mindustry/world/blocks/defense/OverdriveProjector.java b/core/src/mindustry/world/blocks/defense/OverdriveProjector.java index 423462318a31075f047a39d07caee50e031c1390..89b28401796d1d560330328e4bea54f258f3fdeb 100644 --- a/core/src/mindustry/world/blocks/defense/OverdriveProjector.java +++ b/core/src/mindustry/world/blocks/defense/OverdriveProjector.java -@@ -15,6 +15,7 @@ import mindustry.ui.*; - import mindustry.world.*; - import mindustry.world.consumers.*; - import mindustry.world.meta.*; +@@ -17,0 +18 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -138,6 +139,24 @@ public class OverdriveProjector extends Block{ - public void draw(){ - super.draw(); - +@@ -140,0 +142,18 @@ public class OverdriveProjector extends Block{ + float realRange = range + phaseHeat * phaseRangeBoost; + float pro_Transparency = RenderExt.overdriveZoneTransparency; + if(realBoost() > 1 && pro_Transparency > 0){ @@ -74,26 +53,11 @@ index 423462318a31075f047a39d07caee50e031c1390..89b28401796d1d560330328e4bea54f2 + } + } + - float f = 1f - (Time.time / 100f) % 1f; - - Draw.color(baseColor, phaseColor, phaseHeat); diff --git a/core/src/mindustryX/features/RenderExt.java b/core/src/mindustryX/features/RenderExt.java index 62100afee7c0df3fd36781244ccd02cb318316c3..936e714c690d884258097765a25369f7dc089e07 100644 --- a/core/src/mindustryX/features/RenderExt.java +++ b/core/src/mindustryX/features/RenderExt.java -@@ -14,6 +14,7 @@ public class RenderExt{ - public static boolean arcChoiceUiIcon; - public static boolean researchViewer; - public static int hiddenItemTransparency; +@@ -16,0 +17 @@ public class RenderExt{ + public static float overdriveZoneTransparency; - - public static void init(){ - Events.run(Trigger.preDraw, () -> { -@@ -23,6 +24,7 @@ public class RenderExt{ - arcChoiceUiIcon = Core.settings.getBool("arcchoiceuiIcon"); - researchViewer = Core.settings.getBool("researchViewer"); - hiddenItemTransparency = Core.settings.getInt("HiddleItemTransparency"); +@@ -25,0 +27 @@ public class RenderExt{ + overdriveZoneTransparency = Core.settings.getInt("overdrive_zone") / 100f; - }); - Events.run(Trigger.draw, RenderExt::draw); - } diff --git a/patches/client/0021-C-StatusEffects.patch b/patches/client/0021-C-StatusEffects.patch index dfe1c177d7b0..4d0c496903ed 100644 --- a/patches/client/0021-C-StatusEffects.patch +++ b/patches/client/0021-C-StatusEffects.patch @@ -44,11 +44,5 @@ diff --git a/core/src/mindustry/content/StatusEffects.java b/core/src/mindustry/ index ff3dcf43df95bb50b1e8f28e965af02ed912c086..1dc361fe2a3f5a32da09b63220bc79e6025ac9e7 100644 --- a/core/src/mindustry/content/StatusEffects.java +++ b/core/src/mindustry/content/StatusEffects.java -@@ -202,6 +202,7 @@ public class StatusEffects{ - - invincible = new StatusEffect("invincible"){{ - healthMultiplier = Float.POSITIVE_INFINITY; +@@ -204,0 +205 @@ public class StatusEffects{ + color = Color.red; - }}; - - dynamic = new StatusEffect("dynamic"){{ diff --git a/patches/client/0022-C-staticShield.patch b/patches/client/0022-C-staticShield.patch index 5946527e47e4..a75bb2046e48 100644 --- a/patches/client/0022-C-staticShield.patch +++ b/patches/client/0022-C-staticShield.patch @@ -12,33 +12,15 @@ diff --git a/core/assets/shaders/shield.frag b/core/assets/shaders/shield.frag index 098f62c7b1b44187862cc678b3a4b1c15e6e0405..37460c00ff4a251ac8f4099520cec644f743ee6a 100644 --- a/core/assets/shaders/shield.frag +++ b/core/assets/shaders/shield.frag -@@ -8,6 +8,7 @@ uniform vec2 u_texsize; - uniform vec2 u_invsize; - uniform float u_time; - uniform float u_dp; +@@ -10,0 +11 @@ uniform float u_dp; +uniform float u_static; - uniform vec2 u_offset; - - varying vec2 v_texCoords; -@@ -16,7 +17,8 @@ void main(){ - vec2 T = v_texCoords.xy; - vec2 coords = (T * u_texsize) + u_offset; - +@@ -19 +20,2 @@ void main(){ - T += vec2(sin(coords.y / 3.0 + u_time / 20.0), sin(coords.x / 3.0 + u_time / 20.0)) / u_texsize; + if(u_static <1.0) + T += vec2(sin(coords.y / 3.0 + u_time / 20.0), sin(coords.x / 3.0 + u_time / 20.0)) / u_texsize; - - vec4 color = texture2D(u_texture, T); - vec2 v = u_invsize; diff --git a/core/src/mindustry/graphics/Shaders.java b/core/src/mindustry/graphics/Shaders.java index 109b5388bae80211548263b0dc263e3ac3086765..f910a8cae173520af22250315d910e8a0c69ee18 100644 --- a/core/src/mindustry/graphics/Shaders.java +++ b/core/src/mindustry/graphics/Shaders.java -@@ -266,6 +266,7 @@ public class Shaders{ - public void apply(){ - setUniformf("u_dp", Scl.scl(1f)); - setUniformf("u_time", Time.time / Scl.scl(1f)); +@@ -268,0 +269 @@ public class Shaders{ + setUniformf("u_static", Core.settings.getBool("staticShieldsBorder") ? 1 : 0); - setUniformf("u_offset", - Core.camera.position.x - Core.camera.width / 2, - Core.camera.position.y - Core.camera.height / 2); diff --git a/patches/client/0023-C-StatExt.patch b/patches/client/0023-C-StatExt.patch index f963ab2d3121..aa58c2069c51 100644 --- a/patches/client/0023-C-StatExt.patch +++ b/patches/client/0023-C-StatExt.patch @@ -45,10 +45,7 @@ diff --git a/core/assets/bundles/bundle-mdtx.properties b/core/assets/bundles/bu index 87ca026cadc01f80b5e927ed210bc78f7c7fc13b..0cb666446175aa5e952ceaa07669e10a3a023d10 100644 --- a/core/assets/bundles/bundle-mdtx.properties +++ b/core/assets/bundles/bundle-mdtx.properties -@@ -5,3 +5,38 @@ status.disarmed.name = 缴械 - status.invincible.name = 无敌 - status.fast.name = 迅捷 - +@@ -7,0 +8,35 @@ status.fast.name = 迅捷 +#StatExt +stat.unit_range = 雷达范围 +stat.can_overdrive = 能否超速 @@ -88,83 +85,39 @@ diff --git a/core/src/mindustry/type/Item.java b/core/src/mindustry/type/Item.ja index 1c59b0d07a396614c8ee3ebbe90f0c80b3f30d38..6cd22e27e6f1a0910a1e51a9e1cb3f2da87ee915 100644 --- a/core/src/mindustry/type/Item.java +++ b/core/src/mindustry/type/Item.java -@@ -12,6 +12,7 @@ import mindustry.graphics.MultiPacker.*; - import mindustry.logic.*; - import mindustry.world.blocks.environment.*; - import mindustry.world.meta.*; +@@ -14,0 +15 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -115,6 +116,10 @@ public class Item extends UnlockableContent implements Senseable{ - stats.addPercent(Stat.flammability, flammability); - stats.addPercent(Stat.radioactivity, radioactivity); - stats.addPercent(Stat.charge, charge); +@@ -117,0 +119,4 @@ public class Item extends UnlockableContent implements Senseable{ + stats.add(StatExt.cost, cost); + stats.add(StatExt.hardness, hardness); + stats.add(StatExt.healthScaling,healthScaling); + stats.add(StatExt.buildable,buildable); - } - - @Override diff --git a/core/src/mindustry/type/Liquid.java b/core/src/mindustry/type/Liquid.java index 9032b4bf9bdcacd31826eb95fedc7781465cc87a..ccb3c4b63be9aebc1c66f1003e4b17f10db1a2d7 100644 --- a/core/src/mindustry/type/Liquid.java +++ b/core/src/mindustry/type/Liquid.java -@@ -13,6 +13,7 @@ import mindustry.graphics.*; - import mindustry.logic.*; - import mindustry.world.*; - import mindustry.world.meta.*; +@@ -15,0 +16 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.entities.Puddles.*; - -@@ -165,6 +166,7 @@ public class Liquid extends UnlockableContent implements Senseable{ - stats.addPercent(Stat.temperature, temperature); - stats.addPercent(Stat.heatCapacity, heatCapacity); - stats.addPercent(Stat.viscosity, viscosity); +@@ -167,0 +169 @@ public class Liquid extends UnlockableContent implements Senseable{ + stats.add(StatExt.boilPoint,boilPoint); - } - - @Override diff --git a/core/src/mindustry/type/StatusEffect.java b/core/src/mindustry/type/StatusEffect.java index 79d0177b41b7480488f6131935dbf345b9f4598a..2e67b422063355deac7aecb7dd93b3edae3ab647 100644 --- a/core/src/mindustry/type/StatusEffect.java +++ b/core/src/mindustry/type/StatusEffect.java -@@ -13,6 +13,7 @@ import mindustry.gen.*; - import mindustry.graphics.*; - import mindustry.graphics.MultiPacker.*; - import mindustry.world.meta.*; +@@ -15,0 +16 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - public class StatusEffect extends UnlockableContent{ - /** Damage dealt by the unit with the effect. */ -@@ -93,6 +94,7 @@ public class StatusEffect extends UnlockableContent{ - if(speedMultiplier != 1) stats.addPercent(Stat.speedMultiplier, speedMultiplier); - if(reloadMultiplier != 1) stats.addPercent(Stat.reloadMultiplier, reloadMultiplier); - if(buildSpeedMultiplier != 1) stats.addPercent(Stat.buildSpeedMultiplier, buildSpeedMultiplier); +@@ -95,0 +97 @@ public class StatusEffect extends UnlockableContent{ + if(dragMultiplier != 1) stats.addPercent(StatExt.dragMultiplier, dragMultiplier); - if(damage > 0) stats.add(Stat.damage, damage * 60f, StatUnit.perSecond); - if(damage < 0) stats.add(Stat.healing, -damage * 60f, StatUnit.perSecond); - diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 939924880db520a918cc51cf5cace817000fb28d..998caed117d2eeef7f74ad0527c2f01f76f60650 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java -@@ -612,29 +612,47 @@ public class UnitType extends UnlockableContent implements Senseable{ - stats.add(Stat.health, health); - stats.add(Stat.armor, armor); - stats.add(Stat.speed, speed * 60f / tilesize, StatUnit.tilesSecond); +@@ -614,0 +615 @@ public class UnitType extends UnlockableContent implements Senseable{ + stats.add(StatExt.rotateSpeed,rotateSpeed); - stats.add(Stat.size, StatValues.squared(hitSize / tilesize, StatUnit.blocks)); - stats.add(Stat.itemCapacity, itemCapacity); - stats.add(Stat.range, (int)(maxRange / tilesize), StatUnit.blocks); - stats.add(Stat.targetsAir, targetAir); - stats.add(Stat.targetsGround, targetGround); +@@ -619,0 +621,2 @@ public class UnitType extends UnlockableContent implements Senseable{ + stats.add(StatExt.unitItemCapacity, itemCapacity); + stats.add(StatExt.aiController,aiController.get().getClass().getSimpleName()); - - if(abilities.any()){ +@@ -622 +625,9 @@ public class UnitType extends UnlockableContent implements Senseable{ - stats.add(Stat.abilities, StatValues.abilities(abilities)); + stats.add(Stat.abilities, StatValues.abilities(this, abilities)); + } @@ -175,23 +128,16 @@ index 939924880db520a918cc51cf5cace817000fb28d..998caed117d2eeef7f74ad0527c2f01f + stats.add(StatExt.ammoCapacity, ammoCapacity); + if (crushDamage > 0) { + stats.add(StatExt.crushDamage, crushDamage * 60f, StatUnit.perSecond); - } - - stats.add(Stat.flying, flying); - - if(!flying){ - stats.add(Stat.canBoost, canBoost); +@@ -628,0 +640,6 @@ public class UnitType extends UnlockableContent implements Senseable{ + if(canBoost){ + stats.add(StatExt.boostMultiplier, boostMultiplier); + } + } + if(drownTimeMultiplier != 1){ + stats.add(StatExt.drownTimeMultiplier, drownTimeMultiplier); - } - - if(mineTier >= 1){ +@@ -631,0 +649 @@ public class UnitType extends UnlockableContent implements Senseable{ + stats.add(StatExt.mineLevel, "@级", mineTier); - stats.addPercent(Stat.mineSpeed, mineSpeed); +@@ -633,5 +651,5 @@ public class UnitType extends UnlockableContent implements Senseable{ - stats.add(Stat.mineTier, StatValues.drillables(mineSpeed, 1f, 1, null, b -> - b.itemDrop != null && - (b instanceof Floor f && (((f.wallOre && mineWalls) || (!f.wallOre && mineFloor))) || @@ -202,111 +148,63 @@ index 939924880db520a918cc51cf5cace817000fb28d..998caed117d2eeef7f74ad0527c2f01f + (b instanceof Floor f && (((f.wallOre && mineWalls) || (!f.wallOre && mineFloor))) || + (!(b instanceof Floor) && mineWalls)) && + b.itemDrop.hardness <= mineTier && (!b.playerUnmineable || Core.settings.getBool("doubletapmine")))); - } - if(buildSpeed > 0){ - stats.addPercent(Stat.buildSpeed, buildSpeed); -@@ -653,6 +671,10 @@ public class UnitType extends UnlockableContent implements Senseable{ - stats.add(Stat.weapons, StatValues.weapons(this, weapons)); - } - +@@ -655,0 +674,4 @@ public class UnitType extends UnlockableContent implements Senseable{ + if(targetFlags.length > 0 && targetFlags[0] != null){ + stats.add(StatExt.targets, StatValues.targets(this, targetFlags)); + } + - if(immunities.size > 0){ - var imm = immunities.toSeq().sort(); - //it's redundant to list wet for naval units -@@ -682,6 +704,8 @@ public class UnitType extends UnlockableContent implements Senseable{ - - allowLegStep = example instanceof Legsc; - +@@ -684,0 +707,2 @@ public class UnitType extends UnlockableContent implements Senseable{ + stats.useCategories = true; + - //water preset - if(example instanceof WaterMovec){ - naval = true; -@@ -1312,12 +1336,12 @@ public class UnitType extends UnlockableContent implements Senseable{ - - Draw.reset(); - } +@@ -1315 +1339 @@ public class UnitType extends UnlockableContent implements Senseable{ - + - //...where do I put this - public Color shieldColor(Unit unit){ - return shieldColor == null ? unit.team.color : shieldColor; - } +@@ -1320 +1344 @@ public class UnitType extends UnlockableContent implements Senseable{ - + - - public void drawMining(Unit unit){ - if(!unit.mining()) return; diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index d67a1ca03202019648a65863d0114c96fb21cd78..f9ec8feac6e944e76b5e2309da9b78e9d1269348 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java -@@ -22,6 +22,7 @@ import mindustry.entities.units.*; - import mindustry.gen.*; - import mindustry.graphics.*; - import mindustry.world.meta.*; +@@ -24,0 +25 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -164,13 +165,26 @@ public class Weapon implements Cloneable{ - } - - public void addStats(UnitType u, Table t){ +@@ -167 +168,9 @@ public class Weapon implements Cloneable{ - if(inaccuracy > 0){ + if(reload > 0) { - t.row(); -- t.add("[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)inaccuracy + " " + StatUnit.degrees.localized()); ++ t.row(); + int shoots = StatExt.totalShots(shoot); + t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "[stat]2 [lightgray]x " : "") + (shoots == 1 ? "" : "[stat]" + shoots + " [lightgray]x ") + "[stat]" + Strings.autoFixed(60f / reload, 2) + " []" + StatUnit.perSecond.localized()); - } -- if(!alwaysContinuous && reload > 0){ ++ } + t.row(); + t.add("[lightgray]武器范围: [stat]" + String.format("%.1f", bullet.range/8f) + " []格"); + + if (rotate) { -+ t.row(); +@@ -169 +178,5 @@ public class Weapon implements Cloneable{ +- t.add("[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)inaccuracy + " " + StatUnit.degrees.localized()); + t.add("[lightgray]旋转速度: [stat]" + String.format("%.0f", rotateSpeed * 60f) + " []°/s"); + if (rotationLimit < 361f) { + t.row(); + t.add("[lightgray]旋转范围: [stat]" + String.format("%.0f", rotationLimit) + " []" + StatUnit.degrees.localized()); + } -+ } +@@ -171 +184,2 @@ public class Weapon implements Cloneable{ +- if(!alwaysContinuous && reload > 0){ + + if(inaccuracy > 0){ - t.row(); +@@ -173 +187 @@ public class Weapon implements Cloneable{ - t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / reload * shoot.shots, 2) + " " + StatUnit.perSecond.localized()); + t.add("[lightgray]" + Stat.inaccuracy.localized() + ": [stat]" + (int)inaccuracy + " []" + StatUnit.degrees.localized()); - } - - StatValues.ammo(ObjectMap.of(u, bullet)).display(t); diff --git a/core/src/mindustry/ui/ItemImage.java b/core/src/mindustry/ui/ItemImage.java index 874fa6ceff4c1ea412db02eb2adfb4e491771b19..6f20b9cd229a15a67d629e56762d86df3ec97012 100644 --- a/core/src/mindustry/ui/ItemImage.java +++ b/core/src/mindustry/ui/ItemImage.java -@@ -1,11 +1,15 @@ - package mindustry.ui; - +@@ -2,0 +3,2 @@ package mindustry.ui; +import arc.func.Intp; +import arc.func.Prov; - import arc.graphics.g2d.*; +@@ -3,0 +6 @@ import arc.graphics.g2d.*; +import arc.scene.Element; - import arc.scene.ui.*; - import arc.scene.ui.layout.*; - import arc.util.*; - import mindustry.core.*; - import mindustry.type.*; +@@ -8,0 +12 @@ import mindustry.type.*; +import static mindustry.Vars.*; - - public class ItemImage extends Stack{ - -@@ -25,6 +29,24 @@ public class ItemImage extends Stack{ - } - } - +@@ -27,0 +32,18 @@ public class ItemImage extends Stack{ + public ItemImage(TextureRegion region, int reqAmount, Intp curAmount){ + add(new Table(o -> { + o.left(); @@ -325,198 +223,93 @@ index 874fa6ceff4c1ea412db02eb2adfb4e491771b19..6f20b9cd229a15a67d629e56762d86df + })); + } + - public ItemImage(ItemStack stack){ - this(stack.item.uiIcon, stack.amount); - } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index d2b2cbf2fa285ede7df166c8171c73936196cab1..c1dde3fda61032c7e404f3ec3628a6fcfa3df9af 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java -@@ -32,6 +32,7 @@ import mindustry.world.blocks.environment.*; - import mindustry.world.blocks.power.*; - import mindustry.world.consumers.*; - import mindustry.world.meta.*; +@@ -34,0 +35 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import java.lang.reflect.*; - import java.util.*; -@@ -544,7 +545,7 @@ public class Block extends UnlockableContent implements Senseable{ - } - } - +@@ -547 +548 @@ public class Block extends UnlockableContent implements Senseable{ - if(canBeBuilt() && requirements.length > 0){ + if(requirements.length > 0){ - stats.add(Stat.buildTime, buildCost / 60, StatUnit.seconds); - stats.add(Stat.buildCost, StatValues.items(false, requirements)); - } -@@ -556,6 +557,7 @@ public class Block extends UnlockableContent implements Senseable{ - for(var c : consumers){ - c.display(stats); - } +@@ -558,0 +560 @@ public class Block extends UnlockableContent implements Senseable{ + stats.add(StatExt.canOverdrive, canOverdrive); - - //Note: Power stats are added by the consumers. - if(hasLiquids) stats.add(Stat.liquidCapacity, liquidCapacity, StatUnit.liquidUnits); diff --git a/core/src/mindustry/world/blocks/defense/ForceProjector.java b/core/src/mindustry/world/blocks/defense/ForceProjector.java index 74f0fd4860644903c3ce81318681596f0a60d317..4b7d6968838780299971c9a827752e516d74ea0c 100644 --- a/core/src/mindustry/world/blocks/defense/ForceProjector.java +++ b/core/src/mindustry/world/blocks/defense/ForceProjector.java -@@ -20,6 +20,7 @@ import mindustry.ui.*; - import mindustry.world.*; - import mindustry.world.consumers.*; - import mindustry.world.meta.*; +@@ -22,0 +23 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -96,13 +97,15 @@ public class ForceProjector extends Block{ - - if(consItems) stats.timePeriod = phaseUseTime; - super.setStats(); +@@ -98,0 +100 @@ public class ForceProjector extends Block{ + stats.add(Stat.range, radius / tilesize, StatUnit.blocks); - stats.add(Stat.shieldHealth, shieldHealth, StatUnit.none); - stats.add(Stat.cooldownTime, (int) (shieldHealth / cooldownBrokenBase / 60f), StatUnit.seconds); +@@ -101 +103,2 @@ public class ForceProjector extends Block{ - + stats.add(StatExt.regenSpeed, cooldownNormal * Time.toSeconds, StatUnit.perSecond); + stats.add(StatExt.regenSpeedBroken, cooldownBrokenBase * Time.toSeconds, StatUnit.perSecond); - if(consItems && itemConsumer instanceof ConsumeItems coni){ - stats.remove(Stat.booster); - stats.add(Stat.booster, StatValues.itemBoosters("+{0} " + StatUnit.shieldHealth.localized(), stats.timePeriod, phaseShieldBoost, phaseRadiusBoost, coni.items, this::consumesItem)); +@@ -105 +108 @@ public class ForceProjector extends Block{ - stats.add(Stat.booster, StatValues.speedBoosters("", coolantConsumption, Float.MAX_VALUE, true, this::consumesLiquid)); + stats.add(Stat.booster, StatValues.speedBoosters(Core.bundle.get("shield.regenspeed"), coolantConsumption, cooldownLiquid, true, this::consumesLiquid, true)); - } - } - diff --git a/core/src/mindustry/world/blocks/defense/MendProjector.java b/core/src/mindustry/world/blocks/defense/MendProjector.java index 369d0eecea48320fb8559acdf6de9cf2c74447c9..5c9f7369c72dbd5b6b4345008e7dc896e48b02b4 100644 --- a/core/src/mindustry/world/blocks/defense/MendProjector.java +++ b/core/src/mindustry/world/blocks/defense/MendProjector.java -@@ -13,6 +13,7 @@ import mindustry.logic.*; - import mindustry.world.*; - import mindustry.world.consumers.*; - import mindustry.world.meta.*; +@@ -15,0 +16 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -51,13 +52,15 @@ public class MendProjector extends Block{ - stats.timePeriod = useTime; - super.setStats(); - +@@ -54 +54,0 @@ public class MendProjector extends Block{ - stats.add(Stat.repairTime, (int)(100f / healPercent * reload / 60f), StatUnit.seconds); - stats.add(Stat.range, range / tilesize, StatUnit.blocks); +@@ -55,0 +56,3 @@ public class MendProjector extends Block{ + stats.add(StatExt.mend, healPercent, StatUnit.percent); + stats.add(StatExt.mendReload, reload / 60f, StatUnit.seconds); + stats.add(StatExt.mendSpeed, "@%/s", Strings.autoFixed(healPercent / (reload / 60f), 1)); - - if(findConsumer(c -> c instanceof ConsumeItems) instanceof ConsumeItems cons){ - stats.remove(Stat.booster); - stats.add(Stat.booster, StatValues.itemBoosters( +@@ -60 +63 @@ public class MendProjector extends Block{ - "{0}" + StatUnit.timesSpeed.localized(), + "{0}x修复量", - stats.timePeriod, (phaseBoost + healPercent) / healPercent, phaseRangeBoost, - cons.items, this::consumesItem) - ); diff --git a/core/src/mindustry/world/blocks/defense/RegenProjector.java b/core/src/mindustry/world/blocks/defense/RegenProjector.java index 69bbb61116ad4a09306c05f056020305c15ea2e2..4e446b3c30cf663542fd4d3256691a88a7cc66c7 100644 --- a/core/src/mindustry/world/blocks/defense/RegenProjector.java +++ b/core/src/mindustry/world/blocks/defense/RegenProjector.java -@@ -14,6 +14,7 @@ import mindustry.world.*; - import mindustry.world.consumers.*; - import mindustry.world.draw.*; - import mindustry.world.meta.*; +@@ -16,0 +17 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -89,13 +90,13 @@ public class RegenProjector extends Block{ - stats.timePeriod = optionalUseTime; - super.setStats(); - +@@ -92 +92,0 @@ public class RegenProjector extends Block{ - stats.add(Stat.repairTime, (int)(1f / (healPercent / 100f) / 60f), StatUnit.seconds); - stats.add(Stat.range, range, StatUnit.blocks); +@@ -93,0 +94 @@ public class RegenProjector extends Block{ + stats.add(StatExt.mendSpeed, "@%/s", Strings.autoFixed(healPercent * 60f, 1)); - - if(findConsumer(c -> c instanceof ConsumeItems) instanceof ConsumeItems cons){ - stats.remove(Stat.booster); - stats.add(Stat.booster, StatValues.itemBoosters( +@@ -98 +99 @@ public class RegenProjector extends Block{ - "{0}" + StatUnit.timesSpeed.localized(), + "{0}x修复速度", - stats.timePeriod, optionalMultiplier, 0f, - cons.items, this::consumesItem) - ); diff --git a/core/src/mindustry/world/blocks/defense/ShieldWall.java b/core/src/mindustry/world/blocks/defense/ShieldWall.java index 8f7a1135a1c2b46b7b83b8ca58cdbb12ccc90784..53c0889446bda2891a6417c435ff255953447b92 100644 --- a/core/src/mindustry/world/blocks/defense/ShieldWall.java +++ b/core/src/mindustry/world/blocks/defense/ShieldWall.java -@@ -8,6 +8,7 @@ import arc.util.io.*; - import mindustry.annotations.Annotations.*; - import mindustry.graphics.*; - import mindustry.world.meta.*; +@@ -10,0 +11 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -32,6 +33,9 @@ public class ShieldWall extends Wall{ - super.setStats(); - - stats.add(Stat.shieldHealth, shieldHealth); +@@ -34,0 +36,3 @@ public class ShieldWall extends Wall{ + stats.add(Stat.cooldownTime, breakCooldown / Time.toSeconds, StatUnit.seconds); + stats.add(StatExt.regenSpeed, regenSpeed * Time.toSeconds, StatUnit.perSecond); + - } - - public class ShieldWallBuild extends WallBuild{ diff --git a/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java b/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java index 97aedf43b5595bcfb63ea9ecce91dc6e57967e92..cd30d93b35b0547658c39c0b0f6e5ef0f8300973 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java -@@ -52,6 +52,7 @@ public class PointDefenseTurret extends ReloadTurret{ - super.setStats(); - - stats.add(Stat.reload, 60f / reload, StatUnit.perSecond); +@@ -54,0 +55 @@ public class PointDefenseTurret extends ReloadTurret{ + stats.add(Stat.damage, bulletDamage); - } - - public class PointDefenseBuild extends ReloadTurretBuild{ diff --git a/core/src/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/mindustry/world/blocks/defense/turrets/Turret.java index 0baea25f9367d45ad3384bbbc69bd4299b9a19a8..df8ecaa3537b0fb9d1ffad0226695af9596b9b81 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/Turret.java -@@ -26,6 +26,7 @@ import mindustry.ui.*; - import mindustry.world.blocks.*; - import mindustry.world.draw.*; - import mindustry.world.meta.*; +@@ -28,0 +29 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -152,7 +153,8 @@ public class Turret extends ReloadTurret{ - super.setStats(); - - stats.add(Stat.inaccuracy, (int)inaccuracy, StatUnit.degrees); +@@ -155 +156,2 @@ public class Turret extends ReloadTurret{ - stats.add(Stat.reload, 60f / (reload) * shoot.shots, StatUnit.perSecond); + int shoots = StatExt.totalShots(shoot); + stats.add(Stat.reload, "@@/s", shoots == 1 ? "" : shoots + " x ", Strings.autoFixed(60f / reload, 2)); - stats.add(Stat.targetsAir, targetAir); - stats.add(Stat.targetsGround, targetGround); - if(ammoPerShot != 1) stats.add(Stat.ammoUse, ammoPerShot, StatUnit.perShot); diff --git a/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java b/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java index cf4602f09a5e5e6dfd86eef88ace838ea0309fbf..ccb6d48fe731ea72fd720caa06c0173a00dc123a 100644 --- a/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java +++ b/core/src/mindustry/world/blocks/distribution/BufferedItemBridge.java -@@ -9,6 +9,7 @@ import mindustry.gen.*; - import mindustry.graphics.*; - import mindustry.type.*; - import mindustry.world.*; +@@ -11,0 +12 @@ import mindustry.world.*; +import mindustry.world.meta.*; - import mindustryX.features.*; - - import static mindustry.Vars.*; -@@ -26,6 +27,14 @@ public class BufferedItemBridge extends ItemBridge{ - canOverdrive = true; - } - +@@ -28,0 +30,8 @@ public class BufferedItemBridge extends ItemBridge{ + @Override + public void setStats(){ + super.setStats(); @@ -525,17 +318,11 @@ index cf4602f09a5e5e6dfd86eef88ace838ea0309fbf..ccb6d48fe731ea72fd720caa06c0173a + stats.add(Stat.itemsMoved, Strings.autoFixed(bufferCapacity * 60f / speed ,2) , StatUnit.itemsSecond); + } + - public class BufferedItemBridgeBuild extends ItemBridgeBuild{ - ItemBuffer buffer = new ItemBuffer(bufferCapacity); - diff --git a/core/src/mindustry/world/blocks/distribution/Junction.java b/core/src/mindustry/world/blocks/distribution/Junction.java index 698e95ac696a3267bba1eb4bb3da2852154b71a4..5ed25c723e407a4a95c878c6637a3cf34ec4a820 100644 --- a/core/src/mindustry/world/blocks/distribution/Junction.java +++ b/core/src/mindustry/world/blocks/distribution/Junction.java -@@ -30,6 +30,16 @@ public class Junction extends Block{ - noUpdateDisabled = true; - } - +@@ -32,0 +33,10 @@ public class Junction extends Block{ + @Override + public void setStats(){ + super.setStats(); @@ -546,25 +333,13 @@ index 698e95ac696a3267bba1eb4bb3da2852154b71a4..5ed25c723e407a4a95c878c6637a3cf3 + } + + - @Override - public boolean outputsItems(){ - return true; diff --git a/core/src/mindustry/world/blocks/power/ImpactReactor.java b/core/src/mindustry/world/blocks/power/ImpactReactor.java index 136cf66b46876bb32783bab353f1da20726410d8..528b2960a70af587b6b6fbbaf203646d0bd6a594 100644 --- a/core/src/mindustry/world/blocks/power/ImpactReactor.java +++ b/core/src/mindustry/world/blocks/power/ImpactReactor.java -@@ -13,6 +13,7 @@ import mindustry.logic.*; - import mindustry.ui.*; - import mindustry.world.draw.*; - import mindustry.world.meta.*; +@@ -15,0 +16 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - public class ImpactReactor extends PowerGenerator{ - public final int timerUse = timers++; -@@ -41,6 +42,14 @@ public class ImpactReactor extends PowerGenerator{ - explodeSound = Sounds.explosionbig; - } - +@@ -43,0 +45,8 @@ public class ImpactReactor extends PowerGenerator{ + private float warmupToTime(float warmup, float timeScale) { + return Mathf.log(1f - warmupSpeed * timeScale, 1f - warmup); + } @@ -573,13 +348,7 @@ index 136cf66b46876bb32783bab353f1da20726410d8..528b2960a70af587b6b6fbbaf203646d + return 1f - Mathf.pow(1 - warmupSpeed * timeScale, time); + } + - @Override - public void setBars(){ - super.setBars(); -@@ -59,6 +68,14 @@ public class ImpactReactor extends PowerGenerator{ - if(hasItems){ - stats.add(Stat.productionTime, itemDuration / 60f, StatUnit.seconds); - } +@@ -61,0 +71,8 @@ public class ImpactReactor extends PowerGenerator{ + float startTime = warmupToTime(Mathf.pow(consPower.usage / powerProduction, 1f / 5f), 1f); + stats.add(StatExt.warmupPartial, startTime / 60f, StatUnit.seconds); + stats.add(StatExt.warmupTime, warmupToTime(0.999f, 1f) / 60f, StatUnit.seconds); @@ -588,134 +357,75 @@ index 136cf66b46876bb32783bab353f1da20726410d8..528b2960a70af587b6b6fbbaf203646d + startConsPower += consPower.usage - Mathf.pow(timeToWarmup(tick, 1f), 5f) * powerProduction; + } + stats.add(StatExt.warmupPower, Mathf.ceil(startConsPower / 50f) * 50f, StatUnit.none); - } - - public class ImpactReactorBuild extends GeneratorBuild{ diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index 0068ed4d6549a70f801e8a95653fdad7317fb948..21babe1f3e89b0a33bbc93c8e79bc9d76505ad5f 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java -@@ -171,10 +171,7 @@ public class Drill extends Block{ - public void setStats(){ - super.setStats(); - +@@ -174,4 +174 @@ public class Drill extends Block{ - stats.add(Stat.drillTier, StatValues.drillables(drillTime, hardnessDrillMultiplier, size * size, drillMultipliers, b -> b instanceof Floor f && !f.wallOre && f.itemDrop != null && - f.itemDrop.hardness <= tier && f.itemDrop != blockedItem && (indexer.isBlockPresent(f) || state.isMenu()))); - - stats.add(Stat.drillSpeed, 60f / drillTime * size * size, StatUnit.itemsSecond); + stats.add(Stat.drillTier, StatValues.drillBlock(this)); - - if(liquidBoostIntensity != 1 && findConsumer(f -> f instanceof ConsumeLiquidBase) instanceof ConsumeLiquidBase consBase){ - stats.remove(Stat.booster); diff --git a/core/src/mindustry/world/blocks/production/Separator.java b/core/src/mindustry/world/blocks/production/Separator.java index fd387d6960fc0b33278ea5925f18ac659cb66e1a..9c0b560e43d6d1abeb9396283f4a6a99447dc8a2 100644 --- a/core/src/mindustry/world/blocks/production/Separator.java +++ b/core/src/mindustry/world/blocks/production/Separator.java -@@ -12,6 +12,7 @@ import mindustry.world.*; - import mindustry.world.consumers.*; - import mindustry.world.draw.*; - import mindustry.world.meta.*; +@@ -14,0 +15 @@ import mindustry.world.meta.*; +import mindustryX.features.*; - - /** - * Extracts a random list of items from an input item and an input liquid. -@@ -38,7 +39,7 @@ public class Separator extends Block{ - stats.timePeriod = craftTime; - super.setStats(); - +@@ -41 +42 @@ public class Separator extends Block{ - stats.add(Stat.output, StatValues.items(item -> Structs.contains(results, i -> i.item == item))); + stats.add(StatExt.sepOutput,StatValues.items(results)); - stats.add(Stat.productionTime, craftTime / 60f, StatUnit.seconds); - } - diff --git a/core/src/mindustry/world/blocks/sandbox/PowerSource.java b/core/src/mindustry/world/blocks/sandbox/PowerSource.java index 0e011c9bac5573a8124e5e603f0054319eaff0ba..fa8abf6f6424f11e2155a1258157416f1e54423a 100644 --- a/core/src/mindustry/world/blocks/sandbox/PowerSource.java +++ b/core/src/mindustry/world/blocks/sandbox/PowerSource.java -@@ -16,6 +16,12 @@ public class PowerSource extends PowerNode{ - envEnabled = Env.any; - } - +@@ -18,0 +19,6 @@ public class PowerSource extends PowerNode{ + @Override + public void setStats() { + super.setStats(); + stats.add(Stat.basePowerGeneration, powerProduction * 60f, StatUnit.powerSecond); + } + - public class PowerSourceBuild extends PowerNodeBuild{ - @Override - public void onProximityUpdate(){ diff --git a/core/src/mindustry/world/blocks/sandbox/PowerVoid.java b/core/src/mindustry/world/blocks/sandbox/PowerVoid.java index d0a8acf4d7438f25f5a9ec275982f6564f4a4483..6943d06cf9438d757ccc61e582fac169c20683d9 100644 --- a/core/src/mindustry/world/blocks/sandbox/PowerVoid.java +++ b/core/src/mindustry/world/blocks/sandbox/PowerVoid.java -@@ -15,6 +15,5 @@ public class PowerVoid extends PowerBlock{ - @Override - public void setStats(){ - super.setStats(); +@@ -18 +17,0 @@ public class PowerVoid extends PowerBlock{ - stats.remove(Stat.powerUse); - } - } diff --git a/core/src/mindustry/world/consumers/ConsumeItemDynamic.java b/core/src/mindustry/world/consumers/ConsumeItemDynamic.java index 45325369cde396b510ff48ff19335fca5bfdffaa..cf58ad1987a98b584dbfaf43b2bc7930c055fcde 100644 --- a/core/src/mindustry/world/consumers/ConsumeItemDynamic.java +++ b/core/src/mindustry/world/consumers/ConsumeItemDynamic.java -@@ -42,7 +42,7 @@ public class ConsumeItemDynamic extends Consume{ - int i = 0; - - for(ItemStack stack : items.get(build)){ +@@ -45 +45 @@ public class ConsumeItemDynamic extends Consume{ - table.add(new ReqImage(new ItemImage(stack.item.uiIcon, Math.round(stack.amount * multiplier.get(build))), + table.add(new ReqImage(new ItemImage(stack.item.uiIcon, Math.round(stack.amount * multiplier.get(build)), () -> build.items.get(stack.item)), - () -> build.items != null && build.items.has(stack.item, Math.round(stack.amount * multiplier.get(build))))).padRight(8).left(); - if(++i % 4 == 0) table.row(); - } diff --git a/core/src/mindustry/world/consumers/ConsumeItems.java b/core/src/mindustry/world/consumers/ConsumeItems.java index 791db5a71dc02fb139d1369b0efdf115f1af5a4c..322c52cc3d6f4c233371b622c30de608bb06bde5 100644 --- a/core/src/mindustry/world/consumers/ConsumeItems.java +++ b/core/src/mindustry/world/consumers/ConsumeItems.java -@@ -33,7 +33,7 @@ public class ConsumeItems extends Consume{ - table.table(c -> { - int i = 0; - for(var stack : items){ +@@ -36 +36 @@ public class ConsumeItems extends Consume{ - c.add(new ReqImage(new ItemImage(stack.item.uiIcon, Math.round(stack.amount * multiplier.get(build))), + c.add(new ReqImage(new ItemImage(stack.item.uiIcon, Math.round(stack.amount * multiplier.get(build)), () -> build.items.get(stack.item)), - () -> build.items.has(stack.item, Math.round(stack.amount * multiplier.get(build))))).padRight(8); - if(++i % 4 == 0) c.row(); - } diff --git a/core/src/mindustry/world/consumers/ConsumePayloadDynamic.java b/core/src/mindustry/world/consumers/ConsumePayloadDynamic.java index d12abb009d78f089b3a7131b4409ce57a16f1a43..29c3e689c2b23418c809c8916d3b4990b7e337c4 100644 --- a/core/src/mindustry/world/consumers/ConsumePayloadDynamic.java +++ b/core/src/mindustry/world/consumers/ConsumePayloadDynamic.java -@@ -63,7 +63,7 @@ public class ConsumePayloadDynamic extends Consume{ - table.table(c -> { - int i = 0; - for(var stack : pay){ +@@ -66 +66 @@ public class ConsumePayloadDynamic extends Consume{ - c.add(new ReqImage(new ItemImage(stack.item.uiIcon, Math.round(stack.amount * multiplier.get(build))), + c.add(new ReqImage(new ItemImage(stack.item.uiIcon, Math.round(stack.amount * multiplier.get(build)), () -> build.getPayloads().get(stack.item)), - () -> inv.contains(stack.item, Math.round(stack.amount * multiplier.get(build))))).padRight(8); - if(++i % 4 == 0) c.row(); - } diff --git a/core/src/mindustry/world/consumers/ConsumePayloads.java b/core/src/mindustry/world/consumers/ConsumePayloads.java index ae905a4e8b5929ec4274bfe21d13fa9c4d1352f3..03dc185e0ea98f409aa21da9adc7e1ef7cc55ecb 100644 --- a/core/src/mindustry/world/consumers/ConsumePayloads.java +++ b/core/src/mindustry/world/consumers/ConsumePayloads.java -@@ -51,7 +51,7 @@ public class ConsumePayloads extends Consume{ - table.table(c -> { - int i = 0; - for(var stack : payloads){ +@@ -54 +54 @@ public class ConsumePayloads extends Consume{ - c.add(new ReqImage(new ItemImage(stack.item.uiIcon, Math.round(stack.amount * multiplier.get(build))), + c.add(new ReqImage(new ItemImage(stack.item.uiIcon, Math.round(stack.amount * multiplier.get(build)), () -> build.items.get((Item) stack.item)), - () -> inv.contains(stack.item, Math.round(stack.amount * multiplier.get(build))))).padRight(8); - if(++i % 4 == 0) c.row(); - } diff --git a/core/src/mindustry/world/meta/Stat.java b/core/src/mindustry/world/meta/Stat.java index b1257d6232977ca6baaa841b0483fe3d3d1f5871..4249bb2ca961dfbc20fa38fe5b1cc8f079bbc554 100644 --- a/core/src/mindustry/world/meta/Stat.java +++ b/core/src/mindustry/world/meta/Stat.java -@@ -25,17 +25,18 @@ public class Stat implements Comparable{ - heatCapacity = new Stat("heatCapacity"), - viscosity = new Stat("viscosity"), - temperature = new Stat("temperature"), +@@ -28,6 +28,7 @@ public class Stat implements Comparable{ - flying = new Stat("flying"), - speed = new Stat("speed"), - buildSpeed = new Stat("buildSpeed"), @@ -729,79 +439,41 @@ index b1257d6232977ca6baaa841b0483fe3d3d1f5871..4249bb2ca961dfbc20fa38fe5b1cc8f0 + mineTier = new Stat("mineTier", StatCat.support), + payloadCapacity = new Stat("payloadCapacity", StatCat.support), + - baseDeflectChance = new Stat("baseDeflectChance"), - lightningChance = new Stat("lightningChance"), - lightningDamage = new Stat("lightningDamage"), +@@ -37,2 +38,2 @@ public class Stat implements Comparable{ - abilities = new Stat("abilities"), - canBoost = new Stat("canBoost"), + abilities = new Stat("abilities", StatCat.combat), + canBoost = new Stat("canBoost", StatCat.movement), - maxUnits = new Stat("maxUnits"), - - damageMultiplier = new Stat("damageMultiplier"), -@@ -71,8 +72,8 @@ public class Stat implements Comparable{ - linkRange = new Stat("linkRange", StatCat.crafting), - instructions = new Stat("instructions", StatCat.crafting), - +@@ -74,2 +75,2 @@ public class Stat implements Comparable{ - weapons = new Stat("weapons", StatCat.function), - bullet = new Stat("bullet", StatCat.function), + weapons = new Stat("weapons", StatCat.combat), + bullet = new Stat("bullet", StatCat.combat), - - speedIncrease = new Stat("speedIncrease", StatCat.function), - repairTime = new Stat("repairTime", StatCat.function), diff --git a/core/src/mindustry/world/meta/StatCat.java b/core/src/mindustry/world/meta/StatCat.java index 416df5a20af4767cdfdc2646bce19468ad11cd28..239311eea91980f2c3e0facd6613b2373cc11909 100644 --- a/core/src/mindustry/world/meta/StatCat.java +++ b/core/src/mindustry/world/meta/StatCat.java -@@ -15,7 +15,10 @@ public class StatCat implements Comparable{ - items = new StatCat("items"), - crafting = new StatCat("crafting"), - function = new StatCat("function"), +@@ -18 +18,4 @@ public class StatCat implements Comparable{ - optional = new StatCat("optional"); + optional = new StatCat("optional"), + support = new StatCat("support"), + combat = new StatCat("combat"), + movement = new StatCat("movement"); - - public final String name; - public final int id; diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25dcd22034 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java -@@ -12,7 +12,7 @@ import arc.util.*; - import mindustry.*; - import mindustry.content.*; - import mindustry.ctype.*; +@@ -15 +15 @@ import mindustry.ctype.*; -import mindustry.entities.abilities.*; +import mindustry.entities.abilities.Ability; - import mindustry.entities.bullet.*; - import mindustry.gen.*; - import mindustry.maps.*; -@@ -21,6 +21,9 @@ import mindustry.ui.*; - import mindustry.world.*; - import mindustry.world.blocks.defense.turrets.*; - import mindustry.world.blocks.environment.*; +@@ -23,0 +24,3 @@ import mindustry.world.blocks.environment.*; +import mindustry.world.blocks.production.Drill; +import mindustryX.*; +import mindustryX.features.*; - - import static mindustry.Vars.*; - -@@ -164,7 +167,7 @@ public class StatValues{ - - if(state.isGame()){ - var blocks = Vars.content.blocks() +@@ -167 +170 @@ public class StatValues{ - .select(block -> (!checkFloors || block instanceof Floor) && indexer.isBlockPresent(block) && block.attributes.get(attr) != 0 && !((block instanceof Floor f && f.isDeep()) && !floating)) + .select(block -> (!checkFloors || block instanceof Floor) && block.attributes.get(attr) != 0 && !((block instanceof Floor f && f.isDeep()) && !floating)) - .with(s -> s.sort(f -> f.attributes.get(attr))); - - if(blocks.any()){ -@@ -237,7 +240,39 @@ public class StatValues{ - return content(list.as()); - } - +@@ -240 +243,33 @@ public class StatValues{ - public static StatValue drillables(float drillTime, float drillMultiplier, float size, ObjectFloatMap multipliers, Boolf filter){ + public static StatValue drillBlock(Drill drill){ + Seq list = content.blocks().select(b -> b instanceof Floor f && !f.wallOre && f.itemDrop != null && f.itemDrop.hardness <= drill.tier && f.itemDrop != drill.blockedItem); @@ -836,49 +508,25 @@ index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25 + }; + } + public static StatValue drillables(float drillTime, float hardnessMultiplier, float size, ObjectFloatMap multipliers, Boolf filter){ - return table -> { - table.row(); - table.table(c -> { -@@ -252,10 +287,8 @@ public class StatValues{ - info.add(block.localizedName).left().row(); - info.add(block.itemDrop.emoji()).left(); - }).grow(); +@@ -255,4 +290,2 @@ public class StatValues{ - if(multipliers != null){ - b.add(Strings.autoFixed(60f / (Math.max(drillTime + drillMultiplier * block.itemDrop.hardness, drillTime) / multipliers.get(block.itemDrop, 1f)) * size, 2) + StatUnit.perSecond.localized()) - .right().pad(10f).padRight(15f).color(Color.lightGray); - } + b.add(Strings.autoFixed(60f / (drillTime + hardnessMultiplier * block.itemDrop.hardness) * (multipliers == null ? 1 : multipliers.get(block.itemDrop, 1f)) * size, 2) + StatUnit.perSecond.localized()) + .right().pad(10f).padRight(15f).color(Color.lightGray); - }).growX().pad(5); - if(++i % 2 == 0) c.row(); - } -@@ -293,6 +326,10 @@ public class StatValues{ - } - - public static StatValue speedBoosters(String unit, float amount, float speed, boolean strength, Boolf filter){ +@@ -295,0 +329,4 @@ public class StatValues{ + return speedBoosters(unit, amount, speed, strength, filter, false); + } + + public static StatValue speedBoosters(String unit, float amount, float speed, boolean strength, Boolf filter, Boolean isForce){ - return table -> { - table.row(); - table.table(c -> { -@@ -308,7 +345,8 @@ public class StatValues{ - - b.table(bt -> { - bt.right().defaults().padRight(3).left(); +@@ -311 +348,2 @@ public class StatValues{ - if(speed != Float.MAX_VALUE) bt.add(unit.replace("{0}", "[stat]" + Strings.autoFixed(speed * (strength ? liquid.heatCapacity : 1f) + (strength ? 1f : 0f), 2) + "[lightgray]")).pad(5); + if(isForce) bt.add(unit.replace("{0}", "[stat]" + Strings.autoFixed(speed * ((liquid.heatCapacity - 0.4f) * 0.9f + 1), 2) + "[lightgray]")).pad(5); + else if(speed != Float.MAX_VALUE) bt.add(unit.replace("{0}", "[stat]" + Strings.autoFixed(speed * (strength ? liquid.heatCapacity : 1f) + (strength ? 1f : 0f), 2) + "[lightgray]")).pad(5); - }).right().grow().pad(10f).padRight(15f); - }).growX().pad(5).row(); - } -@@ -371,26 +409,54 @@ public class StatValues{ - }; - } - +@@ -373,0 +412 @@ public class StatValues{ + @MindustryXApi.Keep - public static StatValue abilities(Seq abilities){ +@@ -374,0 +414,26 @@ public class StatValues{ + return abilities(null, abilities); + } + @@ -905,9 +553,7 @@ index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25 + } + + public static StatValue targets(UnitType unit, BlockFlag[] targetFlags){ - return table -> { - table.row(); - table.table(t -> { +@@ -378,12 +443,12 @@ public class StatValues{ - int count = 0; - for(Ability ability : abilities){ - if(ability.display){ @@ -932,56 +578,29 @@ index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25 + break; + }else t.add(block.emoji()).width(30f); + count += 1; - } - } +@@ -392,2 +457,3 @@ public class StatValues{ - }; - }); + t.row(); + } + }).padLeft(12f); - }; - } - -@@ -431,7 +497,9 @@ public class StatValues{ - bt.row(); - } - +@@ -434 +500,3 @@ public class StatValues{ - if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){ + if(type instanceof LightningBulletType lb){ + lightning(0, lb.damage, lb.lightningLength, lb.lightningLengthRand).display(bt); + }else if(type.damage > 0 && (type.collides || type.splashDamage <= 0)){ - if(type.continuousDamage() > 0){ - bt.add(Core.bundle.format("bullet.damage", type.continuousDamage()) + StatUnit.perSecond.localized()); - }else{ -@@ -440,12 +508,11 @@ public class StatValues{ - } - - if(type.buildingDamageMultiplier != 1){ +@@ -443,2 +511 @@ public class StatValues{ - int val = (int)(type.buildingDamageMultiplier * 100 - 100); - sep(bt, Core.bundle.format("bullet.buildingdamage", ammoStat(val))); + sep(bt, colorize(type.buildingDamageMultiplier) + "[lightgray]x建筑伤害"); - } - - if(type.rangeChange != 0 && !compact){ +@@ -448 +515 @@ public class StatValues{ - sep(bt, Core.bundle.format("bullet.range", ammoStat(type.rangeChange / tilesize))); + sep(bt, "[lightgray]射程 + " + colorize(type.rangeChange / tilesize > 0) + Strings.autoFixed(type.rangeChange / tilesize, 1) + " [lightgray]格"); - } - - if(type.splashDamage > 0){ -@@ -457,8 +524,7 @@ public class StatValues{ - } - - if(!compact && !Mathf.equal(type.reloadMultiplier, 1f)){ +@@ -460,2 +527 @@ public class StatValues{ - int val = (int)(type.reloadMultiplier * 100 - 100); - sep(bt, Core.bundle.format("bullet.reload", ammoStat(val))); + sep(bt, colorize(type.reloadMultiplier) + "[lightgray]x射速"); - } - - if(type.knockback > 0){ -@@ -473,8 +539,24 @@ public class StatValues{ - sep(bt, Core.bundle.format("bullet.healamount", Strings.autoFixed(type.healAmount, 2))); - } - +@@ -476,2 +542,18 @@ public class StatValues{ - if(type.pierce || type.pierceCap != -1){ - sep(bt, type.pierceCap == -1 ? "@bullet.infinitepierce" : Core.bundle.format("bullet.pierce", type.pierceCap)); + if((type.pierce || type.pierceCap != -1) && !(type instanceof PointLaserBulletType)){ @@ -1002,41 +621,21 @@ index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25 + } + if(laserPierce) str.append("[stat](电性)"); + sep(bt, str.toString()); - } - - if(type.incendAmount > 0){ -@@ -482,11 +564,11 @@ public class StatValues{ - } - - if(type.homingPower > 0.01f){ +@@ -485 +567 @@ public class StatValues{ - sep(bt, "@bullet.homing"); + sep(bt, "[stat]追踪[lightgray]~[]" + Strings.autoFixed(type.homingPower * 50 * Time.toSeconds, 1) + "°/s[lightgray]~[]" + Strings.fixed(type.homingRange / tilesize, 1) + "[lightgray]格"); - } - +@@ -488,2 +570,2 @@ public class StatValues{ - if(type.lightning > 0){ - sep(bt, Core.bundle.format("bullet.lightning", type.lightning, type.lightningDamage < 0 ? type.damage : type.lightningDamage)); + if(!(type instanceof LightningBulletType) && type.lightning > 0){ + lightning(type.lightning, type.lightningDamage < 0 ? type.damage : type.lightningDamage, type.lightningLength, type.lightningLengthRand).display(bt); - } - - if(type.pierceArmor){ -@@ -494,7 +576,7 @@ public class StatValues{ - } - - if(type.maxDamageFraction > 0){ +@@ -497 +579 @@ public class StatValues{ - sep(bt, Core.bundle.format("bullet.maxdamagefraction", (int)(type.maxDamageFraction * 100))); + sep(bt, Core.bundle.format("bullet.maxdamagefraction", (int)(type.maxDamageFraction * 100))); - } - - if(type.suppressionRange > 0){ -@@ -519,26 +601,54 @@ public class StatValues{ - it.add(Core.bundle.format("bullet.interval", Strings.autoFixed(type.intervalBullets / type.bulletInterval * 60, 2))); - it.button(Icon.downOpen, Styles.emptyi, () -> coll.toggle(false)).update(i -> i.getStyle().imageUp = (!coll.isCollapsed() ? Icon.upOpen : Icon.downOpen)).size(8).padLeft(16f).expandX(); - }); +@@ -522,2 +603,0 @@ public class StatValues{ - bt.row(); - bt.add(coll); - } - +@@ -526,2 +606,15 @@ public class StatValues{ - if(type.fragBullet != null){ - bt.row(); + if(type instanceof EmpBulletType eb){ @@ -1054,7 +653,7 @@ index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25 + sep(ec, Strings.format("[stat]对敌方电网建筑减速至@%", Strings.autoFixed(eb.powerSclDecrease * 100, 0))); + }); + } - +@@ -529,4 +622,5 @@ public class StatValues{ - Table fc = new Table(); - ammo(ObjectMap.of(t, type.fragBullet), indent + 1, false).display(fc); - Collapser coll = new Collapser(fc, true); @@ -1064,7 +663,7 @@ index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25 + ammo(ObjectMap.of(t, type.fragBullet), indent + 1, false).display(fc); + }); + } - +@@ -534,2 +628,5 @@ public class StatValues{ - bt.table(ft -> { - ft.left().defaults().left(); + if(type.intervalBullet != null){ @@ -1072,7 +671,7 @@ index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25 + ammo(ObjectMap.of(t, type.intervalBullet), indent + 1, false).display(ic); + }); + } - +@@ -537,2 +634,17 @@ public class StatValues{ - ft.add(Core.bundle.format("bullet.frags", type.fragBullets)); - ft.button(Icon.downOpen, Styles.emptyi, () -> coll.toggle(false)).update(i -> i.getStyle().imageUp = (!coll.isCollapsed() ? Icon.upOpen : Icon.downOpen)).size(8).padLeft(16f).expandX(); + Seq spawn = type.spawnBullets.copy(); @@ -1092,16 +691,10 @@ index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25 + bt.row(); + spawn.removeAll(pred); + } - }); +@@ -540,2 +651,0 @@ public class StatValues{ - bt.row(); - bt.add(coll); - } - }).padLeft(indent * 5).padTop(5).padBottom(compact ? 0 : 5).growX().margin(compact ? 0 : 10); - table.row(); -@@ -546,10 +656,46 @@ public class StatValues{ - }; - } - +@@ -548,0 +659,16 @@ public class StatValues{ + public static StatValue lightning(int shots, float damage, int length, int lengthRand){ + return table -> { + String str = "[lightgray]"; @@ -1118,10 +711,10 @@ index 9c548f2836dc0e3ca068245651611d4d84579d04..eb651d09535c0edf270af4e0a037ee25 + }; + } + - //for AmmoListValue +@@ -550 +676 @@ public class StatValues{ - private static void sep(Table table, String text){ + private static Cell