diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 1d5cf2f291..ff36ac2e14 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -647,6 +647,7 @@ setting.linear.name = Linear Filtering setting.hints.name = Hints setting.flow.name = Display Resource Flow Rate setting.buildautopause.name = Auto-Pause Building +setting.mapcenter.name = Auto Center Map To Player setting.animatedwater.name = Animated Fluids setting.animatedshields.name = Animated Shields setting.antialias.name = Antialias[lightgray] (requires restart)[] diff --git a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java index b956812815..ce843d1b67 100644 --- a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -242,6 +242,7 @@ public class SettingsMenuDialog extends SettingsDialog{ if(!mobile){ game.checkPref("buildautopause", false); } + game.checkPref("mapcenter", true); if(steam){ game.sliderPref("playerlimit", 16, 2, 32, i -> { diff --git a/core/src/mindustry/ui/fragments/MinimapFragment.java b/core/src/mindustry/ui/fragments/MinimapFragment.java index 12195af8a9..a8ca154342 100644 --- a/core/src/mindustry/ui/fragments/MinimapFragment.java +++ b/core/src/mindustry/ui/fragments/MinimapFragment.java @@ -111,6 +111,12 @@ public class MinimapFragment extends Fragment{ } public void toggle(){ + if(Core.settings.getBool("mapcenter")){ + float size = baseSize * zoom * world.width(); + float ratio = (float)renderer.minimap.getTexture().getHeight() / renderer.minimap.getTexture().getWidth(); + panx = (size/2f - player.x() / (world.width() * tilesize) * size) / zoom; + pany = (size*ratio/2f - player.y() / (world.height() * tilesize) * size*ratio) / zoom; + } shown = !shown; } }