mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-13 19:39:04 +07:00
Implement build autopausing (#1017)
Automatically pause building after current build queue is empty
This commit is contained in:
parent
796241b40a
commit
ebee4fa5da
@ -597,6 +597,7 @@ setting.shadows.name = Shadows
|
||||
setting.blockreplace.name = Automatic Block Suggestions
|
||||
setting.linear.name = Linear Filtering
|
||||
setting.hints.name = Hints
|
||||
setting.buildautopause.name = Auto-pause Building
|
||||
setting.animatedwater.name = Animated Water
|
||||
setting.animatedshields.name = Animated Shields
|
||||
setting.antialias.name = Antialias[lightgray] (requires restart)[]
|
||||
|
@ -52,6 +52,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
||||
public @Nullable
|
||||
String uuid, usid;
|
||||
public boolean isAdmin, isTransferring, isShooting, isBoosting, isMobile, isTyping, isBuilding = true;
|
||||
public boolean buildWasAutoPaused = false;
|
||||
public float boostHeat, shootHeat, destructTime;
|
||||
public boolean achievedFlight;
|
||||
public Color color = new Color();
|
||||
|
@ -267,6 +267,12 @@ public class DesktopInput extends InputHandler{
|
||||
int cursorY = tileY(Core.input.mouseY());
|
||||
int rawCursorX = world.toTile(Core.input.mouseWorld().x), rawCursorY = world.toTile(Core.input.mouseWorld().y);
|
||||
|
||||
// automatically pause building if the current build queue is empty
|
||||
if(Core.settings.getBool("buildautopause") && player.isBuilding && !player.isBuilding()){
|
||||
player.isBuilding = false;
|
||||
player.buildWasAutoPaused = true;
|
||||
}
|
||||
|
||||
if(!selectRequests.isEmpty()){
|
||||
int shiftX = rawCursorX - schematicX, shiftY = rawCursorY - schematicY;
|
||||
|
||||
@ -337,6 +343,7 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
if(Core.input.keyTap(Binding.pause_building)){
|
||||
player.isBuilding = !player.isBuilding;
|
||||
player.buildWasAutoPaused = false;
|
||||
}
|
||||
|
||||
if((cursorX != lastLineX || cursorY != lastLineY) && isPlacing() && mode == placing){
|
||||
|
@ -228,6 +228,9 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
game.checkPref("blockreplace", true);
|
||||
game.checkPref("conveyorpathfinding", true);
|
||||
game.checkPref("hints", true);
|
||||
if(!mobile){
|
||||
game.checkPref("buildautopause", false);
|
||||
}
|
||||
|
||||
if(steam && !Version.modifier.contains("beta")){
|
||||
game.checkPref("publichost", false, i -> {
|
||||
|
@ -144,6 +144,9 @@ public class BuildBlock extends Block{
|
||||
|
||||
//if the target is constructible, begin constructing
|
||||
if(entity.cblock != null){
|
||||
if(player.buildWasAutoPaused && !player.isBuilding){
|
||||
player.isBuilding = true;
|
||||
}
|
||||
//player.clearBuilding();
|
||||
player.addBuildRequest(new BuildRequest(tile.x, tile.y, tile.rotation(), entity.cblock), false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user