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