From 8fb7cdaba659150bbdf1ba73da62582c7ffd4d53 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 15 Jul 2021 10:10:36 -0400 Subject: [PATCH 01/71] Fixed #5584 --- core/src/mindustry/io/TypeIO.java | 2 +- .../mindustry/world/blocks/logic/LogicBlock.java | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/core/src/mindustry/io/TypeIO.java b/core/src/mindustry/io/TypeIO.java index 5902413a1c..107b3bc3f9 100644 --- a/core/src/mindustry/io/TypeIO.java +++ b/core/src/mindustry/io/TypeIO.java @@ -633,7 +633,7 @@ public class TypeIO{ } } - /** Representes a building that has not been resolved yet. */ + /** Represents a building that has not been resolved yet. */ public static class BuildingBox{ public int pos; diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index a12ed08399..9ff67fb954 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -249,18 +249,6 @@ public class LogicBlock extends Block{ } } - @Override - public void onProximityAdded(){ - super.onProximityAdded(); - - //unbox buildings after reading - for(var v : executor.vars){ - if(v.objval instanceof BuildingBox b){ - v.objval = world.build(b.pos); - } - } - } - public String findLinkName(Block block){ String bname = getLinkName(block); Bits taken = new Bits(links.size); @@ -595,7 +583,7 @@ public class LogicBlock extends Block{ for(int i = 0; i < varcount; i++){ BVar dest = asm.getVar(names[i]); if(dest != null && !dest.constant){ - dest.value = values[i]; + dest.value = values[i] instanceof BuildingBox box ? world.build(box.pos) : values[i]; } } }); From eb31483a15b3f89452b423620f4c84cef8f88f42 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 15 Jul 2021 10:18:08 -0400 Subject: [PATCH 02/71] Fixed #5585 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 95b6c068ad..419d78ee4f 100644 --- a/build.gradle +++ b/build.gradle @@ -57,7 +57,7 @@ allprojects{ if(!project.hasProperty("versionType")) versionType = 'official' appName = 'Mindustry' steamworksVersion = '0b86023401880bb5e586bc404bedbaae9b1f1c94' - rhinoVersion = '0601de1f37d55b25d2a6e647acba336f40cdefe4' + rhinoVersion = '9f792d202471fb3789eab7bb261fec13d67287e2' loadVersionProps = { return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p } From 1c2b1fb75704f5855e4805c3f182642d2e9aa51a Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 15 Jul 2021 11:27:21 -0400 Subject: [PATCH 03/71] System property cleanup --- core/src/mindustry/ClientLauncher.java | 2 +- core/src/mindustry/net/CrashSender.java | 21 +++++----- core/src/mindustry/ui/Links.java | 40 ++++++++++++------- gradle.properties | 2 +- .../src/mindustry/server/ServerControl.java | 2 +- 5 files changed, 38 insertions(+), 29 deletions(-) diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientLauncher.java index 24582860bf..5ea23d3555 100644 --- a/core/src/mindustry/ClientLauncher.java +++ b/core/src/mindustry/ClientLauncher.java @@ -55,7 +55,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform Log.info("[GL] Max texture size: @", maxTextureSize); Log.info("[GL] Using @ context.", gl30 != null ? "OpenGL 3" : "OpenGL 2"); if(maxTextureSize < 4096) Log.warn("[GL] Your maximum texture size is below the recommended minimum of 4096. This will cause severe performance issues."); - Log.info("[JAVA] Version: @", System.getProperty("java.version")); + Log.info("[JAVA] Version: @", OS.javaVersion); Time.setDeltaProvider(() -> { float result = Core.graphics.getDeltaTime() * 60f; diff --git a/core/src/mindustry/net/CrashSender.java b/core/src/mindustry/net/CrashSender.java index b1cbfdbf58..1f3720c8ac 100644 --- a/core/src/mindustry/net/CrashSender.java +++ b/core/src/mindustry/net/CrashSender.java @@ -29,18 +29,17 @@ public class CrashSender{ report += "Report this at " + Vars.reportIssueURL + "\n\n"; } return report - + "Version: " + Version.combined() + (Vars.headless ? " (Server)" : "") + "\n" - + "OS: " + System.getProperty("os.name") + " x" + (OS.is64Bit ? "64" : "32") + "\n" - + "Java Version: " + System.getProperty("java.version") + "\n" - + "Java Architecture: " + System.getProperty("sun.arch.data.model") + "\n" - + (mods == null ? "" : mods.list().size + " Mods" + (mods.list().isEmpty() ? "" : ": " + mods.list().toString(", ", mod -> mod.name + ":" + mod.meta.version))) - + "\n\n" + error; + + "Version: " + Version.combined() + (Vars.headless ? " (Server)" : "") + "\n" + + "OS: " + OS.osName + " x" + (OS.osArchBits) + " (" + OS.osArch + ")\n" + + "Java Version: " + OS.javaVersion + "\n" + + (mods == null ? "" : mods.list().size + " Mods" + (mods.list().isEmpty() ? "" : ": " + mods.list().toString(", ", mod -> mod.name + ":" + mod.meta.version))) + + "\n\n" + error; } public static void log(Throwable exception){ try{ Core.settings.getDataDirectory().child("crashes").child("crash_" + System.currentTimeMillis() + ".txt") - .writeString(createReport(Strings.neatError(exception))); + .writeString(createReport(Strings.neatError(exception))); }catch(Throwable ignored){ } } @@ -60,7 +59,7 @@ public class CrashSender{ }catch(Throwable ignored){} //don't create crash logs for custom builds, as it's expected - if(Version.build == -1 || (System.getProperty("user.name").equals("anuke") && "release".equals(Version.modifier))){ + if(Version.build == -1 || (OS.username.equals("anuke") && !"steam".equals(Version.modifier))){ ret(); } @@ -141,10 +140,10 @@ public class CrashSender{ ex(() -> value.addChild("server", new JsonValue(fs))); ex(() -> value.addChild("players", new JsonValue(Groups.player.size()))); ex(() -> value.addChild("state", new JsonValue(Vars.state.getState().name()))); - ex(() -> value.addChild("os", new JsonValue(System.getProperty("os.name") + "x" + (OS.is64Bit ? "64" : "32")))); + ex(() -> value.addChild("os", new JsonValue(OS.osName + " x" + OS.osArchBits + " " + OS.osVersion))); ex(() -> value.addChild("trace", new JsonValue(parseException(exception)))); - ex(() -> value.addChild("javaVersion", new JsonValue(System.getProperty("java.version")))); - ex(() -> value.addChild("javaArch", new JsonValue(System.getProperty("sun.arch.data.model")))); + ex(() -> value.addChild("javaVersion", new JsonValue(OS.javaVersion))); + ex(() -> value.addChild("javaArch", new JsonValue(OS.osArchBits))); Log.info("Sending crash report."); diff --git a/core/src/mindustry/ui/Links.java b/core/src/mindustry/ui/Links.java index 6c5962d11c..b3c756ba32 100644 --- a/core/src/mindustry/ui/Links.java +++ b/core/src/mindustry/ui/Links.java @@ -55,20 +55,30 @@ public class Links{ private static String report(){ return "https://github.com/Anuken/Mindustry/issues/new?assignees=&labels=bug&body=" + - Strings.encode(Strings.format( - "**Platform**: `@`\n" + - "\n**Build**: `@`\n" + - "\n**Issue**: *Explain your issue in detail.*\n" + - "\n**Steps to reproduce**: *How you happened across the issue, and what exactly you did to make the bug happen.*\n" + - "\n**Link(s) to mod(s) used**: `@`\n" + - "\n**Save file**: *The (zipped) save file you were playing on when the bug happened. THIS IS REQUIRED FOR ANY ISSUE HAPPENING IN-GAME, REGARDLESS OF WHETHER YOU THINK IT HAPPENS EVERYWHERE. DO NOT DELETE OR OMIT THIS LINE UNLESS YOU ARE SURE THAT THE ISSUE DOES NOT HAPPEN IN-GAME.*\n" + - "\n**Crash report**: *The contents of relevant crash report files. REQUIRED if you are reporting a crash.*\n" + - "\n---\n" + - "\n*Place an X (no spaces) between the brackets to confirm that you have read the line below.*" + - "\n- [ ] **I have updated to the latest release (https://github.com/Anuken/Mindustry/releases) to make sure my issue has not been fixed.**" + - "\n- [ ] **I have searched the closed and open issues to make sure that this problem has not already been reported.**", - OS.isAndroid ? "Android " + Core.app.getVersion() : (System.getProperty("os.name") + (OS.is64Bit ? " x64" : " x32")), - Version.combined(), - Vars.mods.list().any() ? Vars.mods.list().select(LoadedMod::enabled).map(l -> l.meta.author + "/" + l.name + ":" + l.meta.version) : "none")); + Strings.encode(Strings.format( + """ + **Platform**: `@` + + **Build**: `@` + + **Issue**: *Explain your issue in detail.* + + **Steps to reproduce**: *How you happened across the issue, and what exactly you did to make the bug happen.* + + **Link(s) to mod(s) used**: `@` + + **Save file**: *The (zipped) save file you were playing on when the bug happened. THIS IS REQUIRED FOR ANY ISSUE HAPPENING IN-GAME, REGARDLESS OF WHETHER YOU THINK IT HAPPENS EVERYWHERE. DO NOT DELETE OR OMIT THIS LINE UNLESS YOU ARE SURE THAT THE ISSUE DOES NOT HAPPEN IN-GAME.* + + **Crash report**: *The contents of relevant crash report files. REQUIRED if you are reporting a crash.* + + --- + + *Place an X (no spaces) between the brackets to confirm that you have read the line below.* + - [ ] **I have updated to the latest release (https://github.com/Anuken/Mindustry/releases) to make sure my issue has not been fixed.** + - [ ] **I have searched the closed and open issues to make sure that this problem has not already been reported.** + """, + OS.isAndroid ? "Android " + Core.app.getVersion() : (OS.osName + " x" + OS.osArchBits), + Version.combined(), + Vars.mods.list().any() ? Vars.mods.list().select(LoadedMod::enabled).map(l -> l.meta.author + "/" + l.name + ":" + l.meta.version) : "none")); } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 642357fb9e..3489eea88c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=fbdfa0307101b881e208f53666c1f4b7ebf0fe90 +archash=f223b2a9d421d751209efedc615352257fb3773b diff --git a/server/src/mindustry/server/ServerControl.java b/server/src/mindustry/server/ServerControl.java index e25d44d6f5..a75cc39749 100644 --- a/server/src/mindustry/server/ServerControl.java +++ b/server/src/mindustry/server/ServerControl.java @@ -278,7 +278,7 @@ public class ServerControl implements ApplicationListener{ handler.register("version", "Displays server version info.", arg -> { info("Version: Mindustry @-@ @ / build @", Version.number, Version.modifier, Version.type, Version.build + (Version.revision == 0 ? "" : "." + Version.revision)); - info("Java Version: @", System.getProperty("java.version")); + info("Java Version: @", OS.javaVersion); }); handler.register("exit", "Exit the server application.", arg -> { From 3f7dc66ac0910dcc2a90dd2b9db79a3d8a637af7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 15 Jul 2021 14:55:32 -0400 Subject: [PATCH 04/71] Fixed #5587 --- core/src/mindustry/world/blocks/environment/OreBlock.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/mindustry/world/blocks/environment/OreBlock.java b/core/src/mindustry/world/blocks/environment/OreBlock.java index 1ff509465f..7f16310378 100644 --- a/core/src/mindustry/world/blocks/environment/OreBlock.java +++ b/core/src/mindustry/world/blocks/environment/OreBlock.java @@ -30,6 +30,7 @@ public class OreBlock extends OverlayFloor{ /** For mod use only!*/ public OreBlock(String name){ super(name); + this.useColor = true; variants = 3; } From b0d460779858ac50e9063f71c1f295e7ab411b74 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 15 Jul 2021 20:08:05 -0400 Subject: [PATCH 05/71] Fixed #5588 --- core/src/mindustry/ai/types/BuilderAI.java | 13 +++++++++---- core/src/mindustry/core/Logic.java | 1 + core/src/mindustry/game/Teams.java | 1 + core/src/mindustry/input/InputHandler.java | 6 ++---- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/ai/types/BuilderAI.java b/core/src/mindustry/ai/types/BuilderAI.java index 5a3c5b00f8..3f171df120 100644 --- a/core/src/mindustry/ai/types/BuilderAI.java +++ b/core/src/mindustry/ai/types/BuilderAI.java @@ -19,6 +19,7 @@ public class BuilderAI extends AIController{ @Nullable Unit following; @Nullable Teamc enemy; float retreatTimer; + @Nullable BlockPlan lastPlan; @Override public void updateMovement(){ @@ -43,6 +44,7 @@ public class BuilderAI extends AIController{ //set to follower's first build plan, whatever that is unit.plans.clear(); unit.plans.addFirst(following.buildPlan()); + lastPlan = null; }else if(unit.buildPlan() == null){ //not following anyone or building if(timer.get(timerTarget4, 40)){ @@ -78,10 +80,11 @@ public class BuilderAI extends AIController{ } boolean valid = - (req.tile() != null && req.tile().build instanceof ConstructBuild cons && cons.current == req.block) || - (req.breaking ? - Build.validBreak(unit.team(), req.x, req.y) : - Build.validPlace(req.block, unit.team(), req.x, req.y, req.rotation)); + !(lastPlan != null && lastPlan.removed) && + ((req.tile() != null && req.tile().build instanceof ConstructBuild cons && cons.current == req.block) || + (req.breaking ? + Build.validBreak(unit.team(), req.x, req.y) : + Build.validPlace(req.block, unit.team(), req.x, req.y, req.rotation))); if(valid){ //move toward the request @@ -89,6 +92,7 @@ public class BuilderAI extends AIController{ }else{ //discard invalid request unit.plans.removeFirst(); + lastPlan = null; } }else{ @@ -127,6 +131,7 @@ public class BuilderAI extends AIController{ if(world.tile(block.x, block.y) != null && world.tile(block.x, block.y).block().id == block.block){ blocks.removeFirst(); }else if(Build.validPlace(content.block(block.block), unit.team(), block.x, block.y, block.rotation)){ //it's valid. + lastPlan = block; //add build request. unit.addBuild(new BuildPlan(block.x, block.y, block.rotation, content.block(block.block), block.config)); //shift build plan to tail so next unit builds something else. diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index 96de35d5e7..b9ddb2cef9 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -49,6 +49,7 @@ public class Logic implements ApplicationListener{ BlockPlan b = it.next(); Block block = content.block(b.block); if(event.tile.block().bounds(event.tile.x, event.tile.y, Tmp.r1).overlaps(block.bounds(b.x, b.y, Tmp.r2))){ + b.removed = true; it.remove(); } } diff --git a/core/src/mindustry/game/Teams.java b/core/src/mindustry/game/Teams.java index 2fb9c23f69..9d73661ef5 100644 --- a/core/src/mindustry/game/Teams.java +++ b/core/src/mindustry/game/Teams.java @@ -320,6 +320,7 @@ public class Teams{ public static class BlockPlan{ public final short x, y, rotation, block; public final Object config; + public boolean removed; public BlockPlan(int x, int y, short rotation, short block, Object config){ this.x = (short)x; diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index e0f2b88116..0c9c2fc1a6 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -145,6 +145,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ for(int pos : positions){ if(req.x == Point2.x(pos) && req.y == Point2.y(pos)){ + req.removed = true; it.remove(); continue outer; } @@ -887,13 +888,10 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ removed.clear(); //remove blocks to rebuild - Iterator broken = player.team().data().blocks.iterator(); - while(broken.hasNext()){ - BlockPlan req = broken.next(); + for(BlockPlan req : player.team().data().blocks){ Block block = content.block(req.block); if(block.bounds(req.x, req.y, Tmp.r2).overlaps(Tmp.r1)){ removed.add(Point2.pack(req.x, req.y)); - broken.remove(); } } From 278c4f17e5a4069f68dd0c54c4ad0b08289f38c2 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 15 Jul 2021 20:19:51 -0400 Subject: [PATCH 06/71] Why was this class even created --- core/src/mindustry/world/TileData.java | 4 ---- core/src/mindustry/world/TileGen.java | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 core/src/mindustry/world/TileData.java diff --git a/core/src/mindustry/world/TileData.java b/core/src/mindustry/world/TileData.java deleted file mode 100644 index cf34d5ef60..0000000000 --- a/core/src/mindustry/world/TileData.java +++ /dev/null @@ -1,4 +0,0 @@ -package mindustry.world; - -public class TileData{ -} diff --git a/core/src/mindustry/world/TileGen.java b/core/src/mindustry/world/TileGen.java index a1afdee598..f05d8167d7 100644 --- a/core/src/mindustry/world/TileGen.java +++ b/core/src/mindustry/world/TileGen.java @@ -4,7 +4,7 @@ import mindustry.content.*; public class TileGen{ public Block floor; - public Block block ; + public Block block; public Block overlay; { From 57b22a9cabfea92f5e7d516b6b06e5a84c401355 Mon Sep 17 00:00:00 2001 From: Sharlotte <60801210+Sharlottes@users.noreply.github.com> Date: Fri, 16 Jul 2021 21:56:23 +0900 Subject: [PATCH 07/71] Update bundle_ko.properties (#5590) --- core/assets/bundles/bundle_ko.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/assets/bundles/bundle_ko.properties b/core/assets/bundles/bundle_ko.properties index ef57409e9d..4c68f6efef 100644 --- a/core/assets/bundles/bundle_ko.properties +++ b/core/assets/bundles/bundle_ko.properties @@ -100,7 +100,8 @@ joingame = 게임 참여 customgame = 사용자 지정 게임 newgame = 새 게임 none = < 없음 > -none.found = [lightgray]< 없거나 찾을 수 없음 > +none.found = [lightgray]< 찾을 수 없음 > +none.inmap = [lightgray]< 맵에 없음 > minimap = 미니맵 position = 위치 close = 닫기 From 822fe9ab7adb647016ec3cd844f4d5a31ccb53f4 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 16 Jul 2021 10:05:59 -0400 Subject: [PATCH 08/71] Fixed inaccessible gaps in Serpulo generator --- core/src/mindustry/content/Blocks.java | 3 +++ core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index b2971a8bc1..e4c421659a 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -426,6 +426,9 @@ public class Blocks implements ContentList{ darkMetal = new StaticWall("dark-metal"); + Seq.with(metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6) + .each(b -> b.asFloor().wall = darkMetal); + pebbles = new DoubleOverlayFloor("pebbles"); tendrils = new OverlayFloor("tendrils"); diff --git a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java index f69537ef44..3940570f83 100644 --- a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java @@ -244,8 +244,6 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{ cells(1); distort(10f, 6f); - inverseFloodFill(tiles.getn(spawn.x, spawn.y)); - Seq ores = Seq.with(Blocks.oreCopper, Blocks.oreLead); float poles = Math.abs(sector.tile.v.y); float nmag = 0.5f; @@ -296,6 +294,8 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{ median(2); + inverseFloodFill(tiles.getn(spawn.x, spawn.y)); + tech(); pass((x, y) -> { From fc6ee11ffe4aff7cbba6f13c7a672bfcda917ba5 Mon Sep 17 00:00:00 2001 From: RebornTrack970 <62565267+RebornTrack970@users.noreply.github.com> Date: Fri, 16 Jul 2021 19:19:56 +0300 Subject: [PATCH 09/71] Some more servers are back (#5594) * Servers Back * Update servers_v7.json --- servers_v6.json | 2 +- servers_v7.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/servers_v6.json b/servers_v6.json index 6d1bad5a2a..47b959300e 100644 --- a/servers_v6.json +++ b/servers_v6.json @@ -57,7 +57,7 @@ }, { "name": "Omega", - "address": ["178.170.47.34:20204", "157.90.213.2:30308", "157.90.180.53:25738"] + "address": ["178.170.47.34:20204", "157.90.213.2:30308", "157.90.180.53:25738", "185.86.230.61:25578"] }, { "name": "md.obvilionnetwork.ru", diff --git a/servers_v7.json b/servers_v7.json index 9dc02e7370..b73efb5e0a 100644 --- a/servers_v7.json +++ b/servers_v7.json @@ -20,7 +20,7 @@ }, { "name": "Omega", - "address": ["157.90.180.53:25777", "redstonneur1256.ml", "185.86.230.61:25571"] + "address": ["185.86.230.61:25571", "185.86.230.61:25570", "185.86.230.62:25572"] }, { "name": "MeowLand", From 6e10f86546a4a7d9609eb0736e6853df213c7256 Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Fri, 16 Jul 2021 12:21:58 -0400 Subject: [PATCH 10/71] Display item rates on reconstructors (#5581) Display the rates here because why not ![]https://mee6.is-terrible.com/54feDAY76.png --- core/src/mindustry/world/blocks/units/Reconstructor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/mindustry/world/blocks/units/Reconstructor.java b/core/src/mindustry/world/blocks/units/Reconstructor.java index c2e5dd6c4a..89ded06fef 100644 --- a/core/src/mindustry/world/blocks/units/Reconstructor.java +++ b/core/src/mindustry/world/blocks/units/Reconstructor.java @@ -64,6 +64,7 @@ public class Reconstructor extends UnitBlock{ @Override public void setStats(){ + stats.timePeriod = constructTime; super.setStats(); stats.add(Stat.productionTime, constructTime / 60f, StatUnit.seconds); From 07ba378095330f25d58eebb4d39b6764a849085b Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 16 Jul 2021 12:37:31 -0400 Subject: [PATCH 11/71] Hide construct/legacy blocks --- core/src/mindustry/world/blocks/ConstructBlock.java | 1 + core/src/mindustry/world/blocks/legacy/LegacyBlock.java | 1 + gradle.properties | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/world/blocks/ConstructBlock.java b/core/src/mindustry/world/blocks/ConstructBlock.java index a3a66b1280..0bc7115142 100644 --- a/core/src/mindustry/world/blocks/ConstructBlock.java +++ b/core/src/mindustry/world/blocks/ConstructBlock.java @@ -41,6 +41,7 @@ public class ConstructBlock extends Block{ health = 20; consumesTap = true; solidifes = true; + inEditor = false; consBlocks[size - 1] = this; sync = true; } diff --git a/core/src/mindustry/world/blocks/legacy/LegacyBlock.java b/core/src/mindustry/world/blocks/legacy/LegacyBlock.java index 61b3d690f6..46a39168ad 100644 --- a/core/src/mindustry/world/blocks/legacy/LegacyBlock.java +++ b/core/src/mindustry/world/blocks/legacy/LegacyBlock.java @@ -7,6 +7,7 @@ public class LegacyBlock extends Block{ public LegacyBlock(String name){ super(name); + inEditor = false; } /** Removes this block from the world, or replaces it with something else. */ diff --git a/gradle.properties b/gradle.properties index 3489eea88c..7f911ff584 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=f223b2a9d421d751209efedc615352257fb3773b +archash=735ab5cb989b89d6978892788e3e0ad089131926 From 5c6b659ce33b519a6b94882b65f161581b4ae0d7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 16 Jul 2021 12:59:50 -0400 Subject: [PATCH 12/71] Possible rare crash fix --- core/src/mindustry/ai/BlockIndexer.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index 430630f5d3..272fb6d543 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -48,6 +48,7 @@ public class BlockIndexer{ private Seq breturnArray = new Seq<>(Building.class); public BlockIndexer(){ + clearFlags(); Events.on(TilePreChangeEvent.class, event -> { removeIndex(event.tile); @@ -62,11 +63,7 @@ public class BlockIndexer{ flagMap = new TileArray[Team.all.length][BlockFlag.all.length]; activeTeams = new Seq<>(Team.class); - for(int i = 0; i < flagMap.length; i++){ - for(int j = 0; j < BlockFlag.all.length; j++){ - flagMap[i][j] = new TileArray(); - } - } + clearFlags(); allOres.clear(); ores = new IntSeq[content.items().size][][]; @@ -160,6 +157,14 @@ public class BlockIndexer{ return blocksPresent != null && blocksPresent[block.id]; } + private void clearFlags(){ + for(int i = 0; i < flagMap.length; i++){ + for(int j = 0; j < BlockFlag.all.length; j++){ + flagMap[i][j] = new TileArray(); + } + } + } + private TileArray[] getFlagged(Team team){ return flagMap[team.id]; } From 0980495a28deddba2932615b69016c7be1dbed80 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 16 Jul 2021 15:39:03 -0400 Subject: [PATCH 13/71] (commented) support for Call server-to-client sounds --- .../annotations/impl/AssetsProcess.java | 42 ++++++++++++++++--- core/src/mindustry/core/NetClient.java | 16 +++++++ core/src/mindustry/io/TypeIO.java | 10 +++++ core/src/mindustry/type/StatusEffect.java | 2 +- 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/annotations/src/main/java/mindustry/annotations/impl/AssetsProcess.java b/annotations/src/main/java/mindustry/annotations/impl/AssetsProcess.java index 0a0538483b..52706b508e 100644 --- a/annotations/src/main/java/mindustry/annotations/impl/AssetsProcess.java +++ b/annotations/src/main/java/mindustry/annotations/impl/AssetsProcess.java @@ -1,5 +1,7 @@ package mindustry.annotations.impl; +import arc.*; +import arc.audio.*; import arc.files.*; import arc.scene.style.*; import arc.struct.*; @@ -118,9 +120,31 @@ public class AssetsProcess extends BaseProcessor{ void processSounds(String classname, String path, String rtype) throws Exception{ TypeSpec.Builder type = TypeSpec.classBuilder(classname).addModifiers(Modifier.PUBLIC); MethodSpec.Builder loadBegin = MethodSpec.methodBuilder("load").addModifiers(Modifier.PUBLIC, Modifier.STATIC); + CodeBlock.Builder staticb = CodeBlock.builder(); + + type.addField(FieldSpec.builder(IntMap.class, "idToSound", Modifier.STATIC, Modifier.PRIVATE).initializer("new IntMap()").build()); + type.addField(FieldSpec.builder(ObjectIntMap.class, "soundToId", Modifier.STATIC, Modifier.PRIVATE).initializer("new ObjectIntMap()").build()); + + type.addMethod(MethodSpec.methodBuilder("getSoundId") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .addParameter(Sound.class, "sound") + .returns(int.class) + .addStatement("return soundToId.get(sound, -1)").build()); + + type.addMethod(MethodSpec.methodBuilder("getSound") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .addParameter(int.class, "id") + .returns(Sound.class) + .addStatement("return (Sound)idToSound.get(id, () -> Sounds.none)").build()); HashSet names = new HashSet<>(); - Fi.get(path).walk(p -> { + Seq files = new Seq<>(); + Fi.get(path).walk(files::add); + + files.sortComparing(Fi::name); + int id = 0; + + for(Fi p : files){ String name = p.nameWithoutExtension(); if(names.contains(name)){ @@ -133,14 +157,20 @@ public class AssetsProcess extends BaseProcessor{ String filepath = path.substring(path.lastIndexOf("/") + 1) + p.path().substring(p.path().lastIndexOf(path) + path.length()); - String filename = "\"" + filepath + "\""; - loadBegin.addStatement("arc.Core.assets.load(" + filename + ", " + rtype + ".class).loaded = a -> " + name + " = (" + rtype + ")a", filepath, filepath.replace(".ogg", ".mp3")); + staticb.addStatement("soundToId.put($L, $L)", name, id); - type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), name, Modifier.STATIC, Modifier.PUBLIC).initializer("new arc.audio." + rtype.substring(rtype.lastIndexOf(".") + 1) + "()").build()); - }); + loadBegin.addStatement("$T.assets.load($S, $L.class).loaded = a -> { $L = ($L)a; soundToId.put(a, $L); idToSound.put($L, a); }", + Core.class, filepath, rtype, name, rtype, id, id); + + type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), name, Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()").build()); + + id ++; + } + + type.addStaticBlock(staticb.build()); if(classname.equals("Sounds")){ - type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "none", Modifier.STATIC, Modifier.PUBLIC).initializer("new arc.audio." + rtype.substring(rtype.lastIndexOf(".") + 1) + "()").build()); + type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), "none", Modifier.STATIC, Modifier.PUBLIC).initializer("new " + rtype + "()").build()); } type.addMethod(loadBegin.build()); diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java index 04117e67a5..f0e63dbb7d 100644 --- a/core/src/mindustry/core/NetClient.java +++ b/core/src/mindustry/core/NetClient.java @@ -159,6 +159,22 @@ public class NetClient implements ApplicationListener{ clientPacketReliable(type, contents); } + //TODO enable in build 129 + /* + @Remote(variants = Variant.both, unreliable = true) + public static void sound(Sound sound, float volume, float pitch, float pan){ + if(sound == null) return; + + sound.play(volume * Core.settings.getInt("sfxvol") / 100f, pitch, pan); + } + + @Remote(variants = Variant.both, unreliable = true) + public static void soundAt(Sound sound, float x, float y, float volume, float pitch){ + if(sound == null) return; + + sound.at(x, y, pitch, volume); + }*/ + @Remote(variants = Variant.both, unreliable = true) public static void effect(Effect effect, float x, float y, float rotation, Color color){ if(effect == null) return; diff --git a/core/src/mindustry/io/TypeIO.java b/core/src/mindustry/io/TypeIO.java index 107b3bc3f9..b42be76a48 100644 --- a/core/src/mindustry/io/TypeIO.java +++ b/core/src/mindustry/io/TypeIO.java @@ -1,5 +1,6 @@ package mindustry.io; +import arc.audio.*; import arc.graphics.*; import arc.math.geom.*; import arc.struct.*; @@ -501,6 +502,15 @@ public class TypeIO{ return id == -1 ? null : content.item(id); } + //note that only the standard sound constants in Sounds are supported; modded sounds are not. + public static void writeSound(Writes write, Sound sound){ + write.s(Sounds.getSoundId(sound)); + } + + public static Sound readSound(Reads read){ + return Sounds.getSound(read.s()); + } + public static void writeWeather(Writes write, Weather item){ write.s(item == null ? -1 : item.id); } diff --git a/core/src/mindustry/type/StatusEffect.java b/core/src/mindustry/type/StatusEffect.java index 6d4c332a37..fe9a7f487f 100644 --- a/core/src/mindustry/type/StatusEffect.java +++ b/core/src/mindustry/type/StatusEffect.java @@ -76,7 +76,7 @@ public class StatusEffect extends UnlockableContent{ if(reloadMultiplier != 1) stats.addPercent(Stat.reloadMultiplier, reloadMultiplier); if(buildSpeedMultiplier != 1) stats.addPercent(Stat.buildSpeedMultiplier, buildSpeedMultiplier); if(damage > 0) stats.add(Stat.damage, damage * 60f, StatUnit.perSecond); - if(damage < 0) stats.add(Stat.healing, -(damage * 60f), StatUnit.perSecond); + if(damage < 0) stats.add(Stat.healing, -damage * 60f, StatUnit.perSecond); boolean reacts = false; From 6973ed7d555d1cdfa0f6f3666ecd25dd6da0e790 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 Jul 2021 08:52:24 -0400 Subject: [PATCH 14/71] PvP defeated team cleanup --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/core/Logic.java | 26 +++++------------ core/src/mindustry/game/Rules.java | 2 ++ core/src/mindustry/game/Teams.java | 29 +++++++++++++++++++ .../ui/dialogs/CustomRulesDialog.java | 1 + gradle.properties | 2 +- 6 files changed, 41 insertions(+), 20 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 89e7c59f2c..5e19a8781e 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -996,6 +996,7 @@ rules.wavetimer = Wave Timer rules.waves = Waves rules.attack = Attack Mode rules.buildai = AI Building +rules.cleanupdeadteams = Clean Up Defeated Team Buildings (PvP) rules.corecapture = Capture Core On Destruction rules.polygoncoreprotection = Polygonal Core Protection rules.enemyCheat = Infinite AI (Red Team) Resources diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index b9ddb2cef9..d0a6b24a35 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -129,25 +129,7 @@ public class Logic implements ApplicationListener{ Events.on(SectorCaptureEvent.class, e -> { if(!net.client() && e.sector == state.getSector() && e.sector.isBeingPlayed()){ - for(Tile tile : world.tiles){ - //convert all blocks to neutral, randomly killing them - if(tile.isCenter() && tile.build != null && tile.build.team == state.rules.waveTeam){ - Building b = tile.build; - Call.setTeam(b, Team.derelict); - Time.run(Mathf.random(0f, 60f * 6f), () -> { - if(Mathf.chance(0.25)){ - b.kill(); - } - }); - } - } - - //kill all units - Groups.unit.each(u -> { - if(u.team == state.rules.waveTeam){ - Time.run(Mathf.random(0f, 60f * 5f), u::kill); - } - }); + state.rules.waveTeam.data().destroyToDerelict(); } }); @@ -163,6 +145,12 @@ public class Logic implements ApplicationListener{ } }); + //listen to core changes; if all cores have been destroyed, set to derelict. + Events.on(CoreChangeEvent.class, e -> Core.app.post(() -> { + if(state.rules.cleanupDeadTeams && state.rules.pvp && !e.core.isAdded() && e.core.team != Team.derelict && e.core.team.cores().isEmpty()){ + e.core.team.data().destroyToDerelict(); + } + })); } /** Adds starting items, resets wave time, and sets state to playing. */ diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index 2fa767518d..f66dd658ea 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -70,6 +70,8 @@ public class Rules{ public float enemyCoreBuildRadius = 400f; /** If true, no-build zones are calculated based on the closest core. */ public boolean polygonCoreProtection = false; + /** If true, dead teams in PvP automatically have their blocks & units converted to derelict upon death. */ + public boolean cleanupDeadTeams = true; /** Radius around enemy wave drop zones.*/ public float dropZoneRadius = 300f; /** Time between waves in ticks. */ diff --git a/core/src/mindustry/game/Teams.java b/core/src/mindustry/game/Teams.java index 9d73661ef5..97638ed1e2 100644 --- a/core/src/mindustry/game/Teams.java +++ b/core/src/mindustry/game/Teams.java @@ -1,6 +1,7 @@ package mindustry.game; import arc.func.*; +import arc.math.*; import arc.math.geom.*; import arc.struct.Queue; import arc.struct.*; @@ -260,6 +261,34 @@ public class Teams{ this.ai = new BaseAI(this); } + /** Destroys this team's presence on the map, killing part of its buildings and converting everything to 'derelict'. */ + public void destroyToDerelict(){ + + //grab all buildings from quadtree. + var builds = new Seq(); + if(buildings != null){ + buildings.getObjects(builds); + } + + //convert all team tiles to neutral, randomly killing them + for(var b : builds){ + //TODO this may cause a lot of packet spam, optimize? + Call.setTeam(b, Team.derelict); + + if(Mathf.chance(0.25)){ + Time.run(Mathf.random(0f, 60f * 6f), b::kill); + } + } + + //kill all units randomly + units.each(u -> Time.run(Mathf.random(0f, 60f * 5f), () -> { + //ensure unit hasn't switched teams for whatever reason + if(u.team == team){ + u.kill(); + } + })); + } + @Nullable public Seq unitCache(UnitType type){ if(unitsByType == null || unitsByType.length <= type.id || unitsByType[type.id] == null) return null; diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 7c77c47d75..346a9b48bb 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -142,6 +142,7 @@ public class CustomRulesDialog extends BaseDialog{ check("@rules.reactorexplosions", b -> rules.reactorExplosions = b, () -> rules.reactorExplosions); check("@rules.schematic", b -> rules.schematicsAllowed = b, () -> rules.schematicsAllowed); check("@rules.coreincinerates", b -> rules.coreIncinerates = b, () -> rules.coreIncinerates); + check("@rules.cleanupdeadteams", b -> rules.cleanupDeadTeams = b, () -> rules.cleanupDeadTeams, () -> rules.pvp); number("@rules.buildcostmultiplier", false, f -> rules.buildCostMultiplier = f, () -> rules.buildCostMultiplier, () -> !rules.infiniteResources); number("@rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier, 0.001f, 50f); number("@rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources); diff --git a/gradle.properties b/gradle.properties index 7f911ff584..680c4b703a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=735ab5cb989b89d6978892788e3e0ad089131926 +archash=3fe3fc594d041fa0a7e096e50ce1a032ffe3dae0 From 8e21c627a7c335f76d437644a75b87753e42e2dc Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 Jul 2021 09:22:02 -0400 Subject: [PATCH 15/71] Improved Serpulo sector path generation --- .../maps/planet/SerpuloPlanetGenerator.java | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java index 3940570f83..0effbc80f2 100644 --- a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java @@ -57,7 +57,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{ float rawHeight(Vec3 position){ position = Tmp.v33.set(position).scl(scl); - return (Mathf.pow((float)Simplex.noise3d(seed, 7, 0.5f, 1f/3f, position.x, position.y, position.z), 2.3f) + waterOffset) / (1f + waterOffset); + return (Mathf.pow(Simplex.noise3d(seed, 7, 0.5f, 1f/3f, position.x, position.y, position.z), 2.3f) + waterOffset) / (1f + waterOffset); } @Override @@ -127,12 +127,12 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{ position = Tmp.v33.set(position).scl(scl); float rad = scl; float temp = Mathf.clamp(Math.abs(position.y * 2f) / (rad)); - float tnoise = (float)Simplex.noise3d(seed, 7, 0.56, 1f/3f, position.x, position.y + 999f, position.z); + float tnoise = Simplex.noise3d(seed, 7, 0.56, 1f/3f, position.x, position.y + 999f, position.z); temp = Mathf.lerp(temp, tnoise, 0.5f); height *= 1.2f; height = Mathf.clamp(height); - float tar = (float)Simplex.noise3d(seed, 4, 0.55f, 1f/2f, position.x, position.y + 999f, position.z) * 0.3f + Tmp.v31.dst(0, 0, 1f) * 0.2f; + float tar = Simplex.noise3d(seed, 4, 0.55f, 1f/2f, position.x, position.y + 999f, position.z) * 0.3f + Tmp.v31.dst(0, 0, 1f) * 0.2f; Block res = arr[Mathf.clamp((int)(temp * arr.length), 0, arr[0].length - 1)][Mathf.clamp((int)(height * arr[0].length), 0, arr[0].length - 1)]; if(tar > 0.5f){ @@ -145,7 +145,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{ @Override protected float noise(float x, float y, double octaves, double falloff, double scl, double mag){ Vec3 v = sector.rect.project(x, y).scl(5f); - return (float)Simplex.noise3d(seed, octaves, falloff, 1f / scl, v.x, v.y, v.z) * (float)mag; + return Simplex.noise3d(seed, octaves, falloff, 1f / scl, v.x, v.y, v.z) * (float)mag; } @Override @@ -162,12 +162,27 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{ connected.add(this); } + void con(int x1, int y1, int x2, int y2){ + float nscl = rand.random(100f, 140f) * 6f; + int stroke = rand.random(3, 9); + brush(pathfind(x1, y1, x2, y2, tile -> (tile.solid() ? 50f : 0f) + noise(tile.x, tile.y, 2, 0.4f, 1f / nscl) * 500, Astar.manhattan), stroke); + } + void connect(Room to){ if(!connected.add(to)) return; - float nscl = rand.random(100f, 140f); - int stroke = rand.random(3, 9); - brush(pathfind(x, y, to.x, to.y, tile -> (tile.solid() ? 5f : 0f) + noise(tile.x, tile.y, 2, 0.4, 1f / nscl) * 500, Astar.manhattan), stroke); + Vec2 midpoint = Tmp.v1.set(to.x, to.y).add(x, y).scl(0.5f); + rand.nextFloat(); + + //add randomized offset to avoid straight lines + midpoint.add(Tmp.v2.setToRandomDirection(rand).scl(Tmp.v1.dst(x, y))); + + midpoint.sub(width/2f, height/2f).limit(width / 2f / Mathf.sqrt3).add(width/2f, height/2f); + + int mx = (int)midpoint.x, my = (int)midpoint.y; + + con(x, y, mx, my); + con(mx, my, to.x, to.y); } } From 820920e5f975bfe33e064fb09bb43b17312df5bb Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 Jul 2021 09:30:31 -0400 Subject: [PATCH 16/71] Redundant cast cleanup --- core/src/mindustry/maps/filters/GenerateFilter.java | 4 ++-- core/src/mindustry/maps/generators/PlanetGenerator.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/maps/filters/GenerateFilter.java b/core/src/mindustry/maps/filters/GenerateFilter.java index cdddad9099..f6fde18102 100644 --- a/core/src/mindustry/maps/filters/GenerateFilter.java +++ b/core/src/mindustry/maps/filters/GenerateFilter.java @@ -103,11 +103,11 @@ public abstract class GenerateFilter{ //TODO would be nice if these functions used the seed and ditched "in" completely; simplex should be stateless protected float noise(GenerateInput in, float scl, float mag){ - return (float)Simplex.noise2d(seed, 1f, 0f, 1f / scl, in.x, in.y) * mag; + return Simplex.noise2d(seed, 1f, 0f, 1f / scl, in.x, in.y) * mag; } protected float noise(GenerateInput in, float scl, float mag, float octaves, float persistence){ - return (float)Simplex.noise2d(seed, octaves, persistence, 1f / scl, in.x, in.y) * mag; + return Simplex.noise2d(seed, octaves, persistence, 1f / scl, in.x, in.y) * mag; } protected float rnoise(float x, float y, float scl, float mag){ diff --git a/core/src/mindustry/maps/generators/PlanetGenerator.java b/core/src/mindustry/maps/generators/PlanetGenerator.java index 059c8e2d31..a8f0e00e26 100644 --- a/core/src/mindustry/maps/generators/PlanetGenerator.java +++ b/core/src/mindustry/maps/generators/PlanetGenerator.java @@ -115,7 +115,7 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe @Override protected float noise(float x, float y, double octaves, double falloff, double scl, double mag){ Vec3 v = sector.rect.project(x, y); - return (float)Simplex.noise3d(0, octaves, falloff, 1f / scl, v.x, v.y, v.z) * (float)mag; + return Simplex.noise3d(0, octaves, falloff, 1f / scl, v.x, v.y, v.z) * (float)mag; } /** @return the scaling factor for sector rects. */ From 55920e6242073afd1c96a2d546fb9b77ce722f44 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 Jul 2021 11:09:38 -0400 Subject: [PATCH 17/71] Cleanup --- core/src/mindustry/core/World.java | 5 ++--- core/src/mindustry/editor/MapGenerateDialog.java | 4 ++-- core/src/mindustry/entities/comp/BoundedComp.java | 2 +- core/src/mindustry/maps/filters/GenerateFilter.java | 7 ++----- gradle.properties | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/core/src/mindustry/core/World.java b/core/src/mindustry/core/World.java index 8627230a0f..e1363a281f 100644 --- a/core/src/mindustry/core/World.java +++ b/core/src/mindustry/core/World.java @@ -525,8 +525,7 @@ public class World{ private class Context implements WorldContext{ - Context(){ - } + Context(){} @Override public Tile tile(int index){ @@ -579,7 +578,7 @@ public class World{ for(GenerateFilter filter : filters){ filter.randomize(); - input.begin(filter, width(), height(), (x, y) -> tiles.getn(x, y)); + input.begin(width(), height(), (x, y) -> tiles.getn(x, y)); filter.apply(tiles, input); } } diff --git a/core/src/mindustry/editor/MapGenerateDialog.java b/core/src/mindustry/editor/MapGenerateDialog.java index 31af738182..8124e1c459 100644 --- a/core/src/mindustry/editor/MapGenerateDialog.java +++ b/core/src/mindustry/editor/MapGenerateDialog.java @@ -158,7 +158,7 @@ public class MapGenerateDialog extends BaseDialog{ long[] writeTiles = new long[editor.width() * editor.height()]; for(GenerateFilter filter : filters){ - input.begin(filter, editor.width(), editor.height(), editor::tile); + input.begin(editor.width(), editor.height(), editor::tile); //write to buffer for(int x = 0; x < editor.width(); x++){ @@ -414,7 +414,7 @@ public class MapGenerateDialog extends BaseDialog{ } for(var filter : copy){ - input.begin(filter, editor.width(), editor.height(), (x, y) -> unpack(buffer1[Mathf.clamp(x / scaling, 0, pixmap.width -1) + w* Mathf.clamp(y / scaling, 0, pixmap.height -1)])); + input.begin(editor.width(), editor.height(), (x, y) -> unpack(buffer1[Mathf.clamp(x / scaling, 0, pixmap.width -1) + w* Mathf.clamp(y / scaling, 0, pixmap.height -1)])); //read from buffer1 and write to buffer2 pixmap.each((px, py) -> { diff --git a/core/src/mindustry/entities/comp/BoundedComp.java b/core/src/mindustry/entities/comp/BoundedComp.java index 7b09f23f69..fa7d860db2 100644 --- a/core/src/mindustry/entities/comp/BoundedComp.java +++ b/core/src/mindustry/entities/comp/BoundedComp.java @@ -9,7 +9,7 @@ import static mindustry.Vars.*; @Component abstract class BoundedComp implements Velc, Posc, Healthc, Flyingc{ - static final float warpDst = 40f; + static final float warpDst = 30f; @Import float x, y; diff --git a/core/src/mindustry/maps/filters/GenerateFilter.java b/core/src/mindustry/maps/filters/GenerateFilter.java index f6fde18102..fea59ed405 100644 --- a/core/src/mindustry/maps/filters/GenerateFilter.java +++ b/core/src/mindustry/maps/filters/GenerateFilter.java @@ -75,8 +75,7 @@ public abstract class GenerateFilter{ /** localized display name */ public String name(){ - var s = simpleName(); - return Core.bundle.get("filter." + s); + return Core.bundle.get("filter." + simpleName()); } public char icon(){ @@ -100,8 +99,6 @@ public abstract class GenerateFilter{ //utility generation functions - //TODO would be nice if these functions used the seed and ditched "in" completely; simplex should be stateless - protected float noise(GenerateInput in, float scl, float mag){ return Simplex.noise2d(seed, 1f, 0f, 1f / scl, in.x, in.y) * mag; } @@ -141,7 +138,7 @@ public abstract class GenerateFilter{ this.y = y; } - public void begin(GenerateFilter filter, int width, int height, TileProvider buffer){ + public void begin(int width, int height, TileProvider buffer){ this.buffer = buffer; this.width = width; this.height = height; diff --git a/gradle.properties b/gradle.properties index 680c4b703a..7a6d80a68e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=3fe3fc594d041fa0a7e096e50ce1a032ffe3dae0 +archash=2eaaa8e46b18b2a4a5af3e012ce1814b05ab7955 From 0ed7934df002ce2a9d612e8ad0045f86b653446a Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 Jul 2021 15:33:19 -0400 Subject: [PATCH 18/71] arc --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7a6d80a68e..fff01dafe4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=2eaaa8e46b18b2a4a5af3e012ce1814b05ab7955 +archash=626d16628b5c1f69a4a8cbd720eb99bb278e8a1f From f7f2b3438cda329c616d578f182dd00039e5781a Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 Jul 2021 16:46:35 -0400 Subject: [PATCH 19/71] Use short filter names in JSON --- .../mindustry/editor/MapGenerateDialog.java | 9 ++---- core/src/mindustry/io/JsonIO.java | 8 +++++ core/src/mindustry/maps/Maps.java | 31 ++++++++++++------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/core/src/mindustry/editor/MapGenerateDialog.java b/core/src/mindustry/editor/MapGenerateDialog.java index 8124e1c459..e0dd326e6c 100644 --- a/core/src/mindustry/editor/MapGenerateDialog.java +++ b/core/src/mindustry/editor/MapGenerateDialog.java @@ -15,6 +15,7 @@ import mindustry.game.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.io.*; +import mindustry.maps.*; import mindustry.maps.filters.*; import mindustry.maps.filters.GenerateFilter.*; import mindustry.ui.*; @@ -26,12 +27,6 @@ import static mindustry.Vars.*; @SuppressWarnings("unchecked") public class MapGenerateDialog extends BaseDialog{ - final Prov[] filterTypes = new Prov[]{ - NoiseFilter::new, ScatterFilter::new, TerrainFilter::new, DistortFilter::new, - RiverNoiseFilter::new, OreFilter::new, OreMedianFilter::new, MedianFilter::new, - BlendFilter::new, MirrorFilter::new, ClearFilter::new, CoreSpawnFilter::new, - EnemySpawnFilter::new, SpawnPathFilter::new - }; final boolean applied; Pixmap pixmap; @@ -333,7 +328,7 @@ public class MapGenerateDialog extends BaseDialog{ p.marginRight(14); p.defaults().size(195f, 56f); int i = 0; - for(var gen : filterTypes){ + for(var gen : Maps.allFilterTypes){ var filter = gen.get(); var icon = filter.icon(); diff --git a/core/src/mindustry/io/JsonIO.java b/core/src/mindustry/io/JsonIO.java index 37dff7ec56..9f51b32cb0 100644 --- a/core/src/mindustry/io/JsonIO.java +++ b/core/src/mindustry/io/JsonIO.java @@ -1,11 +1,13 @@ package mindustry.io; +import arc.util.*; import arc.util.serialization.*; import arc.util.serialization.Json.*; import mindustry.*; import mindustry.content.*; import mindustry.ctype.*; import mindustry.game.*; +import mindustry.maps.*; import mindustry.type.*; import mindustry.world.*; import mindustry.world.meta.*; @@ -215,6 +217,12 @@ public class JsonIO{ return item != null ? item : liquid; } }); + + //use short names for all filter types + for(var filter : Maps.allFilterTypes){ + var i = filter.get(); + json.addClassTag(Strings.camelize(i.getClass().getSimpleName().replace("Filter", "")), i.getClass()); + } } static class CustomJson extends Json{ diff --git a/core/src/mindustry/maps/Maps.java b/core/src/mindustry/maps/Maps.java index 46b74799d9..613067f61f 100644 --- a/core/src/mindustry/maps/Maps.java +++ b/core/src/mindustry/maps/Maps.java @@ -24,23 +24,30 @@ import mindustry.world.*; import mindustry.world.blocks.storage.*; import java.io.*; +import java.util.concurrent.*; import static mindustry.Vars.*; public class Maps{ + /** All generation filter types. */ + public static Prov[] allFilterTypes = new Prov[]{ + NoiseFilter::new, ScatterFilter::new, TerrainFilter::new, DistortFilter::new, + RiverNoiseFilter::new, OreFilter::new, OreMedianFilter::new, MedianFilter::new, + BlendFilter::new, MirrorFilter::new, ClearFilter::new, CoreSpawnFilter::new, + EnemySpawnFilter::new, SpawnPathFilter::new + }; + /** List of all built-in maps. Filenames only. */ private static String[] defaultMapNames = {"maze", "fortress", "labyrinth", "islands", "tendrils", "caldera", "wasteland", "shattered", "fork", "triad", "mudFlats", "moltenLake", "archipelago", "debrisField", "veins", "glacier", "passage"}; /** Maps tagged as PvP */ - static final String[] pvpMaps = {"veins", "glacier", "passage"}; + private static String[] pvpMaps = {"veins", "glacier", "passage"}; + /** All maps stored in an ordered array. */ private Seq maps = new Seq<>(); - /** Serializer for meta. */ - private Json json = new Json(); - private ShuffleMode shuffleMode = ShuffleMode.all; private @Nullable MapProvider shuffler; - private AsyncExecutor executor = new AsyncExecutor(2); + private ExecutorService executor = Threads.executor(3); private ObjectSet previewList = new ObjectSet<>(); public ShuffleMode getShuffleMode(){ @@ -352,20 +359,20 @@ public class Maps{ if(groups == null) return "[]"; StringWriter buffer = new StringWriter(); - json.setWriter(new JsonWriter(buffer)); + JsonIO.json.setWriter(new JsonWriter(buffer)); - json.writeArrayStart(); + JsonIO.json.writeArrayStart(); for(int i = 0; i < groups.size; i++){ - json.writeObjectStart(SpawnGroup.class, SpawnGroup.class); - groups.get(i).write(json); - json.writeObjectEnd(); + JsonIO.json.writeObjectStart(SpawnGroup.class, SpawnGroup.class); + groups.get(i).write(JsonIO.json); + JsonIO.json.writeObjectEnd(); } - json.writeArrayEnd(); + JsonIO.json.writeArrayEnd(); return buffer.toString(); } public Seq readWaves(String str){ - return str == null ? null : str.equals("[]") ? new Seq<>() : Seq.with(json.fromJson(SpawnGroup[].class, str)); + return str == null ? null : str.equals("[]") ? new Seq<>() : Seq.with(JsonIO.json.fromJson(SpawnGroup[].class, str)); } public void loadPreviews(){ From 33d4ab9edb333a04dfd7eb80b6c049545306a5aa Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 Jul 2021 19:17:47 -0400 Subject: [PATCH 20/71] Fixed block plans not being deleted locally --- core/src/mindustry/input/InputHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 0c9c2fc1a6..0882c39dea 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -888,10 +888,14 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ removed.clear(); //remove blocks to rebuild - for(BlockPlan req : player.team().data().blocks){ + Iterator broken = player.team().data().blocks.iterator(); + while(broken.hasNext()){ + BlockPlan req = broken.next(); Block block = content.block(req.block); if(block.bounds(req.x, req.y, Tmp.r2).overlaps(Tmp.r1)){ removed.add(Point2.pack(req.x, req.y)); + req.removed = true; + broken.remove(); } } From 37d7b3d7fb3a939a7224f6c553671d08d057b1a6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 17 Jul 2021 20:45:53 -0400 Subject: [PATCH 21/71] Fixed screen shake moving camera pan position --- core/src/mindustry/core/Renderer.java | 29 +++++++++++++++------------ gradle.properties | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index 15523f861a..5183069725 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -7,6 +7,7 @@ import arc.graphics.Texture.*; import arc.graphics.g2d.*; import arc.graphics.gl.*; import arc.math.*; +import arc.math.geom.*; import arc.scene.ui.layout.*; import arc.struct.*; import arc.util.*; @@ -45,6 +46,7 @@ public class Renderer implements ApplicationListener{ private Color clearColor = new Color(0f, 0f, 0f, 1f); private float targetscale = Scl.scl(4), camerascale = targetscale, landscale, landTime, weatherAlpha, minZoomScl = Scl.scl(0.01f); private float shakeIntensity, shaketime; + private Vec2 camShakeOffset = new Vec2(); public Renderer(){ camera = new Camera(); @@ -112,12 +114,25 @@ public class Renderer implements ApplicationListener{ landTime = 0f; graphics.clear(Color.black); }else{ - updateShake(0.75f); + if(shaketime > 0){ + float intensity = shakeIntensity * (settings.getInt("screenshake", 4) / 4f) * 0.75f; + camShakeOffset.setToRandomDirection().scl(Mathf.random(intensity)); + camera.position.add(camShakeOffset); + shakeIntensity -= 0.25f * Time.delta; + shaketime -= Time.delta; + shakeIntensity = Mathf.clamp(shakeIntensity, 0f, 100f); + }else{ + camShakeOffset.setZero(); + shakeIntensity = 0f; + } + if(pixelator.enabled()){ pixelator.drawPixelate(); }else{ draw(); } + + camera.position.sub(camShakeOffset); } } @@ -172,18 +187,6 @@ public class Renderer implements ApplicationListener{ } } - void updateShake(float scale){ - if(shaketime > 0){ - float intensity = shakeIntensity * (settings.getInt("screenshake", 4) / 4f) * scale; - camera.position.add(Mathf.range(intensity), Mathf.range(intensity)); - shakeIntensity -= 0.25f * Time.delta; - shaketime -= Time.delta; - shakeIntensity = Mathf.clamp(shakeIntensity, 0f, 100f); - }else{ - shakeIntensity = 0f; - } - } - public void draw(){ Events.fire(Trigger.preDraw); diff --git a/gradle.properties b/gradle.properties index fff01dafe4..c626e234a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=626d16628b5c1f69a4a8cbd720eb99bb278e8a1f +archash=58cab1a87e1ed024a0044c4639594dc22088c87e From 5b2dc021a6e43ec06d426d32977a7298b8b2aa4e Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 18 Jul 2021 08:56:48 -0400 Subject: [PATCH 22/71] Prevent concurrent modification in BlockIndexer#eachBlock --- core/src/mindustry/ai/BlockIndexer.java | 36 +++++++++++++++++-------- gradle.properties | 2 +- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index 272fb6d543..e23d270175 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -211,13 +211,12 @@ public class BlockIndexer{ } public boolean eachBlock(@Nullable Team team, float wx, float wy, float range, Boolf pred, Cons cons){ - returnBool = false; + breturnArray.clear(); if(team == null){ allBuildings(wx, wy, range, b -> { if(pred.get(b)){ - returnBool = true; - cons.get(b); + breturnArray.add(b); } }); }else{ @@ -225,13 +224,20 @@ public class BlockIndexer{ if(buildings == null) return false; buildings.intersect(wx - range, wy - range, range*2f, range*2f, b -> { if(b.within(wx, wy, range + b.hitSize() / 2f) && pred.get(b)){ - returnBool = true; - cons.get(b); + breturnArray.add(b); } }); } - return returnBool; + int size = breturnArray.size; + var items = breturnArray.items; + for(int i = 0; i < size; i++){ + cons.get(items[i]); + items[i] = null; + } + breturnArray.size = 0; + + return size > 0; } /** Get all enemy blocks with a flag. */ @@ -274,16 +280,24 @@ public class BlockIndexer{ } public void allBuildings(float x, float y, float range, Cons cons){ + breturnArray.clear(); for(int i = 0; i < activeTeams.size; i++){ Team team = activeTeams.items[i]; var buildings = team.data().buildings; if(buildings == null) continue; - buildings.intersect(x - range, y - range, range*2f, range*2f, b -> { - if(b.within(x, y, range + b.hitSize()/2f)){ - cons.get(b); - } - }); + buildings.intersect(x - range, y - range, range*2f, range*2f, breturnArray); } + + var items = breturnArray.items; + int size = breturnArray.size; + for(int i = 0; i < size; i++){ + var b = items[i]; + if(b.within(x, y, range + b.hitSize()/2f)){ + cons.get(b); + } + items[i] = null; + } + breturnArray.size = 0; } public Building findEnemyTile(@Nullable Team team, float x, float y, float range, Boolf pred){ diff --git a/gradle.properties b/gradle.properties index c626e234a5..97ea62c507 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=58cab1a87e1ed024a0044c4639594dc22088c87e +archash=65939d39bd6b20ddcfa85cb76cb1ceb815d91aec From 1804111f880974611169769a55a2e50a1c3e007f Mon Sep 17 00:00:00 2001 From: Mina Her Date: Sun, 18 Jul 2021 22:15:04 +0900 Subject: [PATCH 23/71] Add spacing between name and value in slider (#5601) --- .../mindustry/ui/dialogs/SettingsMenuDialog.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java index 7c6ed01a38..6578e9c60c 100644 --- a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -685,21 +685,21 @@ public class SettingsMenuDialog extends Dialog{ slider.setValue(settings.getInt(name)); - Label value = new Label(""); - value.setStyle(Styles.outlineLabel); - value.touchable = Touchable.disabled; + Label value = new Label("", Styles.outlineLabel); + Table content = new Table(); + content.add(title, Styles.outlineLabel).left().growX().wrap(); + content.add(value).padLeft(10f).right(); + content.margin(3f, 33.5f, 3f, 33.5f); + content.touchable = Touchable.disabled; slider.changed(() -> { settings.put(name, (int)slider.getValue()); - value.setText(title + ": " + sp.get((int)slider.getValue())); + value.setText(sp.get((int)slider.getValue())); }); - value.setAlignment(Align.center); - value.setWrap(true); - slider.change(); - table.stack(slider, value).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).left().padTop(4); + table.stack(slider, content).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).left().padTop(4f); table.row(); } } From 974d3498c15f6fd1def82d629916526bac27e3c3 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 18 Jul 2021 11:11:28 -0400 Subject: [PATCH 24/71] Settings tooltips --- core/assets/bundles/bundle.properties | 7 +- core/assets/bundles/bundle_ru.properties | 5 +- .../mindustry/maps/filters/FilterOption.java | 20 +++-- .../ui/dialogs/SettingsMenuDialog.java | 82 +++++++++---------- gradle.properties | 2 +- 5 files changed, 59 insertions(+), 57 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 5e19a8781e..918aee562a 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -846,7 +846,6 @@ setting.doubletapmine.name = Double-Tap to Mine setting.modcrashdisable.name = Disable Mods On Startup Crash setting.animatedwater.name = Animated Surfaces setting.animatedshields.name = Animated Shields -setting.antialias.name = Antialias[lightgray] (requires restart)[] setting.playerindicators.name = Player Indicators setting.indicators.name = Enemy Indicators setting.autotarget.name = Auto-Target @@ -855,7 +854,8 @@ setting.touchscreen.name = Touchscreen Controls setting.fpscap.name = Max FPS setting.fpscap.none = None setting.fpscap.text = {0} FPS -setting.uiscale.name = UI Scaling[lightgray] (restart required)[] +setting.uiscale.name = UI Scaling +setting.uiscale.description = Restart required to apply changes. setting.swapdiagonal.name = Always Diagonal Placement setting.difficulty.training = Training setting.difficulty.easy = Easy @@ -873,7 +873,8 @@ setting.saveinterval.name = Save Interval setting.seconds = {0} seconds setting.milliseconds = {0} milliseconds setting.fullscreen.name = Fullscreen -setting.borderlesswindow.name = Borderless Window[lightgray] (restart may be required) +setting.borderlesswindow.name = Borderless Window +setting.borderlesswindow.description = Restart may be required to apply changes. setting.fps.name = Show FPS & Ping setting.smoothcamera.name = Smooth Camera setting.vsync.name = VSync diff --git a/core/assets/bundles/bundle_ru.properties b/core/assets/bundles/bundle_ru.properties index 8a8c1924de..25cfa5d9da 100644 --- a/core/assets/bundles/bundle_ru.properties +++ b/core/assets/bundles/bundle_ru.properties @@ -845,7 +845,6 @@ setting.doubletapmine.name = Добыча руды двойным нажатие setting.modcrashdisable.name = Отключение модификаций после вылета при запуске setting.animatedwater.name = Анимированные поверхности setting.animatedshields.name = Анимированные щиты -setting.antialias.name = Сглаживание[lightgray] (требует перезапуска)[] setting.playerindicators.name = Индикаторы направления игроков setting.indicators.name = Индикаторы направления врагов setting.autotarget.name = Автозахват цели @@ -854,7 +853,7 @@ setting.touchscreen.name = Сенсорное управление setting.fpscap.name = Максимальный FPS setting.fpscap.none = Неограниченный setting.fpscap.text = {0} FPS -setting.uiscale.name = Масштаб пользовательского интерфейса[lightgray] (необходим перезапуск)[] +setting.uiscale.name = Масштаб пользовательского интерфейса setting.swapdiagonal.name = Всегда диагональное размещение setting.difficulty.training = Обучение setting.difficulty.easy = Лёгкая @@ -872,7 +871,7 @@ setting.saveinterval.name = Интервал сохранения setting.seconds = {0} секунд setting.milliseconds = {0} миллисекунд setting.fullscreen.name = Полноэкранный режим -setting.borderlesswindow.name = Безрамочное окно[lightgray] (может потребоваться перезапуск) +setting.borderlesswindow.name = Безрамочное окно setting.fps.name = Показывать FPS и пинг setting.smoothcamera.name = Плавная камера setting.vsync.name = Вертикальная синхронизация diff --git a/core/src/mindustry/maps/filters/FilterOption.java b/core/src/mindustry/maps/filters/FilterOption.java index 6b2e3aa1f1..41974a06f9 100644 --- a/core/src/mindustry/maps/filters/FilterOption.java +++ b/core/src/mindustry/maps/filters/FilterOption.java @@ -3,6 +3,7 @@ package mindustry.maps.filters; import arc.*; import arc.func.*; +import arc.scene.*; import arc.scene.event.*; import arc.scene.style.*; import arc.scene.ui.*; @@ -60,16 +61,19 @@ public abstract class FilterOption{ @Override public void build(Table table){ - Label label; + Element base; if(!display){ - label = new Label("@filter.option." + name); + Label l = new Label("@filter.option." + name); + l.setWrap(true); + l.setStyle(Styles.outlineLabel); + base = l; }else{ - label = new Label(() -> Core.bundle.get("filter.option." + name) + ": " + Strings.autoFixed(getter.get(), 2)); + Table t = new Table().marginLeft(11f).marginRight(11f); + base = t; + t.add("@filter.option." + name).growX().wrap().style(Styles.outlineLabel); + t.label(() -> Strings.autoFixed(getter.get(), 2)).style(Styles.outlineLabel).right().labelAlign(Align.right).padLeft(6); } - label.setWrap(true); - label.setAlignment(Align.center); - label.touchable = Touchable.disabled; - label.setStyle(Styles.outlineLabel); + base.touchable = Touchable.disabled; Slider slider = new Slider(min, max, step, false); slider.moved(setter); @@ -80,7 +84,7 @@ public abstract class FilterOption{ slider.released(changed); } - table.stack(slider, label).colspan(2).pad(3).growX().row(); + table.stack(slider, base).colspan(2).pad(3).growX().row(); } } diff --git a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java index 6578e9c60c..e291ace87d 100644 --- a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -6,6 +6,8 @@ import arc.func.*; import arc.graphics.*; import arc.graphics.Texture.*; import arc.input.*; +import arc.math.geom.*; +import arc.scene.*; import arc.scene.event.*; import arc.scene.ui.*; import arc.scene.ui.TextButton.*; @@ -28,7 +30,6 @@ import java.io.*; import java.util.zip.*; import static arc.Core.*; -import static mindustry.Vars.net; import static mindustry.Vars.*; public class SettingsMenuDialog extends Dialog{ @@ -283,9 +284,9 @@ public class SettingsMenuDialog extends Dialog{ } void addSettings(){ - sound.sliderPref("musicvol", bundle.get("setting.musicvol.name", "Music Volume"), 100, 0, 100, 1, i -> i + "%"); - sound.sliderPref("sfxvol", bundle.get("setting.sfxvol.name", "SFX Volume"), 100, 0, 100, 1, i -> i + "%"); - sound.sliderPref("ambientvol", bundle.get("setting.ambientvol.name", "Ambient Volume"), 100, 0, 100, 1, i -> i + "%"); + sound.sliderPref("musicvol", 100, 0, 100, 1, i -> i + "%"); + sound.sliderPref("sfxvol", 100, 0, 100, 1, i -> i + "%"); + sound.sliderPref("ambientvol", 100, 0, 100, 1, i -> i + "%"); game.sliderPref("saveinterval", 60, 10, 5 * 120, 10, i -> Core.bundle.format("setting.seconds", i)); @@ -562,52 +563,26 @@ public class SettingsMenuDialog extends Dialog{ rebuild(); } - public SliderSetting sliderPref(String name, String title, int def, int min, int max, StringProcessor s){ - return sliderPref(name, title, def, min, max, 1, s); - } - - public SliderSetting sliderPref(String name, String title, int def, int min, int max, int step, StringProcessor s){ - SliderSetting res; - list.add(res = new SliderSetting(name, title, def, min, max, step, s)); - settings.defaults(name, def); - rebuild(); - return res; - } - public SliderSetting sliderPref(String name, int def, int min, int max, StringProcessor s){ return sliderPref(name, def, min, max, 1, s); } public SliderSetting sliderPref(String name, int def, int min, int max, int step, StringProcessor s){ SliderSetting res; - list.add(res = new SliderSetting(name, bundle.get("setting." + name + ".name"), def, min, max, step, s)); + list.add(res = new SliderSetting(name, def, min, max, step, s)); settings.defaults(name, def); rebuild(); return res; } - public void checkPref(String name, String title, boolean def){ - list.add(new CheckSetting(name, title, def, null)); - settings.defaults(name, def); - rebuild(); - } - - public void checkPref(String name, String title, boolean def, Boolc changed){ - list.add(new CheckSetting(name, title, def, changed)); - settings.defaults(name, def); - rebuild(); - } - - /** Localized title. */ public void checkPref(String name, boolean def){ - list.add(new CheckSetting(name, bundle.get("setting." + name + ".name"), def, null)); + list.add(new CheckSetting(name, def, null)); settings.defaults(name, def); rebuild(); } - /** Localized title. */ public void checkPref(String name, boolean def, Boolc changed){ - list.add(new CheckSetting(name, bundle.get("setting." + name + ".name"), def, changed)); + list.add(new CheckSetting(name, def, changed)); settings.defaults(name, def); rebuild(); } @@ -631,17 +606,41 @@ public class SettingsMenuDialog extends Dialog{ public abstract static class Setting{ public String name; public String title; + public @Nullable String description; + + Setting(String name){ + this.name = name; + title = bundle.get("setting." + name + ".name"); + description = bundle.getOrNull("setting." + name + ".description"); + } public abstract void add(SettingsTable table); + + public void addDesc(Element elem){ + if(description == null) return; + + elem.addListener(new Tooltip(t -> t.background(Styles.black8).margin(4f).add(description).color(Color.lightGray)){ + { + allowMobile = true; + } + @Override + protected void setContainerPosition(Element element, float x, float y){ + this.targetActor = element; + Vec2 pos = element.localToStageCoordinates(Tmp.v1.set(0, 0)); + container.pack(); + container.setPosition(pos.x, pos.y, Align.topLeft); + container.setOrigin(0, element.getHeight()); + } + }); + } } public static class CheckSetting extends Setting{ boolean def; Boolc changed; - CheckSetting(String name, String title, boolean def, Boolc changed){ - this.name = name; - this.title = title; + CheckSetting(String name, boolean def, Boolc changed){ + super(name); this.def = def; this.changed = changed; } @@ -660,7 +659,7 @@ public class SettingsMenuDialog extends Dialog{ }); box.left(); - table.add(box).left().padTop(3f); + addDesc(table.add(box).left().padTop(3f).get()); table.row(); } } @@ -669,9 +668,8 @@ public class SettingsMenuDialog extends Dialog{ int def, min, max, step; StringProcessor sp; - SliderSetting(String name, String title, int def, int min, int max, int step, StringProcessor s){ - this.name = name; - this.title = title; + SliderSetting(String name, int def, int min, int max, int step, StringProcessor s){ + super(name); this.def = def; this.min = min; this.max = max; @@ -689,7 +687,7 @@ public class SettingsMenuDialog extends Dialog{ Table content = new Table(); content.add(title, Styles.outlineLabel).left().growX().wrap(); content.add(value).padLeft(10f).right(); - content.margin(3f, 33.5f, 3f, 33.5f); + content.margin(3f, 33f, 3f, 33f); content.touchable = Touchable.disabled; slider.changed(() -> { @@ -699,7 +697,7 @@ public class SettingsMenuDialog extends Dialog{ slider.change(); - table.stack(slider, content).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).left().padTop(4f); + addDesc(table.stack(slider, content).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).left().padTop(4f).get()); table.row(); } } diff --git a/gradle.properties b/gradle.properties index 97ea62c507..e9750a191e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=65939d39bd6b20ddcfa85cb76cb1ceb815d91aec +archash=e52908cb23da2dead7ac049a1f395bacda64007c From 89942416acbd108e608c06c21570d62e1402fdb2 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 18 Jul 2021 12:12:04 -0400 Subject: [PATCH 25/71] Core containers/vaults no longer explode violently --- core/src/mindustry/entities/comp/BuildingComp.java | 7 ++++++- core/src/mindustry/world/blocks/storage/StorageBlock.java | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 3ccc414500..b98b8bf470 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1018,6 +1018,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, } + /** @return the cap for item amount calculations, used when this block explodes. */ + public int explosionItemCap(){ + return block.itemCapacity; + } + /** Called when the block is destroyed. The tile is still intact at this stage. */ public void onDestroyed(){ float explosiveness = block.baseExplosiveness; @@ -1026,7 +1031,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, if(block.hasItems){ for(Item item : content.items()){ - int amount = items.get(item); + int amount = Math.min(items.get(item), explosionItemCap()); explosiveness += item.explosiveness * amount; flammability += item.flammability * amount; power += item.charge * amount * 100f; diff --git a/core/src/mindustry/world/blocks/storage/StorageBlock.java b/core/src/mindustry/world/blocks/storage/StorageBlock.java index 006d462e6f..be74e98402 100644 --- a/core/src/mindustry/world/blocks/storage/StorageBlock.java +++ b/core/src/mindustry/world/blocks/storage/StorageBlock.java @@ -83,6 +83,12 @@ public class StorageBlock extends Block{ return itemCapacity; } + @Override + public int explosionItemCap(){ + //when linked to a core, containers/vaults are made significantly less explosive. + return linkedCore != null ? Math.min(itemCapacity/60, 6) : itemCapacity; + } + @Override public void drawSelect(){ if(linkedCore != null){ From b3b44214e0c8ec88c10d85ec4b84b5ed1a18ddbb Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 18 Jul 2021 12:45:26 -0400 Subject: [PATCH 26/71] No need to run own server with so many alternatives --- servers_v7.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/servers_v7.json b/servers_v7.json index b73efb5e0a..c01fffce37 100644 --- a/servers_v7.json +++ b/servers_v7.json @@ -1,7 +1,4 @@ [ - { - "address": "mindustry.us.to" - }, { "name": "mindustry.pl", "address": ["mindustry.pl:6000", "mindustry.pl:6666", "mindustry.pl:6966"] From 4ffcf252b76f85d5e14055f971d6d1731c61ad11 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 18 Jul 2021 12:48:57 -0400 Subject: [PATCH 27/71] Fixed bullet heal percent being displayed as 0 when <1 --- core/src/mindustry/content/Blocks.java | 4 ++-- core/src/mindustry/world/meta/StatValues.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index e4c421659a..fdea93ae4a 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1388,14 +1388,14 @@ public class Blocks implements ContentList{ requirements(Category.effect, with(Items.titanium, 250, Items.thorium, 125)); size = 3; itemCapacity = 1000; - health = size * size * 55; + health = size * size * 60; }}; container = new StorageBlock("container"){{ requirements(Category.effect, with(Items.titanium, 100)); size = 2; itemCapacity = 300; - health = size * size * 55; + health = size * size * 60; }}; unloader = new Unloader("unloader"){{ diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index fc2ff2609d..4926ed3516 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -306,7 +306,7 @@ public class StatValues{ } if(type.healPercent > 0f){ - sep(bt, Core.bundle.format("bullet.healpercent", (int)type.healPercent)); + sep(bt, Core.bundle.format("bullet.healpercent", Strings.autoFixed(type.healPercent, 2))); } if(type.pierce || type.pierceCap != -1){ From 5772f5e7da562f3960ba40f3ee1bae177accbf00 Mon Sep 17 00:00:00 2001 From: Darkness6030 <79508138+Darkness6030@users.noreply.github.com> Date: Sun, 18 Jul 2021 21:39:12 +0300 Subject: [PATCH 28/71] So now Mindurka => Darkdustry (#5608) I've changed the server name cuz mindurka sounds strange Now we are DarkDustry --- servers_v7.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servers_v7.json b/servers_v7.json index c01fffce37..4541f5c7fd 100644 --- a/servers_v7.json +++ b/servers_v7.json @@ -24,8 +24,8 @@ "address": ["34.134.111.15", "fifr4.quackhost.uk:21013", "34.134.111.15:4000", "34.134.111.15:7000"] }, { - "name": "Mindurka", - "address": ["mindurka.tk", "mindurka.tk:4000"] + "name": "[cyan]DarkDustry", + "address": ["darkdustry.ml", "darkdustry.ml:7000", "darkdustry.ml:8000"] }, { "name": "Chaotic Neutral", From 787964809018e6029d5fedc273ddee80e08e69ef Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 18 Jul 2021 14:40:59 -0400 Subject: [PATCH 29/71] Suppress invalid save meta errors --- core/assets/bundles/bundle.properties | 3 +-- core/src/mindustry/io/SaveIO.java | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 918aee562a..1c90dd8c8a 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1292,7 +1292,6 @@ block.meltdown.name = Meltdown block.foreshadow.name = Foreshadow block.container.name = Container block.launch-pad.name = Launch Pad -block.launch-pad-large.name = Large Launch Pad block.segment.name = Segment block.command-center.name = Command Center block.ground-factory.name = Ground Factory @@ -1313,11 +1312,11 @@ block.payload-source.name = Payload Source block.disassembler.name = Disassembler block.silicon-crucible.name = Silicon Crucible block.overdrive-dome.name = Overdrive Dome +block.interplanetary-accelerator.name = Interplanetary Accelerator #experimental, may be removed block.block-forge.name = Block Forge block.block-loader.name = Block Loader block.block-unloader.name = Block Unloader -block.interplanetary-accelerator.name = Interplanetary Accelerator block.switch.name = Switch block.micro-processor.name = Micro Processor diff --git a/core/src/mindustry/io/SaveIO.java b/core/src/mindustry/io/SaveIO.java index e6d04d5ddb..0f38a05063 100644 --- a/core/src/mindustry/io/SaveIO.java +++ b/core/src/mindustry/io/SaveIO.java @@ -69,7 +69,6 @@ public class SaveIO{ getMeta(stream); return true; }catch(Throwable e){ - Log.err(e); return false; } } From 1674b2dfd614732225582de846c0b80e00859217 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 18 Jul 2021 16:31:13 -0400 Subject: [PATCH 30/71] Fixed #5609 --- core/src/mindustry/logic/LCanvas.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LCanvas.java b/core/src/mindustry/logic/LCanvas.java index 8ebedb101a..da604532cb 100644 --- a/core/src/mindustry/logic/LCanvas.java +++ b/core/src/mindustry/logic/LCanvas.java @@ -16,6 +16,7 @@ import arc.util.*; import mindustry.*; import mindustry.gen.*; import mindustry.graphics.*; +import mindustry.logic.LStatements.*; import mindustry.ui.*; public class LCanvas extends Table{ @@ -395,11 +396,20 @@ public class LCanvas extends Table{ } public void copy(){ + st.saveUI(); LStatement copy = st.copy(); + + if(copy instanceof JumpStatement st && st.destIndex != -1){ + int index = statements.getChildren().indexOf(this); + if(index != -1 && index < st.destIndex){ + st.destIndex ++; + } + } + if(copy != null){ StatementElem s = new StatementElem(copy); - statements.addChildAfter(StatementElem.this,s); + statements.addChildAfter(StatementElem.this, s); statements.layout(); copy.elem = s; copy.setupUI(); From 2583541c0fed3c14dc5890ad38e877b849748046 Mon Sep 17 00:00:00 2001 From: Sunny Kim <58885089+sk7725@users.noreply.github.com> Date: Mon, 19 Jul 2021 16:36:58 +0900 Subject: [PATCH 31/71] spinSprite --- core/src/mindustry/graphics/Drawf.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/mindustry/graphics/Drawf.java b/core/src/mindustry/graphics/Drawf.java index 7d8b2be9d5..6c4ea7630b 100644 --- a/core/src/mindustry/graphics/Drawf.java +++ b/core/src/mindustry/graphics/Drawf.java @@ -274,4 +274,13 @@ public class Drawf{ Draw.reset(); } + + /** Draws a sprite that should be lightwise correct. Provided sprite must be symmetrical. */ + public static void spinSprite(TextureRegion region, float x, float y, float r){ + r = Mathf.mod(r, 90f); + Draw.rect(region, x, y, r); + Draw.alpha(r / 90f); + Draw.rect(region, x, y, r - 90f); + Draw.alpha(1f); + } } From a7ed7a71d51284107555aab16bf90ee581ff94fd Mon Sep 17 00:00:00 2001 From: Sunny Kim <58885089+sk7725@users.noreply.github.com> Date: Mon, 19 Jul 2021 16:40:57 +0900 Subject: [PATCH 32/71] drawSpinSprite --- core/src/mindustry/world/blocks/production/Drill.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index 8c627ea493..b7125f07d8 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java @@ -54,6 +54,7 @@ public class Drill extends Block{ public float updateEffectChance = 0.02f; public boolean drawRim = false; + public boolean drawSpinSprite = true; public Color heatColor = Color.valueOf("ff5512"); public @Load("@-rim") TextureRegion rimRegion; public @Load("@-rotator") TextureRegion rotatorRegion; @@ -314,7 +315,8 @@ public class Drill extends Block{ Draw.color(); } - Draw.rect(rotatorRegion, x, y, timeDrilled * rotateSpeed); + if(drawSpinSprite) Drawf.spinSprite(rotatorRegion, x, y, timeDrilled * rotateSpeed); + else Draw.rect(rotatorRegion, x, y, timeDrilled * rotateSpeed); Draw.rect(topRegion, x, y); From 8c20203084bda4e725ab7b661805f3eb9b2dafaf Mon Sep 17 00:00:00 2001 From: Sunny Kim <58885089+sk7725@users.noreply.github.com> Date: Mon, 19 Jul 2021 17:09:17 +0900 Subject: [PATCH 33/71] formatting --- core/src/mindustry/world/blocks/production/Drill.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index b7125f07d8..b64cc621c8 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java @@ -315,8 +315,11 @@ public class Drill extends Block{ Draw.color(); } - if(drawSpinSprite) Drawf.spinSprite(rotatorRegion, x, y, timeDrilled * rotateSpeed); - else Draw.rect(rotatorRegion, x, y, timeDrilled * rotateSpeed); + if(drawSpinSprite){ + Drawf.spinSprite(rotatorRegion, x, y, timeDrilled * rotateSpeed); + }else{ + Draw.rect(rotatorRegion, x, y, timeDrilled * rotateSpeed); + } Draw.rect(topRegion, x, y); From 34cf8466d6e753b7adf20c3206f1921d118651ce Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 19 Jul 2021 08:44:19 -0400 Subject: [PATCH 34/71] Added default value for mass driver bullet --- core/src/mindustry/content/Blocks.java | 1 - core/src/mindustry/world/blocks/distribution/MassDriver.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index fdea93ae4a..6893dedf99 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1015,7 +1015,6 @@ public class Blocks implements ContentList{ reloadTime = 200f; range = 440f; consumes.power(1.75f); - bullet = new MassDriverBolt(); }}; //special transport blocks diff --git a/core/src/mindustry/world/blocks/distribution/MassDriver.java b/core/src/mindustry/world/blocks/distribution/MassDriver.java index 045d61736f..cb2e52113d 100644 --- a/core/src/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/mindustry/world/blocks/distribution/MassDriver.java @@ -29,7 +29,7 @@ public class MassDriver extends Block{ public int minDistribute = 10; public float knockback = 4f; public float reloadTime = 100f; - public MassDriverBolt bullet; + public MassDriverBolt bullet = new MassDriverBolt(); public float bulletSpeed = 5.5f; public float bulletLifetime = 200f; public Effect shootEffect = Fx.shootBig2; From c7ff20d47dca73b373850a3e27d70ebcebb7b1c4 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 19 Jul 2021 09:00:35 -0400 Subject: [PATCH 35/71] Fracker + SolidPump spinner lighting --- core/src/mindustry/world/blocks/production/Fracker.java | 2 +- core/src/mindustry/world/blocks/production/SolidPump.java | 2 +- gradle.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/world/blocks/production/Fracker.java b/core/src/mindustry/world/blocks/production/Fracker.java index fc07b9750a..81c314b128 100644 --- a/core/src/mindustry/world/blocks/production/Fracker.java +++ b/core/src/mindustry/world/blocks/production/Fracker.java @@ -53,7 +53,7 @@ public class Fracker extends SolidPump{ Drawf.liquid(liquidRegion, x, y, liquids.get(result) / liquidCapacity, result.color); - Draw.rect(rotatorRegion, x, y, pumpTime); + Drawf.spinSprite(rotatorRegion, x, y, pumpTime); Draw.rect(topRegion, x, y); } diff --git a/core/src/mindustry/world/blocks/production/SolidPump.java b/core/src/mindustry/world/blocks/production/SolidPump.java index e13090ec4e..ac5e778c47 100644 --- a/core/src/mindustry/world/blocks/production/SolidPump.java +++ b/core/src/mindustry/world/blocks/production/SolidPump.java @@ -89,7 +89,7 @@ public class SolidPump extends Pump{ public void draw(){ Draw.rect(region, x, y); Drawf.liquid(liquidRegion, x, y, liquids.total() / liquidCapacity, liquids.current().color); - Draw.rect(rotatorRegion, x, y, pumpTime * rotateSpeed); + Drawf.spinSprite(rotatorRegion, x, y, pumpTime * rotateSpeed); Draw.rect(topRegion, x, y); } diff --git a/gradle.properties b/gradle.properties index e9750a191e..7d2ad854bf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=e52908cb23da2dead7ac049a1f395bacda64007c +archash=cc2e0588e1a87c732d0d155fe24932ae43d641bf From 0c46d5088c059658e4bf8ff09a2e92c57c5730d7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 19 Jul 2021 14:11:07 -0400 Subject: [PATCH 36/71] Better laser/blast drill rotators --- .../blocks/drills/blast-drill-rotator.png | Bin 1085 -> 1012 bytes .../blocks/drills/laser-drill-rotator.png | Bin 558 -> 685 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/core/assets-raw/sprites/blocks/drills/blast-drill-rotator.png b/core/assets-raw/sprites/blocks/drills/blast-drill-rotator.png index 4f17e71eee397b2042fa19b34b57297b1c6d6459..f781765591ea97a276e953a66f2383e524f375b5 100644 GIT binary patch delta 978 zcmdnX@r8YYK|S+2PZ!6KiaBrR8cq^66mYc{X;)BCP`DK=AXvFTe)aoe7*mE8Vsv+mgyxtt7`K&HarH|LjUZ+D-* zuiXFt;oqfKXGDq`Tm5O8%wpC$N4x${Q#Xs4>m2JpP0cK)#SOIo9C{^WGv_Z$f*!{N z85R#dCKYzZNzDu=9UGqL>}}J1vs0{~@Z*|aKfZqLfA)D@9j}9tphMQ=2LV4?#W-aS zP48iu@JeV)Tl@;o2SWQ&)Ec(v9=!K~J6g!1RbP_p!_(VW_r7P^Uw6+$_VLHd>fi0Y z)qgr#yxP!vE7uCv-Ouaic&Ijn@LNRx2y$Xv@^*o7o4({Z#wEXO9*Eqr`>z_zxa6OZ zMVr1Px5C%S2TW^D#xT4r;hb}L`XoQ5hx#z*rvG4henBPYipuN9%g@J7Z_JO|FZIcW z|L!rl+RvFU4o0Ux*sJ4V-OZtJHlO+aVXcSWmlogjPv93+jnI6f>$I17 zOWv)R`kBe)8vRN=43dZRT_!2CF#KV7ZX>#^+qwz|MO`VqpyJAGjx~&d@t>?SVyWd`Hyt z62>LBn}rht+ypnC6JYY#cwenrShYrT0z(iVr&6oFZv8g-glzjeXJj2OeRI1u^&3Y^ z75j>fm$nzLy%M;mg<@1>GJBCS1OeC53b9 zbW2@zdsnZ~80)z9;r+K(S$9`FRC7G#`5^4{OlRp^hD(GOh?Tf;260{xDlp?*V|RYZ z+u8od%U*dGA6I*rcT$w?=1T0@6`A-95BlBlqtfWQXs8QL)=r{8K$ zU;XOZ<9q)nyCo}LdHbsPmfrqnEDXq?p24SL%OA7Hm!Ip`PjeN`zrV-q>rC6Yy8q?> z8TGtBU*wD5Qo*kqeREc3@#};&Ih;N`i>`0K$7|d{S6-(G5@nu{JTf7rAYZBKn#P6@I-@vfH{$JFzNAql|cj?4dfBn?D z^8A^rfet!16rTQ%c=XP|Ky1VI53Q#^GekR9^Tf}X&D?RrWf5c{ zSCPfBm3?KY>xS!9S<@Wew)VFLWKW2C$iDYl@M;z<{aMmZFBP^P=C4}2+>LY9{)9}9 z*UO9T>UQ`>9S?iRzA|x*zsu5llRr$jr7H1HgE ze2u;JOpc8FVNfSw2)&SDE$Cyi zSRU7K!)`;$e~a!(m44lp0h4tPgk6w3#9!ofA&bf8&Q^v(l|T2~x$3JQ#@*7c<@$V` zNvHPn^}Z=fMb#QXL9=X^e8TI02j-Qtbgr!}deb)HQf0&K-;6=|e6k09{6+i&8zO#e z-7n~Vx9Qu1EnXM0ZMW7R5?{qCP~Ch*D(0=wmni?UA6lyztF&tuq%1ppUSeMvQLoy_sekYo!?*6^&3xrW{5ujqW8z0IBu9(d5i^+w6jy&A!l3sWBrOV z$DWEMXlL|4P);!El%}(PM$jIkhQ}dY-IqNYr cs4l-O8gKh$reB)HDs7OIr>mdKI;Vst0I1&5$^ZZW diff --git a/core/assets-raw/sprites/blocks/drills/laser-drill-rotator.png b/core/assets-raw/sprites/blocks/drills/laser-drill-rotator.png index a6d5ad350bcd1c5d3d443cda08d989dafe10e38f..f9301d4e7360f9426f340298f931a5ee690cded6 100644 GIT binary patch delta 662 zcmZ3-vX*s%ayL2y~8;mARyqWNXQi# zh0-Zpg)K6Sfvziy8M3teCU!M7HAOod)^9ygxZ%5@aM`|l-{${(a`&qplSFcl;W02V zBW%V7Zi{1o4}a2r`fK^|rC;)==;@jMafocnN!)peKSZ_OLu{(`ABVuE7{{fD_^+tU z*~pzC%dL>im~!qW>leehap^nHm;Ijh)J}CmEpt)p{NHgqCyE3p8H92cF?q2q)o}DW zkhS-x_<4z@o`$Pc%|~m({#bVZ^zmxyX^?toJg<~Tl5wq*=zC}iO}+Ie+2B`83gdbG_3VfL)cp6@yO*W*HRsCgGoIqx1?mF44!z)x z=CapNOuXW%+a~{Hnn8ug74f>)JvT2uxfx(2=5UPZL#?$zt?AVR?O*t=1aX(C$HX=T{a~mx@_Ts1YB$^Y zwn-BO>jR2e4%x}>=l*M*FnxZ4SNRd)vdx>j&qy;|$?Ttci2Vo)!-1n$pL*V_)+u6Y zFmlvvzopr0B{H;EC2ui delta 534 zcmZ3>x{hUnay{c$PZ!6Kid%2*I{FNn`tmp44k7l{3-ATfo%$q_`^ zn>Ts>ELNH^)n2?Q^JlTbjOp{G6DNEsR^kb((`#`&Ezh3#py>GhJG1xJXfhq;7SxF8 zaJcBi!X>7hb2fgHU-9bQObr`sP4-wbaBNrK=FH%*!%mMMY$*c+Lkio1iii6bis)^d=4YSgDuk>6B%3>UN13YU~2eW%*DXM95e3{ eBSXW68fKj(7Y*<7U;Vrs6f&N!elF{r5}E*9o8Wo? From 6b7a63aba5118beee42575def38fccbc3b4e229e Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 19 Jul 2021 15:20:53 -0400 Subject: [PATCH 37/71] Cleanup --- core/src/mindustry/entities/Effect.java | 34 ++++++++----------- core/src/mindustry/graphics/Drawf.java | 3 +- .../blocks/production/GenericCrafter.java | 2 +- .../blocks/production/LiquidConverter.java | 2 +- .../world/blocks/production/SolidPump.java | 2 +- 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/core/src/mindustry/entities/Effect.java b/core/src/mindustry/entities/Effect.java index 7b72ecdc01..492ab9af0f 100644 --- a/core/src/mindustry/entities/Effect.java +++ b/core/src/mindustry/entities/Effect.java @@ -141,27 +141,23 @@ public class Effect{ } public static void create(Effect effect, float x, float y, float rotation, Color color, Object data){ - if(headless || effect == Fx.none) return; - if(Core.settings.getBool("effects")){ - Rect view = Core.camera.bounds(Tmp.r1); - Rect pos = Tmp.r2.setSize(effect.clip).setCenter(x, y); + if(headless || effect == Fx.none || !Core.settings.getBool("effects")) return; - if(view.overlaps(pos)){ - if(!effect.initialized){ - effect.initialized = true; - effect.init(); - } - - EffectState entity = EffectState.create(); - entity.effect = effect; - entity.rotation = rotation; - entity.data = data; - entity.lifetime = effect.lifetime; - entity.set(x, y); - entity.color.set(color); - if(effect.followParent && data instanceof Posc) entity.parent = ((Posc)data); - entity.add(); + if(Core.camera.bounds(Tmp.r1).overlaps(Tmp.r2.setCentered(x, y, effect.clip))){ + if(!effect.initialized){ + effect.initialized = true; + effect.init(); } + + EffectState entity = EffectState.create(); + entity.effect = effect; + entity.rotation = rotation; + entity.data = data; + entity.lifetime = effect.lifetime; + entity.set(x, y); + entity.color.set(color); + if(effect.followParent && data instanceof Posc p) entity.parent = p; + entity.add(); } } diff --git a/core/src/mindustry/graphics/Drawf.java b/core/src/mindustry/graphics/Drawf.java index 6c4ea7630b..7865312eb5 100644 --- a/core/src/mindustry/graphics/Drawf.java +++ b/core/src/mindustry/graphics/Drawf.java @@ -41,6 +41,7 @@ public class Drawf{ Draw.reset(); } + /** Sets Draw.z to the text layer, and returns the previous layer. */ public static float text(){ float z = Draw.z(); if(renderer.pixelator.enabled()){ @@ -275,7 +276,7 @@ public class Drawf{ Draw.reset(); } - /** Draws a sprite that should be lightwise correct. Provided sprite must be symmetrical. */ + /** Draws a sprite that should be light-wise correct, when rotated. Provided sprite must be symmetrical in shape. */ public static void spinSprite(TextureRegion region, float x, float y, float r){ r = Mathf.mod(r, 90f); Draw.rect(region, x, y, r); diff --git a/core/src/mindustry/world/blocks/production/GenericCrafter.java b/core/src/mindustry/world/blocks/production/GenericCrafter.java index 31e3093140..c6c688ae18 100644 --- a/core/src/mindustry/world/blocks/production/GenericCrafter.java +++ b/core/src/mindustry/world/blocks/production/GenericCrafter.java @@ -120,7 +120,7 @@ public class GenericCrafter extends Block{ warmup = Mathf.approachDelta(warmup, 1f, warmupSpeed); if(Mathf.chanceDelta(updateEffectChance)){ - updateEffect.at(getX() + Mathf.range(size * 4f), getY() + Mathf.range(size * 4)); + updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4)); } }else{ warmup = Mathf.approachDelta(warmup, 0f, warmupSpeed); diff --git a/core/src/mindustry/world/blocks/production/LiquidConverter.java b/core/src/mindustry/world/blocks/production/LiquidConverter.java index 0b0ad4a0f9..c01dbfbc36 100644 --- a/core/src/mindustry/world/blocks/production/LiquidConverter.java +++ b/core/src/mindustry/world/blocks/production/LiquidConverter.java @@ -49,7 +49,7 @@ public class LiquidConverter extends GenericCrafter{ if(cons.valid()){ if(Mathf.chanceDelta(updateEffectChance)){ - updateEffect.at(getX() + Mathf.range(size * 4f), getY() + Mathf.range(size * 4)); + updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4)); } warmup = Mathf.lerpDelta(warmup, 1f, 0.02f); diff --git a/core/src/mindustry/world/blocks/production/SolidPump.java b/core/src/mindustry/world/blocks/production/SolidPump.java index ac5e778c47..d9168c82b1 100644 --- a/core/src/mindustry/world/blocks/production/SolidPump.java +++ b/core/src/mindustry/world/blocks/production/SolidPump.java @@ -108,7 +108,7 @@ public class SolidPump extends Pump{ lastPump = maxPump; warmup = Mathf.lerpDelta(warmup, 1f, 0.02f); if(Mathf.chance(delta() * updateEffectChance)) - updateEffect.at(getX() + Mathf.range(size * 2f), getY() + Mathf.range(size * 2f)); + updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f)); }else{ warmup = Mathf.lerpDelta(warmup, 0f, 0.02f); lastPump = 0f; From b7f7be839db9fff81b274a69fa303a4aa788e103 Mon Sep 17 00:00:00 2001 From: Ilya246 <57039557+Ilya246@users.noreply.github.com> Date: Tue, 20 Jul 2021 02:34:14 +0400 Subject: [PATCH 38/71] Update .pl servers (#5599) * Update .pl servers * Update servers_v7.json --- servers_v7.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers_v7.json b/servers_v7.json index 4541f5c7fd..9e6ad5f4ab 100644 --- a/servers_v7.json +++ b/servers_v7.json @@ -1,7 +1,7 @@ [ { "name": "mindustry.pl", - "address": ["mindustry.pl:6000", "mindustry.pl:6666", "mindustry.pl:6966"] + "address": ["46.105.36.238:6000", "46.105.36.238:6666", "46.105.36.238:6966"] }, { "name": "C.A.M.S.", From aab2437c4ca94af660de3be4209c01e57f5db919 Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Mon, 19 Jul 2021 18:42:03 -0400 Subject: [PATCH 39/71] Dont disconnect when connecting to steam servers on non steam (#5617) This will allow sending steam players to steam servers while completely ignoring non steam ones. --- core/src/mindustry/core/NetClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java index f0e63dbb7d..da52f23269 100644 --- a/core/src/mindustry/core/NetClient.java +++ b/core/src/mindustry/core/NetClient.java @@ -290,6 +290,7 @@ public class NetClient implements ApplicationListener{ @Remote(called = Loc.client, variants = Variant.one) public static void connect(String ip, int port){ + if(!steam && ip.startsWith("steam:")) return; netClient.disconnectQuietly(); logic.reset(); From fde23ceea06ce4041ca94d7bf64a90f5f9f2cccd Mon Sep 17 00:00:00 2001 From: Sunny Kim <58885089+sk7725@users.noreply.github.com> Date: Tue, 20 Jul 2021 08:11:53 +0900 Subject: [PATCH 40/71] SpinSprite DrawRotator for json mods (#5619) --- core/src/mindustry/world/draw/DrawRotator.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/world/draw/DrawRotator.java b/core/src/mindustry/world/draw/DrawRotator.java index 5d75b77825..3bbf1accc8 100644 --- a/core/src/mindustry/world/draw/DrawRotator.java +++ b/core/src/mindustry/world/draw/DrawRotator.java @@ -2,16 +2,22 @@ package mindustry.world.draw; import arc.*; import arc.graphics.g2d.*; +import mindustry.graphics.*; import mindustry.world.*; import mindustry.world.blocks.production.GenericCrafter.*; public class DrawRotator extends DrawBlock{ public TextureRegion rotator, top; + public boolean drawSpinSprite = false; @Override public void draw(GenericCrafterBuild build){ Draw.rect(build.block.region, build.x, build.y); - Draw.rect(rotator, build.x, build.y, build.totalProgress * 2f); + if(drawSpinSprite){ + Drawf.spinSprite(rotator, build.x, build.y, build.totalProgress * 2f); + }else{ + Draw.rect(rotator, build.x, build.y, build.totalProgress * 2f); + } if(top.found()) Draw.rect(top, build.x, build.y); } From b58f202e9e1ef11dc58098c2d4132e4093bbc4cf Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Mon, 19 Jul 2021 20:57:36 -0400 Subject: [PATCH 41/71] Allow hiding of steam servers (#5618) * Allow hiding of steam servers Theres no way to hide them while keeping them public in the steam api so instead this jank is needed. This wont do anything on a vanilla install but will allow people hosting headless steam servers to hide them if they only use the server to verify if players are on steam or not. * Hide only when hidden = true --- desktop/src/mindustry/desktop/steam/SNet.java | 1 + 1 file changed, 1 insertion(+) diff --git a/desktop/src/mindustry/desktop/steam/SNet.java b/desktop/src/mindustry/desktop/steam/SNet.java index 92b8803f85..d4b8236afa 100644 --- a/desktop/src/mindustry/desktop/steam/SNet.java +++ b/desktop/src/mindustry/desktop/steam/SNet.java @@ -312,6 +312,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback, for(int i = 0; i < matches; i++){ try{ SteamID lobby = smat.getLobbyByIndex(i); + if(smat.getLobbyData(lobby, "hidden").equals("true")) continue; String mode = smat.getLobbyData(lobby, "gamemode"); //make sure versions are equal, don't list incompatible lobbies if(mode == null || mode.isEmpty() || (Version.build != -1 && Strings.parseInt(smat.getLobbyData(lobby, "version"), -1) != Version.build)) continue; From b85cbe515e0c73f8894a12e18a12a597d0558844 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 08:49:02 -0400 Subject: [PATCH 42/71] Fixed #5621 --- core/src/mindustry/input/MobileInput.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/input/MobileInput.java b/core/src/mindustry/input/MobileInput.java index cc1ced2143..66a52544a7 100644 --- a/core/src/mindustry/input/MobileInput.java +++ b/core/src/mindustry/input/MobileInput.java @@ -938,7 +938,7 @@ public class MobileInput extends InputHandler implements GestureListener{ }else if(target == null){ player.shooting = false; if(Core.settings.getBool("autotarget") && !(player.unit() instanceof BlockUnitUnit u && u.tile() instanceof ControlBlock c && !c.shouldAutoTarget())){ - target = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.team != Team.derelict, u -> u.team != Team.derelict); + target = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.checkTarget(type.targetAir, type.targetGround), u -> u.team != Team.derelict && type.targetGround); if(allowHealing && target == null){ target = Geometry.findClosest(unit.x, unit.y, indexer.getDamaged(Team.sharded)); From 730cb14f6aab42a3831950be70ab3a34b3a679fb Mon Sep 17 00:00:00 2001 From: notrealn <56411504+notrealn@users.noreply.github.com> Date: Tue, 20 Jul 2021 09:00:19 -0400 Subject: [PATCH 43/71] Fix turret shooting priority when there are multiple teams (#5299) --- core/src/mindustry/ai/BlockIndexer.java | 23 +++++++++++++++++------ core/src/mindustry/entities/Units.java | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/core/src/mindustry/ai/BlockIndexer.java b/core/src/mindustry/ai/BlockIndexer.java index e23d270175..aae2ca6467 100644 --- a/core/src/mindustry/ai/BlockIndexer.java +++ b/core/src/mindustry/ai/BlockIndexer.java @@ -300,19 +300,30 @@ public class BlockIndexer{ breturnArray.size = 0; } - public Building findEnemyTile(@Nullable Team team, float x, float y, float range, Boolf pred){ + public Building findEnemyTile(Team team, float x, float y, float range, Boolf pred){ + Building target = null; + float targetDist = 0; + for(int i = 0; i < activeTeams.size; i++){ Team enemy = activeTeams.items[i]; - if(enemy == team || (team == Team.derelict && !state.rules.coreCapture)) continue; - Building entity = indexer.findTile(enemy, x, y, range, pred, true); - if(entity != null){ - return entity; + Building candidate = indexer.findTile(enemy, x, y, range, pred, true); + if(candidate == null) continue; + + //if a block has the same priority, the closer one should be targeted + float dist = candidate.dst(x, y) - candidate.hitSize() / 2f; + if(target == null || + //if its closer and is at least equal priority + (dist < targetDist && candidate.block.priority.ordinal() >= target.block.priority.ordinal()) || + // block has higher priority (so range doesnt matter) + (candidate.block.priority.ordinal() > target.block.priority.ordinal())){ + target = candidate; + targetDist = dist; } } - return null; + return target; } public Building findTile(Team team, float x, float y, float range, Boolf pred){ diff --git a/core/src/mindustry/entities/Units.java b/core/src/mindustry/entities/Units.java index d0fd94a63c..6fa7889d8e 100644 --- a/core/src/mindustry/entities/Units.java +++ b/core/src/mindustry/entities/Units.java @@ -184,7 +184,7 @@ public class Units{ } } - /** Returns the closest target enemy. First, units are checked, then tile entities. */ + /** Returns the closest target enemy. First, units are checked, then buildings. */ public static Teamc bestTarget(Team team, float x, float y, float range, Boolf unitPred, Boolf tilePred, Sortf sort){ if(team == Team.derelict) return null; From 0e3bb40eb467695dac3c60ccbe6bbd5b612135d7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 10:20:06 -0400 Subject: [PATCH 44/71] More mobile input targeting fixes --- core/src/mindustry/input/MobileInput.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/input/MobileInput.java b/core/src/mindustry/input/MobileInput.java index 66a52544a7..c97e92455c 100644 --- a/core/src/mindustry/input/MobileInput.java +++ b/core/src/mindustry/input/MobileInput.java @@ -88,7 +88,7 @@ public class MobileInput extends InputHandler implements GestureListener{ }else{ Building tile = world.buildWorld(x, y); - if((tile != null && player.team().isEnemy(tile.team) && tile.team != Team.derelict) || (tile != null && player.unit().type.canHeal && tile.team == player.team() && tile.damaged())){ + if((tile != null && player.team().isEnemy(tile.team) && (tile.team != Team.derelict || state.rules.coreCapture)) || (tile != null && player.unit().type.canHeal && tile.team == player.team() && tile.damaged())){ player.unit().mineTile = null; target = tile; } @@ -938,7 +938,7 @@ public class MobileInput extends InputHandler implements GestureListener{ }else if(target == null){ player.shooting = false; if(Core.settings.getBool("autotarget") && !(player.unit() instanceof BlockUnitUnit u && u.tile() instanceof ControlBlock c && !c.shouldAutoTarget())){ - target = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.checkTarget(type.targetAir, type.targetGround), u -> u.team != Team.derelict && type.targetGround); + target = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.checkTarget(type.targetAir, type.targetGround), u -> type.targetGround); if(allowHealing && target == null){ target = Geometry.findClosest(unit.x, unit.y, indexer.getDamaged(Team.sharded)); From 82f0d6a542ea1f987fb34eb0d0433b74d8466c33 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 10:28:58 -0400 Subject: [PATCH 45/71] Fixed core capture crash --- core/src/mindustry/world/blocks/storage/CoreBlock.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index 4106277667..7cc16ad306 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -282,8 +282,11 @@ public class CoreBlock extends StorageBlock{ public void afterDestroyed(){ if(state.rules.coreCapture){ tile.setNet(block, lastDamage, 0); - //core is invincible for several seconds to prevent recapture - ((CoreBuild)tile.build).iframes = captureInvicibility; + //building does not exist on client yet + if(!net.client()){ + //core is invincible for several seconds to prevent recapture + ((CoreBuild)tile.build).iframes = captureInvicibility; + } } } From 6ffc8ba3c56c38b66e3a833dd1064f2d854fe544 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 10:45:15 -0400 Subject: [PATCH 46/71] #4874 --- .../world/blocks/power/LightBlock.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/src/mindustry/world/blocks/power/LightBlock.java b/core/src/mindustry/world/blocks/power/LightBlock.java index 8a88a8e017..16f109d626 100644 --- a/core/src/mindustry/world/blocks/power/LightBlock.java +++ b/core/src/mindustry/world/blocks/power/LightBlock.java @@ -3,12 +3,15 @@ package mindustry.world.blocks.power; import arc.graphics.*; import arc.graphics.g2d.*; import arc.math.*; +import arc.math.geom.*; import arc.scene.ui.layout.*; +import arc.struct.*; import arc.util.*; import arc.util.io.*; import mindustry.annotations.Annotations.*; import mindustry.gen.*; import mindustry.graphics.*; +import mindustry.input.*; import mindustry.logic.*; import mindustry.world.*; @@ -25,6 +28,7 @@ public class LightBlock extends Block{ update = true; configurable = true; saveConfig = true; + swapDiagonalPlacement = true; config(Integer.class, (LightBuild tile, Integer value) -> tile.color = value); } @@ -36,6 +40,19 @@ public class LightBlock extends Block{ super.init(); } + @Override + public void drawPlace(int x, int y, int rotation, boolean valid){ + super.drawPlace(x, y, rotation, valid); + + Drawf.dashCircle(x * tilesize + offset, y * tilesize + offset, radius * 0.75f, Pal.placing); + } + + @Override + public void changePlacementPath(Seq points, int rotation){ + var placeRadius2 = Mathf.pow(radius * 0.7f / tilesize, 2f) * 3; + Placement.calculateNodes(points, this, rotation, (point, other) -> point.dst2(other) <= placeRadius2); + } + public class LightBuild extends Building{ public int color = Pal.accent.rgba(); public float smoothTime = 1f; From b2ed0ee8847f22209a3f46ca408a067e3ca78f6b Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 10:56:58 -0400 Subject: [PATCH 47/71] #4440 --- core/assets/bundles/bundle.properties | 2 +- core/src/mindustry/type/Weapon.java | 2 +- .../world/blocks/defense/turrets/PointDefenseTurret.java | 2 +- core/src/mindustry/world/blocks/defense/turrets/Turret.java | 2 +- core/src/mindustry/world/blocks/distribution/MassDriver.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 1c90dd8c8a..b59c82b302 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -725,7 +725,7 @@ stat.maxconsecutive = Max Consecutive stat.buildcost = Build Cost stat.inaccuracy = Inaccuracy stat.shots = Shots -stat.reload = Shots/Second +stat.reload = Firing Rate stat.ammo = Ammo stat.shieldhealth = Shield Health stat.cooldowntime = Cooldown Time diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 33729c9636..d3a29943bb 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -128,7 +128,7 @@ public class Weapon implements Cloneable{ t.add("[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int)inaccuracy + " " + StatUnit.degrees.localized()); } t.row(); - t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / reload * shots, 2)); + t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / reload * shots, 2) + " " + StatUnit.perSecond.localized()); StatValues.ammo(ObjectMap.of(u, bullet)).display(t); } diff --git a/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java b/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java index 9c0259c8b2..f540fb6864 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/PointDefenseTurret.java @@ -51,7 +51,7 @@ public class PointDefenseTurret extends ReloadTurret{ public void setStats(){ super.setStats(); - stats.add(Stat.reload, 60f / reloadTime, StatUnit.none); + stats.add(Stat.reload, 60f / reloadTime, StatUnit.perSecond); } 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 e797bf19b4..d6da331293 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/Turret.java @@ -106,7 +106,7 @@ public class Turret extends ReloadTurret{ super.setStats(); stats.add(Stat.inaccuracy, (int)inaccuracy, StatUnit.degrees); - stats.add(Stat.reload, 60f / (reloadTime) * (alternate ? 1 : shots), StatUnit.none); + stats.add(Stat.reload, 60f / (reloadTime) * (alternate ? 1 : shots), StatUnit.perSecond); 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/MassDriver.java b/core/src/mindustry/world/blocks/distribution/MassDriver.java index cb2e52113d..4b0f40d87b 100644 --- a/core/src/mindustry/world/blocks/distribution/MassDriver.java +++ b/core/src/mindustry/world/blocks/distribution/MassDriver.java @@ -59,7 +59,7 @@ public class MassDriver extends Block{ super.setStats(); stats.add(Stat.shootRange, range / tilesize, StatUnit.blocks); - stats.add(Stat.reload, 60f / reloadTime, StatUnit.none); + stats.add(Stat.reload, 60f / reloadTime, StatUnit.perSecond); } @Override From 232415f1d7f20e4ddace87e4a65d35d5f2432e76 Mon Sep 17 00:00:00 2001 From: Patrick 'Quezler' Mounier Date: Tue, 20 Jul 2021 17:05:35 +0200 Subject: [PATCH 48/71] Move capping code from armored to normal conduits (#4979) --- .../world/blocks/liquid/ArmoredConduit.java | 14 -------------- .../src/mindustry/world/blocks/liquid/Conduit.java | 7 +++++++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/core/src/mindustry/world/blocks/liquid/ArmoredConduit.java b/core/src/mindustry/world/blocks/liquid/ArmoredConduit.java index e404b36b44..d8f480836c 100644 --- a/core/src/mindustry/world/blocks/liquid/ArmoredConduit.java +++ b/core/src/mindustry/world/blocks/liquid/ArmoredConduit.java @@ -1,13 +1,10 @@ package mindustry.world.blocks.liquid; -import arc.graphics.g2d.*; -import mindustry.annotations.Annotations.*; import mindustry.gen.*; import mindustry.type.*; import mindustry.world.*; public class ArmoredConduit extends Conduit{ - public @Load("@-cap") TextureRegion capRegion; public ArmoredConduit(String name){ super(name); @@ -21,17 +18,6 @@ public class ArmoredConduit extends Conduit{ } public class ArmoredConduitBuild extends ConduitBuild{ - @Override - public void draw(){ - super.draw(); - - //draw the cap when a conduit would normally leak - Building next = front(); - if(next != null && next.team == team && next.block.hasLiquids) return; - - Draw.rect(capRegion, x, y, rotdeg()); - } - @Override public boolean acceptLiquid(Building source, Liquid liquid){ return super.acceptLiquid(source, liquid) && (source.block instanceof Conduit || diff --git a/core/src/mindustry/world/blocks/liquid/Conduit.java b/core/src/mindustry/world/blocks/liquid/Conduit.java index 393af2e8e5..dc0f03767e 100644 --- a/core/src/mindustry/world/blocks/liquid/Conduit.java +++ b/core/src/mindustry/world/blocks/liquid/Conduit.java @@ -28,6 +28,7 @@ public class Conduit extends LiquidBlock implements Autotiler{ public @Load(value = "@-top-#", length = 5) TextureRegion[] topRegions; public @Load(value = "@-bottom-#", length = 5, fallback = "conduit-bottom-#") TextureRegion[] botRegions; + public @Load("@-cap") TextureRegion capRegion; public boolean leaks = true; @@ -83,6 +84,7 @@ public class Conduit extends LiquidBlock implements Autotiler{ public class ConduitBuild extends LiquidBuild implements ChainedBuilding{ public float smoothLiquid; public int blendbits, xscl, yscl, blending; + public boolean capped; @Override public void draw(){ @@ -104,6 +106,8 @@ public class Conduit extends LiquidBlock implements Autotiler{ Draw.scl(xscl, yscl); drawAt(x, y, blendbits, rotation, SliceMode.none); Draw.reset(); + + if(capped && capRegion.found()) Draw.rect(capRegion, x, y, rotdeg()); } protected void drawAt(float x, float y, int bits, float rotation, SliceMode slice){ @@ -124,6 +128,9 @@ public class Conduit extends LiquidBlock implements Autotiler{ xscl = bits[1]; yscl = bits[2]; blending = bits[4]; + + Building next = front(); + capped = next == null || next.team != team || !next.block.hasLiquids; } @Override From 6e967dce705cd5d7ee2159ebed6f1e888e5dfaef Mon Sep 17 00:00:00 2001 From: Phinner <62483793+Phinner@users.noreply.github.com> Date: Tue, 20 Jul 2021 17:19:03 +0200 Subject: [PATCH 49/71] Add xpdustry.fr to server_v6.json (#5625) A server for my dear french Mindustry players, dedicated for plugin testing and survival maps. --- servers_v6.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/servers_v6.json b/servers_v6.json index 47b959300e..843fde67d9 100644 --- a/servers_v6.json +++ b/servers_v6.json @@ -94,5 +94,9 @@ { "name": "Hungarian", "address": ["magyarmindustry.tk"] + }, + { + "name": "Xpdustry", + "address": ["xpdustry.fr"] } ] From 7656aedb6be7e0feedf12f16bf4429668e4de7a8 Mon Sep 17 00:00:00 2001 From: MEEP of Faith <54301439+MEEPofFaith@users.noreply.github.com> Date: Tue, 20 Jul 2021 08:22:17 -0700 Subject: [PATCH 50/71] `Drawf.Laser` with different ends (#5301) * Laser with different ends * Allow usage of different ended TractorBeamTurret lasers * oops * aaaa * too. many. commits. * Remove rotation * I shouldn't be allowed to edit from the browser. --- core/src/mindustry/graphics/Drawf.java | 24 +++++++++++-------- .../defense/turrets/TractorBeamTurret.java | 11 +++++---- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/core/src/mindustry/graphics/Drawf.java b/core/src/mindustry/graphics/Drawf.java index 7865312eb5..e55e7b01a0 100644 --- a/core/src/mindustry/graphics/Drawf.java +++ b/core/src/mindustry/graphics/Drawf.java @@ -204,20 +204,24 @@ public class Drawf{ Draw.color(); } - public static void laser(Team team, TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2, float scale){ - laser(team, line, edge, x, y, x2, y2, Mathf.angle(x2 - x, y2 - y), scale); - } - public static void laser(Team team, TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2){ - laser(team, line, edge, x, y, x2, y2, Mathf.angle(x2 - x, y2 - y), 1f); + laser(team, line, edge, edge, x, y, x2, y2, 1f); } - public static void laser(Team team, TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2, float rotation, float scale){ - float scl = 8f * scale * Draw.scl; - float vx = Mathf.cosDeg(rotation) * scl, vy = Mathf.sinDeg(rotation) * scl; + public static void laser(Team team, TextureRegion line, TextureRegion start, TextureRegion end, float x, float y, float x2, float y2){ + laser(team, line, start, end, x, y, x2, y2, 1f); + } - Draw.rect(edge, x, y, edge.width * scale * Draw.scl, edge.height * scale * Draw.scl, rotation + 180); - Draw.rect(edge, x2, y2, edge.width * scale * Draw.scl, edge.height * scale * Draw.scl, rotation); + public static void laser(Team team, TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2, float scale){ + laser(team, line, edge, edge, x, y, x2, y2, scale); + } + + public static void laser(Team team, TextureRegion line, TextureRegion start, TextureRegion end, float x, float y, float x2, float y2, float scale){ + float scl = 8f * scale * Draw.scl, rot = Mathf.angle(x2 - x, y2 - y); + float vx = Mathf.cosDeg(rot) * scl, vy = Mathf.sinDeg(rot) * scl; + + Draw.rect(start, x, y, start.width * scale * Draw.scl, start.height * scale * Draw.scl, rot + 180); + Draw.rect(end, x2, y2, end.width * scale * Draw.scl, end.height * scale * Draw.scl, rot); Lines.stroke(12f * scale); Lines.line(line, x + vx, y + vy, x2 - vx, y2 - vy, false); diff --git a/core/src/mindustry/world/blocks/defense/turrets/TractorBeamTurret.java b/core/src/mindustry/world/blocks/defense/turrets/TractorBeamTurret.java index 50d0f39894..59cec32040 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/TractorBeamTurret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/TractorBeamTurret.java @@ -20,10 +20,6 @@ import static mindustry.Vars.*; public class TractorBeamTurret extends BaseTurret{ public final int timerTarget = timers++; public float retargetTime = 5f; - - public @Load("block-@size") TextureRegion baseRegion; - public @Load("@-laser") TextureRegion laser; - public @Load("@-laser-end") TextureRegion laserEnd; public float shootCone = 6f; public float shootLength = 5f; @@ -39,6 +35,11 @@ public class TractorBeamTurret extends BaseTurret{ public Sound shootSound = Sounds.tractorbeam; public float shootSoundVolume = 0.9f; + public @Load("block-@size") TextureRegion baseRegion; + public @Load("@-laser") TextureRegion laser; + public @Load(value = "@-laser-start", fallback = "@-laser-end") TextureRegion laserStart; + public @Load("@-laser-end") TextureRegion laserEnd; + public TractorBeamTurret(String name){ super(name); @@ -151,7 +152,7 @@ public class TractorBeamTurret extends BaseTurret{ Draw.mixcol(laserColor, Mathf.absin(4f, 0.6f)); - Drawf.laser(team, laser, laserEnd, + Drawf.laser(team, laser, laserStart, laserEnd, x + Angles.trnsx(ang, shootLength), y + Angles.trnsy(ang, shootLength), lastX, lastY, strength * efficiency() * laserWidth); From ba227d64fbd18f36a948d92cbc5209561acd1fee Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 11:42:11 -0400 Subject: [PATCH 51/71] #5224 --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/game/SectorInfo.java | 25 +++++++++++++++---- .../mindustry/ui/dialogs/PlanetDialog.java | 11 ++++++-- .../world/blocks/campaign/LaunchPad.java | 4 --- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index b59c82b302..f260f639fe 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -566,6 +566,7 @@ sectors.unexplored = [lightgray]Unexplored sectors.resources = Resources: sectors.production = Production: sectors.export = Export: +sectors.import = Import: sectors.time = Time: sectors.threat = Threat: sectors.wave = Wave: diff --git a/core/src/mindustry/game/SectorInfo.java b/core/src/mindustry/game/SectorInfo.java index 06dd82a59c..a471ecf40f 100644 --- a/core/src/mindustry/game/SectorInfo.java +++ b/core/src/mindustry/game/SectorInfo.java @@ -117,11 +117,6 @@ public class SectorInfo{ export.get(item, ExportStat::new).counter += amount; } - /** Subtracts from export statistics. */ - public void handleItemImport(Item item, int amount){ - export.get(item, ExportStat::new).counter -= amount; - } - public float getExport(Item item){ return export.get(item, ExportStat::new).mean; } @@ -270,6 +265,26 @@ public class SectorInfo{ return map; } + + /** @return a newly allocated map with import statistics. Use sparingly. */ + public ObjectMap importStats(){ + //build empty import stats + ObjectMap imports = new ObjectMap<>(); + //for all sectors on all planets that have bases and export to this sector + for(Planet planet : content.planets()){ + for(Sector sector : planet.sectors){ + Sector dest = sector.info.getRealDestination(); + if(sector.hasBase() && sector.info != this && dest != null && dest.info == this){ + //add their exports to our imports + sector.info.export.each((item, stat) -> { + imports.get(item, ExportStat::new).mean += stat.mean; + }); + } + } + } + return imports; + } + public static class ExportStat{ public transient float counter; public transient WindowedMean means = new WindowedMean(valueWindow); diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 7dbf935165..1e5b83fb84 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -614,7 +614,9 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ int[] i = {0}; - stats.each((item, stat) -> { + for(var item : content.items()){ + var stat = stats.get(item); + if(stat == null) continue; int total = (int)(stat.mean * 60 * scl); if(total > 1){ t.image(item.uiIcon).padRight(3); @@ -623,7 +625,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ t.row(); } } - }); + } if(t.getChildren().any()){ c.add(name).left().row(); @@ -658,6 +660,11 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ //export display.get(sector.info.export, "@sectors.export"); + //import + if(sector.hasBase()){ + display.get(sector.info.importStats(), "@sectors.import"); + } + ItemSeq items = sector.items(); //stored resources diff --git a/core/src/mindustry/world/blocks/campaign/LaunchPad.java b/core/src/mindustry/world/blocks/campaign/LaunchPad.java index 0fa14dcce1..c36b5a7a91 100644 --- a/core/src/mindustry/world/blocks/campaign/LaunchPad.java +++ b/core/src/mindustry/world/blocks/campaign/LaunchPad.java @@ -115,10 +115,6 @@ public class LaunchPad extends Block{ Draw.reset(); } - float cooldown = Mathf.clamp(launchCounter / (90f)); - - Draw.mixcol(lightColor, 1f - cooldown); - Draw.rect(podRegion, x, y); Draw.reset(); From b28aff4a7bab660d487d0bbe7fea421760db96f1 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 12:04:34 -0400 Subject: [PATCH 52/71] Sector items display fixes --- core/src/mindustry/game/SectorInfo.java | 3 +- .../mindustry/ui/dialogs/PlanetDialog.java | 55 +++++++++---------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/core/src/mindustry/game/SectorInfo.java b/core/src/mindustry/game/SectorInfo.java index a471ecf40f..8c9f1f1a9e 100644 --- a/core/src/mindustry/game/SectorInfo.java +++ b/core/src/mindustry/game/SectorInfo.java @@ -265,10 +265,9 @@ public class SectorInfo{ return map; } - /** @return a newly allocated map with import statistics. Use sparingly. */ + //TODO this can be a float map public ObjectMap importStats(){ - //build empty import stats ObjectMap imports = new ObjectMap<>(); //for all sectors on all planets that have bases and export to this sector for(Planet planet : content.planets()){ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 1e5b83fb84..32ed6ee79a 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -603,36 +603,33 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ selectAlpha = Mathf.lerpDelta(selectAlpha, Mathf.num(planets.zoom < 1.9f), 0.1f); } + void displayItems(Table c, float scl, ObjectMap stats, String name){ + Table t = new Table().left(); + + int i = 0; + for(var item : content.items()){ + var stat = stats.get(item); + if(stat == null) continue; + int total = (int)(stat.mean * 60 * scl); + if(total > 1){ + t.image(item.uiIcon).padRight(3); + t.add(UI.formatAmount(total) + " " + Core.bundle.get("unit.perminute")).color(Color.lightGray).padRight(3); + if(++i % 3 == 0){ + t.row(); + } + } + } + + if(t.getChildren().any()){ + c.add(name).left().row(); + c.add(t).padLeft(10f).left().row(); + } + } + void showStats(Sector sector){ BaseDialog dialog = new BaseDialog(sector.name()); dialog.cont.pane(c -> { - Cons2, String> display = (stats, name) -> { - Table t = new Table().left(); - - float scl = sector.getProductionScale(); - - int[] i = {0}; - - for(var item : content.items()){ - var stat = stats.get(item); - if(stat == null) continue; - int total = (int)(stat.mean * 60 * scl); - if(total > 1){ - t.image(item.uiIcon).padRight(3); - t.add(UI.formatAmount(total) + " " + Core.bundle.get("unit.perminute")).color(Color.lightGray).padRight(3); - if(++i[0] % 3 == 0){ - t.row(); - } - } - } - - if(t.getChildren().any()){ - c.add(name).left().row(); - c.add(t).padLeft(10f).left().row(); - } - }; - c.defaults().padBottom(5); c.add(Core.bundle.get("sectors.time") + " [accent]" + sector.save.getPlayTime()).left().row(); @@ -655,14 +652,14 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ } //production - display.get(sector.info.production, "@sectors.production"); + displayItems(c, sector.getProductionScale(), sector.info.production, "@sectors.production"); //export - display.get(sector.info.export, "@sectors.export"); + displayItems(c, sector.getProductionScale(), sector.info.export, "@sectors.export"); //import if(sector.hasBase()){ - display.get(sector.info.importStats(), "@sectors.import"); + displayItems(c, 1f, sector.info.importStats(), "@sectors.import"); } ItemSeq items = sector.items(); From 0f199fa4b496fcba504bbc762dd75cfc4c86d610 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 13:17:18 -0400 Subject: [PATCH 53/71] Partial impl of #2923 --- core/src/mindustry/ai/types/DefenderAI.java | 15 +++++++++++- core/src/mindustry/ai/types/FlyingAI.java | 2 ++ .../entities/units/AIController.java | 9 +++++++ core/src/mindustry/game/SpawnGroup.java | 24 +++++++++++++++---- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/ai/types/DefenderAI.java b/core/src/mindustry/ai/types/DefenderAI.java index 93040727e0..3f7915e68e 100644 --- a/core/src/mindustry/ai/types/DefenderAI.java +++ b/core/src/mindustry/ai/types/DefenderAI.java @@ -6,10 +6,14 @@ import mindustry.entities.units.*; import mindustry.gen.*; import mindustry.world.meta.*; +import static mindustry.Vars.*; + public class DefenderAI extends AIController{ @Override public void updateMovement(){ + unloadPayloads(); + if(target != null){ moveTo(target, (target instanceof Sized s ? s.hitSize()/2f * 1.1f : 0f) + unit.hitSize/2f + 15f, 50f); unit.lookAt(target); @@ -23,6 +27,7 @@ public class DefenderAI extends AIController{ @Override protected Teamc findTarget(float x, float y, float range, boolean air, boolean ground){ + //find unit to follow if not in rally mode if(command() != UnitCommand.rally){ //Sort by max health and closer target. @@ -34,6 +39,14 @@ public class DefenderAI extends AIController{ var block = targetFlag(unit.x, unit.y, BlockFlag.rally, false); if(block != null) return block; //return core if found - return unit.closestCore(); + var core = unit.closestCore(); + if(core != null) return core; + + //for enemies, target the enemy core. + if(state.rules.waves && unit.team == state.rules.waveTeam){ + return unit.closestEnemyCore(); + } + + return null; } } diff --git a/core/src/mindustry/ai/types/FlyingAI.java b/core/src/mindustry/ai/types/FlyingAI.java index 72d7eda4ff..b3e35a21d1 100644 --- a/core/src/mindustry/ai/types/FlyingAI.java +++ b/core/src/mindustry/ai/types/FlyingAI.java @@ -11,6 +11,8 @@ public class FlyingAI extends AIController{ @Override public void updateMovement(){ + unloadPayloads(); + if(target != null && unit.hasWeapons() && command() == UnitCommand.attack){ if(!unit.type.circleTarget){ moveTo(target, unit.type.range * 0.8f); diff --git a/core/src/mindustry/entities/units/AIController.java b/core/src/mindustry/entities/units/AIController.java index e0c3231309..e4d2bfaf2b 100644 --- a/core/src/mindustry/entities/units/AIController.java +++ b/core/src/mindustry/entities/units/AIController.java @@ -9,6 +9,7 @@ import mindustry.entities.*; import mindustry.gen.*; import mindustry.type.*; import mindustry.world.*; +import mindustry.world.blocks.payloads.*; import mindustry.world.meta.*; import static mindustry.Vars.*; @@ -178,6 +179,14 @@ public class AIController implements UnitController{ return Geometry.findClosest(unit.x, unit.y, Vars.spawner.getSpawns()); } + protected void unloadPayloads(){ + if(unit instanceof Payloadc pay && pay.hasPayload() && target instanceof Building && pay.payloads().peek() instanceof UnitPayload){ + if(target.within(unit, Math.max(unit.type().range + 1f, 75f))){ + pay.dropLastPayload(); + } + } + } + protected void circle(Position target, float circleLength){ circle(target, circleLength, unit.speed()); } diff --git a/core/src/mindustry/game/SpawnGroup.java b/core/src/mindustry/game/SpawnGroup.java index 2b7e8625c9..115c78a7e6 100644 --- a/core/src/mindustry/game/SpawnGroup.java +++ b/core/src/mindustry/game/SpawnGroup.java @@ -1,5 +1,6 @@ package mindustry.game; +import arc.struct.*; import arc.util.*; import arc.util.serialization.*; import arc.util.serialization.Json.*; @@ -39,12 +40,12 @@ public class SpawnGroup implements JsonSerializable{ public float shieldScaling = 0f; /** Amount of enemies spawned initially, with no scaling */ public int unitAmount = 1; + /** Seq of payloads that this unit will spawn with. */ + public @Nullable Seq payloads; /** Status effect applied to the spawned unit. Null to disable. */ - @Nullable - public StatusEffect effect; + public @Nullable StatusEffect effect; /** Items this unit spawns with. Null to disable. */ - @Nullable - public ItemStack items; + public @Nullable ItemStack items; public SpawnGroup(UnitType type){ this.type = type; @@ -85,6 +86,15 @@ public class SpawnGroup implements JsonSerializable{ unit.shield = getShield(wave); + //load up spawn payloads + if(payloads != null && unit instanceof Payloadc pay){ + for(var type : payloads){ + if(type == null) continue; + Unit payload = type.create(unit.team); + pay.pickup(payload); + } + } + return unit; } @@ -101,6 +111,9 @@ public class SpawnGroup implements JsonSerializable{ if(shieldScaling != 0) json.writeValue("shieldScaling", shieldScaling); if(unitAmount != 1) json.writeValue("amount", unitAmount); if(effect != null) json.writeValue("effect", effect.name); + if(payloads != null && payloads.size > 0){ + json.writeValue("payloads", payloads.map(u -> u.name).toArray(String.class)); + } } @Override @@ -117,6 +130,9 @@ public class SpawnGroup implements JsonSerializable{ shields = data.getFloat("shields", 0); shieldScaling = data.getFloat("shieldScaling", 0); unitAmount = data.getInt("amount", 1); + if(data.has("payloads")){ + payloads = Seq.with(json.readValue(String[].class, data.get("payloads"))).map(s -> content.getByName(ContentType.unit, s)); + } //old boss effect ID if(data.has("effect") && data.get("effect").isNumber() && data.getInt("effect", -1) == 8){ From 4c51519b8a31da2cdee4d0b59ae3fa9be312171b Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 13:59:19 -0400 Subject: [PATCH 54/71] #4886 --- core/assets/bundles/bundle.properties | 2 +- core/src/mindustry/world/meta/StatValues.java | 25 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index f260f639fe..9827c1af87 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -795,7 +795,7 @@ bullet.damage = [stat]{0}[lightgray] damage bullet.splashdamage = [stat]{0}[lightgray] area dmg ~[stat] {1}[lightgray] tiles bullet.incendiary = [stat]incendiary bullet.homing = [stat]homing -bullet.frag = [stat]frag +bullet.frags = [stat]{0}[lightgray]x frag bullets: bullet.lightning = [stat]{0}[lightgray]x lightning ~ [stat]{1}[lightgray] damage bullet.buildingdamage = [stat]{0}%[lightgray] building damage bullet.knockback = [stat]{0}[lightgray] knockback diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index 4926ed3516..5f83234dcf 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -256,6 +256,10 @@ public class StatValues{ } public static StatValue ammo(ObjectMap map){ + return ammo(map, 0); + } + + public static StatValue ammo(ObjectMap map, int indent){ return table -> { table.row(); @@ -264,12 +268,12 @@ public class StatValues{ orderedKeys.sort(); for(T t : orderedKeys){ - boolean unit = t instanceof UnitType; + boolean compact = t instanceof UnitType || indent > 0; BulletType type = map.get(t); //no point in displaying unit icon twice - if(!unit & !(t instanceof PowerTurret)){ + if(!compact && !(t instanceof PowerTurret)){ table.image(icon(t)).size(3 * 8).padRight(4).right().top(); table.add(t.localizedName).padRight(10).left().top(); } @@ -293,11 +297,11 @@ public class StatValues{ sep(bt, Core.bundle.format("bullet.splashdamage", (int)type.splashDamage, Strings.fixed(type.splashDamageRadius / tilesize, 1))); } - if(!unit && !Mathf.equal(type.ammoMultiplier, 1f) && type.displayAmmoMultiplier){ + if(!compact && !Mathf.equal(type.ammoMultiplier, 1f) && type.displayAmmoMultiplier){ sep(bt, Core.bundle.format("bullet.multiplier", (int)type.ammoMultiplier)); } - if(!Mathf.equal(type.reloadMultiplier, 1f)){ + if(!compact && !Mathf.equal(type.reloadMultiplier, 1f)){ sep(bt, Core.bundle.format("bullet.reload", Strings.autoFixed(type.reloadMultiplier, 2))); } @@ -325,14 +329,17 @@ public class StatValues{ sep(bt, Core.bundle.format("bullet.lightning", type.lightning, type.lightningDamage < 0 ? type.damage : type.lightningDamage)); } - if(type.fragBullet != null){ - sep(bt, "@bullet.frag"); - } - if(type.status != StatusEffects.none){ sep(bt, (type.minfo.mod == null ? type.status.emoji() : "") + "[stat]" + type.status.localizedName); } - }).padTop(unit ? 0 : -9).left().get().background(unit ? null : Tex.underline); + + if(type.fragBullet != null){ + sep(bt, Core.bundle.format("bullet.frags", type.fragBullets)); + bt.row(); + + ammo(ObjectMap.of(t, type.fragBullet), indent + 1).display(bt); + } + }).padTop(compact ? 0 : -9).padLeft(indent * 8).left().get().background(compact ? null : Tex.underline); table.row(); } From 8436599c79636d4b83bf3c71f9d57297f19cdc8f Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 14:12:48 -0400 Subject: [PATCH 55/71] #5050 --- .../mindustry/entities/bullet/BulletType.java | 2 +- .../mindustry/entities/comp/BulletComp.java | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 4a1df75e62..3640299921 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -371,7 +371,7 @@ public class BulletType extends Content implements Cloneable{ e -> e.checkTarget(collidesAir, collidesGround) && e.team != b.team, t -> collidesGround && (t.team != b.team || t.damaged())); }else{ - target = Units.closestTarget(b.team, b.x, b.y, homingRange, e -> e.checkTarget(collidesAir, collidesGround), t -> collidesGround); + target = Units.closestTarget(b.team, b.x, b.y, homingRange, e -> e.checkTarget(collidesAir, collidesGround) && !b.hasCollided(e.id), t -> collidesGround && !b.hasCollided(t.id)); } if(target != null){ diff --git a/core/src/mindustry/entities/comp/BulletComp.java b/core/src/mindustry/entities/comp/BulletComp.java index e1254670f0..839e0b0c44 100644 --- a/core/src/mindustry/entities/comp/BulletComp.java +++ b/core/src/mindustry/entities/comp/BulletComp.java @@ -80,6 +80,10 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw remove(); } + public boolean hasCollided(int id){ + return collided.size != 0 && !collided.contains(id); + } + @Replace public float clipSize(){ return type.drawSize; @@ -90,7 +94,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw public boolean collides(Hitboxc other){ return type.collides && (other instanceof Teamc t && t.team() != team) && !(other instanceof Flyingc f && !f.checkTarget(type.collidesAir, type.collidesGround)) - && !(type.pierce && collided.contains(other.id())); //prevent multiple collisions + && !(type.pierce && hasCollided(other.id())); //prevent multiple collisions } @MethodPriority(100) @@ -116,16 +120,16 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw if(type.collidesTiles && type.collides && type.collidesGround){ world.raycastEach(World.toTile(lastX()), World.toTile(lastY()), tileX(), tileY(), (x, y) -> { - Building tile = world.build(x, y); - if(tile == null || !isAdded()) return false; + Building build = world.build(x, y); + if(build == null || !isAdded()) return false; - if(tile.collide(self()) && type.testCollision(self(), tile) && !tile.dead() && (type.collidesTeam || tile.team != team) && !(type.pierceBuilding && collided.contains(tile.id))){ + if(build.collide(self()) && type.testCollision(self(), build) && !build.dead() && (type.collidesTeam || build.team != team) && !(type.pierceBuilding && hasCollided(build.id))){ boolean remove = false; - float health = tile.health; + float health = build.health; - if(tile.team != team){ - remove = tile.collision(self()); + if(build.team != team){ + remove = build.collision(self()); } if(remove || type.collidesTeam){ @@ -133,11 +137,11 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw hit = true; remove(); }else{ - collided.add(tile.id); + collided.add(build.id); } } - type.hitTile(self(), tile, health, true); + type.hitTile(self(), build, health, true); return !type.pierceBuilding; } From f8ddf952ca0d5a3a55f109b45c433e62825bdf51 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 15:22:57 -0400 Subject: [PATCH 56/71] Improved coal centrifuge update effect --- core/src/mindustry/content/Blocks.java | 2 +- core/src/mindustry/content/Fx.java | 7 +++++++ core/src/mindustry/graphics/Pal.java | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 6893dedf99..3708ee6b6c 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -712,7 +712,7 @@ public class Blocks implements ContentList{ coalCentrifuge = new GenericCrafter("coal-centrifuge"){{ requirements(Category.crafting, with(Items.titanium, 20, Items.graphite, 40, Items.lead, 30)); - craftEffect = Fx.smeltsmoke; + craftEffect = Fx.coalSmeltsmoke; outputItem = new ItemStack(Items.coal, 1); craftTime = 30f; size = 2; diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index caf2b37f6a..562aebad98 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -1622,6 +1622,13 @@ public class Fx{ }); }), + coalSmeltsmoke = new Effect(40f, e -> { + randLenVectors(e.id, 0.2f + e.fin(), 4, 6.3f, (x, y, fin, out) -> { + color(Color.darkGray, Pal.coalBlack, e.finpowdown()); + Fill.circle(e.x + x, e.y + y, out * 2f + 0.25f); + }); + }), + formsmoke = new Effect(40, e -> { randLenVectors(e.id, 6, 5f + e.fin() * 8f, (x, y) -> { color(Pal.plasticSmoke, Color.lightGray, e.fin()); diff --git a/core/src/mindustry/graphics/Pal.java b/core/src/mindustry/graphics/Pal.java index 012e5a0aff..a990905900 100644 --- a/core/src/mindustry/graphics/Pal.java +++ b/core/src/mindustry/graphics/Pal.java @@ -6,6 +6,7 @@ public class Pal{ public static Color thoriumPink = Color.valueOf("f9a3c7"), + coalBlack = Color.valueOf("272727"), items = Color.valueOf("2ea756"), command = Color.valueOf("eab678"), From 02c03e9c67b2638cb4bfc5ebaea55b9567485fde Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 17:38:09 -0400 Subject: [PATCH 57/71] Cleanup & minor layout bugfixes --- core/src/mindustry/ai/types/LogicAI.java | 2 +- core/src/mindustry/audio/SoundControl.java | 2 +- core/src/mindustry/game/SectorInfo.java | 2 +- .../ui/dialogs/CustomRulesDialog.java | 2 +- .../mindustry/ui/dialogs/PlanetDialog.java | 2 +- .../ui/dialogs/SchematicsDialog.java | 22 ++----------------- 6 files changed, 7 insertions(+), 25 deletions(-) diff --git a/core/src/mindustry/ai/types/LogicAI.java b/core/src/mindustry/ai/types/LogicAI.java index 3357d36946..193e5aaf48 100644 --- a/core/src/mindustry/ai/types/LogicAI.java +++ b/core/src/mindustry/ai/types/LogicAI.java @@ -17,7 +17,7 @@ public class LogicAI extends AIController{ /** Minimum delay between item transfers. */ public static final float transferDelay = 60f * 1.5f; /** Time after which the unit resets its controlled and reverts to a normal unit. */ - public static final float logicControlTimeout = 10f * 60f; + public static final float logicControlTimeout = 60f * 10f; public LUnitControl control = LUnitControl.idle; public float moveX, moveY, moveRad; diff --git a/core/src/mindustry/audio/SoundControl.java b/core/src/mindustry/audio/SoundControl.java index 00939df0f1..5b29b62a85 100644 --- a/core/src/mindustry/audio/SoundControl.java +++ b/core/src/mindustry/audio/SoundControl.java @@ -17,7 +17,7 @@ import static mindustry.Vars.*; /** Controls playback of multiple audio tracks.*/ public class SoundControl{ - protected static final float finTime = 120f, foutTime = 120f, musicInterval = 60 * 60 * 3f, musicChance = 0.6f, musicWaveChance = 0.46f; + protected static final float finTime = 120f, foutTime = 120f, musicInterval = 3f * Time.toMinutes, musicChance = 0.6f, musicWaveChance = 0.46f; /** normal, ambient music, plays at any time */ public Seq ambientMusic = Seq.with(); diff --git a/core/src/mindustry/game/SectorInfo.java b/core/src/mindustry/game/SectorInfo.java index 8c9f1f1a9e..4d2b20b9cc 100644 --- a/core/src/mindustry/game/SectorInfo.java +++ b/core/src/mindustry/game/SectorInfo.java @@ -55,7 +55,7 @@ public class SectorInfo{ /** Waves this sector can survive if under attack. Based on wave in info. <0 means uncalculated. */ public int wavesSurvived = -1; /** Time between waves. */ - public float waveSpacing = 60 * 60 * 2; + public float waveSpacing = 2 * Time.toMinutes; /** Damage dealt to sector. */ public float damage; /** How many waves have passed while the player was away. */ diff --git a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java index 346a9b48bb..3b5978a290 100644 --- a/core/src/mindustry/ui/dialogs/CustomRulesDialog.java +++ b/core/src/mindustry/ui/dialogs/CustomRulesDialog.java @@ -263,7 +263,7 @@ public class CustomRulesDialog extends BaseDialog{ rebuild[0] = () -> { base.clearChildren(); - int cols = Math.max(1, Core.graphics.getWidth() / 460); + int cols = Math.max(1, (int)(Core.graphics.getWidth() / Scl.scl(450))); int idx = 0; for(WeatherEntry entry : rules.weather){ diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 32ed6ee79a..00f29b0a39 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -739,7 +739,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ updateSelected(); }).checked(sector.info.icon == null); - int cols = (int)Math.min(20, Core.graphics.getWidth() / 52f); + int cols = (int)Math.min(20, Core.graphics.getWidth() / Scl.scl(52f)); int i = 1; for(var key : defaultIcons){ diff --git a/core/src/mindustry/ui/dialogs/SchematicsDialog.java b/core/src/mindustry/ui/dialogs/SchematicsDialog.java index a4616af643..cdafcf0e80 100644 --- a/core/src/mindustry/ui/dialogs/SchematicsDialog.java +++ b/core/src/mindustry/ui/dialogs/SchematicsDialog.java @@ -415,32 +415,14 @@ public class SchematicsDialog extends BaseDialog{ t.marginRight(19f); t.defaults().size(48f); - int cols = (int)Math.min(20, Core.graphics.getWidth() / 52f); - - /* - int i = 0; - for(var key : defaultIcons){ - var value = Icon.icons.get(key); - - t.button(value, Styles.cleari, () -> { - sector.info.icon = key; - sector.info.contentIcon = null; - sector.saveInfo(); - hide(); - updateSelected(); - }).checked(key.equals(sector.info.icon)); - - if(++i % cols == 0) t.row(); - }*/ - - int i = 0; + int cols = (int)Math.min(20, Core.graphics.getWidth() / Scl.scl(52f)); for(ContentType ctype : defaultContentIcons){ t.row(); t.image().colspan(cols).growX().width(Float.NEGATIVE_INFINITY).height(3f).color(Pal.accent); t.row(); - i = 0; + int i = 0; for(UnlockableContent u : content.getBy(ctype).as()){ if(!u.isHidden() && u.unlockedNow() && u.hasEmoji() && !tags.contains(u.emoji())){ t.button(new TextureRegionDrawable(u.uiIcon), Styles.cleari, iconMed, () -> { From 447562b2f12e8ea3e4ad1ab350e7abcf7683f9a8 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 17:55:00 -0400 Subject: [PATCH 58/71] Turret accurateDelay parameter --- core/src/mindustry/entities/Predict.java | 10 +++++++--- .../world/blocks/defense/turrets/Turret.java | 15 +++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/core/src/mindustry/entities/Predict.java b/core/src/mindustry/entities/Predict.java index 3f8aca60cd..67ca74c42b 100644 --- a/core/src/mindustry/entities/Predict.java +++ b/core/src/mindustry/entities/Predict.java @@ -9,8 +9,8 @@ import mindustry.gen.*; * Class for predicting shoot angles based on velocities of targets. */ public class Predict{ - private static Vec2 vec = new Vec2(); - private static Vec2 vresult = new Vec2(); + private static final Vec2 vec = new Vec2(); + private static final Vec2 vresult = new Vec2(); /** * Calculates of intercept of a stationary and moving target. Do not call from multiple threads! @@ -52,6 +52,10 @@ public class Predict{ } public static Vec2 intercept(Position src, Position dst, float v){ + return intercept(src, dst, 0, 0, v); + } + + public static Vec2 intercept(Position src, Position dst, float offsetx, float offsety, float v){ float ddx = 0, ddy = 0; if(dst instanceof Hitboxc h){ ddx += h.deltaX(); @@ -61,7 +65,7 @@ public class Predict{ ddx -= h.deltaX(); ddy -= h.deltaY(); } - return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), ddx, ddy, v); + return intercept(src.getX(), src.getY(), dst.getX() + offsetx, dst.getY() + offsety, ddx, ddy, v); } /** diff --git a/core/src/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/mindustry/world/blocks/defense/turrets/Turret.java index d6da331293..308746919e 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/Turret.java @@ -60,6 +60,8 @@ public class Turret extends ReloadTurret{ public float minRange = 0f; public float burstSpacing = 0; public boolean alternate = false; + /** If true, this turret will accurately target moving targets with respect to charge time. */ + public boolean accurateDelay = false; public boolean targetAir = true; public boolean targetGround = true; @@ -216,11 +218,16 @@ public class Turret extends ReloadTurret{ public void targetPosition(Posc pos){ if(!hasAmmo() || pos == null) return; BulletType bullet = peekAmmo(); - float speed = bullet.speed; - //slow bullets never intersect - if(speed < 0.1f) speed = 9999999f; - targetPos.set(Predict.intercept(this, pos, speed)); + var offset = Tmp.v1.setZero(); + + //when delay is accurate, assume unit has moved by chargeTime already + if(accurateDelay && pos instanceof Hitboxc h){ + offset.set(h.deltaX(), h.deltaY()).scl(chargeTime / Time.delta); + } + + targetPos.set(Predict.intercept(this, pos, offset.x, offset.y, bullet.speed <= 0.01f ? 99999999f : bullet.speed)); + if(targetPos.isZero()){ targetPos.set(pos); } From 14e4203ee7354fecacff0862b917495cc70f8901 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 17:59:47 -0400 Subject: [PATCH 59/71] #4912 --- core/src/mindustry/content/Blocks.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 3708ee6b6c..5605aeba31 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -304,7 +304,7 @@ public class Blocks implements ContentList{ shale = new Floor("shale"){{ variants = 3; - attributes.set(Attribute.oil, 1f); + attributes.set(Attribute.oil, 1.6f); }}; stoneWall = new StaticWall("stone-wall"){{ From 8cf2068a703d028c0a759839d36871543a003eba Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 19:15:50 -0400 Subject: [PATCH 60/71] Create pull_request_template.md --- .github/pull_request_template.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..4f03450b6e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,5 @@ +If your pull request is **not** translation-related, read the list of requirements below and check each box: + +- [ ] I have read the [contribution guidelines](https://github.com/Anuken/Mindustry/blob/master/CONTRIBUTING.md). +- [ ] I have ensured that my code compiles, if applicable. +- [ ] I have ensured that any new features in this PR function correctly in-game, if applicable. From d506685bbaff0809754bb6d48e627882c29e9862 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 20 Jul 2021 19:56:55 -0400 Subject: [PATCH 61/71] Stacked map editor brush slider --- core/src/mindustry/content/Blocks.java | 1 + core/src/mindustry/content/Fx.java | 9 ++++----- core/src/mindustry/editor/MapEditorDialog.java | 8 +++++--- .../mindustry/world/blocks/power/ThermalGenerator.java | 3 ++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 5605aeba31..88d1758c6a 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1161,6 +1161,7 @@ public class Blocks implements ContentList{ requirements(Category.power, with(Items.copper, 40, Items.graphite, 35, Items.lead, 50, Items.silicon, 35, Items.metaglass, 40)); powerProduction = 1.8f; generateEffect = Fx.redgeneratespark; + effectChance = 0.013f; size = 2; floating = true; ambientSound = Sounds.hum; diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 562aebad98..e0288e4eb8 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -1526,11 +1526,10 @@ public class Fx{ }); }), - redgeneratespark = new Effect(18, e -> { - randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> { - float len = e.fout() * 4f; - color(Pal.redSpark, Color.gray, e.fin()); - Fill.circle(e.x + x, e.y + y, len/2f); + redgeneratespark = new Effect(80, e -> { + color(Pal.redSpark, Color.gray, e.fin()); + randLenVectors(e.id, 2, e.finpow() * 9f, (x, y) -> { + Fill.circle(e.x + x, e.y + y, e.fslope() * 1.8f); }); }), diff --git a/core/src/mindustry/editor/MapEditorDialog.java b/core/src/mindustry/editor/MapEditorDialog.java index ac7631cff3..9b51df514b 100644 --- a/core/src/mindustry/editor/MapEditorDialog.java +++ b/core/src/mindustry/editor/MapEditorDialog.java @@ -560,10 +560,12 @@ public class MapEditorDialog extends Dialog implements Disposable{ } } - t.top(); - t.add("@editor.brush"); + var label = new Label("@editor.brush"); + label.setAlignment(Align.center); + label.touchable = Touchable.disabled; + + t.top().stack(slider, label).width(size * 3f - 20).padTop(4f); t.row(); - t.add(slider).width(size * 3f - 20).padTop(4f); }).padTop(5).growX().top(); mid.row(); diff --git a/core/src/mindustry/world/blocks/power/ThermalGenerator.java b/core/src/mindustry/world/blocks/power/ThermalGenerator.java index 1c6d7837eb..309b9aa8b9 100644 --- a/core/src/mindustry/world/blocks/power/ThermalGenerator.java +++ b/core/src/mindustry/world/blocks/power/ThermalGenerator.java @@ -12,6 +12,7 @@ import mindustry.world.meta.*; public class ThermalGenerator extends PowerGenerator{ public Effect generateEffect = Fx.none; + public float effectChance = 0.05f; public Attribute attribute = Attribute.heat; public ThermalGenerator(String name){ @@ -52,7 +53,7 @@ public class ThermalGenerator extends PowerGenerator{ public void updateTile(){ productionEfficiency = sum + attribute.env(); - if(productionEfficiency > 0.1f && Mathf.chance(0.05 * delta())){ + if(productionEfficiency > 0.1f && Mathf.chanceDelta(effectChance)){ generateEffect.at(x + Mathf.range(3f), y + Mathf.range(3f)); } } From db13bffad66ad091828ee5b93290b3120b6e7054 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 21 Jul 2021 07:58:50 -0400 Subject: [PATCH 62/71] Descriptions for new content --- core/assets/bundles/bundle.properties | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 9827c1af87..bc8ca60339 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1547,6 +1547,8 @@ block.memory-bank.description = Stores information for a logic processor. High c block.logic-display.description = Displays arbitrary graphics from a logic processor. block.large-logic-display.description = Displays arbitrary graphics from a logic processor. block.interplanetary-accelerator.description = A massive electromagnetic railgun tower. Accelerates cores to escape velocity for interplanetary deployment. +block.repair-turret.description = Continuously repairs the closest damaged unit in its vicinity. Optionally accepts coolant. +block.payload-propulsion-tower.description = Long-range payload transport structure. Shoots payloads to other linked payload propulsion towers. unit.dagger.description = Fires standard bullets at all nearby enemies. unit.mace.description = Fires streams of flame at all nearby enemies. @@ -1581,6 +1583,11 @@ unit.omura.description = Fires a long-range piercing railgun bolt at enemies. Co unit.alpha.description = Defends the Shard core from enemies. Builds structures. unit.beta.description = Defends the Foundation core from enemies. Builds structures. unit.gamma.description = Defends the Nucleus core from enemies. Builds structures. +unit.retusa.description = Places proximity mines. Repairs allied units. +unit.oxynoe.description = Fires structure-repairing streams of flame at nearby enemies. Targets nearby enemy projectiles with a point defense turret. +unit.cyerce.description = Fires seeking cluster-missiles at enemies. Repairs allied units. +unit.aegires.description = Shocks all enemy units and structures that enter its energy field. Repairs all allies. +unit.navanax.description = Fires massive EMP projectiles, dealing significant damage to enemy power networks and repairing allied structures. Melts nearby enemies with 4 autonomous laser turrets. lst.read = Read a number from a linked memory cell. lst.write = Write a number to a linked memory cell. From 4ab063679b8c40043ce25b4a2f102a88ec4fa159 Mon Sep 17 00:00:00 2001 From: VizardAlpha <43859764+VizardAlpha@users.noreply.github.com> Date: Wed, 21 Jul 2021 14:37:14 +0200 Subject: [PATCH 63/71] Update short_description.txt for android (#5401) --- fastlane/metadata/android/fr-FR/short_description.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/metadata/android/fr-FR/short_description.txt b/fastlane/metadata/android/fr-FR/short_description.txt index f511b816dd..e8deb5ded0 100644 --- a/fastlane/metadata/android/fr-FR/short_description.txt +++ b/fastlane/metadata/android/fr-FR/short_description.txt @@ -1 +1 @@ -L'industrie au service de ce tower defense. +Un tower-defense ouvert, axé sur la gestion des ressources. From fcb9ebb8c33367f11186ecfd091ec490d1ba991f Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 21 Jul 2021 09:02:08 -0400 Subject: [PATCH 64/71] Thermal generator effect tweaks --- core/assets/bundles/bundle.properties | 2 +- core/src/mindustry/content/Blocks.java | 2 +- core/src/mindustry/content/Fx.java | 16 ++++++++++------ .../src/mindustry/world/draw/DrawArcSmelter.java | 2 -- gradle.properties | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index bc8ca60339..80d41b2dac 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1587,7 +1587,7 @@ unit.retusa.description = Places proximity mines. Repairs allied units. unit.oxynoe.description = Fires structure-repairing streams of flame at nearby enemies. Targets nearby enemy projectiles with a point defense turret. unit.cyerce.description = Fires seeking cluster-missiles at enemies. Repairs allied units. unit.aegires.description = Shocks all enemy units and structures that enter its energy field. Repairs all allies. -unit.navanax.description = Fires massive EMP projectiles, dealing significant damage to enemy power networks and repairing allied structures. Melts nearby enemies with 4 autonomous laser turrets. +unit.navanax.description = Fires explosive EMP projectiles, dealing significant damage to enemy power networks and repairing allied structures. Melts nearby enemies with 4 autonomous laser turrets. lst.read = Read a number from a linked memory cell. lst.write = Write a number to a linked memory cell. diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 88d1758c6a..8b84a190c7 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1161,7 +1161,7 @@ public class Blocks implements ContentList{ requirements(Category.power, with(Items.copper, 40, Items.graphite, 35, Items.lead, 50, Items.silicon, 35, Items.metaglass, 40)); powerProduction = 1.8f; generateEffect = Fx.redgeneratespark; - effectChance = 0.013f; + effectChance = 0.011f; size = 2; floating = true; ambientSound = Sounds.hum; diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index e0288e4eb8..6b1d87ec06 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -1526,12 +1526,16 @@ public class Fx{ }); }), - redgeneratespark = new Effect(80, e -> { - color(Pal.redSpark, Color.gray, e.fin()); - randLenVectors(e.id, 2, e.finpow() * 9f, (x, y) -> { - Fill.circle(e.x + x, e.y + y, e.fslope() * 1.8f); - }); - }), + redgeneratespark = new Effect(90, e -> { + color(Pal.redSpark); + alpha(e.fslope()); + + rand.setSeed(e.id); + for(int i = 0; i < 2; i++){ + v.set(e.finpow() * 9f * rand.nextFloat(), 0).rotate(rand.random(360f)).add(e.x, e.y); + Fill.circle(v.x, v.y, rand.random(1.4f, 2.4f)); + } + }).layer(Layer.bullet - 1f), generatespark = new Effect(18, e -> { randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> { diff --git a/core/src/mindustry/world/draw/DrawArcSmelter.java b/core/src/mindustry/world/draw/DrawArcSmelter.java index 957b739b4c..51706aafbe 100644 --- a/core/src/mindustry/world/draw/DrawArcSmelter.java +++ b/core/src/mindustry/world/draw/DrawArcSmelter.java @@ -22,8 +22,6 @@ public class DrawArcSmelter extends DrawBlock{ Draw.rect(bottom, build.x, build.y); if(build.warmup > 0f && flameColor.a > 0.001f){ - - Lines.stroke(circleStroke * build.warmup); float si = Mathf.absin(flameRadiusScl, flameRadiusMag); diff --git a/gradle.properties b/gradle.properties index 7d2ad854bf..f7d316f36e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=cc2e0588e1a87c732d0d155fe24932ae43d641bf +archash=0242770e4a63299dbaed350f974f4fee1de81cf1 From 1c22e2ed28ce8d0c36808f4ff71a18a37ff72fe4 Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Wed, 21 Jul 2021 15:50:35 -0400 Subject: [PATCH 65/71] Update StatValues.java (#5629) Why is this number 0? The default amount should be 1, the timeperiod is already set to 0 everywhere anyways. --- core/src/mindustry/world/meta/StatValues.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index 5f83234dcf..8be545047a 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -96,7 +96,7 @@ public class StatValues{ for(int i = 0; i < list.size; i++){ Item item = list.get(i); - table.add(timePeriod <= 0 ? new ItemDisplay(item) : new ItemDisplay(item, 0, timePeriod, true)).padRight(5); + table.add(timePeriod <= 0 ? new ItemDisplay(item) : new ItemDisplay(item, 1, timePeriod, true)).padRight(5); if(i != list.size - 1){ table.add("/"); From b3be906e28dd857607ac5b7d4a976464462431eb Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 21 Jul 2021 21:03:26 -0400 Subject: [PATCH 66/71] Removed MendProjector phase coloration --- core/src/mindustry/content/Fx.java | 2 +- core/src/mindustry/world/blocks/defense/MendProjector.java | 4 ++-- gradle.properties | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 6b1d87ec06..2eb71b595b 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -1532,7 +1532,7 @@ public class Fx{ rand.setSeed(e.id); for(int i = 0; i < 2; i++){ - v.set(e.finpow() * 9f * rand.nextFloat(), 0).rotate(rand.random(360f)).add(e.x, e.y); + v.trns(rand.random(360f), rand.random(e.finpow() * 9f)).add(e.x, e.y); Fill.circle(v.x, v.y, rand.random(1.4f, 2.4f)); } }).layer(Layer.bullet - 1f), diff --git a/core/src/mindustry/world/blocks/defense/MendProjector.java b/core/src/mindustry/world/blocks/defense/MendProjector.java index 036863d530..f61f3c0355 100644 --- a/core/src/mindustry/world/blocks/defense/MendProjector.java +++ b/core/src/mindustry/world/blocks/defense/MendProjector.java @@ -18,7 +18,7 @@ import static mindustry.Vars.*; public class MendProjector extends Block{ public final int timerUse = timers++; public Color baseColor = Color.valueOf("84f491"); - public Color phaseColor = Color.valueOf("ffd59e"); + public Color phaseColor = baseColor; public @Load("@-top") TextureRegion topRegion; public float reload = 250f; public float range = 60f; @@ -91,7 +91,7 @@ public class MendProjector extends Block{ float realRange = range + phaseHeat * phaseRangeBoost; charge = 0f; - indexer.eachBlock(this, realRange, other -> other.damaged(), other -> { + indexer.eachBlock(this, realRange, Building::damaged, other -> { other.heal(other.maxHealth() * (healPercent + phaseHeat * phaseBoost) / 100f * efficiency()); Fx.healBlockFull.at(other.x, other.y, other.block.size, baseColor); }); diff --git a/gradle.properties b/gradle.properties index f7d316f36e..a5a0e68fcb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=0242770e4a63299dbaed350f974f4fee1de81cf1 +archash=a81197126a9190337ab9065734b5134d5f08ac05 From 72fb66e5b260eb123df2739acaf48f170212d913 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 22 Jul 2021 11:21:23 -0400 Subject: [PATCH 67/71] Anuken/Mindustry-Suggestions/issues/2730 --- core/src/mindustry/ai/WaveSpawner.java | 1 + core/src/mindustry/content/StatusEffects.java | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/ai/WaveSpawner.java b/core/src/mindustry/ai/WaveSpawner.java index f9490dbef2..a895af863f 100644 --- a/core/src/mindustry/ai/WaveSpawner.java +++ b/core/src/mindustry/ai/WaveSpawner.java @@ -180,6 +180,7 @@ public class WaveSpawner{ private void spawnEffect(Unit unit){ unit.rotation = unit.angleTo(world.width()/2f * tilesize, world.height()/2f * tilesize); unit.apply(StatusEffects.unmoving, 30f); + unit.apply(StatusEffects.invincible, 60f); unit.add(); Call.spawnEffect(unit.x, unit.y, unit.rotation, unit.type); diff --git a/core/src/mindustry/content/StatusEffects.java b/core/src/mindustry/content/StatusEffects.java index bc0a7e4864..fb75fcabd3 100644 --- a/core/src/mindustry/content/StatusEffects.java +++ b/core/src/mindustry/content/StatusEffects.java @@ -12,7 +12,7 @@ import mindustry.graphics.*; import static mindustry.Vars.*; public class StatusEffects implements ContentList{ - public static StatusEffect none, burning, freezing, unmoving, slow, wet, muddy, melting, sapped, tarred, overdrive, overclock, shielded, shocked, blasted, corroded, boss, sporeSlowed, disarmed, electrified; + public static StatusEffect none, burning, freezing, unmoving, slow, wet, muddy, melting, sapped, tarred, overdrive, overclock, shielded, shocked, blasted, corroded, boss, sporeSlowed, disarmed, electrified, invincible; @Override public void load(){ @@ -188,5 +188,9 @@ public class StatusEffects implements ContentList{ color = Color.valueOf("e9ead3"); disarm = true; }}; + + invincible = new StatusEffect("invincible"){{ + healthMultiplier = Float.POSITIVE_INFINITY; + }}; } } From f4f46eb924f1e16c65ff75e8901d87c5537d9359 Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Fri, 23 Jul 2021 13:45:48 -0400 Subject: [PATCH 68/71] Better plan skipping (#5634) This prevents the plans being skipped when there is a large number of items entering the core yet the core is still starved of that item. --- core/src/mindustry/entities/comp/BuilderComp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/BuilderComp.java b/core/src/mindustry/entities/comp/BuilderComp.java index 9b456e5602..f9a5af6ca2 100644 --- a/core/src/mindustry/entities/comp/BuilderComp.java +++ b/core/src/mindustry/entities/comp/BuilderComp.java @@ -179,7 +179,7 @@ abstract class BuilderComp implements Posc, Statusc, Teamc, Rotc{ //requests that you have at least *started* are considered if(state.rules.infiniteResources || team.rules().infiniteResources || request.breaking || core == null || request.isRotation(team)) return false; - return (request.stuck && !core.items.has(request.block.requirements)) || (Structs.contains(request.block.requirements, i -> !core.items.has(i.item) && Mathf.round(i.amount * state.rules.buildCostMultiplier) > 0) && !request.initialized); + return (request.stuck && !core.items.has(request.block.requirements)) || (Structs.contains(request.block.requirements, i -> !core.items.has(i.item, Math.min(i.amount, 15)) && Mathf.round(i.amount * state.rules.buildCostMultiplier) > 0) && !request.initialized); } void removeBuild(int x, int y, boolean breaking){ From 0c00000910e2c876c61cab63c021b2418086741e Mon Sep 17 00:00:00 2001 From: Semetrix <73433905+Semetrix@users.noreply.github.com> Date: Fri, 23 Jul 2021 20:49:42 +0100 Subject: [PATCH 69/71] Add a second Hungarian server (#5636) --- servers_v6.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers_v6.json b/servers_v6.json index 843fde67d9..98a1079bd4 100644 --- a/servers_v6.json +++ b/servers_v6.json @@ -93,7 +93,7 @@ }, { "name": "Hungarian", - "address": ["magyarmindustry.tk"] + "address": ["magyarmindustry.tk", "148.251.175.124:25601"] }, { "name": "Xpdustry", From d89a1fac70ece3ba3182ca29137c11faf290933e Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 23 Jul 2021 15:50:09 -0400 Subject: [PATCH 70/71] Update pull_request_template.md --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 4f03450b6e..81d2a8c472 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,4 +1,4 @@ -If your pull request is **not** translation-related, read the list of requirements below and check each box: +If your pull request is **not** translation or serverlist-related, read the list of requirements below and check each box: - [ ] I have read the [contribution guidelines](https://github.com/Anuken/Mindustry/blob/master/CONTRIBUTING.md). - [ ] I have ensured that my code compiles, if applicable. From 53214f0ddc4a02ea263fa082fccce60147b66caf Mon Sep 17 00:00:00 2001 From: buthed010203 Date: Fri, 23 Jul 2021 15:51:26 -0400 Subject: [PATCH 71/71] Enable mining of sand when double click to mine is enabled (#4788) * Sand mineable with double click to mine enabled Since the only reason sand is un-mineable in the first place is because accidentally mining it is annoying, it should be enabled for double click to mine. * only show sand as mineable when double click mine is enabled Co-authored-by: Anuken --- core/src/mindustry/input/InputHandler.java | 2 +- core/src/mindustry/type/UnitType.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 0882c39dea..bc385af592 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -1027,7 +1027,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ return !Core.scene.hasMouse() && tile.drop() != null && player.unit().validMine(tile) - && !(tile.floor().playerUnmineable && tile.overlay().itemDrop == null) + && !((!Core.settings.getBool("doubletapmine") && tile.floor().playerUnmineable) && tile.overlay().itemDrop == null) && player.unit().acceptsItem(tile.drop()) && tile.block() == Blocks.air; } diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 7e0b55ce65..da238f0584 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -279,7 +279,7 @@ public class UnitType extends UnlockableContent{ if(mineTier >= 1){ stats.addPercent(Stat.mineSpeed, mineSpeed); - stats.add(Stat.mineTier, StatValues.blocks(b -> b instanceof Floor f && f.itemDrop != null && f.itemDrop.hardness <= mineTier && !f.playerUnmineable)); + stats.add(Stat.mineTier, StatValues.blocks(b -> b instanceof Floor f && f.itemDrop != null && f.itemDrop.hardness <= mineTier && (!f.playerUnmineable || Core.settings.getBool("doubletapmine")))); } if(buildSpeed > 0){ stats.addPercent(Stat.buildSpeed, buildSpeed);