diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 0118b14469..6306e04bbe 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -726,6 +726,7 @@ setting.blockreplace.name = Automatic Block Suggestions setting.linear.name = Linear Filtering setting.hints.name = Hints setting.flow.name = Display Resource Flow Rate +setting.backgroundpause.name = Pause In Background setting.buildautopause.name = Auto-Pause Building setting.animatedwater.name = Animated Surfaces setting.animatedshields.name = Animated Shields diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index e767330769..30f9eae747 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -412,13 +412,15 @@ public class Control implements ApplicationListener, Loadable{ @Override public void pause(){ - wasPaused = state.is(State.paused); - if(state.is(State.playing)) state.set(State.paused); + if(settings.getBool("backgroundpause", true)){ + wasPaused = state.is(State.paused); + if(state.is(State.playing)) state.set(State.paused); + } } @Override public void resume(){ - if(state.is(State.paused) && !wasPaused){ + if(state.is(State.paused) && !wasPaused && settings.getBool("backgroundpause", true)){ state.set(State.playing); } } diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index 1ccc39d4c3..d7ec068be8 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -378,6 +378,7 @@ public class UI implements ApplicationListener, Loadable{ cont.add(text).pad(2f).growX().wrap().get().setAlignment(Align.center); cont.row(); cont.button("@ok", this::hide).size(120, 50).pad(4); + closeOnBack(); }}.show(); } @@ -405,6 +406,7 @@ public class UI implements ApplicationListener, Loadable{ cont.button("@ok", this::hide).size(110, 50).fillX().left(); cont.row(); cont.add(col).colspan(2).pad(2); + closeOnBack(); }}.show(); } @@ -420,6 +422,7 @@ public class UI implements ApplicationListener, Loadable{ cont.add(text).width(400f).wrap().get().setAlignment(align, align); cont.row(); buttons.button("@ok", this::hide).size(110, 50).pad(4); + closeOnBack(); }}.show(); } @@ -427,6 +430,7 @@ public class UI implements ApplicationListener, Loadable{ new Dialog(titleText){{ cont.margin(15).add(text).width(400f).wrap().left().get().setAlignment(Align.left, Align.left); buttons.button("@ok", this::hide).size(110, 50).pad(4); + closeOnBack(); }}.show(); } @@ -436,6 +440,7 @@ public class UI implements ApplicationListener, Loadable{ titleTable.row(); titleTable.image().color(Pal.accent).height(3f).growX().pad(2f); buttons.button("@ok", this::hide).size(110, 50).pad(4); + closeOnBack(); }}.show(); } diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index df932a8310..8363d16d02 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -869,7 +869,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, public void placed(){ if(net.client()) return; - if((block.consumesPower && !block.outputsPower) || (!block.consumesPower && block.outputsPower)){ + if(block.consumesPower || block.outputsPower){ int range = 10; tempTiles.clear(); Geometry.circle(tileX(), tileY(), range, (x, y) -> { diff --git a/core/src/mindustry/game/Universe.java b/core/src/mindustry/game/Universe.java index 9fa93eb840..fa96e491a2 100644 --- a/core/src/mindustry/game/Universe.java +++ b/core/src/mindustry/game/Universe.java @@ -197,7 +197,7 @@ public class Universe{ if(!sector.isAttacked() && turn > invasionGracePeriod){ //invasion chance depends on # of nearby bases if(Mathf.chance(baseInvasionChance * sector.near().count(Sector::hasEnemyBase))){ - int waveMax = Math.max(sector.info.winWave, sector.isBeingPlayed() ? state.wave : 0) + Mathf.random(2, 5) * 5; + int waveMax = Math.max(sector.info.winWave, state.wave) + Mathf.random(2, 5) * 5; //assign invasion-related things if(sector.isBeingPlayed()){ diff --git a/core/src/mindustry/ui/dialogs/BaseDialog.java b/core/src/mindustry/ui/dialogs/BaseDialog.java index 09539939de..b99b164ca4 100644 --- a/core/src/mindustry/ui/dialogs/BaseDialog.java +++ b/core/src/mindustry/ui/dialogs/BaseDialog.java @@ -1,7 +1,6 @@ package mindustry.ui.dialogs; import arc.*; -import arc.input.*; import arc.scene.ui.*; import arc.util.*; import mindustry.core.GameState.*; @@ -54,11 +53,7 @@ public class BaseDialog extends Dialog{ } public void addCloseListener(){ - keyDown(key -> { - if(key == KeyCode.escape || key == KeyCode.back){ - Core.app.post(this::hide); - } - }); + closeOnBack(); } @Override diff --git a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java index d58b930e77..6b6771819d 100644 --- a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -281,7 +281,9 @@ public class SettingsMenuDialog extends SettingsDialog{ game.checkPref("blockreplace", true); game.checkPref("conveyorpathfinding", true); game.checkPref("hints", true); + if(!mobile){ + game.checkPref("backgroundpause", true); game.checkPref("buildautopause", false); } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 923c6558af..36c9d15e7b 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -617,7 +617,7 @@ public class Block extends UnlockableContent{ public ItemStack[] researchRequirements(){ ItemStack[] out = new ItemStack[requirements.length]; for(int i = 0; i < out.length; i++){ - int quantity = 40 + Mathf.round(Mathf.pow(requirements[i].amount, 1.15f) * 20 * researchCostMultiplier, 10); + int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.15f) * 20 * researchCostMultiplier, 10); out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity)); } diff --git a/core/src/mindustry/world/blocks/power/PowerNode.java b/core/src/mindustry/world/blocks/power/PowerNode.java index 042b03099e..d8f8b05f8f 100644 --- a/core/src/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/mindustry/world/blocks/power/PowerNode.java @@ -183,7 +183,7 @@ public class PowerNode extends PowerBlock{ protected void getPotentialLinks(Tile tile, Cons others){ Boolf valid = other -> other != null && other.tile() != tile && other.power != null && - ((!other.block.outputsPower && other.block.consumesPower) || (other.block.outputsPower && !other.block.consumesPower) || other.block instanceof PowerNode) && + (other.block.outputsPower || other.block.consumesPower || other.block instanceof PowerNode) && overlaps(tile.x * tilesize + offset, tile.y * tilesize + offset, other.tile(), laserRange * tilesize) && other.team == player.team() && !other.proximity.contains(e -> e.tile == tile) && !graphs.contains(other.power.graph);