diff --git a/core/src/mindustry/entities/comp/PuddleComp.java b/core/src/mindustry/entities/comp/PuddleComp.java index 9d42b43cb9..100298828d 100644 --- a/core/src/mindustry/entities/comp/PuddleComp.java +++ b/core/src/mindustry/entities/comp/PuddleComp.java @@ -57,7 +57,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); 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 ca8e248a85..6f9d62dac9 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 custom camera 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); @@ -460,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 @@ -1186,6 +1203,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/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; 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){ 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/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/core/src/mindustry/world/blocks/production/SolidPump.java b/core/src/mindustry/world/blocks/production/SolidPump.java index 9c2908efef..912af46b18 100644 --- a/core/src/mindustry/world/blocks/production/SolidPump.java +++ b/core/src/mindustry/world/blocks/production/SolidPump.java @@ -40,7 +40,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); } } @@ -48,7 +48,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())); } @@ -92,7 +92,6 @@ public class SolidPump extends Pump{ public float validTiles; public float lastPump; - @Override public void drawCracks(){} @@ -118,7 +117,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)); 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 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",