diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index 89b8f38e3a..59660d9214 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -10,7 +10,7 @@ import io.anuke.ucore.UCore; import io.anuke.ucore.scene.ui.layout.Unit; public class Vars{ - public static final boolean testAndroid = false; + public static final boolean testAndroid = true; //shorthand for whether or not this is running on android public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) || testAndroid; //shorthand for whether or not this is running on GWT diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index 06f121405a..a5148165ee 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -546,6 +546,7 @@ public class Control extends Module{ @Override public void update(){ + //UCore.log(input.placeMode, input.breakMode, input.lastPlaceMode); if(Gdx.input != proxy){ Gdx.input = proxy; diff --git a/core/src/io/anuke/mindustry/core/NetClient.java b/core/src/io/anuke/mindustry/core/NetClient.java index f65e825439..0a3f81c5e4 100644 --- a/core/src/io/anuke/mindustry/core/NetClient.java +++ b/core/src/io/anuke/mindustry/core/NetClient.java @@ -48,7 +48,7 @@ public class NetClient extends Module { IntSet requests = new IntSet(); IntSet recieved = new IntSet(); float playerSyncTime = 2; - float dataTimeout = 60*13; //13 seconds timeout + float dataTimeout = 60*15; //13 seconds timeout public NetClient(){ diff --git a/core/src/io/anuke/mindustry/entities/effect/DamageArea.java b/core/src/io/anuke/mindustry/entities/effect/DamageArea.java index 4c5bae1558..1e9d6a6416 100644 --- a/core/src/io/anuke/mindustry/entities/effect/DamageArea.java +++ b/core/src/io/anuke/mindustry/entities/effect/DamageArea.java @@ -60,7 +60,7 @@ public class DamageArea{ }; Entities.getNearby(Vars.control.enemyGroup, rect, cons); - Entities.getNearby(Vars.control.playerGroup, rect, cons); + if(!Vars.control.isFriendlyFire()) Entities.getNearby(Vars.control.playerGroup, rect, cons); } public static void damageEntities(float x, float y, float radius, int damage){ diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index d5a8828864..94ff64ac30 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -36,6 +36,7 @@ public abstract class InputHandler extends InputAdapter{ public PlaceMode placeMode = android ? PlaceMode.cursor : PlaceMode.hold; public PlaceMode breakMode = android ? PlaceMode.none : PlaceMode.holdDelete; public PlaceMode lastPlaceMode = placeMode; + public PlaceMode lastBreakMode = breakMode; public abstract void update(); public abstract float getCursorX(); diff --git a/core/src/io/anuke/mindustry/input/PlaceMode.java b/core/src/io/anuke/mindustry/input/PlaceMode.java index 6c58a3b6ac..d75256573f 100644 --- a/core/src/io/anuke/mindustry/input/PlaceMode.java +++ b/core/src/io/anuke/mindustry/input/PlaceMode.java @@ -1,8 +1,6 @@ package io.anuke.mindustry.input; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.Input.Buttons; -import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Colors; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; @@ -11,7 +9,6 @@ import io.anuke.mindustry.ui.fragments.ToolFragment; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Draw; -import io.anuke.ucore.core.Inputs; import io.anuke.ucore.core.Timers; import io.anuke.ucore.scene.utils.Cursors; import io.anuke.ucore.util.Bundles; @@ -97,12 +94,9 @@ public enum PlaceMode{ Vector2 offset = tile.block().getPlaceOffset(); float fract = control.getInput().breaktime / tile.getBreakTime(); - if(Inputs.buttonDown(Buttons.RIGHT)){ - Draw.color(Color.YELLOW, Color.SCARLET, fract); - Draw.linecrect(tile.worldx() + offset.x, tile.worldy() + offset.y, tile.block().width * Vars.tilesize, tile.block().height * Vars.tilesize); - }else if(android && control.getInput().breaktime > 0){ + if(android && control.getInput().breaktime > 0){ Draw.color(Colors.get("breakStart"), Colors.get("break"), fract); - Draw.polygon(tile.worldy() + offset.y, tile.worldx() + offset.x, 25, 4 + (1f - fract) * 26); + Draw.polygon(tile.worldx() + offset.y, tile.worldy() + offset.x, 25, 4 + (1f - fract) * 26); } Draw.reset(); } diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java index 633707d004..a438643841 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java @@ -54,6 +54,7 @@ public class PlacementFragment implements Fragment{ placing = false; container.clearActions(); container.actions(Actions.translateBy(0, -(container.getTranslation().y + translation), i, n)); + if (!input.lastBreakMode.both) input.placeMode = input.lastBreakMode; }else{ placing = true; container.clearActions(); @@ -131,6 +132,7 @@ public class PlacementFragment implements Fragment{ new imagebutton("icon-" + mode.name(), "toggle", 10 * 3, () -> { control.getInput().resetCursor(); input.breakMode = mode; + input.lastBreakMode = mode; if (!mode.both){ input.placeMode = mode; }else{ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java index a21524988e..79b1167a4d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/distribution/Conveyor.java @@ -18,6 +18,7 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.AbstractList; +import java.util.Collections; import java.util.List; import static io.anuke.mindustry.Vars.tilesize; @@ -235,7 +236,7 @@ public class Conveyor extends Block{ } }; - wrapper.sort(Conveyor::compareItems); + Collections.sort(wrapper, Conveyor::compareItems); } private static int compareItems(Integer a, Integer b){ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java index e09818bc10..3117b073a0 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Pump.java @@ -3,6 +3,7 @@ package io.anuke.mindustry.world.blocks.types.production; import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.resource.Liquid; +import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Layer; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.types.LiquidBlock; @@ -24,7 +25,12 @@ public class Pump extends LiquidBlock{ layer = Layer.overlay; flowfactor = 3f; } - + + @Override + public boolean canReplace(Block other) { + return other instanceof Pump && other != this; + } + @Override public void getStats(Array list){ super.getStats(list);