From db6b8abce687e5bde1d350fcc9729095db0d1f9d Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 2 Oct 2021 08:42:07 -0400 Subject: [PATCH 1/7] Fixed #6089 --- core/src/mindustry/ui/Menus.java | 18 ++++++++++++++++-- .../world/blocks/production/SolidPump.java | 3 +-- gradle.properties | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/ui/Menus.java b/core/src/mindustry/ui/Menus.java index 1d79b59831..511bd7b55b 100644 --- a/core/src/mindustry/ui/Menus.java +++ b/core/src/mindustry/ui/Menus.java @@ -68,20 +68,34 @@ public class Menus{ ui.showText("", message); } - @Remote(variants = Variant.both) + @Remote(variants = Variant.both, unreliable = true) public static void infoPopup(String message, float duration, int align, int top, int left, int bottom, int right){ if(message == null) return; ui.showInfoPopup(message, duration, align, top, left, bottom, right); } - @Remote(variants = Variant.both) + @Remote(variants = Variant.both, unreliable = true) public static void label(String message, float duration, float worldx, float worldy){ if(message == null) return; ui.showLabel(message, duration, worldx, worldy); } + @Remote(variants = Variant.both) + public static void infoPopupReliable(String message, float duration, int align, int top, int left, int bottom, int right){ + if(message == null) return; + + ui.showInfoPopup(message, duration, align, top, left, bottom, right); + } + + @Remote(variants = Variant.both) + public static void labelReliable(String message, float duration, float worldx, float worldy){ + if(message == null) return; + + ui.showLabel(message, duration, worldx, worldy); + } + @Remote(variants = Variant.both) public static void infoToast(String message, float duration){ if(message == null) return; diff --git a/core/src/mindustry/world/blocks/production/SolidPump.java b/core/src/mindustry/world/blocks/production/SolidPump.java index f430ef7679..d65e3ecf26 100644 --- a/core/src/mindustry/world/blocks/production/SolidPump.java +++ b/core/src/mindustry/world/blocks/production/SolidPump.java @@ -38,7 +38,7 @@ public class SolidPump extends Pump{ drawPotentialLinks(x, y); if(attribute != null){ - drawPlaceText(Core.bundle.format("bar.efficiency", Math.round(Math.max(sumAttribute(attribute, x, y) / size / size + baseEfficiency, 0f) * 100 * percentSolid(x, y))), x, y, valid); + drawPlaceText(Core.bundle.format("bar.efficiency", Math.round(Math.max((sumAttribute(attribute, x, y)) / size / size + percentSolid(x, y) * baseEfficiency, 0f) * 100)), x, y, valid); } } @@ -90,7 +90,6 @@ public class SolidPump extends Pump{ public float validTiles; public float lastPump; - @Override public void drawCracks(){} diff --git a/gradle.properties b/gradle.properties index 5d87cf4f6d..23a9144e91 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,4 +24,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=b2199ab9716ef9664f02f3d04549f65a7e2787d7 +archash=159f05aff28e1f4edf6214f225aef2d63c4c37a6 From d95662233cba707f804d0dfc21f9f958321d3f5b Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 2 Oct 2021 12:05:02 -0400 Subject: [PATCH 2/7] Fixed #6090 --- core/src/mindustry/input/InputHandler.java | 1 + core/src/mindustry/world/blocks/production/SolidPump.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index ca8e248a85..0e0f897c85 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -1186,6 +1186,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } public boolean validPlace(int x, int y, Block type, int rotation, BuildPlan ignore){ + //TODO with many requests, this is O(n * m), very laggy for(BuildPlan req : player.unit().plans()){ if(req != ignore && !req.breaking diff --git a/core/src/mindustry/world/blocks/production/SolidPump.java b/core/src/mindustry/world/blocks/production/SolidPump.java index d65e3ecf26..8098bebd59 100644 --- a/core/src/mindustry/world/blocks/production/SolidPump.java +++ b/core/src/mindustry/world/blocks/production/SolidPump.java @@ -46,7 +46,7 @@ public class SolidPump extends Pump{ public void setBars(){ super.setBars(); bars.add("efficiency", (SolidPumpBuild entity) -> new Bar(() -> Core.bundle.formatFloat("bar.pumpspeed", - entity.lastPump / Time.delta * 60, 1), + entity.lastPump * 60, 1), () -> Pal.ammo, () -> entity.warmup * entity.efficiency())); } @@ -115,7 +115,7 @@ public class SolidPump extends Pump{ if(cons.valid() && typeLiquid() < liquidCapacity - 0.001f){ float maxPump = Math.min(liquidCapacity - typeLiquid(), pumpAmount * delta() * fraction * efficiency()); liquids.add(result, maxPump); - lastPump = maxPump; + lastPump = maxPump / Time.delta; warmup = Mathf.lerpDelta(warmup, 1f, 0.02f); if(Mathf.chance(delta() * updateEffectChance)) updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f)); From b20cdb97c56671477e84ba0dbd62ce9fb5292ccc Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 2 Oct 2021 13:01:54 -0400 Subject: [PATCH 3/7] Reset chat font cache color --- core/src/mindustry/ui/fragments/ChatFragment.java | 1 + core/src/mindustry/ui/fragments/ScriptConsoleFragment.java | 1 + gradle.properties | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/ui/fragments/ChatFragment.java b/core/src/mindustry/ui/fragments/ChatFragment.java index 9a1159350c..0d97d5d6a2 100644 --- a/core/src/mindustry/ui/fragments/ChatFragment.java +++ b/core/src/mindustry/ui/fragments/ChatFragment.java @@ -149,6 +149,7 @@ public class ChatFragment extends Table{ if(i - scrollPos == 0) theight -= textspacing + 1; font.getCache().clear(); + font.getCache().setColor(Color.white); font.getCache().addText(messages.get(i).formattedMessage, fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true); if(!shown && fadetime - i < 1f && fadetime - i >= 0f){ diff --git a/core/src/mindustry/ui/fragments/ScriptConsoleFragment.java b/core/src/mindustry/ui/fragments/ScriptConsoleFragment.java index 76e856e437..e6de3a897c 100644 --- a/core/src/mindustry/ui/fragments/ScriptConsoleFragment.java +++ b/core/src/mindustry/ui/fragments/ScriptConsoleFragment.java @@ -133,6 +133,7 @@ public class ScriptConsoleFragment extends Table{ if(i - scrollPos == 0) theight -= textspacing + 1; font.getCache().clear(); + font.getCache().setColor(Color.white); font.getCache().addText(messages.get(i), fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true); if(!open){ diff --git a/gradle.properties b/gradle.properties index 23a9144e91..7045ce0646 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,4 +24,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=159f05aff28e1f4edf6214f225aef2d63c4c37a6 +archash=ea2d4b8455a8502eeea80795cd2b6d10d8dfe21c From aed57aaac30909506d7811030f3e5222fc4386b1 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 3 Oct 2021 11:21:53 -0400 Subject: [PATCH 4/7] Added InputHandler lock system --- core/src/mindustry/input/DesktopInput.java | 34 ++++++++++++---------- core/src/mindustry/input/InputHandler.java | 12 ++++++++ core/src/mindustry/input/MobileInput.java | 16 +++++----- 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 8b729f096e..7865462726 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -192,6 +192,7 @@ public class DesktopInput extends InputHandler{ ui.listfrag.toggle(); } + boolean locked = locked(); boolean panCam = false; float camSpeed = (!Core.input.keyDown(Binding.boost) ? panSpeed : panBoostSpeed) * Time.delta; @@ -204,24 +205,27 @@ public class DesktopInput extends InputHandler{ panning = false; } - if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){ - if(input.keyDown(Binding.mouse_move)){ - panCam = true; + if(!locked){ + if(((player.dead() || state.isPaused()) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){ + if(input.keyDown(Binding.mouse_move)){ + panCam = true; + } + + Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(camSpeed)); + }else if(!player.dead() && !panning){ + Core.camera.position.lerpDelta(player, Core.settings.getBool("smoothcamera") ? 0.08f : 1f); + } + + if(panCam){ + Core.camera.position.x += Mathf.clamp((Core.input.mouseX() - Core.graphics.getWidth() / 2f) * panScale, -1, 1) * camSpeed; + Core.camera.position.y += Mathf.clamp((Core.input.mouseY() - Core.graphics.getHeight() / 2f) * panScale, -1, 1) * camSpeed; } - Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(camSpeed)); - }else if(!player.dead() && !panning){ - Core.camera.position.lerpDelta(player, Core.settings.getBool("smoothcamera") ? 0.08f : 1f); } - if(panCam){ - Core.camera.position.x += Mathf.clamp((Core.input.mouseX() - Core.graphics.getWidth() / 2f) * panScale, -1, 1) * camSpeed; - Core.camera.position.y += Mathf.clamp((Core.input.mouseY() - Core.graphics.getHeight() / 2f) * panScale, -1, 1) * camSpeed; - } + shouldShoot = !scene.hasMouse() && !locked; - shouldShoot = !scene.hasMouse(); - - if(!scene.hasMouse()){ + if(!scene.hasMouse() && !locked){ if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){ Unit on = selectedUnit(); var build = selectedControlBuild(); @@ -236,7 +240,7 @@ public class DesktopInput extends InputHandler{ } } - if(!player.dead() && !state.isPaused() && !scene.hasField() && !renderer.isCutscene()){ + if(!player.dead() && !state.isPaused() && !scene.hasField() && !locked){ updateMovement(player.unit()); if(Core.input.keyTap(Binding.respawn)){ @@ -271,7 +275,7 @@ public class DesktopInput extends InputHandler{ } } - if(player.dead()){ + if(player.dead() || locked){ cursorType = SystemCursor.arrow; return; } diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index 0e0f897c85..d7c09a17a9 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -50,6 +50,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ public final OverlayFragment frag = new OverlayFragment(); + /** If any of these functions return true, input is locked. */ + public Seq inputLocks = Seq.with(() -> renderer.isCutscene()); public Interval controlInterval = new Interval(); public @Nullable Block block; public boolean overrideLineRotation; @@ -433,6 +435,16 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } } + /** Adds an input lock; if this function returns true, input is locked. Used for mod cutscenes or panning. */ + public void addLock(Boolp lock){ + inputLocks.add(lock); + } + + /** @return whether most input is locked, for 'cutscenes' */ + public boolean locked(){ + return inputLocks.contains(Boolp::get); + } + public Eachable allRequests(){ return cons -> { for(BuildPlan request : player.unit().plans()) cons.get(request); diff --git a/core/src/mindustry/input/MobileInput.java b/core/src/mindustry/input/MobileInput.java index 27e02d9d0a..26b686490a 100644 --- a/core/src/mindustry/input/MobileInput.java +++ b/core/src/mindustry/input/MobileInput.java @@ -435,7 +435,7 @@ public class MobileInput extends InputHandler implements GestureListener{ @Override public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){ - if(state.isMenu()) return false; + if(state.isMenu() || locked()) return false; down = true; @@ -515,7 +515,7 @@ public class MobileInput extends InputHandler implements GestureListener{ @Override public boolean longPress(float x, float y){ - if(state.isMenu()|| player.dead()) return false; + if(state.isMenu()|| player.dead() || locked()) return false; //get tile on cursor Tile cursor = tileAt(x, y); @@ -575,7 +575,7 @@ public class MobileInput extends InputHandler implements GestureListener{ @Override public boolean tap(float x, float y, int count, KeyCode button){ - if(state.isMenu() || lineMode) return false; + if(state.isMenu() || lineMode || locked()) return false; float worldx = Core.input.mouseWorld(x, y).x, worldy = Core.input.mouseWorld(x, y).y; @@ -654,6 +654,8 @@ public class MobileInput extends InputHandler implements GestureListener{ public void update(){ super.update(); + boolean locked = locked(); + if(player.dead()){ mode = none; manualShooting = false; @@ -661,11 +663,11 @@ public class MobileInput extends InputHandler implements GestureListener{ } //zoom camera - if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((!player.isBuilder() || !isPlacing() || !block.rotate) && selectRequests.isEmpty()))){ + if(!locked && Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((!player.isBuilder() || !isPlacing() || !block.rotate) && selectRequests.isEmpty()))){ renderer.scaleCamera(Core.input.axisTap(Binding.zoom)); } - if(!Core.settings.getBool("keyboard")){ + if(!Core.settings.getBool("keyboard") && !locked){ //move camera around float camSpeed = 6f; Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta * camSpeed)); @@ -681,7 +683,7 @@ public class MobileInput extends InputHandler implements GestureListener{ } } - if(!player.dead() && !state.isPaused() && !renderer.isCutscene()){ + if(!player.dead() && !state.isPaused() && !locked){ updateMovement(player.unit()); } @@ -791,7 +793,7 @@ public class MobileInput extends InputHandler implements GestureListener{ @Override public boolean pan(float x, float y, float deltaX, float deltaY){ - if(Core.scene == null || Core.scene.hasDialog() || Core.settings.getBool("keyboard")) return false; + if(Core.scene == null || Core.scene.hasDialog() || Core.settings.getBool("keyboard") || locked()) return false; float scale = Core.camera.width / Core.graphics.getWidth(); deltaX *= scale; From 0d0fe394d32a3568082d1d160cc5ccdfc70efa59 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 3 Oct 2021 13:12:20 -0400 Subject: [PATCH 5/7] Serpulo water tweaks --- core/src/mindustry/input/InputHandler.java | 7 ++++++- core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index d7c09a17a9..6f9d62dac9 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -435,7 +435,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } } - /** Adds an input lock; if this function returns true, input is locked. Used for mod cutscenes or panning. */ + /** Adds an input lock; if this function returns true, input is locked. Used for mod 'cutscenes' or custom camera panning. */ public void addLock(Boolp lock){ inputLocks.add(lock); } @@ -472,6 +472,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ player.unit().type.weapons.first().noAmmoSound.at(player.unit()); } + //you don't want selected blocks while locked, looks weird + if(locked()){ + block = null; + } + wasShooting = player.shooting; //only reset the controlled type and control a unit after the timer runs out diff --git a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java index 48962fea7a..efa75d18fa 100644 --- a/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/SerpuloPlanetGenerator.java @@ -327,7 +327,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{ } } - boolean naval = (float)waters / total >= 0.26f; + boolean naval = (float)waters / total >= 0.15f; //create water pathway if the map is flooded if(naval){ From 6d49bd39be8f2878fab76a8278ba3a92047eed57 Mon Sep 17 00:00:00 2001 From: way-zer Date: Mon, 4 Oct 2021 21:21:02 +0800 Subject: [PATCH 6/7] Fix #5702 (#6098) --- core/src/mindustry/entities/comp/PuddleComp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/PuddleComp.java b/core/src/mindustry/entities/comp/PuddleComp.java index c14c49a826..09fc49dfe9 100644 --- a/core/src/mindustry/entities/comp/PuddleComp.java +++ b/core/src/mindustry/entities/comp/PuddleComp.java @@ -60,7 +60,7 @@ abstract class PuddleComp implements Posc, Puddlec, Drawc{ accepting = 0f; if(amount >= maxLiquid / 1.5f){ - float deposited = Math.min((amount - maxLiquid / 1.5f) / 4f, 0.3f) * Time.delta; + float deposited = Math.min((amount - maxLiquid / 1.5f) / 4f, 0.3f * Time.delta); int targets = 0; for(Point2 point : Geometry.d4){ Tile other = world.tile(tile.x + point.x, tile.y + point.y); From 77736f227f23d9959b5baca9200dade37df1b7fc Mon Sep 17 00:00:00 2001 From: Fatonndev <56699208+Fatonndev@users.noreply.github.com> Date: Mon, 4 Oct 2021 21:39:55 +0300 Subject: [PATCH 7/7] New domain name (#6076) * new domain name * moved to new domain --- servers_v6.json | 4 ++-- servers_v7.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/servers_v6.json b/servers_v6.json index 1c862a5c10..913fb3989b 100644 --- a/servers_v6.json +++ b/servers_v6.json @@ -60,8 +60,8 @@ "address": ["yeeth.mindustry.me:2004","185.86.230.61:25570"] }, { - "name": "md.obvilionnetwork.ru", - "address": ["obvilionnetwork.ru", "obvilionnetwork.ru:7001", "obvilionnetwork.ru:7002", "obvilionnetwork.ru:7003"] + "name": "Obvilion Network", + "address": ["obvilion.ru", "obvilion.ru:7001", "obvilion.ru:7002", "obvilion.ru:7003"] }, { "name": "Mindustry PLAY", diff --git a/servers_v7.json b/servers_v7.json index 3ac3890c61..49c9880814 100644 --- a/servers_v7.json +++ b/servers_v7.json @@ -33,7 +33,7 @@ }, { "name": "Obvilion Network", - "address": ["obvilionnetwork.ru:7004", "obvilionnetwork.ru:7005"] + "address": ["obvilion.ru:7004", "obvilion.ru:7005"] }, { "name": "io",