diff --git a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java index 6e1ab37030..7fe7aea771 100644 --- a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java +++ b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java @@ -277,7 +277,7 @@ public interface BuilderTrait extends Entity, TeamTrait{ public boolean initialized; //animation variables - public float animScale; + public float animScale = 0f; public float animInvalid; /** This creates a build request. */ diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index 36aa33c096..82ac867e05 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -433,6 +433,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ for(BuildRequest request : buildQueue()){ if(request.progress > 0.01f || (buildRequest() == request && request.initialized && (dst(request.x * tilesize, request.y * tilesize) <= placeDistance || state.isEditor()))) continue; + request.animScale = 1f; if(request.breaking){ control.input.drawBreaking(request); }else{ diff --git a/core/src/io/anuke/mindustry/input/DesktopInput.java b/core/src/io/anuke/mindustry/input/DesktopInput.java index 59bdc5fe66..127d674ea4 100644 --- a/core/src/io/anuke/mindustry/input/DesktopInput.java +++ b/core/src/io/anuke/mindustry/input/DesktopInput.java @@ -235,7 +235,7 @@ public class DesktopInput extends InputHandler{ lastLineY = cursorY; mode = placing; updateLine(selectX, selectY); - }else if(req != null && !req.breaking && mode == none){ + }else if(req != null && !req.breaking && mode == none && !req.initialized){ sreq = req; }else if(req != null && req.breaking){ deleting = true; diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index a8e106849b..84c0c8799f 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -330,6 +330,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ /** Draws a placement icon for a specific block. */ protected void drawRequest(int x, int y, Block block, int rotation){ brequest.set(x, y, rotation, block); + brequest.animScale = 1f; block.drawRequest(brequest, allRequests(), validPlace(x, y, block, rotation)); } @@ -393,7 +394,9 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ lineRequests.clear(); iterateLine(x1, y1, x2, y2, l -> { rotation = l.rotation; - lineRequests.add(new BuildRequest(l.x, l.y, l.rotation, block)); + BuildRequest req = new BuildRequest(l.x, l.y, l.rotation, block); + req.animScale = 1f; + lineRequests.add(req); }); } @@ -445,12 +448,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } } + /* //clear when the player taps on something else if(!consumed && !mobile && player.isBuilding() && block == null){ //player.clearBuilding(); block = null; return true; - } + }*/ if(!showedInventory){ frag.inv.hide(); diff --git a/core/src/io/anuke/mindustry/input/MobileInput.java b/core/src/io/anuke/mindustry/input/MobileInput.java index ec906e45d1..7cc5159b55 100644 --- a/core/src/io/anuke/mindustry/input/MobileInput.java +++ b/core/src/io/anuke/mindustry/input/MobileInput.java @@ -208,7 +208,7 @@ public class MobileInput extends InputHandler implements GestureListener{ } //move all current requests to removal array so they fade out - removals.addAll(selectRequests); + removals.addAll(selectRequests.find(r -> !r.breaking)); selectRequests.clear(); selecting = false; }).visible(() -> !selectRequests.isEmpty()).name("confirmplace"); @@ -217,9 +217,10 @@ public class MobileInput extends InputHandler implements GestureListener{ @Override public void buildUI(Group group){ group.fill(t -> { - t.bottom().left().visible(() -> (player.isBuilding() || block != null || mode == breaking) && !state.is(State.menu)); + t.bottom().left().visible(() -> (player.isBuilding() || block != null || mode == breaking || !selectRequests.isEmpty()) && !state.is(State.menu)); t.addImageTextButton("$cancel", Icon.cancelSmall, () -> { player.clearBuilding(); + selectRequests.clear(); mode = none; block = null; }).width(155f); @@ -244,6 +245,11 @@ public class MobileInput extends InputHandler implements GestureListener{ request.animScale = Mathf.lerpDelta(request.animScale, 0f, 0.2f); request.animInvalid = Mathf.lerpDelta(request.animInvalid, 0f, 0.2f); + if(request.breaking){ + drawSelected(request.x, request.y, tile.block(), Pal.remove); + }else{ + request.block.drawRequest(request, allRequests(), true); + } //TODO //drawRequest(request); } @@ -328,8 +334,11 @@ public class MobileInput extends InputHandler implements GestureListener{ @Override protected void drawRequest(BuildRequest request){ + if(request.tile() == null) return; + brequest.animScale = request.animScale = Mathf.lerpDelta(request.animScale, 1f, 0.1f); + if(request.breaking){ - drawSelected(request.x, request.y, request.block, Pal.remove); + drawSelected(request.x, request.y, request.tile().block(), Pal.remove); }else{ drawRequest(request.x, request.y, request.block, request.rotation); drawSelected(request.x, request.y, request.block, Pal.accent); diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index fe618ab7d9..838eeeee7a 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -676,7 +676,10 @@ public class Block extends BlockStorage{ } public void drawRequestRegion(BuildRequest req, Eachable list){ - Draw.rect(icon(Cicon.full), req.drawx(), req.drawy(), !rotate ? 0 : req.rotation * 90); + TextureRegion reg = icon(Cicon.full); + Draw.rect(icon(Cicon.full), req.drawx(), req.drawy(), + reg.getWidth() * req.animScale * Draw.scl, reg.getHeight() * req.animScale * Draw.scl, + !rotate ? 0 : req.rotation * 90); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java b/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java index d32813791d..675f6f9ed8 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java @@ -1,24 +1,19 @@ package io.anuke.mindustry.world.blocks.power; -import io.anuke.arc.Core; -import io.anuke.arc.graphics.Color; -import io.anuke.arc.graphics.g2d.Draw; -import io.anuke.arc.graphics.g2d.TextureRegion; -import io.anuke.arc.math.Mathf; -import io.anuke.arc.util.Time; -import io.anuke.mindustry.content.Fx; -import io.anuke.mindustry.entities.Effects; -import io.anuke.mindustry.entities.type.TileEntity; -import io.anuke.mindustry.type.Item; -import io.anuke.mindustry.type.Liquid; -import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.consumers.ConsumeItemFilter; -import io.anuke.mindustry.world.consumers.ConsumeLiquidFilter; -import io.anuke.mindustry.world.meta.BlockStat; -import io.anuke.mindustry.world.meta.StatUnit; +import io.anuke.arc.*; +import io.anuke.arc.graphics.*; +import io.anuke.arc.graphics.g2d.*; +import io.anuke.arc.math.*; +import io.anuke.arc.util.*; +import io.anuke.mindustry.content.*; +import io.anuke.mindustry.entities.*; +import io.anuke.mindustry.entities.type.*; +import io.anuke.mindustry.type.*; +import io.anuke.mindustry.world.*; +import io.anuke.mindustry.world.consumers.*; +import io.anuke.mindustry.world.meta.*; -import static io.anuke.mindustry.Vars.content; -import static io.anuke.mindustry.Vars.tilesize; +import static io.anuke.mindustry.Vars.*; /** * Power generation block which can use items, liquids or both as input sources for power production. @@ -53,6 +48,10 @@ public class ItemLiquidGenerator extends PowerGenerator{ } } + public ItemLiquidGenerator(String name){ + super(name); + } + @Override public void load(){ super.load(); diff --git a/core/src/io/anuke/mindustry/world/blocks/power/SingleTypeGenerator.java b/core/src/io/anuke/mindustry/world/blocks/power/SingleTypeGenerator.java index 72c0ec9e4b..12f5a629b2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/SingleTypeGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/SingleTypeGenerator.java @@ -9,6 +9,10 @@ public class SingleTypeGenerator extends ItemLiquidGenerator{ super(hasItems, hasLiquids, name); } + public SingleTypeGenerator(String name){ + super(name); + } + @Override protected float getItemEfficiency(Item item){ return 1f; diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java index f8d2f873e2..e97099f3ef 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java @@ -83,6 +83,14 @@ public class DesktopLauncher extends ClientLauncher{ } if(useSteam){ + //delete leftover dlls + FileHandle file = new FileHandle("."); + for(FileHandle other : file.parent().list()){ + if(other.name().contains("steam") && (other.extension().equals("dll") || other.extension().equals("so") || other.extension().equals("dylib"))){ + other.delete(); + } + } + if(showConsole){ StringBuilder base = new StringBuilder(); Log.setLogger(new LogHandler(){